Automating Cisco IOS using NSO 5.3 on Ubuntu Linux 20.04 – Part 4 (NSO Services)

Categories Automation, Cisco, Devnet, NSO
  • A network service refers to a collection of configurations across devices on a network.
  • NSO Services are used to create instances of services to deploy across your network.
  • You can define any set of configuration templates and sets of variables for those templates.
  • NSO will keep track of the service instances and only update or remove services.
  • Services can be a customer, tenant, site id, or anything you want to define.
  • Services provide assurance and verification that prove the intended outcome on the network before applying the configuration into a production environment. Services can be used along side other applications or workflow engines.

Creating the Service Package

  • NSO uses a built in package management system to handle NEDs and custom service packages.
  • ncs-make-package is a CLI tool that will auto generate a skeleton structure of files needed for creating the service package.
  • The tree is a tiny, cross-platform command-line program used to recursively list or display the content of a directory in a tree-like format. It outputs the directory paths and files in each sub-directory and a summary of a total number of sub-directories and files.
  • Review the contents of the loopback-service.yang and loopback-service-template.xml files using cat to output to the terminal.
  • Launch the ncs_cli
  • Create a loopback interface with an IP schematic.
  • go to the top directory and verify the pending configuration changes.
  • Output the changes using XML formatting and copy the interface configuration section between the </config> tags
  • Using a text editor such as gedit, nano, vi, vim or whatever you are comfortabl with paste in the XML configuration you copied between the </config> tags
  • rename the IP address and give it a variable of {/dummy}
  • Save the configuration after verifying the config contents are proper.
  • make the package
  • Get back into the ncs_cli
  • reload the packages in ncs.

Creating a Service Instance

  • From configuration mode in the NSO CLI use the new loopback-service command.
  • Name the instance test and add variables for the device and IP scheme.
  • Verify the configuration on the a0 device.