09-17-2019 04:09 PM
Very often when building Python maagic scripts or applications, or even within service/action logic, it is cumbersome to manually draft the Python object paths, could the BU add into the ncs_cli or even as a separate standalone tool, which took in XPATH statements generated from the ncs_cli, the auto-generated Python Maagic paths?
admin@ncs# show running-config devices device netsim-ios-0 config ios:interface | display xpath /devices/device[name='netsim-ios-0']/config/ios:interface/Loopback[name='0'] /devices/device[name='netsim-ios-0']/config/ios:interface/FastEthernet[name='0/0'] /devices/device[name='netsim-ios-0']/config/ios:interface/FastEthernet[name='1/0'] /devices/device[name='netsim-ios-0']/config/ios:interface/FastEthernet[name='1/1'] admin@ncs# show running-config devices device netsim-ios-0 config ios:interface devices device netsim-ios-0 config ios:interface Loopback0 no shutdown exit ios:interface FastEthernet0/0 no shutdown exit ios:interface FastEthernet1/0 no shutdown exit ios:interface FastEthernet1/1 no shutdown exit ! ! admin@ncs# would like admin@ncs# show running-config devices device netsim-ios-0 config ios:interface | display maagic root.devices.device["netsim-ios-0"].config.ios__interface.GigabitEthernet["0"] etc
09-17-2019 11:40 PM
Hi!
Actually not a bad feature request. If you have support contract please file a feature request TAC case.
One thing that might get you at least half way is to use an interactive python prompt with tab completion. Have a look at this repository
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