cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
189
Views
7
Helpful
8
Replies
Cisco Employee

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

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
Cisco Employee

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

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

8 REPLIES 8
Highlighted
Beginner

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

Hi,

sure, you could do it this way

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

Simon

Cisco Employee

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

or even

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

Cisco Employee

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

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

Cisco Employee

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

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)

Cisco Employee

Re: Can we export device details to xml from NSO(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.

$

-----

Cisco Employee

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

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

Cisco Employee

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

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?

Cisco Employee

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

Sorry, i had not seen your earlier comment fully.

The ncs_cli commands which u suggested will suffice our requirement.

Thank you v much