You are on page 1of 63

Table of Contents

Table of Figures.............................................................................................................................................................5
LIST OF TABLES.........................................................................................................................................................8
LIST OF ABBREVIATION..........................................................................................................................................9
ABSTRACT................................................................................................................................................................10
CHAPTER I INTRODUCTION...............................................................................................................................11
1.1

OpenDaylightController(SDN..................................................................................................................11

1.2

HowDoesSDNorSoftwareDefinedNetworkingWork?...........................................................................12

1.3

AdvantagesofSDN.....................................................................................................................................13

1.4

GeneralSDNFramework............................................................................................................................14

1.5

SDN&OpenFlow.......................................................................................................................................15

1.6

LayersinSDNwithOpenDaylight(CurrentStableRelease.).....................................................................16

1.7

MininetNetworktopologyemulator.......................................................................................................16

1.8

Iperf............................................................................................................................................................17

1.9

OpenvSwitchwithOpenFlow.....................................................................................................................17

1.10

ServerLoadBalancing................................................................................................................................19

CHAPTER II TECHNICAL BACKGROUND........................................................................................................20


2.1

Objective&ProjectScope..........................................................................................................................20

2.2

Setup..........................................................................................................................................................21

CHAPTER III DESIGN AND IMPLEMENTATION.............................................................................................23


3.1

Topology:....................................................................................................................................................23

3.2

Implementation:........................................................................................................................................24

3.3

HowtorunourProject:............................................................................................................................25

3.4

ObservationandResults:...........................................................................................................................30

3.4.1

Network Load balancing...................................................................................................................30

Conclusion (Network Load balancing without STP enabled).............................................................................41


Conclusion (Network Load balancing with STP )..............................................................................................44
3.4.2

Server Load Balancing Round Robin Demonstration.......................................................................44

3.6.3

Server Load Balancing Random Demonstration...............................................................................49

Conclusion (Sever Load Balancing Round Robin/Random)..............................................................................55


Appendix.....................................................................................................................................................................56
References:..................................................................................................................................................................66

Ryerson University | Load Balancing Using SDN with


Open Daylight Controller

Table of Figures
Figure 1.1

SDN & Open Flow

Figure 1.2

Open Flow versions & their Release dates

Figure 1.3

High Level Plane distribution of SDN

Figure 1.4

SDN Frame Work

Figure 1.5

Opendaylight SDN Framework

Figure 1.6

SDN Open flow Integration

Figure1.7

Opendaylight Lithium layer Diagram

Figure1.8

Mininet high level layer Diagram

Figure1.9

Open flow Match Action

Figure 1.10

Flow table Components

Figure 2.1

Our Project Problem Description

Figure 3.1

Given Topology with Port Assignement

Figure 3.2

Port assignement in Python Script

Figure 3.3

Running Controller

Figure 3.4

Running Mininet Topology

Figure 3.5

Wireshark Filter

Figure 3.6

Ping Result

Figure 3.7

ODL portal Topology display

Figure 3.8

Shell script to create Server load Balancing Topologies

Figure 3.9

Running Round Robin Topology

Figure 3.10

Running Random Topology

Figure 3.11

Controller message when connecting to Mininet

Figure 3.12

Portal display of OSGI bundles

Figure 3.13

OSGI switch bundles

Figure 3.14

OSGI load Balancer Bundles

Figure 3.15

OSGI Host tracker bundle

Figure 3.16

OSGI Open flow bundle

Figure 3.17

OSGI Topology Manager

Ryerson University | Load Balancing Using SDN with


Open Daylight Controller

Figure 3.18

Wireshark arp message display, OFPT_PACKET_IN

Figure 3.19

TCP Packet for ARP

Figure 3.20

ARP PACKET_IN and PACKET_OUT

Figure 3.21

IP Packet and Open flow Packet information

Figure 3.22

Controller instruction OFPT_FLOW_MOD

Figure 3.23

Open flow Packet Details, FLOW_MOD

Figure 3.24

Ports and links

Figure 3.25

Open flow switch port dumps

Figure 3.26

Ping between hosts in mininet

Figure 3.27

Port dump after ping

Figure 3.28

ODL Portal packet stats after ping port between switch 2 and switch 7

Figure 3.29

ODL Portal packet stats after ping port between switch 1 and switch 7

Figure 3.30

ODL Portal packet stats after ping ports between switch 2and switch 6

Figure 3.31

ODL Portal packet stats after ping ports between switch 5 and switch 2

Figure 3.32

ODL Portal packet stats after ping ports between switch 4 and switch 1

Figure 3.33

Enabling STP in ovsdb switches

Figure 3.34

STP convergence switch1 as Root

Figure 3.35

ODL Portal View when Switch1 is root

Figure 3.36

STP convergence switch2 as Root

Figure 3.37

H9 as client 32 iperf flow with only two servers listenin

Figure 3.38

H1 response, two host up and rest down

Figure 3.39

H3 response, two host up and rest down

Figure 3.40

Client H9 32 flows 20MB window and 1 sec delay all hosts up round Robin

Figure 3.41

Server H1 response ,all hosts up round Robin

Figure 3.42

Server H3 response ,all hosts up round Robin

Figure 3.43

Random topology creation

Figure 3.44

Random topology H9 Client 32 flows two servers up

Figure 3.45

Random topology H9 Client Server H1 response

Figure 3.46

Random topology H9 Client ,Server H1 response

Figure 3.47

Random topology H9 Client Server H3 response all servers up

Ryerson University | Load Balancing Using SDN with


Open Daylight Controller

Figure 3.48

Random topology H9 Client Server H3 response all servers up

Figure 3.49

Random topology H9 Client Server H1 response all servers up

Ryerson University | Load Balancing Using SDN with


Open Daylight Controller

LIST OF TABLES

Table

Contents

Table 3.1

Host IP Assignment

Table 3.2

Bundle and respective function description

Table 3.3

Filter details wireshark

Ryerson University | Load Balancing Using SDN with


Open Daylight Controller

LIST OF ABBREVIATION
IP
LAN
SDN
ODL
OVS
VIP
ARP
JDK
JRE
OSGI
SAL

Internet Protocol
Local Area Network
Software Defined Networking
Open Day Light
Open Virtual Switch
Virtual IP
Address Resolution Protocol
Java Development Kit
Java Runtime Environment
Open Service Gateway Initiative
Service Abstraction Layer

Ryerson University | Load Balancing Using SDN with


Open Daylight Controller

ABSTRACT

Our Project is to implement and study server load balancing in the Software Defined Networking (SDN)
environment using Round Robin and Random Policy. The load balancing Policies are run at the SDN Controller. Load
balancing is very important concept in Data centers where high availability as well as performance is required.
In this Project we used open source Opendaylight Controller which provides the North Bound interface to
implement the load balancing Policies and also provides the south bound interface to communicate with OpenFlow
switches. The entire data center is emulated in the Mininet platform.
During our work on this project we learned about Software defined networking, how it is different from
traditional Networking, we got a greater insight about ODL, Mininet, and OpenFlow vSwitch.

Ryerson University | Load Balancing Using SDN with


Open Daylight Controller

10

CH
HAPTER I INTROD
DUCTION
The main idea of SDN is to decouple thee control plane from the data pplane and movee the control pllane to the centrralized
SDN contro
oller. Only the data plane fun
nctions left in th
he networking ddevices. The coontroller comm
municates and coontrols
the networrking devices through
t
the sou
uth bound protocol, such as OpenFlow. N
Network applicaations running at the
controller are
a made prograammable throug
gh the north bou
und API.
1.1 Open Daylight Con
ntroller (SDN
N)
Open Daylight
D
(ODL
L) is a highly av
vailable, modulaar, extensible, sscalable and muulti-protocol coontroller infrastrructure
built for
f SDN deploy
yments on mod
dern heterogen
neous multi-venndor networks. It provides a model-driven sservice
abstracction platform that allows users to write apps
a
that easilly work acrosss a wide varieety of hardwarre and
southb
bound protocolss.
SDN has
h becoming po
opular with the Open Flow Pro
otocol widely acccepted as induustry Standard. O
Open daylight P
Project
uses th
his protocol. Allso Open Dayliight can use oth
her southboundd protocol, not jjust open flow.. Open Daylighht is an
open source
s
project which is writtten in Java, it uses maven ffor Package Deployment. Oppen Daylight iss open
Comm
munity Project under (Open Services
S
Gatew
way initiative) for the north bound interfaace it exposes REST
(Repreesentational Staate Transfer - a web based) AP
PI and implemeents open flow based policies for Southbounnd. The
controller provides framework
f
for pluggable mo
odules to perfoorm network ttasks. These taasks include roouting,
switch
hing, security etcc.
The so
outhbound interface provides su
upport for diffeerent protocols ((via separate pplugins); some oof examples aree Open
Flow 1.0, Open Flow
w 1.3, BGP-LS
S, etc. These modules
m
can bee linked in reall time to Service Abstraction Layer
s
bound deevices to northh bound applicaations. The SA
AL will
(SAL). The SAL is a service whicch links these south
mine the best way
w to achieve service requessted and take ccare of the undderlying protoccol used betweeen the
determ
controller and the netw
work devices.

Following
Fo
figuree illustrates the Openflow as thhe component off SDN Platform
m:-

Figure 1.1(Openflow as Part of SDN)

Source (htttp://www.slidesshare.net/VijayaaguruJayaram/ccisco-openflow))

Ryerson
R
Univerrsity | Load Ballancing Using S
SDN with
O
Open Daylight C
Controller

11

Follow
wing is the Road
dmap of the Op
pen flow Protoccol implementaation. We are ussing mininet em
mulator to creatte open
flow switches for ourr Project Impleementation. As of our Project OF1.4 specificcation is the ccurrent release of this
protocol.

Figure
F
1.2(Versiions of OpenFlow
w with Release Date)

1.2 How Does


D
SDN or Software Defined Networrking Work?
Trraditionally, mo
ost network deevices have con
ntrol plane andd data plane in the same netw
working devicee. SDN
deecouples contro
ol plane from data
d plane. The control plane iss moved to a ceentralized controoller.

SDN
S
Controllerr works as the intelligent
i
part of the networkk, it offers centrral control of thhe complete neetwork,
an
nd enables Adm
min to program the underlying Network (switcches and router s).The controlleer utilizes southhbound
APIs
A
to send instruction to the switches and ro
outers. OpenFloow is the first sstandard adopteed by SDN providers,
an
nd is used as southbound
s
pro
otocol to send instructions too underlay netw
work. The netw
work applicatioons use
Northbound
N
APIs at the SDN co
ontroller to com
mmunicate with external worldd to implement tthe desirable Neetwork
co
ontrol and policces.

Ryerson
R
Univerrsity | Load Ballancing Using S
SDN with
O
Open Daylight C
Controller

12

Diagram below
w shows high level plane distriibution of the SD
DN based netwoorks.

Applicaations
NorthInterface

ControlPlane
Contrroller
South
Interface
SouthInterface

Switcches

Figure 1.3(Simplified S
SDN Plane)

1.3 Advantages of SDN


N

Application Driven:
D
one can
n directly prograam Network as control is separrated from
Forwarding functions.
fu
Dynamic Co
ontrol: Separatin
ng control from
m forwarding allows users tto adjust netwoork- traffic floows on
demand.
Centralized Management:
M
Network
N
control is centralizedd in SDN controoller which mainntains overall vview of
the network and
a for applications and instrucctions provides a single logicall switch.

Ryerson
R
Univerrsity | Load Ballancing Using S
SDN with
O
Open Daylight C
Controller

13

Based on opeen Standard an


nd vendor ind
dependent: As S
SDN follows oopen Standard, it simplifies neetwork
design and op
peration and elim
minates Vendorr dependency.

n theory SDN sh
hould be Ideaal solution to todays data netw
working problem
ms, but it has itts own disadvanntages.
In
Siince control is moved
m
to Centrralized Controller, controller shhould be capablle of handling llot of processing load.
When
W
packet is lost
l between thee Controller and
d switches, it w
will have larger impact, where as in legacy neetwork,
single packet losss may be toleraated to some ex
xtent as these nnetworks have aalways backup paths availablee in the
ork deploymentt.
prroduction netwo
In
n SDN Control messages
m
could
d get lost and co
ould lead to delaay in transmissiion or data loss. Solution to thiis have
beeen achieved via
v some sort of
o parallelism by
b using multiiple controllerss with the swittch or using m
multiple
ch
hannels betweeen one controlller and switch
h. Primary conn
nnections will bbe used for C
Control messagees and
au
uxiliary connecttion will be useed for data messsages or for UD
DP messages.
Deetailed explanattion for SDN pllanes can be fouund at :
So
ource (https://bo
ooks.google.ca//sdn/ paul_gorannsoon/)

1.4 Generral SDN Fram


mework
Here
H is the General conceptual view
v
of SDN Frrame Work

Figurre 1.4(SDN Fram


me Work)

gswitch.com/sittes/default/filess/_/213479.1_sddn-blog-graphicc.jpeg)
Source (http://big
n the above diag
gram two versiions of SDN fraamework has bbeen depicted, tthe basic differeence between thhe two
In
was
w that SDN OS
S and controllerr have been bun
ndled together inn 2.0 frameworrk.

Ryerson
R
Univerrsity | Load Ballancing Using S
SDN with
O
Open Daylight C
Controller

14

Figure 1.5(Open
O
Daylight S
SDN Frameworkk)

Source (http:://www-935.ibm
m.com/services//image/systemss_networking_solutions_od_diagram3_rev6.jppg)
In the diagram
m . 1.5 ODL fram
mework has beeen shown, this ddiagram clearlyy depicts that soouthbound interrfaces
witches whereass northbound innterface deal wiith client and appplications. Conntroller
deeal with physicaal and virtual sw
has some
s
extension
ns which perform
m all network ffunctions.

1.5 SDN & Open Flow


w

Ryerson
R
Univerrsity | Load Ballancing Using S
SDN with
O
Open Daylight C
Controller

15

Figure1.6
6(SDN Openflow
w Integration)
Source (http
ps://www.clear.rice.edu/comp5529/www/paperrs/tutorial_4.pddf)

1.6 Layerrs in SDN witth Open Dayllight (Current Stable Releaase.)

Figure1.7(Open daylight Lithiium layer Diagrram)


Source(https://www.opendaylig
ght.org/sites/ww
ww.opendaylighht.org/files/pagees/images/openddaylight_lithium
mdiagr
am_lrgr.jpgg)

1.7 Minin
net - Network
k topology em
mulator
Mininet
M
is the neetwork emulato
or which provid
des user a tool to emulate Nettworks, it runs emulated Topoologies
ussing single Lin
nux kernel. It acts
a
as a real Network
N
once eemulated topollogy is created. Switches creaated in
mininet
m
run opeen flow and con
nnects to remotte SDN controlller(in our case we have used O
Opendaylight aas SDN
co
ontroller). It pro
ovides rich APII interface whicch provides Neetwork engineerrs way to emulate different Neetwork
To
opologies.
Th
he following diagram
d
shows how an emulaated mininet neetwork simulatiion helps Netw
work engineers to test
Network
N
topolog
gy quickly instead of using exp
pensive hardwarre testbed.

Ryerson
R
Univerrsity | Load Ballancing Using S
SDN with
O
Open Daylight C
Controller

16

Figure1.8( Mininet
M
high levvel layer Diagram
m)
Source (http://netseminar.stanford.eddu/seminars/11__14_13.pdf )
Th
he simulated Networks
N
can bee tested on the real
r hardware teest bed once thee Network topoologies are fullyy tested
ussing mininet or vise versa.

1.8 Iperf

perf is a w used network testing


g tool that can create
c
TCP and UDP data streaams and
Ip
Measure
M
the throughput of a nettwork that is carrrying them.
It can measure th
he bandwidth an
nd the quality off a network linkk.
Ip
perf has a client and server funcctionality, and can
c measure thee throughput beetween the two eends,
Eiither unidirectio
onal or bidirectiional.
It is open source software and ru
uns on various platforms
p
includding Linux, UN
NIX and Windows.

1.9 OpenvSwitch with


h OpenFlow
Openvswitch
O
is an alternate of Linux bridgee module and iit has been avvailable since linux kernel 2.44. The
Openvswitch
O
hass made enhanceement as comp
pared to other B
Bridges. The deetail is available at openvswitcch.org.
One
O of them is su
upport of Open
nFlow protocol.
A switch functio
on can be brokeen into: Controll plane, data plaane. The controol plane is the pplane which creeates a
fo
orwarding/flow table, and dataa plane will folllow these ruless for the incomiing packets. OppenFlow is a prrotocol
which
w
allows taaking the control plane funcctionality to ceentral controlleer and allows central controoller to
im
mplement these Rules.
Th
his setup is diffferent from thee proprietary Vendor
V
setup inn which these ruules are implem
mented at eachh node,
which
w
requires network Administrators to impllement changes at each node sseparately.
Source (http://en.community
y.dell.com/techcen
nter/networking/w
w/wiki/3820.openvvswitch-openflow-lets-get-started)

Ryerson
R
Univerrsity | Load Ballancing Using S
SDN with
O
Open Daylight C
Controller

17

OpenFlow
O
Switcch comprises off switch data Plaane, which incluudes:

Po
orts
Flo
ow tables
Flo
ows
Maatch Classifiers
Mo
odifiers and Actions

Figure1.9(Opeen flow Match A


Action)

Ryerson
R
Univerrsity | Load Ballancing Using S
SDN with
O
Open Daylight C
Controller

18

Figure 1.10(Flow table Components)


Above Diagrams shows how OpenvSwitch works and how match action counter is performed, and once match
found it finally forward the packet to desired port otherwise packet is dropped.

1.10

Server Load Balancing


The main idea of using load balancing is to implement the following three things:Scalability:
Manageability:
Availability:

Load can be distributed to different servers


Application can be transferred from one server to another within same
cluster (server group).
To reduce downtime in Production Systems.

In our case load balancer service is running on controller which acts as a reverse proxy to distributes
network traffic across a number of servers based on predefined polices: Round Robin or Random.
Load Balancing in servers can be implemented by two methods:Stateless: The controller does not keep track of state of servers and will send the information based on
policy to server even the particular server is down.
State-full: The controller keeps track of state of servers and monitors the state of the related servers.

Ryerson University | Load Balancing Using SDN with


Open Daylight Controller

19

CHAPTE
ER II TEC
CHNICAL B
BACKGRO
OUND

2.1 Objectiv
O
ve & Pro
oject Sco
ope
Seetup the follow
wing topology in
n the Mininet:

Figure2.1
1 (Our Project P
Problem Descripption)

S1-S7 are OpenVswitches


O
(OVSs), H1 to
o H8 are serverss. H9 is the hostt that generates traffic to the seervers. The links
between s1/s2 and s3/s4/s5
5/s6 should hav
ve a bandwidth of
o 100Mbps eacch; the links bettween s7 and s11/s2 have the
bandwidth of 400Mbps.
The Open daylight shoulld have a built--in network loa
ad balancer. T est if it is the ccase. The pattern that you aree
looking forr is this:
The first flo
ow between H9
9 and a virtual seerver will use th
he path S7-S1-S
S3-H1;
The second
d flow between H9 and a virtuaal server uses S7
7-S2-S4-H2;
The third fllow between H9
9and a virtual seerver uses S7-S
S1-S5-H3;
The fourth flow between H9
H and a virtuall server uses S7
7-S2-S6-H4;
The fifth flo
ow between H9
9 and a virtual server uses S7-S
S2-S3-H5;

Ryerson
R
Univerrsity | Load Ballancing Using S
SDN with
O
Open Daylight C
Controller

20

The sixth flow between H9and a virtual server uses S7-S1-S4-H6;


And so on
Study if this is the case. If not, record the paths taken. Use iperf traffic generator to generate TCP traffic and measure the
delay and throughput. Generate 32 flows with data rate of 20Mbps each.
Compare the results with only two servers (says H1 and H2). The idea here is to show that by using more servers, we can
use more available network bandwidth, thus reduce the delay and increase the throughput.
Compare the delay and throughput between the round-robin and random policies.
To accomplish our desired project, we use the following devices and tools:

2.2 Setup
1.
2.
3.
4.
5.
6.
7.
8.
9.

Two Virtual Machines each one with Ubuntu 14.04 32 bit


Oracle VirtualBox
GIT
Apache Maven
MobaXterm
VBox Guest Addition for Linux
WireShark
Mininet
ODL Controller Code

2.2.1: Two Virtual Machines each one with Ubuntu 14.04 32 bit:
We need to download Ubuntu with version 14.04 version 32bit and configure it as virtual Machine. We need two
machines for our project, one will be used as controller and other will be used for Mininet.
2.2.2: Oracle VirtualBox
We have installed our Virtual machines using Oracle Virtual Box.
2.2.3: GIT
GIT is open source version control tool; we have used git to get the current version from ODL repository.
2.2.4: Apache Maven.
Apache Maven is the tool used to build Java projects; we have used Apache Maven to build ODL OSGI bundles
after downloading them, details are in the installation appendix.
2.2.5: MobaXterm
We have used this tool as our ssh client .
2.2.6: VBox Guest Addition:
This is an ISO which is helpful to maximize the size of Linux OS while working in Windows
2.2.7: WireShark:

Ryerson University | Load Balancing Using SDN with


Open Daylight Controller

21

We have used wireshark to analyze open flow packets. This can be configured on Linux and windows both. We
have installed version which includes openflow plugin.
2.2.8: MiniNet:
This tool is used to emulate the network.
2.2.9: ODL :
We downloaded opendaylight(ODL) OSGI bundles using Git and compiled them locally using Maven.

Ryerson University | Load Balancing Using SDN with


Open Daylight Controller

22

CHAPTER
C
III
I DESIG
GN AND IM
MPLEMENT
TATION

3.1 Topology
T
y:

Figure3.1
1(Given Topoloogy with Port A
Assignment)
The topology given to us was with 4 serrvers but later it
i was modifiedd to above topoology with moree scope of workk to it.
were advised to oobserve Networrk load
Our Initial Study scope was to implemeent Server load balancing onlyy but later we w
balancing as
a well and stud
dy which ODL bundle
b
will be used
u
for network
rk load balancinng.
S1-S7 are OpenVswitches
O
s (OVSs), H1 to
t H8 are serveers. H9 is the hhost that generaates traffic to tthe servers. Thee links
between s1
1/s2 and s3/s4//s5/s6 should have
h
a bandwid
dth of 100Mbpps each; the linnks between s77 and s1/s2 haave the
bandwidth of 400Mbps. Controller has Ro
ound Robin and
d Random Policcies running in it.

Node
H1
H2
H3
H4
H5
H6
H7
H8
H9

IP Address
A
0.0.1
10.0
0.0.2
10.0
0.0.3
10.0
0.0.4
10.0
0.0.5
10.0
0.0.6
10.0
0.0.7
10.0
0.0.8
10.0
0.0.9
10.0

Designaation
Servvers

Client

Ryerson
R
Univerrsity | Load Ballancing Using S
SDN with
O
Open Daylight C
Controller

23

3.2 Implementation:
Software tools requirements to install Opendaylight and Mininet. Opendaylight can be installed in more than one way
depending on the intention of the future use; also it can be installed on Linux, UNIX and Windows machine. Opendaylight
has 03 major releases for now, Hydrogen, Helium and Lithium, we have used current Stable release which is Helium. Also
we need to have Java JDK, git and Maven installed on the box before one begins installation of the ODL.
Here are the 03 methods one can use to install ODL:
1. Using Karaf
2. Pulling the code from CLI and build locally using Maven. (We have used this method for our Project) 3. Import
Code into Eclipse and re-compiling using Maven.
1) Installation Using Karaf
This is the easiest way one can install ODL, one needs to be familiar with Karaf commands, this link provides nice
introduction to karaf.
http://www.liquid-reality.de/display/liquid/2011/02/15/Karaf+Tutorial+Part+1+-+Installation+and+First+application
To install ODL on Ubuntu, Opendaylight wiki provides step by step procedure.
https://wiki.opendaylight.org/view/Install_On_Ubuntu_14.04
2) Pulling the code from CLI and build locally using Maven.
We have followed this procedure in our installation; following are the steps we have followed in our ODL setup. This is
specific to Ubuntu.
The detailed Procedure is in the Appendix.
3) Eclipse Installation and build the code in Eclipse using Maven.
This method is used if one is developer and wants to see the code of all the packages or needs to write new custom
application this method should be used; we have imported code in the Eclipse, but havent used it for the Project.
Following references can be used to use Eclipse:https://wiki.opendaylight.org/view/Getting_Started:Eclipse:Installing_Eclipse_on_Ubuntu
https://wiki.opendaylight.org/view/GettingStarted:_Eclipse
http://networkstatic.net/importing-opendaylight-into-eclipse/
3.4 Load Balancing Methods Used and VIP
VIP (Virtual IP), in server load balancing: VIP acts as the proxy between the external world and the server group. We
have demonstrated opendaylight controller load Balancer bundle
(org.opendaylight.controller.samples.loadbalancer.internal) two features round robin and random policies.
RoundRobin policy: This policy will send traffic to group of servers in orderly manner one after the other
Random policy: This policy will select servers randomly based on random algorithm

Ryerson University | Load Balancing Using SDN with


Open Daylight Controller

24

3.3 How
H
to run our Project::
We have im
mplemented ou
ur project using
g two virtual machines
m
each hhaving Ubuntu Linux, One haas mininet, Wirreshark
installed, whereas
w
on the second
s
box we have installed the
t opendaylighht controller. W
We are using hoost only IP of thhe both
VMs to co
ommunicate.
We have crreated Python script
s
on the miininet box to ru
un the mininet ttopology; We have port assiggnment in our P
Python
scripts whicch helped us in identifying porrt numbers when
n running the teests.

Figure 3.2 (Port assignm


ment in Python S
Script)
As the snaapshot shows we
w have used th
hree digit port numbers whenn the link is beetween switchees and two diggit port
numbers wh
hen the link is between
b
switch and host.
On the ODL
L box we have wrapper shell scripts
s
which will
w create the lo ad Balancer Toopologies. Openn Secure CRT too login
to Both VM
Ms via their Hosst only IPs:

Ryerson
R
Univerrsity | Load Ballancing Using S
SDN with
O
Open Daylight C
Controller

25

Figure 3.3( Running Conntroller)

ODL VM we
w have created
d alias $ctl in th
he user .bashrc file which startts the controllerr. It takes from 3 to 5 minutes for the
controller to be up and run
nning fully. Theen you will noticce a prompt as O
OSGI> which iis prompt of conntroller.
Once the co
ontroller is runn
ning we will sttart our Python script for our ttopology in the Mininet VM, aand run the wirreshark
on the miniinet.

Figure 3.4(Running Minninet topology )

Ryerson
R
Univerrsity | Load Ballancing Using S
SDN with
O
Open Daylight C
Controller

26

Figure 3.5( Wireshark F


Filter)
We have applied
a
filter on
n the particularr port, between
n mininet and ODL VM, andd it only filters openflow andd TCP
messages.

Once we piing between thee hosts the topollogy will be upd


dated in the in tthe ODL portal.

Figure 3.6(Ping Result)

Ryerson
R
Univerrsity | Load Ballancing Using S
SDN with
O
Open Daylight C
Controller

27

Figure3.7
7(ODL portal T
Topology displaay)

Then we haave to open ano


other instance of
o Secure CRT and connect it tto controller in order to run otther scripts for Round
Robin and Random
R
Policy
y.

Figure 3.8(Shell script too create Server load Balancingg Topologies)


Above snap
pshot shows thee related scripts on the ODL VM
M:
We will run
n Round robin Policy
P
as follow
ws:-

Ryerson
R
Univerrsity | Load Ballancing Using S
SDN with
O
Open Daylight C
Controller

28

Figure 3.9(Running Rouund Robin Topoology)


We have crreated round ro
obin pool with 8 hosts and add
ded them in thee Pool, and assiigned VIP to thhat Pool. Similaarly we
can run Ran
ndom Topology
y by following script.
s

Figure 3.10(Running Raandom Topologgy)

The messag
ge below showss OSGI info meessage when min
ninet connects tto controller.

Ryerson
R
Univerrsity | Load Ballancing Using S
SDN with
O
Open Daylight C
Controller

29

Figure 3.11( Controller m


message when connecting to M
Mininet)

Figure 3.12(Portal displaay of OSGI bunndles)

The above snapshot showss OSGI bundle information in ODL


O
Portal.

3.4 Observa
O
ation and
d Resultts:
3.4.1

Network
N
Load
d balancing

First step fo
or us was to stu
udy the Open daaylight should have
h
a built-in nnetwork load baalancer,
For this wee identified the OSGI
O
bundles which
w
will be ussed during this study,
Here is the snap shot of the bundles (Swittch bundles)

Ryerson
R
Univerrsity | Load Ballancing Using S
SDN with
O
Open Daylight C
Controller

30

Figure 3.13 ( OSGI swittch bundles)

Load Balan
ncer Bundles

Figure 3.14(OSGI load B


Balancer Bundlles)
Host Track
ker bundle

Figure 3.15(OSGI Host tracker bundle))


Openflow bundle

Figure 3.16(OSGI openfflow bundle)


Topology Manager
M
bundlee

Figure 3.17(OSGI Topoology Manager bbundle)


We have in
ncluded the OS
SGI bundle and the functions description
d
from
m the ODL wikki which are beeing used in ouur Case
study.
Package/OSGiBundle
org.opendayligh
ht.controller.arphand
dler.internal

Exporte
edInterfaces

IHostFinder

Descriptio
on
Component reesponsible for learninng about
host location.. It achieves the goal by

Ryerson
R
Univerrsity | Load Ballancing Using S
SDN with
O
Open Daylight C
Controller

31

org.opendaylight.controller.forwarding.staticrouting.internal

org.opendaylight.controller.forwardingrulesmanager.internal

org.opendaylight.controller.hosttracker.internal

org.opendaylight.controller.protocol_plugin.openflow.internal

IListenDataPacket

looking at the ARP conversation between


an host and the controller. This is an
application that show case a possible host
tracking mechanism, especially useful in
the cases like OpenFlow where the
controller can see all the packets if
instructed to.

IForwardingStaticRouting

Provide the necessary hooks to inject in


the area controlled by the controller,
routes to reach traditional IP networks.

ICacheUpdateAware

IfNewHostNotify

IConfigurationContainerAware

IContainerListener

ISwitchManagerAware

IForwardingRulesManager

IInventoryListener

ICacheUpdateAware

IConfigurationContainerAware

IFlowProgrammerListener

ISwitchManagerAware

IInventoryListener

IfIptoHost

IfHostListener

ITopologyManagerAware

IContainerListener

IController

IDataPacketListen

IDataPacketMux

IDiscoveryService

IFlowProgrammerNotifier

IInventoryShimExternalListener

IMessageListener

Manager of all the Forwarding Rules, this


component take case of forwarding rules
and is the one that manage conflicts
between them.

Track the location of the host relatively to


the SDN network.

Protocol plugin for OpenFlow 1.0. Include


the openflow J library as well the
necessary glue logic to adapt to SAL layer
along with a discovery mechanism for
learning the graph of the OpenFlow
network portion.

Ryerson University | Load Balancing Using SDN with


Open Daylight Controller

32

IOFStatisticsMannager

IPluginInDataPaccketService

IPluginInFlowProogrammerService

IPluginInInventorryService

IPluginInReadSerrvice

IPluginInTopologgyService

IPluginReadServiiceFilter

IRefreshInternalP
Provider

IStatisticsListenerr

ITopologyServiceeShimListener

IListenDataPackeet

IConfigManager

IInventoryListeneer

IfNewHostNotifyy

IListenRoutingUppdates

org.opendayligh
ht.controller.statisticsmanager.internal

IStatisticsManageer

Component inn charge of using thee


ReadService from SAL, in order tto collect
several statisttics from the SDN neetwork.

org.opendayligh
ht.controller.switchm
manager.internal

IListenInventoryU
Updates

ISwitchManager

ware
ICacheUpdateAw

Component hholding the inventoryy


information ffor all the known noddes in the
controller. Alll the components thaat wants
to have accesss to let say a port nam
me or
node name orr any inventory inform
mation,
will find them
m via query to this
component.

IConfigurationCoontainerAware

IListenTopoUpdaates

ITopologyManagger

IConfigurationCoontainerAware

org.opendayligh
ht.controller.sampless.loadbalancer.internaal

org.opendayligh
ht.controller.sampless.simpleforwarding.in
nternal

org.opendayligh
ht.controller.topologymanager.internal

Implementatiion of a simple load-bbalancer.


This componeent wants to show caase the
usage of the ffunctional modules.

Sample impleementation of an appplication


simulating a ttraditional IP network
rk. This
component w
wants to show case the usage
of the functioonal modules.

Component hholding the whole nettwork


graph. Providde notifications on eddges
updates to whho wants to listen aboout it.

Table3.2( Bundle
B
and resp
pective function
n description)
Mininet sen
nd Packet_IN op
penflow messag
ge to controllerr to get the path information.

Ryerson
R
Univerrsity | Load Ballancing Using S
SDN with
O
Open Daylight C
Controller

33

Figure 3.18(Wireshark aarp message dissplay ,OFPT_PA


ACKET_IN)

Figure 3.19(TCP packett for ARP)


The ARP broadcast
b
is show
w as below, wh
hich is sent betw
ween controller and switches w
when there is no matching entryy.

Figure 3.20 (ARP PACK


KET_IN and PA
ACKET_OUT)

Ryerson
R
Univerrsity | Load Ballancing Using S
SDN with
O
Open Daylight C
Controller

34

Figure 3.21(IP Packet annd Open flow P


Packet informatiion)
Controllerw
willdecidethebestpathwithFLOW_MODw
whichcontains flowinstructio
oninthiscaseittisflow0aswehave
usedopenfflow1.0protoco
olbetweencon
ntrollerandswitches,whichuuseonetablefo
ortheflows.

Figure 3.22 ( Controller instruction OF


FPT_FLOW_MO
OD)

Ryerson
R
Univerrsity | Load Ballancing Using S
SDN with
O
Open Daylight C
Controller

35

Figure 3.23 (Openflow P


Packet Details, FLOW_MOD))

We have ussed following fiilters for the wirreshark trace.

Message
OFPT_PA
ACKET_IN

Typee
Switcch->Controller

OFPT_PA
ACKET_OUT
OFPT_FL
LOW_MOD

Contrroller->Switch
h
Contrroller->Switch
h

Desccription
A paacket receivedd doesnt matcch switch flow
w
tablee entry , switchh sends to conntroller for
instrruction
Conttroller sends too switch one oor more ports.
Conttroller sends too switch to addd entry in thee flow
tablee

Table 3.3
3 (Filter details wireshark)
This is thee snapshot we had taken befo
ore Network diiscovery in thee controller, whhich were indiccation arp beinng sent
between co
ontroller and Op
penflow switchees for network discovery.
d
We have taaken the list of ports
p
and links in
i mininet

Ryerson
R
Univerrsity | Load Ballancing Using S
SDN with
O
Open Daylight C
Controller

36

Figure 3.24(Ports and linnks)

Ryerson
R
Univerrsity | Load Ballancing Using S
SDN with
O
Open Daylight C
Controller

37

Figure 3.25(Openflow sw
witch port dum
mps)

As we havee used ping betw


ween the hosts to
t observe the Network
N
load b alancing featurre of the ODL, w
we have sent onne ping
from each host
h to host 9 an
nd once ping co
ompleted, we ob
bserved the pathhs taken by the packets to reacch host 9 by takiing the
snapshot in
n the ODL portaal and OVSDB switch
s
interfacees.

Ryerson
R
Univerrsity | Load Ballancing Using S
SDN with
O
Open Daylight C
Controller

38

Figure 3.26(ping betweeen hosts in miniinet)


We observeed that the con
ntroller does loaad Balancing ussing simple loaad Balancer moodule which is clear from the switch
interface du
umps at the con
ntroller portal an
nd in the ovsdb dump On mininnet side.

Ryerson
R
Univerrsity | Load Ballancing Using S
SDN with
O
Open Daylight C
Controller

39

Figure 3.27(Port dump aafter ping)


This snapsh
hot shows the dump
d
from ovsd
db interfaces

Figure 3.28
8 (ODL Portal paccket stats after pinng port between sw
witch 2 and switch 7)

This is snap
pshot of switch 2 to switch 7 which
w
indicates 4 packets were sent between tw
wo switches.

Figure 3.29
9(ODL Portal packket stats after pingg port between swiitch 1 and switch 77)

This snapsh
hot is between switch1---switcch 7 and show 4 packets weree sent betweenn them (which iindicates load ssharing
between theese switches) Same is the case between access level switchess

Ryerson
R
Univerrsity | Load Ballancing Using S
SDN with
O
Open Daylight C
Controller

40

Figure 3.30
0(ODL Portal packker stats after pingg port between swiitch 2and switch 6)

Switch 6 sn
napshot 2 pack
kets received fro
om h9

Figure 3.31
1(ODL Portal packker stats after pingg port between swiitch 5 and switch 22)

Switch 5 sn
napshot 2 packeets received fro
om h9

Figure 3.32
2(ODL Portal packket stats after pingg port between swiitch 4 and switch 11)

And all thee ports connectted have been used


u
almost equaally.

Conclusion
C
(N
Network Loa
ad balancing without STP
P enabled)
From our Observation
O
wee have conclud
ded that ODL bundle
b
(org.opeendaylight.conttroller.samples.loadbalancer.innternal)
does the Neetwork load balancing along with
w Server load balancing whenn STP is not ennabled.

We have taaken the results one more time, this time we haave enabled ST
TP in the switch es.

Ryerson
R
Univerrsity | Load Ballancing Using S
SDN with
O
Open Daylight C
Controller

41

Figure 3.33
3(Enabling STP inn ovsdb switches)

Figu
ure 3.34( STP con
nvergence switch 1 as Root )

We observeed that all the hosts discovered


d H9 by using sw
witch1 this timee, switch 2 wass not used due tto STP.

Ryerson
R
Univerrsity | Load Ballancing Using S
SDN with
O
Open Daylight C
Controller

42

Figure 3.35( ODL Po


ortal View when S
Switch1 is root, alll )

Whereas on
n the 2nd occasio
on switch 2 wass used and Swittch 1 was not ussed to discover H9.

Figu
ure 3.36( STP con
nvergence switch22 as Root )

Ryerson
R
Univerrsity | Load Ballancing Using S
SDN with
O
Open Daylight C
Controller

43

Conclussion (Network
k Load balan
ncing with STP )
From our Observation
O
wee have conclud
ded that ODL bundle
b
(org.opeendaylight.conttroller.samples.loadbalancer.innternal)
does the Neetwork load ballancing at the co
ore level switch
hes and it takes a while before it is fully convverged. We triedd many
times this was
w the case afteer STP was fullly converged.

3.4.2 Server Load Balancing


B
Ro
ound Robin Demonstrati
D
ion
We have successfully dem
monstrated both
h round Robin and
a Random Seever Load-balanncing Policies. IIn this section w
we will
ur observations for Round Rob
bin policies. Ass our Case studdy was to demoonstrate server R
Round Robin P
Policies
describe ou
using 32 ip
perf flows each with 20MB wiindow, and send
d these flows eevery 1sec.In thhe first section w
we have used H
H1 and
H3 as serveers and H9 as client,
c
and havee generated resp
pective flows. W
We have kept rrest of the hostss down, which means
we will hav
ve time outs wh
hen client wants to send traffic to those hosts ,T
There snapshott clearly indicattes these time ouuts.

Figu
ure 3.37 (H9 as client 32 iperf flow w
with only two servvers listening)

Ryerson
R
Univerrsity | Load Ballancing Using S
SDN with
O
Open Daylight C
Controller

44

We have ussed jperf, which


h is GUI based iperf and our ob
bservation indiccates we were nnot able to utilizze the max banddwidth
when somee of the Paths were down betweeen host and cliient.

Figu
ure 3.38(Server 1 response,
r
two hostt up and rest downn)

The above snapshot indiccates we have had


h input band
dwidth of arounnd 32 MB/s annd each of the hhost through puut was
max:7.5 wh
hich indicates there
t
was clear loss of bandwid
dth and not all bbandwidth was utilized.

Ryerson
R
Univerrsity | Load Ballancing Using S
SDN with
O
Open Daylight C
Controller

45

Figu
ure 3.39(Server 3 response,
r
two hostt up and rest downn)

Same is thee case of H3.

2nd case: when all the hostts are up. We have


h
achieved almost
a
100% eff
fficiency, we haad same bandwiidth available but this
unning and 32 flows
f
generatedd by following sscript.
time it was fully distributeed. All servers ru

Ryerson
R
Univerrsity | Load Ballancing Using S
SDN with
O
Open Daylight C
Controller

46

Figu
ure 3.40(Client H9
9 32 flows 20MB w
window and 1 sec delay all hosts up round Robin )

Snap shot of the client.

Ryerson
R
Univerrsity | Load Ballancing Using S
SDN with
O
Open Daylight C
Controller

47

Figu
ure 3.41(Server H1
1 response ,all hossts up round Robinn )

We have taaken host H1 an


nd H3 snap shott this time and we
w can see maxx bandwidth wa s utilized as wee had 32 MB annd each
sever was getting
g
approx. at 4MB, and we
w have almost reached
r
100% eefficiency.

Ryerson
R
Univerrsity | Load Ballancing Using S
SDN with
O
Open Daylight C
Controller

48

Figu
ure 3.42 (Server H3 response ,all hossts up round Robiin )

3.6.3

Server Load Balancing


B
Ra
andom Demo
onstration

This time we
w used STP en
nabled Network
k and the rest off the simulationn setting were ssame, which meeans first time w
we had
two serverss running, which
h was the case of
o Round Robin
n sever Simulattion.

Figu
ure 3.43 (Random topology creation )

Ryerson
R
Univerrsity | Load Ballancing Using S
SDN with
O
Open Daylight C
Controller

49

Figu
ure 3.44 (Random topology H9 Cliennt 32 flows two seervers up )

Ryerson
R
Univerrsity | Load Ballancing Using S
SDN with
O
Open Daylight C
Controller

50

Figu
ure 3.45 (Random
m topology H9 Clieent Server H1 respponse )

Ryerson
R
Univerrsity | Load Ballancing Using S
SDN with
O
Open Daylight C
Controller

51

Figure 3.46 (Rand


dom topology H9 Client Server H3 rresponse )

We almost have same resu


ults as Round Robin,
R
even we changed Netwoork to STP enabbled, we have loosses when not all the
servers are up as we can seee from the snap
pshot.

Ryerson
R
Univerrsity | Load Ballancing Using S
SDN with
O
Open Daylight C
Controller

52

Figu
ure 3.47 (Random topology H9 Cliennt 32 flows all serrvers up)

Ryerson
R
Univerrsity | Load Ballancing Using S
SDN with
O
Open Daylight C
Controller

53

Figu
ure 3.48 (Random topology H9 Cliennt Server H3 respoonse all servers upp )

Ryerson
R
Univerrsity | Load Ballancing Using S
SDN with
O
Open Daylight C
Controller

54

Figure 3.49 (Ran


ndom topology H9 Client Server H1 response all serveers up )

When we have all the seervers in listenin


ng mode in Ran
ndom LB, we gget 100% efficiiency, which w
was the case of Round
Robin topology also.

Conclusion
C
(S
Sever Load Balancing
B
Roound Robin/R
Random)
We have successfully deemonstrated bo
oth Round Rob
bin and Random
m Server Loadd-balancing annd concluded thhat we
received maax throughput when
w
all the serrvers are availab
ble irrespective of the load balaancing method..
Note:- Thiss is Ideal condittion, for STP en
nabled Network
k, as network inn not overloadedd , we can achieeve 100% throuughput,
but if this iss not the case th
hen we will hav
ve less throughp
put as not all thee links are utilizzed when STP iis enabled.

Ryerson
R
Univerrsity | Load Ballancing Using S
SDN with
O
Open Daylight C
Controller

55

Appendix
Openday light Wrapper scripts for Load Balancer
Create_8_load_balance_Round_Robin_topo.bash
echo "Create load balancer pool with round robin load balancing policy "
curl --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X POST http://192.168.56.105:8080/one/nb/v2/lb/default/create/pool d '{"name":"PoolRR","lbmethod":"roundrobin"}'

if [[ $? == 0 ]] ; then

echo " load balancer pool Created "


fi
curl --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X POST http://192.168.56.105:8080/one/nb/v2/lb/default/create/vip d '{"name":"VIP-RR","ip":"10.0.0.20","protocol":"TCP","port":"5550","poolname":"PoolRR"}'

echo " Create load balancer VIP "


curl --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X PUT http://192.168.56.105:8080/one/nb/v2/lb/default/update/vip -d
'{"name":"VIP-RR","poolname":"PoolRR"}'

if [[ $? == 0 ]] ; then

echo " load balancer VIP Created "


fi

echo "Creating Pool Members"

for members in 1 2 3 4 5 6 7 8
do
curl
--user
"admin":"admin"
-H
"Accept:
application/json"
-H
"Content-type:
application/json"
http://192.168.56.105:8080/one/nb/v2/lb/default/create/poolmember -d '{"name":"PM'$members'","ip":"10.0.0.'$members'","poolname":"PoolRR"}'

-X

Ryerson University | Load Balancing Using SDN with


Open Daylight Controller

56

POST

if [[ $? == 0 ]] ; then

echo " Pool Member PM"$members" Created "


fi
done

Create_load_balance_random.bash
echo "Create load balancer pool with Random load balancing policy "
curl --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X POST http://192.168.56.105:8080/one/nb/v2/lb/default/create/pool d '{"name":"PoolRA","lbmethod":"random"}'

if [[ $? == 0 ]] ; then

echo " load balancer pool Created "


fi
curl --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X POST http://192.168.56.105:8080/one/nb/v2/lb/default/create/vip d '{"name":"VIP-RA","ip":"10.0.0.20","protocol":"TCP","port":"5550","poolname":"PoolRA"}'

echo " Create load balancer VIP "


curl --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X PUT http://192.168.56.105:8080/one/nb/v2/lb/default/update/vip -d
'{"name":"VIP-RA","poolname":"PoolRA"}'

if [[ $? == 0 ]] ; then

echo " load balancer VIP Created "


fi

echo "Creating Pool Members"

for members in 1 2 3 4 5 6 7 8
do
curl
--user
"admin":"admin"
-H
"Accept:
application/json"
-H
"Content-type:
application/json"
http://192.168.56.105:8080/one/nb/v2/lb/default/create/poolmember -d '{"name":"PM'$members'","ip":"10.0.0.'$members'","poolname":"PoolRA"}'

-X

if [[ $? == 0 ]] ; then

Ryerson University | Load Balancing Using SDN with


Open Daylight Controller

57

POST

echo " Pool Member PM"$members" Created "


fi
done
deletepools_topo.bash
for members in 1 2 3 4 4 5 6 7 8
do
curl
--user
"admin":"admin"
-H
"Accept:
application/json"
http://192.168.56.105:8080/one/nb/v2/lb/default/delete/poolmember/PM"$members"/PoolRR

-H

"Content-type:

application/json"

-X

DELETE

application/json"

-H

"Content-type:

application/json"

-X

DELETE

application/json"

-H

"Content-type:

application/json"

-X

DELETE

done
echo "Delete VIP"
curl
--user
"admin":"admin"
-H
"Accept:
http://192.168.56.105:8080/one/nb/v2/lb/default/delete/vip/VIP-RR

echo "Delete Pool"


curl
--user
"admin":"admin"
-H
"Accept:
http://192.168.56.105:8080/one/nb/v2/lb/default/delete/pool/PoolRR

Mininet Scripts

Python topology Script


from mininet.topo import Topo
from mininet.net import Mininet
from mininet.link import Link
from mininet.util import quietRun
from mininet.log import setLogLevel, info
from mininet.node import Controller, RemoteController, OVSController
from mininet.node import CPULimitedHost, Host, Node
from mininet.node import OVSKernelSwitch, UserSwitch
from mininet.util import dumpNodeConnections
from mininet.cli import CLI
from mininet.log import setLogLevel, info
from mininet.link import TCLink, Intf
from subprocess import call

Ryerson University | Load Balancing Using SDN with


Open Daylight Controller

58

setLogLevel('info')
net = Mininet(link=TCLink)
# Servers
Host1 = net.addHost('h1',cls=Host, ip="10.0.0.1")
Host2 = net.addHost('h2',cls=Host, ip="10.0.0.2")
Host3 = net.addHost('h3', cls=Host,ip="10.0.0.3")
Host4 = net.addHost('h4', cls=Host,ip="10.0.0.4")
Host5 = net.addHost('h5', cls=Host,ip="10.0.0.5")
Host6 = net.addHost('h6', cls=Host,ip="10.0.0.6")
Host7 = net.addHost('h7', cls=Host,ip="10.0.0.7")
Host8 = net.addHost('h8', cls=Host,ip="10.0.0.8")

# Clients

Host9 = net.addHost('h9', ip="10.0.0.9")

Switch1 = net.addSwitch('s1')
Switch2 = net.addSwitch('s2')
Switch3 = net.addSwitch('s3')
Switch4 = net.addSwitch('s4')
Switch5 = net.addSwitch('s5')
Switch6 = net.addSwitch('s6')
Switch7 = net.addSwitch('s7')

# Adding Switches

#
linksw400 = dict(bw=400)
linksw100 = dict(bw=100)
linkclients = dict(bw=100)

Ryerson University | Load Balancing Using SDN with


Open Daylight Controller

59

linkservers = dict(bw=100)
# links between switches and hosts
net.addLink(Host1, Switch3,port1=13,port2=31 ,**linkservers)
net.addLink(Host5,Switch3,port1=53,port2=35 , **linkservers)

net.addLink(Host2,Switch4,port1=24,port2=42 , **linkservers)
net.addLink(Host6 , Switch4,port1=64,port2=46 ,**linkservers)

net.addLink(Host3 ,Switch5, port1=35,port2=53 ,**linkservers)


net.addLink(Host7, Switch5, port1=75,port2=57 ,**linkservers)

net.addLink(Host4, Switch6 , port1=46,port2=64, **linkservers)


net.addLink(Host8, Switch6 ,port1=86,port2=68 , **linkservers)

net.addLink(Host9, Switch7,port1=97,port2=79 ,**linkclients)


#net.addLink(Host5, Switch7,port1=5711,port2=7511,intf1Name='h7s70-eth570', intf2Name='s7h50-eth70', **linkclients)

# links between switches


# links between switch 2 and 4

net.addLink(Switch2, Switch4 , port1=240, port2=420, intf1Name='s24-eth240', intf2Name='s42-eth420' ,**linksw100)

net.addLink(Switch2, Switch5,port1=250, port2=520, intf1Name='s25-eth250', intf2Name='s52-eth520' , **linksw100)

net.addLink(Switch2, Switch6 , port1=260, port2=620, intf1Name='s26-eth260', intf2Name='s62-eth620' , **linksw100)

net.addLink(Switch2, Switch3 ,port1=230, port2=320, intf1Name='s23-eth230', intf2Name='s32-eth320' ,**linksw100)

net.addLink(Switch1, Switch4 ,port1=140, port2=410, intf1Name='s14-eth140', intf2Name='s41-eth410' ,**linksw100)

net.addLink(Switch1, Switch5 ,port1=150, port2=510, intf1Name='s15-eth150', intf2Name='s51-eth510' ,**linksw100)

Ryerson University | Load Balancing Using SDN with


Open Daylight Controller

60

net.addLink(Switch1, Switch6,port1=160, port2=610, intf1Name='s16-eth160', intf2Name='s61-eth610' ,**linksw100)


net.addLink(Switch1, Switch3 ,port1=130, port2=310, intf1Name='s13-eth130', intf2Name='s31-eth310' ,**linksw100)
net.addLink(Switch7, Switch1, port1=710, port2=170, intf1Name='s71-eth710', intf2Name='s17-eth170' , **linksw400)
net.addLink(Switch7, Switch2, port1=720, port2=270, intf1Name='s72-eth720', intf2Name='s27-eth270' , **linksw100)

net.addController('c0', controller=RemoteController, ip='192.168.56.105', port=6633)


net.build()
net.start()

CLI(net)
#simpleTest()
net.stop()

Get Interface Stats Script


echo "Port , Transmitted , Recieved " > result.txt
sudo ovs-vsctl list interface|grep name |grep "-"|awk -F":" '{print $2}'|sed -e 's/"//' -e 's/"//' > a.txt
>b.txt
>c.txt
line=$(sudo ovs-vsctl list interface|grep -n name |grep "-"|awk -F":" '{print $1}')
for X in $line
do
let Y=$X;
let Z=$Y+5
sudo ovs-vsctl list interface|awk '(NR=='$Z') {print $0}' |awk -F"rx_packets=" '{print $2}'|awk -F"," '{print ","$1}' >>b.txt
sudo ovs-vsctl list interface|awk '(NR=='$Z') {print $0}' |awk -F"tx_packets=" '{print ","$2}'|sed -e "s/}//" >> c.txt
done
paste a.txt b.txt c.txt >>result.txt

Enable STP Script

sudo ovs-vsctl set bridge s1 stp_enable=true


sudo ovs-vsctl set bridge s2 stp_enable=true
sudo ovs-vsctl set bridge s3 stp_enable=true

Ryerson University | Load Balancing Using SDN with


Open Daylight Controller

61

sudo ovs-vsctl set bridge s4 stp_enable=true


sudo ovs-vsctl set bridge s5 stp_enable=true
sudo ovs-vsctl set bridge s6 stp_enable=true
sudo ovs-vsctl set bridge s7 stp_enable=true

echo "Bridge s1 status"


sudo ovs-vsctl get bridge s1 stp_enable

echo "Bridge s2 status"


sudo ovs-vsctl get bridge s2 stp_enable

echo "Bridge s3 status"


sudo ovs-vsctl get bridge s3 stp_enable

echo "Bridge s3 status"


sudo ovs-vsctl get bridge s3 stp_enable

echo "Bridge s4 status"


sudo ovs-vsctl get bridge s4 stp_enable

echo "Bridge s5 status"


sudo ovs-vsctl get bridge s5 stp_enable

echo "Bridge s6 status"


sudo ovs-vsctl get bridge s6 stp_enable

echo "Bridge s7 status"


sudo ovs-vsctl get bridge s7 stp_enable

Ryerson University | Load Balancing Using SDN with


Open Daylight Controller

62

Installation steps ODL ( Pulling Code from Git Repository and compiling it Locally using Maven
sudo apt-add-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
set path
-----------sudo vi .bashrc
-----------Install Java JDK 8
#---------------------------#Java home
#---------------JAVA_HOME=/usr/lib/jvm/java-8-oracle
export JAVA_HOME
#-----------PATH=$PATH:$JAVA_HOME
export PATH
sudo mkdir -p /usr/local/apache-maven
sudo wget http://ftp.wayne.edu/apache/maven/maven-3/3.3.3/binaries/apache-maven-3.3.3-bin.tar.gz
sudo mv apache-maven-3.3.3-bin.tar.gz /usr/local/apache-maven
sudo tar -xzvf /usr/local/apache-maven/apache-maven-3.3.3-bin.tar.gz -C /usr/local/apache-maven/
sudo update-alternatives --install /usr/bin/mvn mvn /usr/local/apache-maven/apache-maven-3.3.3/bin/mvn 1
sudo update-alternatives --config mvn
sudo apt-get install vim
Maven Install
vim ~/.bashrc
------------add
export M2_HOME=/usr/local/apache-maven/apache-maven-3.3.3
export MAVEN_OPTS="-Xms256m -Xmx512m" # Very important to put the "m" on the end

Resource:
https://wiki.opendaylight.org/view/Install_On_Ubuntu_14.04

Ryerson University | Load Balancing Using SDN with


Open Daylight Controller

63

sudo add-apt-repository ppa:git-core/ppa -y


sudo apt-get update
sudo apt-get install git
Git Install

git version
Resource
http://unix.stackexchange.com/questions/33617/how-can-i-update-to-a-newer-version-of-git-using-apt-get

Once Environment is setup , we can pull code from ODL repository, we have used anonymous
Pull in our setup. Following are the steps:
Move the desired directory, in our case it is user $HOME
git clone https://git.opendaylight.org/gerrit/p/controller.git
saif@saif-SDN:~$ wget -q -O - https://raw.githubusercontent.com/opendaylight/odlparent/master/settings.xml > ~/.m2/settings.xml
saif@saif-SDN:~$ cd controller/
saif@saif-SDN:~/controller$ sudo git checkout stable/helium
Checking out files: 100% (3975/3975), done.
ODL installation
Branch stable/helium set up to track remote branch stable/helium from origin.
Switched to a new branch 'stable/helium'
saif@saif-SDN:~/controller$
mvn clean install DskipTests
It takes a while to install depending on the Machine hardware and memory.
Once Installation is successful , it will show summary of installation on the Screen.

setting up Mininet
git clone git://github.com/mininet/mininet
mininet/util/install.sh -n3f
sudo apt-get install scons
git clone https://github.com/CPqD/ofdissector
cd ofdissector/src
scons install
It may fail with complain
scons: Reading SConscript files ...

Ryerson University | Load Balancing Using SDN with


Open Daylight Controller

64

scons: done reading SConscript files.


scons: Building targets ...
g++ -o openflow-common.os -c -fPIC -I. -I/usr/include/wireshark -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include openflow-common.cpp
In file included from openflow-common.cpp:5:0:
./openflow-common.hpp:10:20: fatal error: config.h: No such file or directory

you need to install


apt-get install wireshark-dev
after that you may get lib missing
scons install
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
g++ -o openflow-common.os -c -fPIC -I. -I/usr/include/wireshark -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include openflow-common.cpp
In file included from openflow-common.cpp:9:0:
./of13/openflow-130.hpp:12:0: warning: "PROTO_TAG_OPENFLOW_VER" redefined [enabled by default]
apt-get install libgtk2.0-dev
apt-get install glade
pkg-config --list-all | grep glib

vi openflow-common.cpp
scons install
substitute 'dissector_add' with 'dissector_add_uint', not with 'dissector_add_unint'
scons install

resources:
https://github.com/CPqD/ofdissector/issues/14
http://sdn-lab.com/2014/03/19/how-to-analyze-openflow-packets-in-wireshark-at-ubuntu-12-04/
https://github.com/CPqD/ofdissector/issues/13

Ryerson University | Load Balancing Using SDN with


Open Daylight Controller

65

References:

https://www.opendaylight.org/sites/opendaylight/files/bk-user-guide.pdf
http://roan.logdown.com/posts/191801-set-openvswitch
http://conferences.sigcomm.org/sigcomm/2012/hotsdn.php
https://wiki.opendaylight.org/view/OpenDaylight_dlux:Dlux_Karaf_Feature
https://wiki.opendaylight.org/view/OpenDaylight_Controller:Main
http://blog.jcuff.net/2013/09/my-first-steps-with-openflow.html
https://wiki.opendaylight.org/view/OpenDaylight_Controller:Eclipse_Setup
http://askubuntu.com/questions/420281/how-to-update-maven-3-0-4-3-1-1
https://git-scm.com/book/en/v2/Getting-Started-Installing-Git
https://wiki.opendaylight.org/view/OpenDaylight_Controller:Installation
https://wiki.opendaylight.org/view/OpenDaylight_Controller:Load_Balancer_Service
https://wiki.opendaylight.org/view/OpenDaylight_Toolkit:Main:Windows
http://www.slideshare.net/joelwking/introduction-to-openflow-41257742

Ryerson University | Load Balancing Using SDN with


Open Daylight Controller

66

You might also like