Versions Compared

Key

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

...

All builtin sample and test applications provided by ONOS are now delivered using this mechanism and come pre-installed - although not activated - as part of the standard ONOS distribution. This includes any providers, such as OpenFlow providers. In this way, all optional software components can be installed into and withdrawn from ONOS without the need to rebuild, or even to reconfigure ONOS itself.

Application

...

Package

Applications can be packaged into a single .oar (ONOS Application aRchive) file, for easy delivery of software to a running ONOS cluster. The .oar file is a ZIP file that contains all artifacts, such as feature definitions or OSGi bundles, which may otherwise not be available on Maven central. The following describes the structure of the .oar file:

  • app.xml - application descriptor
  • m2/<groupId>/<artifactId>/<version>/<featuresRepo>
  • m2/<groupId>/<artifactId>/<version>/<artifact>
  • ...

The application package files can be produced using onos-maven-plugin quite easily. The pom.xml file needs to include onos-maven-plugin in its build section and if the pom.xml defines onos.app.name property, or if the module base directory contains app.xml file, the plugin will build the application .oar file and this file will be installed into M2 repository during Maven install phase. See the Maven example below.

Application Definition

Single bundle applications can be easily produced by specifying the following properties in the bundle's pom.xml file:

  • onos.app.name - name of the application, should be specified in reverse DNS notation, e.g. org.onosproject.fwd
  • onos.app.origin - name of the originating entity or company, e.g. ON.Lab

Multi-bundle applications, or those that need to bring in other artifacts, or custom feature dependencies can be defined using the app.xml file, located in the module base directory. The uploaded or defined in ONOS using either a plain app.xml file or a package file (ZIP) containing an app.xml file, any OSGi bundles,  or feature definition file. The app.xml file specifies the following attributes:

  • name - application name, specified in reverse DNS notation
  • version - application version
  • origin - company or organization where application originated
  • description - short description of the application
  • features - list of Apache Karaf features that comprise the application
  • featuresRepo - optional URL of application feature definition artifact
  • artifact - lists artifacts that are to be included in application package

The following is an example of of the ONOS OnePing sample application app.xml file:

Code Block
<?xml version="1.0" encoding="UTF-8"?>
<app name="org.onosproject.oneping" origin="ON.Lab" version="1.2.0"
     featuresRepo="mvn:org.onosproject/oneping-app-features/1.2.0-SNAPSHOT/xml/features"
     features="oneping-app,onos-app-tvue">
    <description>One-Ping-Only sample application!</description>
    <artifact>mvn:...</artifact>
</app>

The app.xml file can contain Maven properties such as ${project.groupId}, ${project.artifactId}, ${project.version}, ${project.description}, ${featureshort.version}, which will result in substitution of the appropriate value from the Maven pom.xml file. It is highly recommended to use these in order to minimize the amount of maintenance required.

Application Package

If an application needs to deliver artifacts, such as feature definitions or OSGi bundles which are not available in a public object repository such as Maven central, it can be packaged into an .oar (ONOS Application aRchive) package file, which is a ZIP file that contains the above app.xml descriptor as well as any other artifacts organized using repository structure hierarchy. The following describes the structure of the application package file:

  • app.xml - application descriptor
  • m2/<groupId>/<artifactId>/<version>/<featuresRepo>
  • m2/<groupId>/<artifactId>/<version>/<artifact>
  • ...

The application package files can be produced using onos-maven-plugin quite easily. The pom.xml file needs to include onos-maven-plugin in its build section and if the base module directory contains app.xml file, the plugin will build the application .oar file and this file will be installed into M2 repository during Maven install phase. See the Maven example below.The ONOS code-base contains examples of both approaches under the apps source tree.

CLI Commands

Administrators can interact with the inventory of applications using the following console commands:

...

Code Block
<plugins>
    ...
    <plugin>
        <groupId>org.onosproject</groupId>
        <artifactId>onos-maven-plugin</artifactId>
        <version>1.4-SNAPSHOT</version>
        <executions>
            <execution>
                <id>app</id>
                <phase>package</phase>
                <goals>
                    <goal>app</goal>
                </goals>
            </execution>
        </executions>
    </plugin>
    ...
</plugins>

Note that the plugin will tag the .oar file as installation artifact, resulting in its installation or deployment into the Maven repository when the Maven install or deploy goals are invoked.

Builtin Sample and Test Applications

...