04-10-2019 05:45 AM
Hello,
May someone guide me on how to use deref function within python service code.
I want to fetch the Loopback address of the other end. From within Python service code, I want to address the other end of the lXvpn service, and then fetch the loopback address.
THanks and regards.
Solved! Go to Solution.
04-10-2019 06:44 AM
Suppose that your other-end device name is stored in d, loopback ID stored in lo_id and you have access to the root object (one of the arguments of the cb_create() method. Then you should be able to do something like this:
ip = root.ncs__devices.device[d].config.ios__interface.Loopback[lo_id].ip.address.primary.address
This is for an IOS device. For another kind of device, the config prefix will be different and the config path is also going to be different, but the idea remains the same.
You can get the xpath from CLI with 'show run devices device my-device config my-device-prefix:path to loopback | display xpath | display prefixes'
04-10-2019 06:44 AM
Suppose that your other-end device name is stored in d, loopback ID stored in lo_id and you have access to the root object (one of the arguments of the cb_create() method. Then you should be able to do something like this:
ip = root.ncs__devices.device[d].config.ios__interface.Loopback[lo_id].ip.address.primary.address
This is for an IOS device. For another kind of device, the config prefix will be different and the config path is also going to be different, but the idea remains the same.
You can get the xpath from CLI with 'show run devices device my-device config my-device-prefix:path to loopback | display xpath | display prefixes'
04-10-2019 07:18 AM
I got it. Somehow, I was concentrated on deref function, I didn't think about fetching loopback from device tree.
Thanks
Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the NSO Developer community: