In addition to the core ONOS system and applications, the ONOS project has created sample applications ("ONOS Sample Apps") which provide additional features and can also serve as instructional code or as something that you can extend and modify into a full-featured application.
Prerequisites
Before building the ONOS Sample Apps, you should make sure that you have installed Java, git, and Maven.
| Info | ||
|---|---|---|
| ||
Beware: ONOS and ONOS the core applications in the main ONOS source tree are currently built using |
...
To simply compile and check for errors, you can cd to the onos-app-samples directory and run:
| Code Block | ||
|---|---|---|
| ||
mvn compile
|
This will download all of the required .jar files, including ONOS as well as other required libraries, and compile the Java source into .class files.
It will produce a lot of output, but should eventually succeed, printing something like:
| Code Block | ||
|---|---|---|
| ||
[INFO] Reactor Summary: [INFO] [INFO] onos-app-samples ................................... SUCCESS [ 2.619 s] [INFO] onos-app-calendar .................................. SUCCESS [ 1.290 s] [INFO] onos-app-database-perf ............................. SUCCESS [ 0.272 s] [INFO] onos-app-flowtest .................................. SUCCESS [ 0.359 s] [INFO] onos-app-ifwd ...................................... SUCCESS [ 0.247 s] ... [INFO] onos-app-icona ..................................... SUCCESS [ 0.051 s] [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 13.487 s [INFO] Finished at: 2017-02-03T15:32:55-08:00 [INFO] Final Memory: 76M/379M [INFO] ------------------------------------------------------------------------ |
Building the .oar files
To compile each app all the way from Java into an .oar (ONOS app archive) file which can be installed into ONOS, you can run
| Code Block | ||
|---|---|---|
| ||
mvn install |
in the onos-apps-samples directory.
This will produce similar output to that produced by mvn compile, but will take slightly longer since it is creating the .oar files as well.
...
The .oar files are suitable for installation into the appropriate version of ONOS that you specified in pom.xml.
Note that mvn install doesn't actually install the package into ONOS! Rather you need to follow the appropriate instructions for installing and activating the app into your own ONOS system.
Application installation and activation is discussed in Managing ONOS applications.
...