Versions Compared

Key

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

...

Cluster-ize your instances

 


Now you have three instances of ONOS. Each of these instances is running independently but we want them to run in a cluster. First we need to download a utility (called onos-form-cluster) that will make it easy for us to form the cluster:

Code Block
$ wget https://raw.githubusercontent.com/opennetworkinglab/onos/master/tools/package/bin/onos-form-cluster
--2015-03-19 19:28:59--  https://raw.githubusercontent.com/opennetworkinglab/onos/master/tools/package/bin/onos-form-cluster
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 199.27.79.133
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|199.27.79.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 717 [text/plain]
Saving to: ‘onos-form-cluster’
100%[=========================================================================================================================]
2015-03-19 19:29:00 (225 MB/s) - ‘onos-form-cluster’ saved [717/717]

...


Then let's make this file an executable:

Code Block
$ chmod u+x onos-form-cluster

...


Next I recommend adding the following to your .bashrc, it will make it easier to get the docker instance IP.

Code Block
docker-ip() {
  sudo docker inspect --format '{{ .NetworkSettings.IPAddress }}' "$@"
}

...


Once you have this added do not forget to re-source your .bashrc file:

Code Block
$ . ~/.bashrc

 


Now you are ready to form your cluster by simply running the following:

...

Notice that the names onos1, onos2, and onos3 are the names you gave your instances when you ran them. 


The previous command caused the ONOS instances to restart and come back up as a cluster. We can observe this by ssh'ing into one onos instance:

...

Code Block
sudo mn --topo tree,2 --controller remote,ip=`docker-ip onos1`
*** Creating network
*** Adding controller
*** Adding hosts:
h1 h2 h3 h4 
*** Adding switches:
s1 s2 s3 
*** Adding links:
(s1, s2) (s1, s3) (s2, h1) (s2, h2) (s3, h3) (s3, h4) 
*** Configuring hosts
h1 h2 h3 h4 
*** Starting controller
c0 
*** Starting 3 switches
s1 s2 s3 ...
*** Starting CLI:
mininet> pingall
*** Ping: testing ping reachability
h1 -> h2 h3 h4 
h2 -> h1 h3 h4 
h3 -> h1 h2 h4 
h4 -> h1 h2 h3 
*** Results: 0% dropped (12/12 received)
mininet>

 


Remarks

The ONOS cluster you just created is not running any specific application. To install an application you will need to use the onos-app utility as documented in Application Subsystem..

Building your own ONOS docker image

If you have modified the source code of ONOS, you might want to build your modified ONOS into your own docker image so that you can run it in some environment. The following command will build an ONOS docker image out of an ONOS source tree:

Code Block
$ docker build -t onosproject/onos:test .

This builds an image with the tag onosproject/onos:test, and of course you are free to tag your image however you'd like.