0% found this document useful (0 votes)
4 views

ONOSTutorial

ONOS
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

ONOSTutorial

ONOS
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 102

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/316075546

Open Network Operating System (ONOS) Learning Tutorial

Presentation · January 2017


DOI: 10.13140/RG.2.2.36149.47840

CITATIONS READS

2 4,827

1 author:

Muhammad Imran
National Cyber Security Auditing and Evaluation Lab
9 PUBLICATIONS 256 CITATIONS

SEE PROFILE

All content following this page was uploaded by Muhammad Imran on 13 April 2017.

The user has requested enhancement of the downloaded file.


1
Muhammad Imran (Ph.D Scholar)
Department of Computer and Information Sciences,
Pakistan Institute of Engineering and Applied Sciences, Islamabad.
 Introduction
 SDN
▪ What, Why and Where?
 ONOS

 Setting up ONOS Development Environment


 Prerequisites and Setup
 Install Required Software

 Major Components of ONOS VM


 Mininet
▪ Basic Commands
▪ Advance Functions
 ONOS Controller
▪ CLI Commands
▪ Graphical User Interface
 Development Environment
▪ Importing and Modifying Application in Intellij IDEA
▪ Building and Installing Application

3
 Computing has advanced rapidly over the past three decades.

 But the networking has remained virtually unchanged.

 The networks themselves have become a critical component


of all infrastructures in society.

 Networks are also important part of the emerging public and


private clouds.

4
 The traditional network devices are:

 Closed

 Complex

 Inflexible

 Proprietary

 Operationally Expensive

 Not supported for innovation and progress


5
 In this environment, it is too difficult, if not impossible, for
network operators, third parties, and even vendors to
innovate.

 Operators cannot customize and optimize networks for their


use cases that are relevant to their business and cannot offer
customized solutions to their customers.

 Traditional networks lack a common set of APIs, which make


it very difficult to program applications directly to network
resources.

6
 Software Defined Networking (SDN) separates the control
plane from the data plane.

 Freeing software innovation cycles to become independent of


hardware innovation cycles.

 SDN accelerates Internet and Cloud innovation while


significantly reducing the costs of building and operating
networks.

7
8
 The software defined networks are:

 Open

 Simple

 Flexible

 Reduced operational costs

 Improved network visibility

 To support the innovation and progress


9
 SDN support for network "slices" in campus environments,
which enable IT managers to segment the network for
specific departments (such as research and development)
while allowing other network user groups to run
independently.

 Enterprises

 Data centers

10
11
 Following are some Open and community driven controllers:

 Open Daylight
 ONOS (Open Networking Operating System)
 Project Floodlight
 Beacon
 NOX/POX
 Open vSwitch
 Ryu Controller (supported by NTT Labs)
 Faucet (Python based on Ryu for production networks)

12
 ONOS is a SDN operating system for service providers to make it
easy to create apps and services.
 Top-Level Features:
 High availability through clustering and distributed state management.
 Scalability through clustering and sharing of network device control.
 Northbound abstractions for a global network view, network graph and
application intents.
 Pluggable southbound for support of OpenFlow and new or legacy
protocols.
 Graphical user interface to view multi-layer topologies and inspect elements
of the topology.
 REST API for access to Northbound abstractions as well as CLI commands.
 CLI for debugging.
 Support for both proactive and reactive flow setup.

13
14
15
 In broad scenario, there are four ONOS deployment models

 Full build and full remote deployment

 Full build and full local deployment

 Application build and remote redeployment

 Application build and local redeployment

16
Building ONOS
Development Environment

17
 In this section, we will build the complete ONOS
development environment from scratch in a Virtual Machine.

 Hardware Requirements (minimum) :


 Core i7 Processor (Core i3)
 8 GB RAM (4GB)
 40 GB Disk Space (15 GB)

18
 Following major software are required:

 Oracle Virtual Box (or VM Ware)


 Ubuntu 14.04
 Java 8 JDK (Oracle Java recommended)
 Apache Maven 3.3.9
 Apache Karaf 3.0.5
 ONOS 1.8.1
 IDE IntelliJ (or Eclipse)

19
 The commands at the build machine shell will start with
sdn@ONOS:~$
 sdn@ONOS:~$ sudo su
 root@ONOS:~#

 Commands at the shell of the remote onos shell will begin


with sdn@onos1:~$
 sdn@onos1:~$ sudo su
 sdn@onos1:~#

20
 Install Oracle’s Virtual Box

 Create a new VM with following specifications:


 Ubuntu Server 14.04 LTS 64-bit
 2GB or more RAM
 2 or more processors
 15GB or more hard disk
 2 network adopters

21
22
23
24
25
26
27
28
29
1. Apply proxy setting and password less sudo access (optional)
2. Install pre-requisite software
3. Install Mininet
4. Install Karaf and Maven
5. Install Oracle Java 8
6. Clone ONOS 1.8
7. Apply settings for ONOS 1.8.1
8. Setting up remote system
9. Apply cell settings for ONOS
10. Build ONOS
11. Package ONOS
12. Run ONOS
13. Install IntelliJ IDEA

30
31
 In terminal type sudo visudo and add highlighted lines

32
 Execute following commands in Linux terminal to install pre-
requisite softwares

 sdn@ONOS:~$ sudo apt-get update


 sdn@ONOS:~$ sudo apt-get install git
 sdn@ONOS:~$ git config --global url."https://".insteadOf git://
 sdn@ONOS:~$ sudo apt-get install openssh-server
 sdn@ONOS:~$ sudo apt-get install curl
 sdn@ONOS:~$ ssh-keygen -t rsa

33
 To download and install Mininet execute following
commands:

 sdn@ONOS:~$ git clone http://github.com/mininet/mininet


 sdn@ONOS:~$ mininet/util/install.sh –nvfw
 sdn@ONOS:~$ sudo mn
 sdn@ONOS:~ exit

 This will also install wireshark which is a famous packet


analysis tool.

34
35
 To download and install Appache Karaf and Maven execute
following commands in terminal:

 sdn@ONOS:~$ mkdir Applications


 sdn@ONOS:~$ cd Downloads/
 sdn@ONOS:~$ wget
http://archive.apache.org/dist/karaf/3.0.5/apache-karaf-3.0.5.tar.gz
 sdn@ONOS:~$ wget http://archive.apache.org/dist/maven/maven-
3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz
 sdn@ONOS:~$ tar -zxvf apache-karaf-3.0.5.tar.gz -C ../Applications/
 sdn@ONOS:~$ tar -zxvf apache-maven-3.3.9-bin.tar.gz -C
../Applications/
 sdn@ONOS:~$ mvn -v
 sdn@ONOS:~$ cd

36
37
 To install Oracle’s Java 8 execute following commands in
terminal :

 sdn@ONOS:~$ sudo apt-get install software-properties-common -y


 sdn@ONOS:~$ sudo add-apt-repository ppa:webupd8team/java -y
 sdn@ONOS:~$ sudo apt-get update
 sdn@ONOS:~$ sudo apt-get install oracle-java8-installer oracle-
java8-set-default -y

38
39
40
41
42
 To download the ONOS 1.8 source code

 sdn@ONOS:~$ git checkout onos


 sdn@ONOS:~$ cd Downloads/
 sdn@ONOS:~$ wget
https://github.com/opennetworkinglab/onos/archive/onos-1.8.zip
 sdn@ONOS:~$ unzip onos-1.8.zip -d ~/
 sdn@ONOS:~$ cd
 sdn@ONOS:~$ mv onos-onos-1.8/ onos/
 sdn@ONOS:~$ cd onos

43
 To apply settings for ONOS, execute following command in
Linux terminal and add highlighted lines (shown in next
slides) in files:

 sdn@ONOS:~$ gedit .bashrc


 sdn@ONOS:~$ gedit Applications/apache-kraf-
3.0.5/etc/org.apache.karaf.features.cfg
 sdn@ONOS:~$ gedit onos/.buckconfig
 sdn@ONOS:~$ gedit .m2/settings.xml
 sdn@ONOS:~$ . ~/.bashrc
 sdn@ONOS:~$ env

44
45
46
47
48
 There are two options to set remote machine

 Make another VM
▪ Create new VM and install Linux as done before
▪ Perform Deployment Steps 1, 2 and 5.

 Use LXC (Linux Containers) as operating system


▪ Install lxc program
▪ Download Ubuntu OS
▪ Make a new sudo group user named “sdn” with password “rocks”
▪ Perform Deployment Steps 1, 2 and 5.

49
 To install, download and setup LXC container execute
following commands:

 sdn@ONOS:~$ sudo apt-get install lxc


 sdn@ONOS:~$ sudo lxc-create -n onos1 -t ubuntu
 sdn@ONOS:~$ sudo lxc-start -n onos1

 Upon the execution of the above command the downloaded


Linux system will start

 Sign-in with username “ubuntu” and password “ubuntu”

50
 Make a new user in sudo group with username “sdn” and
password “rocks” with following commands:

 ubuntu@onos1:~$ sudo su
 root@onos1:~# adduser sdn
 root@onos1:~# adduser sdn sudo
 root@onos1:~# exit
 ubuntu@onos1:~$ logout

 Sign-in with username “sdn” and password “rocks”

51
 To add proxy settings (optional)

 sdn@onos1:~$ nano .bashrc

 Add following lines at end of file:


 export http_proxy='http://<ip>:<port>'
 export https_proxy='http ://<ip>: <port>'
 export ftp_proxy='http ://<ip>:<port>’

 Save the file after adding above lines

52
 Repeat step 1 for password less sudo access
 sdn@onos1:~$ sudo visudo

 Execute following commands of step 2:


 sdn@onos1:~$ sudo apt-get update
 sdn@onos1:~$ sudo apt-get install git

 Install Oracle Java 8 by repeating the commands of step 5

 To shutdown LXC container write


 sdn@onos1:~$ sudo poweroff

53
 To make clone of container and for their settings execute
following commands:
 sdn@ONOS:~$ sudo lxc-clone onos1 onos2
 sdn@ONOS:~$ sudo lxc-start -n onos1 -d
 sdn@ONOS:~$ sudo lxc-start -n onos2 -d
 sdn@ONOS:~$ sudo lxc-ls -fancy

 Now two containers are running to verify and save ssh keys
enter following commands:
 sdn@ONOS:~$ ssh sdn@<onos1 IP>
 sdn@ONOS:~$ ssh sdn@<onos2 IP>

54
 To apply ONOS environment settings execute following
commands:

 sdn@ONOS:~$ export OCI ="192.168.56.101"


 sdn@ONOS:~$ export OC1="192.168.56.101"
 sdn@ONOS:~$ export OCN="192.168.56.103"
 sdn@ONOS:~$ export ONOS_APPS="drivers,openflow"
 sdn@ONOS:~$ export ONOS_USER=sdn
 sdn@ONOS:~$ export ONOS_GROUP=sdn
 sdn@ONOS:~$ export ONOS_NIC=“192.168.56.* “

55
 Cell settings can also be applied by making a cell file at the
location showing in file header below
 To load cell settings in terminal execute following command:
 sdn@ONOS:~$ cell <file-name>

56
 After applying cell settings execute following commands to
push key:

 sdn@ONOS:~$ onos-push-keys $OC1


 sdn@ONOS:~$ onos-push-keys $OC2

57
58
 Run the following command to build ONOS:

 sdn@ONOS:~$ cd ~/onos
 sdn@ONOS:~$ mvn clean install # or use the alias 'mci‘
 sdn@ONOS:~$ onos-package
 sdn@ONOS:~$ stc setup
 sdn@ONOS:~$ onos

59
60
61
62
63
64
65
66
67
 To download and install IntelliJ IDEA development tool
perform the following steps:

 Download IntelliJ IDEA from https://www.jetbrains.com/idea/

 Exexute following commands:


 sdn@ONOS:~$ tar xfz ideaIC-2016.3.2.tar.gz
 sdn@ONOS:~$ sudo mv idea-IC-163.10154.41/ /opt/idea
 sdn@ONOS:~$ gedit ~/.bashrc

 Add following line at the end of file


 export PATH=/opt/idea/bin:$PATH
 Run idea.sh from bin directory
68
69
ONOS
Major Components

70
 A complete SDN simulation tool with different controllers,
switches and other networking tools like wireshark etc.

 Controllers
 NOX
 Ryu
 OVS Controller

 Switches
 OVSSwitch
 IVSSwitch
 LinuxBridge
 OVSBridge
71
 To make basic topology
 $ sudo mn
 To display mininet CLI commands
 mininet> help
 To display nodes
 mininet> nodes
 To display links
 mininet> links
 To display network
 mininet> net
 To dump information about all nodes
 mininet> dump

72
 To execute a command on a specific node
 mininet> h1 ifconfig ‐a
 mininet> s1 ifconfig ‐a
 mininet> h1 ps ‐a
 mininet> s1 ps ‐a

73
 To ping from host 1 to host 2
 mininet> h1 ping ‐c 1 h2

 To check all connections


 mininet> pingall

 To run a simple web server and client


 mininet> h1 python ‐m SimpleHTTPServer 80 &
 mininet> h2 wget ‐O ‐ h1
 ...
 mininet> h1 kill <python process ID>

74
 Run a Regression Test
 $ sudo mn ‐‐test pingpair
 Run a bandwidth test
 $ sudo mn ‐‐test iperf

 Link variations
 $ sudo mn ‐‐link tc,bw=10,delay=10ms
 mininet> iperf
 mininet> h1 ping ‐c10 h2
 Adjustable verbosity
 $ sudo mn ‐v debug

75
 To make single topology
 $ sudo mn ‐‐topo single,3

 To make bus topology


 $ sudo mn ‐‐topo linear,4

 To make tree topology


 $ sudo mn ‐‐topo tree,2,2

 Custom topologies can also be made


 sudo mn --custom mininet/custom/topo-2sw-2host.py --topo mytopo

76
 For more complex debugging, you can start Mininet so that it
spawns one or more xterms.

 To start an xterm for every host and switch, pass the ‐x option
 $ sudo mn ‐x

 To start xterm while in mininet


 mininet> xterm h1 h2

77
 For fault tolerance testing, it can be helpful to bring links up
and down

 To disable both halves of a virtual Ethernet pair


 mininet> link s1 h1 down

 To bring the link back up


 mininet> link s1 h1 up

78
 The ONOS is very useful to learn the basic knowledge of SDN.

 We can make any topology in mininet and connect to it with


ONOS controller and then visualize it in GUI.

 In addition, it also provide full support to develop the new


applications and to modify the existing applications.

79
 To see help
 onos> help

 To check ONOS nodes


 onos> nodes

 To check devices (openflow switches)


 onos> devices

 To check hosts
 onos> hosts

80
 To check links between devices
 onos> links [device]

 To check flows
 onos> flows

 To check paths
 onos> paths device1 device2

 To check intents
 onos> intents

81
 To check all installed applications
 onos> apps -s

 To check running applications


 onos> apps ‐s ‐a

 To activate an application
 onos> app activate org.onosproject.fwd

 To deactivate an application
 onos> app deactivate org.onosproject.fwd

82
 ONOS has ability to show the topology in graphical form in
the browser.

 Graph shows the switches and hosts attached to each other


by links.

 IP addresses are shown on hosts.

 The graphical interface can be opened in browser with


following link:
 http://<controller-IP>:8181/onos/ui/index.html

83
84
 In addition to topology view, ONOS GUI also has:
 Summary pane
▪ It shows you a summary of what is going on at this ONOS cluster
 Switch details
▪ This pane gives information about the switch
 Host details
▪ This pane gives information about the host
 Instance pane
▪ The GUI has the ability to show which ONOS instances are active
 Show traffic
▪ Show traffic between hosts
 Install intents

85
86
87
88
 This component of ONOS is used for development purpose.

 It is very easy to create, install, activate, modify or reinstall an


application in ONOS.

 It provides different tools for this purpose.

 IntelliJ IDEA is a famous IDE for ONOS development.

 A sample application onos-byon is provided for experiment.


 Download from https://github.com/bocon13/onos-byon

89
 Run IntelliJ IDEA
 Select "Import Project" and import the onos-byon project.
 Import the project from external model, and select "Maven".
 Check "Sources" and "Documentation" in the Automatically
download section
 Click 'Next' and click next as well on the following window.
 Pick Java 8 in the next window by first clicking on the green '+'
sign and JDK
 Select 'java-8-oracle‘ from jvm directory and click 'ok'
 Finally click on 'Finish‘

90
 To build new application
 cd $ONOS_ROOT/tools/package/archetypes
 mci
 cd
 To build new application
 onos‐create‐app
 Enter appropriate parameters
 Define value for property 'groupId': : org.foo
 Define value for property 'artifactId': : foo‐app
 Define value for property 'version': 1.0‐SNAPSHOT: :
 Define value for property 'package': org.foo: : org.foo.app
 Confirm properties configuration:
 groupId: org.foo
 artifactId: foo‐app
 version: 1.0‐SNAPSHOT
 package: org.foo.app
 Y: :
91
 To build new application unzip the downloaded onos-byon.zip
 Open a new terminal and enter following commands:
 sdn@ONOS:~$ cell <settings>
 sdn@ONOS:~$ cd onos-byon
 sdn@ONOS:~$ mci
 sdn@ONOS:~$ onos-app $OC1 install target/byon-1.0-
SNAPSHOT.oar
 sdn@ONOS:~$ onos> apps -s app activate org.onos.byon
 sdn@ONOS:~$ onos> apps -s -a
 sdn@ONOS:~$ onos> list-networks

92
93
94
95
96
97
 To rebuild an application enter following commands:
 sdn@ONOS:~$ cell <settings>
 sdn@ONOS:~$ cd onos-byon
 sdn@ONOS:~$ mci
 sdn@ONOS:~$ onos-app $OC1 reinstall target/byon-1.1-
SNAPSHOT.oar
 sdn@ONOS:~$ onos> apps -s app activate org.onos
 sdn@ONOS:~$ onos> apps -s -a
 sdn@ONOS:~$ onos> list-networks

98
99
Questions?

100
 http://onosproject.org/

 https://wiki.onosproject.org/display/ONOS/Wiki+Home

 https://github.com/

 https://www.opennetworking.org/

 http://opennetsummit.org/

 http://searchsdn.techtarget.com/

 https://en.wikipedia.org/wiki/

101
View publication stats

You might also like