05-10-2023 10:13 AM
Hi,
I can do the following in NSO's ncs_cli:
prompt> show configuration devices device J1 config junos:configuration | display set
I can write shell then in Java program to invoke the shell script:
ncs_cli -u admin << END
show configuration devices device ${DEVNM} config junos:configuration | display set
exit
END
But is there any way to do it programmatically without a shell script?
Thx
sm000x
07-11-2023 12:50 PM
Please check these repos in the Cisco Code Exchange:
https://developer.cisco.com/codeexchange/search/?products=NSO
They ones using Ansible or the NSO API seem promising.
For a complete overview, see this repo as well:
https://developer.cisco.com/codeexchange/github/repo/juliogomez/netdevops/
I hope you find what you're looking for.
07-12-2023 11:08 PM - edited 07-12-2023 11:10 PM
Hello,
Based on the Python doc , you cannot . You can only get normal Junos config without the set .
You can check the example in the install directory (
07-13-2023 01:35 AM
What is the underlying use-case for needing the config in "set"- format?
07-14-2023 06:36 PM
Hello @tohagber,
I'll provide one person's brief view of why the "display set" option is important.
Like the "formal" parameter that's available for IOS XR's "show running-config formal" command, the Junos "display set" option produces output that provides all the configuration components that make up each command submitted to the device.
This level of detail makes it much easier to compare configuration statements and ensure correctness.
The detail also makes it easier to compare configuration statements and determine differences in the configs of different boxes.
11-06-2023 05:25 AM
I'd echo 'it'd be nice to be able to "show services my-service-abc | display set"'
why?
I have hundreds of json requests that create nso service instances in various test cases via restconf.
I'd like to be able to generate (and keep up to date) examples for nso operators, many of whom enjoy using set commands via CLI, and are accustomed to reviewing these.
there must be some way to ask nso for this form of output on a service instance get, via RESTConf??
11-06-2023 06:32 AM
The "show ... | display set" command is implemented in NSO's CLI server, thus when communicating with NSO via restconf or other interfaces the CLI server is not involved hence that pipe command does not exist for other interfaces.
The closest thing (i can think of how atm) is that you could implement an action that takes a path (you want to show) as a parameter
and the action implementation uses maapi.save_config(..) which has support for providing the result back in different formats, like:
MAAPI_CONFIG_XML
The configuration format is XML.
MAAPI_CONFIG_XML_PRETTY
The configuration format is pretty printed XML.
MAAPI_CONFIG_JSON
The configuration is in JSON format.
MAAPI_CONFIG_J
The configuration is in curly bracket Juniper CLI format.
MAAPI_CONFIG_C
The configuration is in Cisco XR style format.
... To return that back from the action.
11-06-2023 06:51 AM
Hi, Tohagber:
Thank you for this suggestion. I will give it a try.
THX
sm000x
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