cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
474
Views
7
Helpful
3
Replies
Highlighted
Beginner

Interface configuration

Good morning,

i'm working with the api of the cisco prime and I need to get the number of a port-channel that a physical interface is on.

interface GigabitEthernet1/1

switchport

switchport trunk encapsulation dot1q

switchport trunk allowed vlan 11,99,254,425-427,500,600

switchport mode trunk

channel-group 10 mode active

end

I've been looking the cisco prime api documentation and I haven't found any way to get this information. Does anyone know how to get it?

3 REPLIES 3
Highlighted
Contributor

Thiago

The port channel exists on the switch, not in Prime.

go to the switch and run the following

sh interface description (if it was labeled with description)

sh etherchannel summary (to see what port channel the interfaces belong to ad what the port channel number is.

HTH,

Vince

Highlighted
Cisco Employee

Thiago,

I don't believe the API has a resource that returns this information unfortunately.  I've forwarded your feature request to our product management team

Highlighted
Not applicable

I don't work for Cisco so I'm not sure if I can post but here so far it's letting me so I'll keep going.

One way of getting that port-channel number would be to extract the switch config and parse the info yourself, using regex to match that config line.

If you want to do it that way, use the ConfigVersions API with the deviceName of the switch (or whatever other identifier) to get the config ID.

https://<primeUrl>/webacs/api/v1/data/ConfigVersions?deviceName=<deviceName>&isLast=true&.full=true

The "isLast=true" part will get the most recently collected config in the instance there are multiple stored configs.

If your configs are being saved by Prime, your returned tree data should include fileInfos like the below.

<fileInfos>

    <fileInfo>

          <fileId>4742337804</fileId>

          <fileState>STARTUPCONFIG</fileState>

          <fileType>TEXT</fileType>

    </fileInfo>

    <fileInfo>

          <fileId>4742337803</fileId>

          <fileState>RUNNINGCONFIG</fileState>

          <fileType>TEXT</fileType>

    </fileInfo>

</fileInfos>

The "fileInfos" contain the fileIds of the running and startup configs. Grab the number of whichever you'd prefer and then use that with the extractSanitizedFile API.

https://<primeUrl>/webacs/api/v1/op/configArchiveService/extractSanitizedFile?fileId=4742337804

The returned fileData is a straight text dump of the device's config. You can download it yourself as XML by default or JSON if you add ".json" to the url's path.

So https://<primeUrl>/webacs/api/v1/op/configArchiveService/extractSanitizedFile.json?fileId=4742337804

I hope that helps.

This widget could not be displayed.