cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
180
Views
0
Helpful
1
Replies
Beginner

ncs_cli | display maagic

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
Everyone's tags (4)
1 REPLY 1
Cisco Employee

Re: ncs_cli | display maagic

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

 

https://github.com/NSO-developer/ncs_pycli