Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Interfaces and Classes

  • NetconfController.java, implemented  implemented by NetconfControllerImpl.java: tracks all the NETCONF devices, serves as a one stop for connecting and obtaining a device and (un)register listeners on device events.

  • NetconfDevice.java implemented by NetconfDeviceImpl.java: represents a NETCONF capable device connected to the ONOS core with his own NetconfSession and his informations saved in an instance of NetconfDeviceInfo
  • NetconfSession.java: interface that every type of transport connection to a NETCONF device must implement, represents the single access point for any operation on the device. An example is NetconfSessionImpl: uses an SSH2 Connection and Session to exchange information and perform operations like get/set-config with the physical NETCONF device. The capability to start a subscription to a device's notifications can be started here.
  • NetconfSessionDelegate.javadelegate interface implemented by NetconfSessionDelegateImpl in NetconfSessionImpl. Serves the purpose of completing the future returned by the thread so the session can return the correct reply for the specific request to the caller, effectively making the request call blocking on the Future.
  • NetconfDeviceProvider.java: manages any NETCONF device role and all the interactions with the ONOS core.
  • NetconfDeviceListener.java implemented by InnerNetconfDeviceListener.java in NetconfDeviceProvider: informs the provider in the ONOS core that a NETCONF device is connected/disconnected.
  • NetconfDeviceOutputEvent.java represent an output event from a device session's stream, it can be a reply, notification, unregistration from the network, error.
  • NetconfDeviceOutputEventListener.java implemented by NetconfDeviceOutputEventListenerImpl.java: interface and implementation of a listener that receives notifications from the device stream: replies, notifications, disconnections and errors. NetconfSession has method to set them to the underling stream handler class, such as NetconfStreamThread.
  • NetconfDeviceInfo.java: contains ip,port,protocol,username,password and DeviceId of a NETCONF device; it's used to exchange information about a device without having to pass the device instance itself.
  • NetconfAlarmProvider.java: manages capturing relevant notifications from devices and creating and alerting the core of alarms based on these notifications.
  • NetconfAlarmTranslator.java: translates the general case of a NETCONF notification to an alarm, defined by Alarm.java, with information from the notification message.
  • NetconfException.java represents an exception happened in the NETCONF protocol implementation.

...

Connect your own device to ONOS

Devices are discovered based on the Network Configuration Service, which uses a JSON file to represent the configuration of as well as provide information about devices.

If you have your own device that talks NETCONF protocol follow this section. Otherwise, if you don't but want to try ONOS NETCONF implementation out with a test VM proceed to the Example section.

Once you have your device Running on some IP address and some port, in order to make ONOS see it you should follow these steps. 

  • start ONOS
  • activate the netconf app :

    Code Block
    onos> app activate org.onosproject.netconf
  • if you wrote your own driver for your device activate that specific driver (i.e.) :

    Code Block
    onos> app activate org.onosproject.drivers.fujitsu
  • give ONOS the information to connect to the device and which driver to use for you device in a json file. You need to specify username, password, ip and port. If you wrote a specific driver that has also to be changed form the standard "netconf" one.

    Code Block
    {
      "devices":{
        "netconf:<ip>:<port>":{
          "basic":{
            "driver": <driver-name>
          }
        }
      },
      "apps":{
        "org.onosproject.netconf":{
          "devices":[{
            "name":<username>,
            "password":<password>,
            "ip":<ip>,
            "port":<port>
          }]
        }
      }
    }

    A working example is in $ONOS_ROOT/tools/test/configs/netconf-cfg.json. Change the IP both in the DeviceId at the top and in the devices array. The port number by default on NETCONF is 830, so unless you made any changes to that leave it as is.
    You can also add other information, more than the driver, to the basic device configuration information: "type": "<device-type>", "manufacturer": "<device-manufacturer>","hwVersion": "<hw-version>","swVersion": "<sw-version>".

     

  • upload the configuration you just wrote to the instance of ONOS you are running, in our case localhost:

    Code Block
    <your_machine>~$ curl -X POST -H "content-type:application/json" http://localhost:8181/onos/v1/network/configuration -d @<path_to_your_json_configuration_file> --user onos:rocks

    or 

    Code Block
    <your_machine>~$ onos-netcfg localhost <path_to_your_json_configuration_file>
  • Check if the device is present in ONOS:

    Code Block
    onos> devices

    should return, among other devices also something like:

    Code Block
    onos> id=netconf:10.1.9.24:1830, available=true, role=MASTER, type=SWITCH, mfr=unknown, hw=unknown, sw=unknown, serial=unknown, ipaddress=10.1.9.24, driver=ovs-netconf, name=netconf:10.1.9.24:1830

    If the device is not present the could have been and error and you have to check the logs.

    • for localhost logs

      Code Block
      <your_machine>~$ tl

      or for remote logs

      Code Block
      <your_machine>~$ ol <IP Address with ONOS instance>
    • verify that the logs don't contain NETCONF related exceptions and this warning does not appear:

      Code Block
      WARN  | event-dispatch-0 | ListenerRegistry <.....> org.onosproject.netconf.NetconfException: Can't connect to NETCONF device on 10.1.9.24:1830

      In case the log is preset it means that the device was not able to reply on the given IP and Port. Verify Ip and Port in the Json file you posted and retry. If any other exception is present, such as no device name, please read the log and react to it accordingly.

  • Once the device is present in ONOS you can interact with it.

...

  • Start the Mininet machine with of-config installed under Virtual-Box
  • [Optional] Set If you are running one ONOS instance outside of localhost (127.0.0.1), set a controller with the set controller command. For Exampleexample, you will have a different IP for your ONOS instance.

    Code Block
    mininet-vm:~$ sudo ovs-vsctl set-controller ofc-bridge tcp:10.128.12.1:6653 
  • [Optional] If you are running multiple external ONOS instances,

    Code Block
    mininet-vm:~$ sudo ovs-vsctl set-controller ofc-bridge tcp:10.128.12.1:6653 tcp:10.128.12.2:6653 tcp: 10.128.12.3:6653
  • Start the ofc-server in the Mininet machine

    Code Block
    mininet-vm:~$ sudo ofc-server -v 3 -f
  • start ONOS
  • activate the netconf app :

    Code Block
    onos> app activate org.onosproject.netconf
  • activate the netconf drivers :

    Code Block
    onos> app activate org.onosproject.drivers.netconf
  • give ONOS the information to connect to the device and which driver to use for it in the $ONOS_ROOT/tools/test/configs/netconf-cfg.json file. Change the IP both in the DeviceId at the top and in the devices array. The port number by default on NETCONF is 830, so unless you made any changes to that leave it as is.

  • upload the configuration you just modified to the instance of ONOS you are running, in our case localhost:

    Code Block
    <your_machine>~$ curl -X POST -H "content-type:application/json" http://localhost:8181/onos/v1/network/configuration -d @$ONOS_ROOT/tools/test/configs/netconf-cfg.json --user onos:rocks

    or 

    Code Block
    <your_machine>~$ onos-netcfg localhost $ONOS_ROOT/tools/test/configs/netconf-cfg.json
  • open the onos logs 

    for localhost logs

    Code Block
    <your_machine>~$ tl

    or for remote logs

    Code Block
    <your_machine>~$ ol
  • verify that the logs don't contain NETCONF related exceptions and this warning does not appear:

    Code Block
    | WARN | event-dispatch-0 | NetconfDeviceProvider | 186 - org.onosproject.onos-netconf-provider-device - 1.4.0.SNAPSHOT | Can't connect to NETCONF device on <ip>:<port>

    In case the log is preset it means that the device was not able to reply on the given IP and Port. Verify Ip and Port in the Json file you posted and retry. If any other exception is present, such as no device name, please read the log and react to it accordingly.

  • Call the command or run the app you have written. For example:

    Code Block
    onos> device-controllers netconf:@10.1.9.24:830

Notifications

If you start a subscription to a device with createSubscription, ONOS will receive <notification> XML messages from the NETCONF device. NetconfAlarmProvider and NetconfAlarmTranslator translate these notification messages into alarms, as they are defined in Alarm.java, and notifies the core about the new alarms.

Future Work

There is much room for improvement and testing, this is only a basic skeleton of the infrastructure. The improvement should be focused on extracting the XML that is now encoded in the NetconfSessionImpl's methods and testing each operation. In the future the XML can be generated through YANG models so it can be specific for every type of device we want to connect.

...