Cisco NSO a lighty.io

[NSO Guide] Cisco NSO® with lighty.io

by Samuel Kontriš | Leave us your feedback on this post!

This is a continuation of our guide on the Cisco Network Service Orchestrator. In our previous article, we have shown you how to install and run Cisco NSO with three virtual devices. We believe you had time to test it out and get to know this great tool.

Now, we will show you how to use the Cisco NSO with our SDN Framework – lighty.io. You can read more about lighty.io here, and even download lighty-core from our GitHub here.

Prerequisites

This tutorial was tested on Ubuntu 18.04 LTS. In this tutorial we are going to use:

Get and start the lighty.io application

To get the lighty.io 11.2.0 release, clone its GitHub repository and build it with Maven.

git clone https://github.com/PANTHEONtech/lighty-core.git
cd lighty-core
git checkout 11.2.0
mvn clean install

After the build, locate the lighty-community-restconf-netconf-app artifact and unzip its distribution from the target directory:

cd lighty-examples/lighty-community-restconf-netconf-app/target
unzip lighty-community-restconf-netconf-app-11.2.0-bin.zip
cd lighty-community-restconf-netconf-app-11.2.0

Now we can start lighty.io application by running its .jar file:

java -jar lighty-community-restconf-netconf-app-11.2.0.jar

After a few seconds we should see in the logs message that everything was started successfully:

INFO [main] (Main.java:97) - lighty.io and RESTCONF-NETCONF started in 7326.731ms

The lighty.io application should now be up and running. The default RESTCONF port is 8888.

Connect Cisco NSO to the lighty.io application

To connect Cisco NSO to the lighty.io application via NETCONF protocol we must add it as a node to the configuration datastore using RESTCONF. To do this, call a PUT request on the URI:

http://localhost:8888/restconf/data/network-topology:network-topology/topology=topology-netconf/node=nso

with the payload:

{
    "netconf-topology:node":[ { 
        "node-id":"nso",
        "host":"127.0.0.1",
        "port":2022,
        "username":"admin",
        "password":"admin",
        "tcp-only":false,
        "keepalive-delay":0,
        "netconf-node-configuration:schemaless":false
    } ]
}

The parameter nodeId specifies the name, under which we will address Cisco NSO in the lighty.io application. Parameters host and port specify, where the Cisco NSO instance is running. The default username and password for Cisco NSO is admin/admin. In case you would like to change node-id be sure to change it in the URI too.

To check if Cisco NSO was connected successfully, call a GET request on the URI:

http://localhost:8888/restconf/data/network-topology:network-topology/topology=topology-netconf/node=nso

The output should look similar to this:

{
    "network-topology:node": [
        {
            "node-id": "nso",
            "netconf-node-topology:unavailable-capabilities": {...},
            "netconf-node-topology:schemaless": false,
            "netconf-node-topology:available-capabilities": {...},
            "netconf-node-topology:password": "admin",
            "netconf-node-topology:username": "admin",
            "netconf-node-topology:tcp-only": false,
            "netconf-node-topology:port": 2022,
            "netconf-node-topology:host": "127.0.0.1",
            "netconf-node-topology:keepalive-delay": 0,
            "netconf-node-topology:connection-status": "connected"
        }
    ]
}

If Cisco NSO was connected successfully, the value of the connection-status should be connected.

Activate Cisco NSO service using lighty.io

Activation of the Cisco NSO service is similar to connecting Cisco NSO to lighty.io. We are going to activate the ACL service we created in the previous tutorial, by calling PUT REST request on URI:

http://localhost:8888/restconf/data/network-topology:network-topology/topology=topology-netconf/node=nso/yang-ext:mount/services/acl-service:acl-service=myAcl

with payload:

{
    "acl-service:acl-service": [
        {
            "ACL_Name": "myAcl",
            "ACL_Direction": "in",
            "devices": [
                {
                    "device_name": "c0",
                    "interfaces": [
                        {
                            "interface_type": "GigabitEthernet",
                            "interface_number": "1/1"
                        }
                    ]
                }
            ]
        }
    ]
}

This payload is modeled in a YANG model we created together with the ACL service in our previous tutorial. Feel free to change the values of the ACL parameters (first, check what types they are in the ACL service YANG model) and if you are changing ACL_Name, don’t forget to change it in the URI too.

Unfortunately, in the time of writing this tutorial, there is a bug in the OpenDaylight NETCONF (NETCONF-568) with parsing the output from this call. It prevents lighty.io from sending a response to the RESTCONF request we sent and we need to manually stop waiting for this response in Postman (or another REST client you are using).

Now, our service should be activated! To check activated services in Cisco NSO, call a GET request on the URI:

http://localhost:8888/restconf/data/network-topology:network-topology/topology=topology-netconf/node=nso/yang-ext:mount/services/acl-service:acl-service=myAcl

In response, you should see the service we just activated. It should look similar to this:

"acl-service:acl-service": [
    {
        "ACL_Name": "myAcl",
        "ACL_Direction": "in",
        "devices": [
            {
                "device_name": "c0",
                "interfaces": [
                    {
                        "interface_type": "GigabitEthernet",
                        "interface_number": "1/1"
                    }
                ]
            }
        ],
        "directly-modified": {
            "devices": [
                "c0"
            ]
        },
        "device-list": [
            "c0"
        ],
        "modified": {
            "devices": [
                "c0"
            ]
        }
    }
]

To check if the device was configured, log into Cisco NSO CLI and execute a show command:

ncs_cli -u admin
show configuration devices device c0 config ios:interface

You should see an output, similar to this:

admin@ncs> show configuration devices device c0 config ios:interface
FastEthernet 1/0;
GigabitEthernet 1/1 {
    ip {
        access-group {
            access-list myAcl;
            direction   in;
        }
    }
}

A Postman collection containing all REST requests we executed in this tutorial can be found here or downloaded directly from here.

Today we showed you how to connect Cisco NSO with lighty.io. Up next, our tutorial will depict how to connect ONAP SDN-C with Cisco NSO.

Leave us your feedback on this post!

10/03/2020 Update: Added the video demonstration, enjoy!


You can contact us at https://pantheon.tech/

Explore our Pantheon GitHub.

Watch our YouTube Channel.

© 2023 PANTHEON.tech s.r.o