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.
switchport trunk encapsulation dot1q
switchport trunk allowed vlan 11,99,254,425-427,500,600
switchport mode trunk
channel-group 10 mode active
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?
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.
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
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.
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.
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.
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.
I hope that helps.