...
ONOS may be run on the build machine directly, or packaged and launched on remote machines or VMs. This section describes both launching ONOS on the build machine (locally), and packaging and deploying on a remote (target) machine.
Deployment Scenario: Running locally on build machine
Initial configuration
Karaf must first be configured to load the ONOS-related modules. Karaf's configuration file $KARAF_ROOT/etc/org.apache.karaf.features.cfg
. Edit the file:
Append the following to featuresRepositories:
Code Block | ||
---|---|---|
| ||
mvn:org.onlab.onos/onos-features/1.0.0-SNAPSHOT/xml/features |
Append the following to featuresBoot:
Code Block | ||
---|---|---|
| ||
onos-api,onos-core-trivial,onos-cli,onos-openflow,onos-app-fwd,onos-app-mobility,onos-app-tvuegui |
The above loads the trivial (single-instance) ONOS core, forwarding, and topology viewer Web GUI applications.
...
Running locally on build machine
After running maven as described in Building ONOS and making the above changes, karaf
can be used to start ONOS and attach to its CLI:
...
Tip | |||||
---|---|---|---|---|---|
Launching karaf may bring up the default karaf prompt, without the 'ONOS' ASCII art. This is purely cosmetic, and shouldn't affect functionality. If the branding is desired, one can move the branding bundle created during the build process to karaf's lib directory:
And relaunch karaf. |
...
Running remotely with onos-package
and onos-install
onos-install
Remote installations are useful when one wishes to run ONOS on a remote machine (or a VM), or run multiple ONOS instances in a cluster. This section demonstrates remote installation on a single remote machine.
...
The ONOS build process produces a number of OSGi bundles, which are essentially Java jar files. One could simply deploy these bundles These bundles can e deployed in any OSGi container to run ONOS, but this would require that such container be installed, properly configured, and that the bundles be collected and properly staged. The ONOS utility scripts, onos-package
and onos-install
, simplifies this task by packaging into two steps:
- Running
onos-package
packages the ONOS binaries into a distributable compressed tar.
...
- Then,
- Running
onos-install
pushes the package created byonos-package
onto the remote VM.
Setup
Some preparations are needed
Setup
The prerequisites for using these scripts are:
On the build machine:
- The Apache Karaf binaries (either .zip or .tar.gz format) are available in ~/Downloads
- The ONOS source has been built
On the target VM:
- The Oracle Java 8 JRE and Maven are installed
- A user named sdn with sudo privilege exists, or, on the build machine, the ONOS_USER environment variable is set to the preferred username for the VM
The ONOS_FEATURES variable should be set to the list of modules Karaf should launch with ONOS:
Code Block language text $ export ONOS_FEATURES="webconsole,onos-api,onos-core,onos-cli,onos-openflow,onos-app-fwd,onos-app-mobility,onos-app-tvue"
On the target VM:
- The Oracle Java 8 JRE and Maven are installed
- A user named sdn with sudo privilege exists, or, on the build machine, the ONOS_USER environment variable is set to the preferred username for the VM
Additionally, onos-install
relies on ssh
to deploy the package to the target machine. To make the process easier, password-less (e.g. key-based) login to the VM is recommended. The onos-push-keys utility can be used to transfer one's public keys to the VM:
Code Block | ||
---|---|---|
| ||
$ onos-push-keys 192.168.56.10
sdn@192.168.56.10's password:
sdn@192.168.56.10's password: |
This requires that the keys have been generated prior to using the utility. As shown above, it will ask for the password twice.
Finally, the ONOS_FEATURES variable should be set to the list of modules Karaf should launch with ONOS:
Code Block | ||
---|---|---|
| ||
$ export ONOS_FEATURES="webconsole,onos-api,onos-core,onos-cli,onos-openflow,onos-app-fwd,onos-app-mobility,onos-app-tvue" |
Deployment
...
's password: |
This requires that the keys have been generated prior to using the utility. As shown above, it will ask for the password twice.
Deployment
Run
to produce a self-contained tar archiveonos-package
...
:
Code Block language text $ onos-package -rw-r--r-- 1 onosuser wheel 34187574 Nov 8 14:52 /tmp/onos-1.0.0.onosuser.tar.gz
As seen above, the file has the naming convention "onos-1.0.0.<username>.tar.gz", and is created under the /tmp directory.
...
Deploy the binary by pointing
onos-install
to the remote target to run ONOS on (192.168.56.20 in this example):Code Block language text $ onos-install 192.168.56.20 onos start/running, process 9513
Tip If ONOS has been previously installed on a remote machine,onos-install -f [target]
will force a reinstall.
Once ONOS is running, the onos
utility can be used to attach to the remote instance's CLI:
...