02-04-2021 10:56 AM
Hello,
Is there a way to obtain the parent container/list of an specific python maagic object?
Thanks
-- Santiago
Solved! Go to Solution.
02-04-2021 11:00 AM
Use the _parent member, here is an example from ncs_pycli:
In [1]: d = root.devices.device['router0'] In [2]: dp = d._parent In [3]: d Out[3]: ListElement name=device tag=617911018 keys={router0} In [4]: dp Out[4]: List name=device tag=617911018 In [5]: dp._path Out[5]: '/ncs:devices/device' In [6]: d._path Out[6]: '/ncs:devices/device{router0}'
02-04-2021 11:00 AM
Use the _parent member, here is an example from ncs_pycli:
In [1]: d = root.devices.device['router0'] In [2]: dp = d._parent In [3]: d Out[3]: ListElement name=device tag=617911018 keys={router0} In [4]: dp Out[4]: List name=device tag=617911018 In [5]: dp._path Out[5]: '/ncs:devices/device' In [6]: d._path Out[6]: '/ncs:devices/device{router0}'
08-04-2023 07:16 PM
Hi Viktor
where is ncs_pycli? Is it downloadable tool of NSO. After sourcing ncsrc, and checking path of NSO, I do not see ncs_pycli.
Thanks.
TK
08-07-2023 09:21 AM
Hello,
It’s available Here
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