published

Network Services Orchestrator Remote CLI

CLI utility to manage NSO remotely from the command line.

Credentials can be set using the following environmental variables

NSO_RESTCONF_URL 
NSO_USER 
NSO_PASSWORD

Supported subcommands

Add devices

% ./nso_remote_cli add-devices --help                 
Usage: nso_remote_cli add-devices [OPTIONS]

  Add devices into NSO

Options:
  -i, --inventory-file TEXT      NSO Inventory file in yaml format. Use
                                 --print-inventory-example to generate one
                                 [default: ./nso_device_inventory.yaml]
  -e, --print-inventory-example  Print example inventory file
  -f, --fetch-keys               Fetch devices' SSH keys
  -s, --sync-from                Sync from devices
  --help                         Show this message and exit.                      Show this message and exit.

Parameters can be added to the inventory file as needed, as long as they are defined in the yang models. If you are
not sure how to add your devices with extra settings, add one device manually in NSO,
execute "show running-config devices device | de-select config | display json" and convert the output to yaml

Example output

% ./nso_remote_cli add-devices -i test.yaml
Devices added successfully

Install

  1. It is strongly recommended to use virtual environments
  2. Install dependencies in requirements.txt in any python supported system
  3. Test using nso_remote_cli --help
% ./nso_remote_cli --help            
Usage: nso_remote_cli [OPTIONS] COMMAND [ARGS]...

  Top level command

Options:
  --help  Show this message and exit.

Commands:
  add-devices  Add devices into NSO

Sandbox

If you do not have a NSO instance available, you can use the NSO Reservable Sandbox
to test the script

If you need to revisit the NSO Basics, you can start here.

Use Case

# NSO remote CLI management ### Manage one or multiple NSO instances from your terminal This CLI utility allows you to interact with NSO remotely and can be used to automate repetitive tasks. Supported use cases: * Automate devices from inventory file
View code on GitHub

Code Exchange Community

Get help, share code, and collaborate with other developers in the Code Exchange community.View Community
Disclaimer:
Cisco provides Code Exchange for convenience and informational purposes only, with no support of any kind. This page contains information and links from third-party websites that are governed by their own separate terms. Reference to a project or contributor on this page does not imply any affiliation with or endorsement by Cisco.