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

ncs_cli | display maagic

jason.belk
Level 1
Level 1

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
1 Reply 1

hniska
Cisco Employee
Cisco Employee

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

Getting Started

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: