cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2664
Views
12
Helpful
8
Replies

Can we export device details to xml from NSO(CDB)

kbarve
Cisco Employee
Cisco Employee

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

1 Accepted Solution

Accepted Solutions

Akira Iwamoto
Cisco Employee
Cisco Employee

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

View solution in original post

8 Replies 8

sspehar
Level 1
Level 1

Hi,

sure, you could do it this way

admin@ncs(config)# show full-configuration devices device device0 | display xml | save device0.xml

Simon

or even

admin@ncs% save device0.xml xml devices device device0

Akira Iwamoto
Cisco Employee
Cisco Employee

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

kbarve
Cisco Employee
Cisco Employee

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)

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.

$

-----

Yeah any cli command is fine. How can I achieve CDB cleanup with ncs_cli ?

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?

Sorry, i had not seen your earlier comment fully.

The ncs_cli commands which u suggested will suffice our requirement.

Thank you v much

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: