cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
3115
Views
7
Helpful
0
Comments
frjansso
Cisco Employee
Cisco Employee

At times it can help to test against NETSIM devices, e.g. to measure memory consumption, during service development etc. This document describes how to extract the configuration of a real device and load it into one or more NETSIM devices.

Get device data from the device

Let's say you have a device in NSO that you will use as template: device0.

The first step is to export its config to XML

C: show running-config devices device device0 config | display xml | save device.xml

J: show configuration devices device device0 config | display xml | save device.xml

This will store device.xml in your current directory and this file will look like:

<config xmlns="http://tail-f.com/ns/config/1.0">

  <devices xmlns="http://tail-f.com/ns/ncs">

    <device>

      <name>device0</name>

      <config>

        ...

      </config>

    </device>

  </devices>

</config>

And whatever is in the inner (bold) config tags is what is needed for the NETSIM.

So you can either remove the outer tags manually, or simply use (Thanks Viktor Leijon!):

# xmllint --noout --xpath "/*/*/*/*[local-name()='config']" device.xml > dev_netsim.xml

Now create the NETSIM device (in the example below I assume IOS, but it can be any NED):

# ncs-netsim create-network packages/cisco-ios 1 ios

This will create a directory structure: netsim/ios/ios0

Before you start the NETSIM: Copy the generated XML into the NETSIM CDB directory:

# cp dev_netsim.xml netsim/ios/ios0/cdb/.

Start the NETSIM

# ncs-netsim start ios0

If you login to the NETSIM

# ncs-netsim cli-c ios0

# show running-config

Should display all the config.

Now this can be automated and you can create more than one NETSIM from the XML.

Please note that the name dev_netsim.xml is totally arbitrary, the NETSIM will load all xml files in the cdb directory the first time it starts.

If you have an exising NETSIM you can load merge the dev_netsim.xml:

# ncs-netsim cli-c ios0

# configure

# load merge <path to dev_netsim.xml>

# commit

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: