Running NSO Examples

Run and interact with practice examples provided with the NSO installer.

circle-exclamation

This section provides an overview of how to run the examples provided with the NSO installer. By working through the examples, the reader should get a good overview of the various aspects of NSO and hands-on experience from interacting with it.

circle-info

This section references the examples located in $NCS_DIR/examples.ncsarrow-up-right. The examples all have README files that include instructions related to the example.

General Instructions

  1. Make sure that NSO is installed with a Local Install according to the instructions in Local Install.

  2. Source the ncsrc file in the NSO installation directory to set up a local environment. For example:

    $ source ~/nso-6.0/ncsrc
  3. Proceed to the example directory:

    $ cd $NCS_DIR/examples.ncs/device-management/simulated-cisco-ios
  4. Follow the instructions in the README files that are located in the example directories.

Every example directory is a complete NSO run-time directory. The README file and the detailed instructions later in this guide show how to generate a simulated network and NSO configuration for running the specific examples. Basically, the following steps are done:

  1. Create a simulated network using the ncs-netsim --create-network command:

    $ ncs-netsim create-network cisco-ios-cli-3.8 3 ios

    This creates 3 Cisco IOS devices called ios0, ios1, and ios2.

  2. Create an NSO run-time environment using the ncs-setup command:

    $ ncs-setup --dest .

    This command uses the --dest option to create local directories for logs, database files, and the NSO configuration file to the current directory (note that . refers to the current directory).

  3. Start NCS netsim:

    $ ncs-netsim start
  4. Start NSO:

    $ ncs
circle-exclamation

Common Mistakes

Some of the most common mistakes are:

chevron-rightNot Sourcing the ncsrc Filehashtag

You have not sourced the ncsrc file:

chevron-rightNot Starting NSO from the Runtime Directoryhashtag

You are trying to start NSO from a directory that is not set up as a runtime directory.

What happened above is that NSO did not find an ncs.conf in the local directory, so it uses the default in /etc/ncs/ncs.conf. That ncs.conf says there shall be directories at ./ such as ./state which is not true. Make sure that you cd to the root of the example and check that there is a ncs.conf file and a cdb-dir directory.

chevron-rightHaving Another Instance of NSO Runninghashtag

You already have another instance of NSO running (or the same with netsim):

To resolve the above, just stop the running instance of NSO and netsim. Remember that it does not matter where you started the "running" NSO and netsim; there is no need to cd back to the other example before stopping.

chevron-rightNot Having the NetSim Device Configuration Loaded into NSOhashtag

Another problem that users run into sometimes is where the NetSim device configuration is not loaded into NSO. This can happen if the order of commands is not followed. To resolve this, remove the database files in the ncs_cdb directory (keep any files with the .xml extension). In this way, NSO will reload the XML initialization files provided by ncs-setup.

Last updated

Was this helpful?