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

Advanced use of xpath eval in Cisco NSO devtools

ryahoffman
Level 1
Level 1

I'd like to use xpath eval or a similar Cisco NSO CLI command to further pre-validate my XML code before running "packages reload".  I'd like to speed up my template development by catching syntax issues earlier.  In particular, I'd like to be able to include conditionals and other commands applied against the xpath on the CLI to try them out before including them in the template.  Some examples below for foreach and set that fail.  Is this possible with 'xpath eval'?  Is there another approach I should take?

ncs(config)# xpath eval /oc-if-config:oc-interfaces//device[device='se1']/interfaces/*
/oc-if-config:oc-interfaces/device[device='se1']/interfaces/interface[name='1/1/c1']
/oc-if-config:oc-interfaces/device[device='se1']/interfaces/interface[name='1/1/c1/1']
/oc-if-config:oc-interfaces/device[device='se1']/interfaces/interface[name='1/1/c2']
/oc-if-config:oc-interfaces/device[device='se1']/interfaces/interface[name='1/1/c2/1']
/oc-if-config:oc-interfaces/device[device='se1']/interfaces/interface[name='1/1/c3']
/oc-if-config:oc-interfaces/device[device='se1']/interfaces/interface[name='1/1/c3/1']
/oc-if-config:oc-interfaces/device[device='se1']/interfaces/interface[name='1/1/c4']
/oc-if-config:oc-interfaces/device[device='se1']/interfaces/interface[name='1/1/c4/1']
/oc-if-config:oc-interfaces/device[device='se1']/interfaces/interface[name='1/1/c5']
/oc-if-config:oc-interfaces/device[device='se1']/interfaces/interface[name='1/1/c6']
/oc-if-config:oc-interfaces/device[device='se1']/interfaces/interface[name='lag-1']
ncs(config)# xpath eval foreach /oc-if-config:oc-interfaces//device[device='se1']/interfaces/*
ncs(config)# xpath eval foreach {/oc-if-config:oc-interfaces//device[device='se1']/interfaces/*}
Error: Invalid name: {/oc-i
ncs(config)#
ncs(config)# xpath eval set INT_LIST=/oc-if-config:oc-interfaces//device[device='se1']/interfaces/*
ncs(config)# xpath eval INT_LIST
ncs(config)#

0 Replies 0