Learning POX OpenFlow controller : Proactive approach

The application name is topo_proactive.py.
This module works in a proactive mode. It is dependant on discovery module and can work with spanning_tree module in the topology with loops.

The idea behind this module is to assign all switches and hosts topology aware IP addresses. Knowning all IP addresses in advance, routing rules are installed.
Routing is based on the short path calculation. Hosts and switches get IP addresses by DHCP protocol from the controller.
Rules for creating IP addresses look the following way:

  • Switch address has a format of 10.<switch_id>.0.1
  • Network address has a format of 10.<switch_id>.0.0
  • Host address has a format of 10.<switch_id>.<switch_port_id>.<host_id>

Where

  • switch_id is generated by controller reflection just the ordering number
  • switch_port_id is a switch port number where host is connected to
  • host_id is the ordering number of a host

Example topology
Topology

The proactive nature of the module is encapsulated in the send_table method of TopoSwitch class. The logic inside this method populates the following rules to a switch:

  • Redirect all DHCP, LLDP, ARP, NDP packets to controller
  • Redirect packets with destination IP address from a network owned by known switch to a next hop port calculated by short path algorithm
  • Redirect packets with destination IP from a network owned by current switch  to a particular port where host with this IP was previously seen

Rules in OVS, retrieved using sudo ovs-ofctl dump-flows s1 command, will look the folllowing way.

cookie=0x0, duration=150.350s, table=0, n_packets=0, n_bytes=0, idle_age=150, ip,nw_dst=10.3.0.0/16 actions=output:1
 cookie=0x0, duration=150.350s, table=0, n_packets=0, n_bytes=0, idle_age=150, ip,nw_dst=10.2.0.0/16 actions=output:1
 cookie=0x0, duration=150.350s, table=0, n_packets=5, n_bytes=1711, idle_age=90, udp,tp_src=68,tp_dst=67 actions=CONTROLLER:65535
 cookie=0x0, duration=90.025s, table=0, n_packets=0, n_bytes=0, idle_age=90, ip,nw_dst=10.1.3.1 actions=mod_dl_src:00:00:00:00:00:01,mod_dl_dst:f2:5e:b1:0d:1f:3e,output:3
 cookie=0x0, duration=93.717s, table=0, n_packets=0, n_bytes=0, idle_age=93, ip,nw_dst=10.1.2.1 actions=mod_dl_src:00:00:00:00:00:01,mod_dl_dst:ea:2b:ce:81:3d:ca,output:2
 cookie=0x0, duration=150.350s, table=0, n_packets=0, n_bytes=0, idle_age=150, priority=32767,ip,nw_dst=255.255.255.255 actions=output:2,output:3
 cookie=0x0, duration=150.053s, table=0, n_packets=0, n_bytes=0, idle_age=150, ip,nw_dst=10.1.1.1 actions=mod_dl_src:00:00:00:00:00:01,mod_dl_dst:6a:c2:7e:06:13:98,output:1
 cookie=0x0, duration=150.350s, table=0, n_packets=29, n_bytes=1189, idle_age=0, priority=65000,dl_dst=01:23:20:00:00:01,dl_type=0x88cc actions=CONTROLLER:65535
 cookie=0x0, duration=150.350s, table=0, n_packets=0, n_bytes=0, idle_age=150, priority=32767,ip,nw_dst=10.1.3.0/24 actions=CONTROLLER:65535
 cookie=0x0, duration=150.350s, table=0, n_packets=0, n_bytes=0, idle_age=150, priority=32767,ip,nw_dst=10.1.1.0/24 actions=CONTROLLER:65535
 cookie=0x0, duration=150.350s, table=0, n_packets=0, n_bytes=0, idle_age=150, priority=32767,ip,nw_dst=10.1.2.0/24 actions=CONTROLLER:65535

Start POX using the following command line.
./pox.py log.level –DEBUG openflow.of_01 forwarding.topo_proactive openflow.discovery

Mininet script (proactive_net.py)

#!/usr/bin/python

from mininet.net import Mininet
from mininet.node import Controller, RemoteController, Node
from mininet.cli import CLI
from mininet.log import setLogLevel, info
from mininet.link import Link, Intf

def aggNet():

	CONTROLLER_IP='127.0.0.1'

	net = Mininet( topo=None,
               	build=False)

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

	h1 = net.addHost( 'h1', ip='0.0.0.0' )
	h2 = net.addHost( 'h2', ip='0.0.0.0' )
	h3 = net.addHost( 'h3', ip='0.0.0.0' )
	h4 = net.addHost( 'h4', ip='0.0.0.0' )
	s1 = net.addSwitch( 's1' )
	s2 = net.addSwitch( 's2' )
	s3 = net.addSwitch( 's3' )

	net.addLink( s1, s2 )
	net.addLink( s2, s3 )

	net.addLink( h1, s1 )
	net.addLink( h2, s1 )
	net.addLink( h3, s3 )
	net.addLink( h4, s3 )

	net.start()
	CLI( net )
	net.stop()

if __name__ == '__main__':
	setLogLevel( 'info' )
	aggNet()

After executing “sudo python proactive_net.py” execute the following commands inside mininet shell.

h1 dhclient h1-eth0
h2 dhclient h2-eth0
h3 dhclient h3-eth0
h4 dhclient h4-eth0

References

3 thoughts on “Learning POX OpenFlow controller : Proactive approach

  1. Hello,

    I have got an issues while executing the above code, in below is the error messages that I have got:
    …….
    mininet@mininet-vm:~/pox$ ./pox.py log.level -DEBUG openflow.of_01 forwarding.topo_proactive openflow.discovery
    POX 0.2.0 (carp) / Copyright 2011-2013 James McCauley, et al.
    DEBUG:core:POX 0.2.0 (carp) going up…
    DEBUG:core:Running on CPython (2.7.6/Mar 22 2014 22:59:56)
    DEBUG:core:Platform is Linux-3.13.0-24-generic-x86_64-with-Ubuntu-14.04-trusty
    INFO:core:POX 0.2.0 (carp) is up.
    DEBUG:openflow.of_01:Listening on 0.0.0.0:6633
    INFO:openflow.of_01:[None 1] closed
    INFO:openflow.of_01:[00-00-00-00-00-01 2] connected
    DEBUG:openflow.discovery:Installing flow for 00-00-00-00-00-01
    DEBUG:f.t_p.00-00-00-00-00-01:Connect [00-00-00-00-00-01 2]
    DEBUG:f.t_p:Disabling flooding for 3 ports
    WARNING:f.t_p.00-00-00-00-00-01:e2:84:75:2b:72:5f has incorrect IP 10.0.0.1
    WARNING:f.t_p.00-00-00-00-00-01:e2:84:75:2b:72:5f has incorrect IP 10.0.0.1
    WARNING:f.t_p.00-00-00-00-00-01:e2:84:75:2b:72:5f has incorrect IP 10.0.0.1
    WARNING:f.t_p.00-00-00-00-00-01:de:d7:4a:4a:cb:c0 has incorrect IP 10.0.0.2
    WARNING:f.t_p.00-00-00-00-00-01:de:d7:4a:4a:cb:c0 has incorrect IP 10.0.0.2
    WARNING:f.t_p.00-00-00-00-00-01:de:d7:4a:4a:cb:c0 has incorrect IP 10.0.0.2
    WARNING:f.t_p.00-00-00-00-00-01:e2:84:75:2b:72:5f has incorrect IP 10.0.0.1
    WARNING:f.t_p.00-00-00-00-00-01:e2:84:75:2b:72:5f has incorrect IP 10.0.0.1
    WARNING:f.t_p.00-00-00-00-00-01:e2:84:75:2b:72:5f has incorrect IP 10.0.0.1
    WARNING:f.t_p.00-00-00-00-00-01:de:d7:4a:4a:cb:c0 has incorrect IP 10.0.0.2
    WARNING:f.t_p.00-00-00-00-00-01:de:d7:4a:4a:cb:c0 has incorrect IP 10.0.0.2
    WARNING:f.t_p.00-00-00-00-00-01:de:d7:4a:4a:cb:c0 has incorrect IP 10.0.0.2
    WARNING:f.t_p.00-00-00-00-00-01:e2:84:75:2b:72:5f has incorrect IP 10.0.0.1
    WARNING:f.t_p.00-00-00-00-00-01:e2:84:75:2b:72:5f has incorrect IP 10.0.0.1
    WARNING:f.t_p.00-00-00-00-00-01:e2:84:75:2b:72:5f has incorrect IP 10.0.0.1
    …………

    Could you please advise me about how to overcome this issue.

    Many thanks,

    Ali

    Like

Leave a comment