I have a layer 3 switch and I need to set priorities for forwarding, I've tried some solutions but no success, does anyone have any ideas?
This is the code:
#!/usr/bin/python
'Setting the position of nodes and providing mobility'
import sys
from mininet.node import RemoteController
from mininet.log import setLogLevel, info
from mn_wifi.cli import CLI
from
mn_wifi.net import Mininet_wifi
#from mn_wifi.associationControl import associationControl
def myNetwork():
"Create a network."
net = Mininet_wifi(controller=None)
info( '*** Adding controller\n' )
c0 = net.addController(name='c0',
controller=RemoteController, ip='192.168.2.143',port=6653)
info("*** Creating nodes\n")
# Add hosts and switches
#info( '*** Add switches/APs\n')
s1 = net.addSwitch('s1', listenPort=1)
s2 = net.addSwitch('s2', listenPort=2)
s3 = net.addSwitch('s3', listenPort=3)
s4 = net.addSwitch('s4', listenPort=4)
info( '*** Add hosts/stations\n')
h1 = net.addHost('h1',ip='10.0.0.1', defaultRoute='via 10.0.0.10')
h2 = net.addHost('h2', ip='10.0.2.2', defaultRoute='via 10.0.2.12')
h3 = net.addHost('h3', ip='10.0.3.3', defaultRoute='via 10.0.3.13')
h4 = net.addHost('h4', ip='10.0.4.4', defaultRoute='via 10.0.4.14')
h5 = net.addHost('h5', ip='10.0.0.5', defaultRoute='via 10.0.0.10')
h6 = net.addHost('h6', ip='10.0.2.6', defaultRoute='via 10.0.2.12')
h7 = net.addHost('h7', ip='10.0.3.7', defaultRoute='via 10.0.3.13')
h8 = net.addHost('h8', ip='10.0.4.8', defaultRoute='via 10.0.4.14')
info( '*** Add links\n')
net.addLink(s1, h1)
net.addLink(s1, h5)
net.addLink(s2, h2)
net.addLink(s2, h6)
net.addLink(s3, h3)
net.addLink(s3, h7)
net.addLink(s4, h8)
net.addLink(s4, h4)
net.addLink(s1, s2)
net.addLink(s3, s4)
info( '*** Starting network\n')
net.build()
info( '*** Starting controllers\n')
for controller in net.controllers:
controller.start()
info( '*** Starting switches/APs\n')
net.get('s1').start([c0])
net.get('s2').start([c0])
net.get('s3').start([c0])
net.get('s4').start([c0])
info("*** Configuring wifi nodes\n")
net.configureWifiNodes()
net.plotGraph(max_x=100, max_y=100)
#net.setAssociationCtrl('ssf')
info("*** Starting network\n")
s1.cmd("ovs-ofctl add-flow s1 priority=65535,ip,dl_dst=10.0.0.1,actions=output:1")
s2.cmd("ovs-ofctl add-flow s1 priority=535,ip,dl_dst=10.0.2.0,actions=output:2")
s3.cmd("ovs-ofctl add-flow s1 priority=10,ip,dl_dst=10.0.0.3,actions=output:3")
s4.cmd("ovs-ofctl add-flow s1 priority=65,ip,dl_dst=10.0.0.4,actions=output:1")
info("*** Running CLI\n")
CLI(net)
info("*** Stopping network\n")
net.stop()
if __name__ == '__main__':
setLogLevel( 'info' )
myNetwork()