Versions Compared

Key

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

...

As a reference, our collection of additions/modifications can be summarized in the following directory layout:

Code Block
languagetext
$${ONOS_ROOT}/apps/pom.xml (apps parent POM)
         |    |  
         |    /ifwd/pom.xml (application POM)
         |         |
         |         /src/main/java/org/onosproject/ifwd/IntentReactiveForwarding.java (the application)
         |             |                              |
         |             |                              /package-info.java (optional documentation/annotations)
         |             |
         |             /test/java/org/onosproject/ifwd/ (Unit tests go here)
         |
         /core/api/src/main/java/org/onosproject/net/apps/ForwardingMapService.java (the service interface)
         |
         /cli/src/main/java/org/onosproject/cli/net/ForwardingMapCommand.java (the command)
                      |
                      /resources/OSGI-INF/blueprint/shell-config.xml (Karaf shell configuration)  

Conventions

${ONOS_ROOT} refers to the project root directory for ONOS. For example, if the project directory is ~/onos_next,  cd ${ONOS_ROOT} is equivalent to cd ~/onos_next .

...

We start by defining a new interface for the service in the onos-api package (${ONOS_ROOT}/core/api/src/main/java/org/onosproject/net/). We also create a new directory, apps/, for our service interface to reside in. The interface is added to this location so that the cli package that implements the commands has access to it.

...

The CLI commands are defined in the project directory ${ONOS_ROOT}/cli/. There are two types of commands, with their source files located in the following locations:

  • ${ONOS_ROOT}/cli/src/main/java/org/onosproject/cli - Commands related to system configuration and monitoring
  • ${ONOS_ROOT}/cli/src/main/java/org/onosproject/cli/net - Commands related to network configuration and monitoring

...

Next, we need to tell Karaf about our new command by editing shell-config.xml, located in ${ONOS_ROOT}/cli/src/main/resources/OSGI-INF/blueprint/. We add the following to the contents between the <command-bundle></command-bundle> clause in the file:

...

Code Block
languagetext
$ cd ${ONOS_ROOT}
$ mvn clean install
$ karaf clean

...