EMAIL SUPPORT

dclessons@dclessons.com

LOCATION

NZ

Integrating Mininet Virtual Switch With ODL

Integrating Mininet Virtual Switch With ODL

Posted on Jan 10, 2020 (0)

Integrating Mininet Virtual Switch With ODL

Mininet is the Virtual machine system which creates the virtual switch, Virtual host under it. It is the best tool to create the Open Flow virtual switch and hosts and these host can be easily connected to virtual ports of virtual switch, IP can also be assigned to these hosts and work well to test SDN parameters in SDN LAB environment via ODL controller.

Steps to configure Mininet in VMware Workstation

Download Mininet from http://mininet.org/download/.

Import the OVF file in to VMWARE workstation and its networking setting is such a way that ODL and mininet should be in such a way that both should be able to ping to each other.

Following credential is used to access mininet:

  • Username: mininet
  • Password: mininet

Here we will be covering some overview information about Mininet.

Mininet is a tool through which you can create the virtual switches and host and connect to them. It also help these OpenFlow virtual switch to get registered in SDN ODL controller.

sudo mn command is used to run mininet and to build the topology.To get various version of  mn command you should run following  command:

mininet@mininet-vm:~$ sudo mn  --help

once you run this command , you will get all the other option available under mn which helps you to explore the mininet more.

As you see the  --switch provides you option to choose the type of virtual switch which Mininet can create like OVS, IVS, or OVS Bridge.

--Controller option let Mininet to connect its virtual switches to external SDN controller by following command

mininet@mininet-vm:~$ sudo mn --controller=remote, ip=142.100.64.133

Running the default mn command :

By running the default mn command in mininet , creates the default topology with one virtual switch and two host connected to virtual ports of that switch.

Here , two host h1 and h2 are created and it also added on switch s1. Both host are connected to virtual switch s1 and you are under mininet command prompt.

Logical Topology is shown here:

Under mininet command prompt you can achieve the following :

  • Ping hosts to each other
  • Run host specific command like ifconfig
  • Change the topology
  • Run dump to capture flows or modify flows
  • Run commands on virtual host.

How to get the details of current topology and network information via mininet:

To get the network topology from CLI you can use the net command as shown in below figure:

Here , you can easily see the following connectivity.

  • Host h1 eth0 is connected to switch s1 eth1
  • Host h2 eth0 is conetced to switch s1 eth2

Now in order to check the ip address allocated to these host h1 and h2 , use the following command as shown

To check what Ubuntu or OS version these hosts are using , you can run the following command :

How to integrate the mininet with ODL :

To integrate the mininet with ODL you have to run the following command :

First run the boron from ODL controller via this command on ODL

sudo /opt/odl/boron/bin/karaf

After landing on Karaf (OpenDaylight) Command Prompt, run the following command:

feature:install odl-dlux-all odl-restconf odl-l2switch-switch odl-mdsal-apidocs

This above command will install the important and required module to enable ODL to perform as ODL controller and enable l2 switch functionality on it. Once you install this l2 switch module your ODL will start listening at TCP 6633 which is OPENFLOW service which is required to provide communication between Mininet and ODL controller.

Now once you are able to login to ODL via Web interface. We will try to build the following topology in mininet with below command

mininet@mininet-vm:~$ sudo mn --controller=remote,ip=142.100.64.133 --topo=linear,2 --mac

Topology is like this :

  • h1 Eth0 connected to s1 Eth1
  • s1 eth2 connected to s2 eth2
  • h2 eth0 connected to s2 eth1

Now login to ODL web-interface and click on topology :

You will see that ODL has learned the two Virtual switch , this happens because Mininet will send 2 Hello for each virtual switch to ODL and then in reply ODL will also send 2 HELLO Reply , so by doing this your two Virtual switch will be discovered in ODL. This has been captured via wireshark in below figure

Now in Mininet, ping h2 from h1 for testing:

Now as soon as you ping, ODL will detect the two host and enable the flow between them to make ping successful.

Now login to ODL and check the topology section again and you will see that ODL has detected the host has connected to switch interface.

Now let’s see how packet moves from h1 to h2 and how ping gets successful. Now as soon as h1 starts ping to h2, h1 does not have MAC address of h2 so h1 by default sends the ARP request to get the MAC of h2 host.

As soon as ARP request was sent to switch s1 , with broadcast destination as ff.ff.ff.ff.ff.ff , switch do not know what to do for this packet so , switch s1 forwards the Arp packet to SDN controller.

As soon as ODL receives the packet , Its L2 Switch module starts handling the packet , where this module decaptulates this ARP packet from openFlow message and find that request is to get the MAC address for 10.0.0.2. Now, Neither ODL and Nor its L2 Switch module has prior information about where 10.0.0.2 is connected and what’s its MAC address in its any table. So ODL will tell to Switches how to handle the broadcast frame because the virtual switch has no logic how to handle broadcast frame.

ODL tells how to handle broadcast frame with the help of FLOW-MOD message. This Message is used to modify the flow table in all virtual switches, and by this message ODL programs the flow table of virtual switches.

You can see 7642.7644,7645 and one more MOD packet now shown here are FLOW-MOD packets from ODL controller to Mininet.

These four message will be sent by ODL because there are two switch and each switch has two ports. Two message for each switch and each switch has two active ports.

Via these MOD message, ODL program the Flow table for each Virtual switch and tells each switch to forward the broadcast message to both port 1 and port 2 that is why ODL generates the four packets.

feature:install odl-dlux-all odl-restconf odl-l2switch-switch odl-mdsal-apidocs

With this method, OpenDaylight installs the flows inside OpenFlow switches, and hosts will now be able to communicate with each other.

Summery of the above discussed packet flow:

Following shows the steps for ping between host H1 to H2 :

  • H1 starts the ping H2
  • H1 realizes that source IP address (10.0.0.1/24) and destination IP address (10.0.0.2/24) are both in the same layer 2 subnet. Therefore, it needs to send an ARP request to find the destination MAC address of 10.0.0.2.
  • The H1 generates an ARP request to find the MAC address of H2. The ARP request is sent out from Port 1 to S1 with destination MAC of 00:00:00:00:00:00 (broadcast).
  • Switch S1 receives the frame with the source of H1 MAC address and find that it has no entry in its flow table to forward the frame. Therefore, S1 ask the SDN controller about how to deal with this packet.
  • Switch S1 encapsulates the ARP request packet in an OpenFlow IN packet and sends it to OpenDaylight. The OpenFlow packet goes from 142.100.64.135 (Mininet) to  142.100.64.133 (OpenDaylight) over TCP 6633 (OpenFlow)
  • OpenDaylight receives the OpenFlow packets and passes them to the L2 switch module for processing.
  • OpenDaylight sends a flow configuration message to S1 telling that if a frame is received on Port 1, destined broadcast, you need to send it out to all the ports.
  • S1 installs the flow and forwards the packet to all the ports, which is only Port 2 at this stage.
  • S2 receives a frame on Port 2, destined for broadcast. It has no flow installed in its table to match; therefore, it encapsulates the packets and forwards them to OpenDaylight.

Note that OpenDaylight is smart enough to avoid this by sending an OpenFlow MOD message to S2 prior to receiving such a message.

  • S2 gets the OpenFlow MOD message from OpenDaylight to forward a broadcast message to all the ports. Therefore, it forwards to Port 1, which is connected to H2.
  • H2 receives the ARP request packet and sends a reply.
  • H2 replies to ARP and the same process will happen again.

Comment

    You are will be the first.

LEAVE A COMMENT

Please login here to comment.