The information on this page is deprecated.


Task

Create an ONOS device behaviour interface and implementation from a YANG model. These classes enables app o CLI command to talk to the device and configure it.

Execution

Code generation

Code editing

 

You class should now look something like this:

package org.onosproject.net.behaviour;
import org.onosproject.net.driver.HandlerBehaviour;
/**
* <...javadoc here..>
*/
public interface <your_interface_name> extends HandlerBehaviour {

<...methods here…>
  
}

Example:

The interface we just built should be the only class from the generated ones that you need, but if there is something more, take it from the generated classes folder and put it (where ?)

Interface implementation

After the creation of the interface you have to implement the methods to operate on the device.

In order to do this you must create a class in <onos_base_directory>/drivers/src/main/java/org/onosproject/driver/netconf/ 


with this declaration:

public class <your_class_name> extends AbstractHandlerBehaviour
      implements <your_interface_name> {

Now let IntelliJ autogenerate the body of the interface’s methods for you and then put your code in it.

Example:

For an example of the whole infrastructure you can take a look at the ControllerConfig.Java class and it’s implementation in NetconfControllerConfig.java

Driver activation

In order to have your device recognized by ONOS you need to put the behavior and it's implementation in a <driver></driver> tag in <onos_home_directory>/drivers/src/main/resources/onos-drivers.xml.

Example:

<driver name="ovs-netconf"
        manufacturer="Nicira, Inc\." hwVersion="Open vSwitch" swVersion="2\..*">
    <behaviour api="org.onosproject.net.behaviour.ControllerConfig"
               impl="org.onosproject.driver.netconf.NetconfControllerConfig"/>
</driver>

See Also

NETCONF : wiki page on how to use the present NETCONF infrastructure to talk to the device