02-01-2021 02:28 AM
Hello,
I try to display the device-list of a service instance using python code.
I tired this:
for instance in root.services.serviceName:
print(instance.device_list)
and I got as a result this:
LeafList name=device-list tag=96950231
I want to display the same output as the cli when I type:
#show services serviceName serviceInstance device-list
output: device-list [ device1 device2 device3 ]
How can I do please?
Solved! Go to Solution.
02-02-2021 02:14 AM
The simplest way to handle this is using the as_list() method within the Maagic API, which converts an NSO leaf-list into a python list.
for instance in root.services.serviceName: print(instance.device_list.as_list())
02-02-2021 02:14 AM
The simplest way to handle this is using the as_list() method within the Maagic API, which converts an NSO leaf-list into a python list.
for instance in root.services.serviceName: print(instance.device_list.as_list())
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide