ONOS -- Install, and Running as a service === # Requirements ## Hard requirements :::info 2 core CPU 2 GB RAM 10 GB hdd 1 NIC (any speed) ::: ## Software requirements ### For ubuntu 16.04(recommended) ```shell= # Add user for onos (such as sdn) sudo adduser sdn --system --group # Java8 sudo apt update sudo add-apt-repository ppa:webupd8team/java -y sudo apt update echo "oracle-java8-installer shared/accepted-oracle-license-v1-1 select true" | sudo debconf-set-selections sudo apt install oracle-java8-installer oracle-java8-set-default -y # Curl sudo apt install curl ``` ### For ubuntu 14.04 ```shell= # Add user for onos (such as sdn) sudo adduser sdn --system --group # Java8 sudo apt-get update sudo add-apt-repository ppa:webupd8team/java -y sudo apt-get update echo "oracle-java8-installer shared/accepted-oracle-license-v1-1 select true" | sudo debconf-set-selections sudo apt-get install oracle-java8-installer oracle-java8-set-default -y # Curl sudo apt-get install curl ``` ### *alternative way to install java8 if oracle-java8-installer not working* ```shell= # Download jdk-8u161-linux-x64.tar.gz form java website # http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html cd /usr/lib sudo mkdir jdk cd jdk sudo tar xzvf jdk-8u161-linux-x64.tar.gz ``` *Add env parameters `sudo vim /etc/profile` to the end of the file* ``` export JAVA_HOME=/usr/lib/jdk/jdk1.8.0_161 export JRE_HOME=/usr/lib/jdk/jdk1.8.0_161/jre export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH export CLASSPATH=$CLASSPATH:.:$JAVA_HOME/lib:$JAVA_HOME/jre/lib ``` *Run update-alternatives* ```shell= sudo update-alternatives --install /usr/bin/java java /usr/lib/jdk/jdk1.8.0_161/bin/java 300 sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jdk/jdk1.8.0_161/bin/javac 300 sudo update-alternatives --config java sudo update-alternatives --config javac ``` # Installation ## Download offical binary ```shell= # Create /opt sudo mkdir -p /opt && cd /opt # Download ONOS and untar to /opt sudo wget -c http://onos.sdn.nctu.edu.tw/onos/release/onos-1.12.0.tar.gz sudo tar xzf onos-1.12.0.tar.gz sudo mv onos-1.12.0 onos sudo chown -R sdn:sdn onos ``` ## Configure startup options *sudo -u sdn vim /opt/onos/options* ```shell= # running onos with user sdn export ONOS_USER=sdn # default active drivers and openflow export ONOS_APPS=drivers,openflow ``` ## Install service files ### For ubuntu 16.04 ```shell= sudo cp /opt/onos/init/onos.initd /etc/init.d/onos sudo cp /opt/onos/init/onos.service /etc/systemd/system/ sudo systemctl daemon-reload sudo systemctl enable onos ``` ### For ubuntu 14.04 ```shell= sudo cp /opt/onos/init/onos.initd /etc/init.d/onos sudo cp /opt/onos/init/onos.conf /etc/init/onos.conf ``` ## Running ONOS as a service ### For ubuntu 16.04 ```shell= sudo systemctl {start|stop|status|restart} onos.service ``` ### For ubuntu 14.04 ```shell= sudo service onos {start|stop|status} ``` # Trying ONOS with network emulator Mininet **<font color="red">*Before install your Mininet ... Remember to stop ONOS!*</font>** ## Install Mininet ### For ubuntu 16.04 ```shell= sudo apt install mininet ``` ### For ubuntu 14.04 ```shell= sudo apt-get install mininet ``` ### Install from source ```shell= cd ~/ && git clone https://github.com/mininet/mininet cd mininet && git checkout 2.2.1 util/install.sh -a ``` ## Test your Mininet ```shell= sudo mn --test pingall ``` ## Attach Mininet to ONOS **<font color="red">*Rememeber to run your ONOS*</font>** ```shell= # Run mininet command to connect to ONOS sudo mn --controller=remote,ip=127.0.0.1,port=6653 --topo=tree,depth=2 # Also can run mininet with python script and connect to ONOS # Sample python file: https://url.fit/Zdd7P sudo python mininet-sample.py ``` # User Interfaces ## ONOS Web UI ### Setup user password ```shell= # Remove default account /opt/onos/bin/onos-user-password onos --remove # Add your own account /opt/onos/bin/onos-user-password sdndstw onosrocks ``` ### Open your browser and login with your account `http://{your_server_ip}:8181/onos/ui` ### Topology ![ONOS Web Topology](https://i.imgur.com/lx5nDuw.png) ### Applications ![ONOS Web Applications](https://i.imgur.com/W91FR9Y.png) ### Devices ![ONOS Web Devices](https://i.imgur.com/BpeqRbI.png) ### Links ![ONOS Web Links](https://i.imgur.com/idIAEEo.png) ### Hosts ![ONOS Web Hosts](https://i.imgur.com/ltNzBNc.png) ## ONOS Command Line Interface ### Setup key and login ONOS CLI ```shell= # Generate & add user key to karaf ssh-keygen -t rsa /opt/onos/bin/onos-user-key $USER ~/.ssh/id_rsa.pub # Login to CLI /opt/onos/bin/onos ``` ### ONOS welcome screen ![ONOS CLI](https://i.imgur.com/IlTP9UY.png) ### Show apps ![ONOS CLI Apps](https://i.imgur.com/KkSjEfN.png) ### Show devices ![ONOS CLI Devices](https://i.imgur.com/vd98iCO.png) ### Show links ![ONOS CLI Links](https://i.imgur.com/pmAateZ.png) ### Show hosts ![ONOS CLI Hosts](https://i.imgur.com/H8i881T.png) ###### contact me: [nosignal@nctu.edu.tw](mailto:nosignal@nctu.edu.tw) ###### tags: `Service` `ONOS` `SDN`