11-20-2017 11:20 PM - edited 03-01-2019 04:02 AM
Hi
If we have NSO with devices added, is there a way to export it to an xml file (like we do import device xml to NSO with ncs_load)?
Regards
Kirti
Solved! Go to Solution.
11-23-2017 05:15 PM
ncs_load command works for both import and export.
The default behavior is actually export (save)
Exporting with Keypath
# ncs_load -p /devices/device{csr}
Exporting with with xpath
# ncs_load -P "/devices/device[name='csr']"
Several options are there. -F option can control the output format, for example.
To include operational data, -o option can be used.
Please see the details in the help.
# ncs_load -h
11-21-2017 01:45 AM
Hi,
sure, you could do it this way
admin@ncs(config)# show full-configuration devices device device0 | display xml | save device0.xml
Simon
11-23-2017 02:10 AM
or even
admin@ncs% save device0.xml xml devices device device0
11-23-2017 05:15 PM
ncs_load command works for both import and export.
The default behavior is actually export (save)
Exporting with Keypath
# ncs_load -p /devices/device{csr}
Exporting with with xpath
# ncs_load -P "/devices/device[name='csr']"
Several options are there. -F option can control the output format, for example.
To include operational data, -o option can be used.
Please see the details in the help.
# ncs_load -h
11-27-2017 10:41 PM
Thanks Akira, those commands really helped.
Another query. Is there any command to wipe out the NSO CDB. meaning just delete all devices from NSO?
(We did try ncs_load -l dummy.xml, this deletes all devices and add dummy device, but then we have to get rid of dummy device as well. so was looking for something which will cleanup the CDB)
11-27-2017 10:57 PM
Hi Kirti,
I can't think of good way to do with ncs_load.
Replacing with the specified xml needs the current existing data without devices.
To make it easier, how about to use ncs_cli command?
---
admin@ncs(config)# no devices device *
admin@ncs(config)# commit
---
If you want to complete on linux shell, you can use pipes.
-----
$ cat device_delete.txt
conf
no devices device *
commit
$
$ ncs_cli -u admin -C < device_delete.txt
Commit complete.
$
-----
11-27-2017 11:33 PM
Yeah any cli command is fine. How can I achieve CDB cleanup with ncs_cli ?
11-27-2017 11:35 PM
I'm not sure if I understand what you want to ask.
I thought you wanted to delete the all devices in CDB. (/devices/device)
The above commit will delete the all devices.
If not, could you clarify your question more?
11-27-2017 11:37 PM
Sorry, i had not seen your earlier comment fully.
The ncs_cli commands which u suggested will suffice our requirement.
Thank you v much
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