Using l2_multi (Floyd-Warshall algorithm) to find a shortest path
1. Using Visual Network Description (VND) to draw the network topoplog.
2. Using the l2_multi pox controller module to find the shortest path from sender to receiver to send packets.
A. Draw the network topology
1. Open web browser and go to http://www.ramonfontes.com/vnd/# (See
https://www.youtube.com/playlist?list=PLccoFREVAt_4nEtrkl59mjjf5ZzRX8DZA for more detail operations.)
2. Click computer and drag it to the canvas twice to draw two computers, i.e. computer_1 and computer_2.
3. Click switchOpenflow and drag it to the canvas to draw four switches.
4. Click controllerOpenflow and drag it to the canvas.
5. Click links, choose ethernet, and add links.
6. Choose FileàExportàExport to Mininet
7. Save it to the file.
8. Set the file executable.
9. Open the file.
Script created by VND - Visual Network Description (SDN version)
from mininet.net import Mininet
from mininet.node import Controller, RemoteController, OVSKernelSwitch, OVSLegacyKernelSwitch, UserSwitch
from mininet.cli import CLI
from mininet.log import setLogLevel
from mininet.link import Link, TCLink
"Create a network."
net = Mininet( controller=RemoteController, link=TCLink, switch=OVSKernelSwitch )
print "*** Creating nodes"
h1 = net.addHost( 'h1', mac='00:00:00:00:00:01', ip='10.0.0.1/8' )
h2 = net.addHost( 'h2', mac='00:00:00:00:00:02', ip='10.0.0.2/8' )
s3 = net.addSwitch( 's3', listenPort=6634, mac='00:00:00:00:00:03' )
s4 = net.addSwitch( 's4', listenPort=6635, mac='00:00:00:00:00:04' )
s5 = net.addSwitch( 's5', listenPort=6636, mac='00:00:00:00:00:05' )
s6 = net.addSwitch( 's6', listenPort=6637, mac='00:00:00:00:00:06' )
c7 = net.addController( 'c7', controller=RemoteController, ip='127.0.0.1', port=6633 )
print "*** Creating links"
net.addLink(s4, h2, 3, 0)
net.addLink(s6, s4, 2, 2)
net.addLink(s5, s6, 2, 1)
net.addLink(s3, s5, 3, 1)
net.addLink(s3, s4, 2, 1)
net.addLink(h1, s3, 0, 1)
print "*** Starting network"
s4.start( [c7] )
s6.start( [c7] )
s5.start( [c7] )
s3.start( [c7] )
print "*** Running CLI"
CLI( net )
print "*** Stopping network"
if __name__ == '__main__':
setLogLevel( 'info' )
B. Using the l2_multi pox controller module to find the shortest path from sender to receiver to send packets.
1. Run the l2_multi pox controller. We will also use discovery module to construct the network topology. When the topology is known, the l2_multi can use Floyd-Warshall algorithm to find a shortest path. Note l2_multi.py is under /pox/pox/forwarding and discovery.py is under /pox/pox/openflow
2. Open another terminal and run the script.
3. Ping test.
4. There are two paths from h1 to h2, i.e. h1->s3->s4->h2 and h1->s3->s5->s6->s4->h4. The shortest path is h1->s3->s4->h2.
Check the rules for s3 (we can see the rules for arp and ip operations between 10.0.0.1 (h1) and 10.0.0.2(h2))
Check the rules for s4 (we can see the rules for arp and ip operations between 10.0.0.1 (h1) and 10.0.0.2(h2))
No rules for s5 and s6. Because the packets from h1 will not go via s5 and s6 to h2.
Dr. Chih-Heng Ke
Department of Computer Science and Information Engineering, National Quemoy University, Kinmen, Taiwan
Email: email@example.com / firstname.lastname@example.org