...
Info |
---|
This page describes a mechanism for setting up a virtual test environment across multiple VMs or hardware servers. If you simply want to do ONOS development with a virtual multi-node ONOS cluster, check out Mininet and onos.py workflow. This page assumes that the reader has been able to work through Installing and running ONOS. |
Overview
Testing and managing a distributed platform like ONOS can become a cumbersome task.
In order to simplify testing and to make it more repeatable, a number of assets, including the aforementioned ONOS scripts, have been developed to make the developer’s and tester’s lives easier. These are located under onos/tools/test/, and Appendix A of this Guide provides a listing of available utilities. These scripts can be used on a test cluster consisting of multiple VMs, containers, or hardware servers.
Test Environment Components
An ONOS developer's environment may include the following:
...
Lastly, since a developer may want to test different scenarios against different sets of VMs or servers, ONOS provides the notion of test cells.
Test Cells
A test cell refers to a specific controller cluster environment designated for testing. This can mean a set of bare-metal servers, or a set of VMs running on developer’s laptop. Cell definition files are bash snippets that export a few environment variables into the developer’s (or tester’s) shell. These variables are then used by a number of the ONOS test and utility scripts. This allows the scripts and test scenarios to be independent to a specific test bench setup.
Using cells
Cell definitions are loaded into the shell environment with the cell
utility. This utility takes the name of a cell definition file as the argument. For example:
...
The utility script cells
can be used to view all available cell definitions. Without parameters, cell
will list the values associated with the current cell in use.
Cell Definition Files
A cell definition file defines values for the aforementioned environment variables. A cell definition file may look like the following:
...
ONOS 1.1.0 and later comes with vicell command to ease editing and applying cell definition files. See vicell -h for usage details.
Creating custom cell definitions
Custom cell definition files may be added to ONOS_ROOT/tools/test/cells/, which enables them to be loaded and listed with cell
and cells.
Test VM Setup
ONOS, being an SDN controller authored in Java, can run on a variety of platforms. However, in the interest of focus, the ONOS team engages primarily in testing on Ubuntu server distributions, specifically Ubuntu Server 14.04* LTS 64-bit.
...
For password-less login, the onos-push-keys
utility can be used to transfer one's SSH key to the VM.
Using the Test Environment
Once set up, changes to the codebase can be (relatively) quickly tested in a distributed setting as follows:
...
Code Block | ||
---|---|---|
| ||
$ onos-service --cell restart |
Alternative: Lightweight Virtualization
A developer might not wish to run multiple VMs due to resource constraints of the build machine or environment. In such cases, lightweight virtualization technologies may be used to supply the resource containment for each ONOS instance. One easy way to create an ONOS cluster in a single VM or server is to use onos.py, which uses Mininet hosts/containers for ONOS nodes. Another approach is to create multiple containers using lxc
.