def topology(): "Create a network." net = Mininet_wifi(controller=Controller, accessPoint=OVSKernelAP) info("*** Creating nodes\n") net.addStation('sta1', mac='00:00:00:00:00:02', ip='10.0.0.2/8', min_x=30, max_x=30, min_y=70, max_y=70, min_v=1, max_v=1) net.addStation('sta2', mac='00:00:00:00:00:03', ip='10.0.0.3/8', min_x=30, max_x=30, min_y=70, max_y=70, min_v=5, max_v=5) ap1 = net.addAccessPoint('ap1', ssid='new-ssid', mode='g', channel='1', position='50,50,0') c1 = net.addController('c1', controller=Controller) info("*** Configuring wifi nodes\n") net.configureWifiNodes() net.plotGraph(max_x=300, max_y=300) net.seed(20) net.startMobility(time=0, model='RandomDirection', max_x=100, max_y=100, min_v=0.5, max_v=0.8) info("*** Starting network\n") net.build() c1.start() ap1.start([c1]) info("*** Running CLI\n") CLI_wifi(net) info("*** Stopping network\n") net.stop()
def topology(): "Create a network." net = Mininet_wifi(controller=Controller, accessPoint=OVSKernelAP) info("*** Creating nodes\n") net.addStation('sta1', mac='00:00:00:00:00:02', ip='10.0.0.2/8') net.addStation('sta2', mac='00:00:00:00:00:03', ip='10.0.0.3/8') net.addStation('sta3', mac='00:00:00:00:00:04', ip='10.0.0.4/8') net.addStation('sta4', mac='00:00:00:00:00:05', ip='10.0.0.5/8') net.addStation('sta5', mac='00:00:00:00:00:06', ip='10.0.0.6/8') net.addStation('sta6', mac='00:00:00:00:00:07', ip='10.0.0.7/8') net.addStation('sta7', mac='00:00:00:00:00:08', ip='10.0.0.8/8') net.addStation('sta8', mac='00:00:00:00:00:09', ip='10.0.0.9/8') net.addStation('sta9', mac='00:00:00:00:00:10', ip='10.0.0.10/8') net.addStation('sta10', mac='00:00:00:00:00:11', ip='10.0.0.11/8') ap1 = net.addAccessPoint('ap1', ssid='ssid-ap1', mode='g', channel='1', position='50,50,0') ap2 = net.addAccessPoint('ap2', ssid='ssid-ap2', mode='g', channel='6', position='70,50,0', range=30) ap3 = net.addAccessPoint('ap3', ssid='ssid-ap3', mode='g', channel='11', position='90,50,0') c1 = net.addController('c1', controller=Controller) net.propagationModel(model="logDistance", exp=5) info("*** Configuring wifi nodes\n") net.configureWifiNodes() info("*** Associating and Creating links\n") net.addLink(ap1, ap2) net.addLink(ap2, ap3) net.plotGraph(max_x=120, max_y=120) net.associationControl('ssf') net.seed(1) net.startMobility(time=0, model='RandomWayPoint', max_x=120, max_y=120, min_v=0.3, max_v=0.5) info("*** Starting network\n") net.build() c1.start() ap1.start([c1]) ap2.start([c1]) ap3.start([c1]) info("*** Running CLI\n") CLI_wifi(net) info("*** Stopping network\n") net.stop()
def topology(): "Create a network." net = Mininet_wifi(controller=Controller, accessPoint=OVSKernelAP, link=wmediumd) info("*** Creating nodes\n") ap1 = net.addAccessPoint('ap1', ssid='new-ssid', mode='a', channel='36', position='150,150,0') net.addStation('sta1', mac='00:00:00:00:00:02', ip='10.0.0.2/8') net.addStation('sta2', mac='00:00:00:00:00:03', ip='10.0.0.3/8') c1 = net.addController('c1', controller=Controller) info("*** Configuring Propagation Model\n") net.propagationModel(model="logDistance", exp=3) info("*** Configuring wifi nodes\n") net.configureWifiNodes() net.plotGraph(max_x=300, max_y=300) net.seed(20) net.startMobility(time=0, model='RandomDirection', max_x=300, max_y=300, min_v=0.5, max_v=0.8) info("*** Starting network\n") net.build() c1.start() ap1.start([c1]) info("*** Running CLI\n") CLI_wifi(net) info("*** Stopping network\n") net.stop()
def topology(mobility): "Create a network." net = Mininet_wifi(link=wmediumd, wmediumd_mode=interference) info("*** Creating nodes\n") if mobility: sta1 = net.addStation('sta1') sta2 = net.addStation('sta2') sta3 = net.addStation('sta3') else: sta1 = net.addStation('sta1', position='10,10,0') sta2 = net.addStation('sta2', position='50,10,0') sta3 = net.addStation('sta3', position='90,10,0') info("*** Configuring wifi nodes\n") net.configureWifiNodes() info("*** Creating links\n") net.addMesh(sta1, ssid='meshNet', channel=5) net.addMesh(sta2, ssid='meshNet', channel=5) net.addMesh(sta3, ssid='meshNet', channel=5) if mobility: net.plotGraph(max_x=100, max_y=100) net.seed(20) net.startMobility(time=0, model='RandomDirection', max_x=100, max_y=100, min_v=0.5, max_v=0.8) info("*** Starting network\n") net.build() info("*** Running CLI\n") CLI_wifi(net) info("*** Stopping network\n") net.stop()
def topology(): "Create a network." net = Mininet_wifi(controller=Controller, accessPoint=OVSKernelAP) info("*** Creating nodes\n") net.addStation('sta1', antennaHeight='1', antennaGain='5') net.addStation('sta2', antennaHeight='1', antennaGain='5') ap1 = net.addAccessPoint('ap1', ssid='new-ssid', equipmentModel='DI524', mode='g', channel='1', position='50,50,0') c1 = net.addController('c1', controller=Controller) net.propagationModel(model="logDistance", exp=4) info("*** Configuring wifi nodes\n") net.configureWifiNodes() net.plotGraph(max_x=100, max_y=100) net.seed(1) net.startMobility(time=0, model='RandomWayPoint', max_x=100, max_y=100, min_v=0.5, max_v=0.5) info("*** Starting network\n") net.build() c1.start() ap1.start([c1]) info("*** Running CLI\n") CLI_wifi(net) info("*** Stopping network\n") net.stop()
def topology(): "Create a network." net = Mininet_wifi(controller=RemoteController, accessPoint=UserAP, link=wmediumd, wmediumd_mode=interference) staList = [] internetIface = 'enp2s0' usbDongleIface = 'wlan2' print("*** Creating nodes") for n in range(10): staList.append(n) staList[n] = net.addStation('sta%s' % (n + 1), wlans=2, mac='00:00:00:00:00:' + '%02x' % (n + 1), ip='192.168.0.%s/24' % (n + 1)) phyap1 = net.addPhysicalBaseStation( 'phyap1', wlans=2, protocols='OpenFlow13', ssid='Sigcomm-2016-Mininet-WiFi,Sigcomm-2016-Mininet-WiFi', mode='g', channel='1', position='50,115,0', phywlan=usbDongleIface) ap2 = net.addAccessPoint('ap2', protocols='OpenFlow13', ssid='ap-ssid2', mode='g', channel='11', position='100,175,0') ap3 = net.addAccessPoint('ap3', protocols='OpenFlow13', ssid='ap-ssid3', mode='g', channel='6', position='150,115,0') ap4 = net.addAccessPoint('ap4', protocols='OpenFlow13', ssid='ap-ssid4', mode='g', channel='11', position='100,55,0') c5 = net.addController('c5', controller=RemoteController, port=6653) sta11 = net.addStation('sta11', ip='10.0.0.111/8', position='60,100,0') h12 = net.addHost('h12', ip='10.0.0.109/8') root = net.addHost('root', ip='10.0.0.254/8', inNamespace=False) print("*** Configuring Propagation Model") net.propagationModel(model="logDistance", exp=4) print("*** Configuring wifi nodes") net.configureWifiNodes() print("*** Creating links") for sta in staList: net.addLink(sta, cls=mesh, ssid='meshNet') net.plotGraph(max_x=240, max_y=240) "Seed" net.seed(20) print("*** Associating and Creating links") net.addLink(phyap1, ap2) net.addLink(ap2, ap3) net.addLink(sta11, phyap1, 0, 1) net.addLink(ap3, ap4) net.addLink(ap4, phyap1) net.addLink(root, ap3) net.addLink(phyap1, h12) print("*** Starting network") net.build() c5.start() phyap1.start([c5]) ap2.start([c5]) ap3.start([c5]) ap4.start([c5]) time.sleep(2) 'output=all,flood' ap3.cmd( 'dpctl unix:/tmp/ap3 meter-mod cmd=add,flags=1,meter=1 drop:rate=100') ap3.cmd( 'dpctl unix:/tmp/ap3 flow-mod table=0,cmd=add in_port=4,eth_type=0x800,ip_dst=10.0.0.100,meter:1 apply:output=flood' ) phyap1.cmd( 'dpctl unix:/tmp/phyap1 flow-mod table=0,cmd=add in_port=2,ip_dst=10.0.0.109,eth_type=0x800,ip_proto=6,tcp_dst=80 apply:set_field=tcp_dst:80,set_field=ip_dst:10.0.0.111,output=5' ) phyap1.cmd( 'dpctl unix:/tmp/phyap1 flow-mod table=0,cmd=add in_port=1,eth_type=0x800,ip_proto=6,tcp_src=80 apply:set_field=ip_src:10.0.0.109,output=2' ) fixNetworkManager(root, 'root-eth0') startNAT(root, internetIface) sta11.cmd('ip route add default via 10.0.0.254') sta11.cmd('pushd /home/fontes; python3 -m http.server 80 &') ip = 201 for sta in staList: sta.setIP('10.0.0.%s/8' % ip, intf="%s-wlan1" % sta) sta.cmd('ip route add default via 10.0.0.254') ip += 1 net.startMobility(startTime=0, model='RandomWalk', max_x=200, max_y=200, min_v=0.1, max_v=0.2) print("*** Running CLI") CLI_wifi(net) print("*** Stopping network") net.stop()
def topology(): "Create a network." net = Mininet_wifi(controller=RemoteController, accessPoint=OVSKernelAP, link=wmediumd, enable_interference=True) print "*** Creating nodes" sta1 = net.addStation('sta1', mac='00:00:00:00:00:02', position='50,50,0', ip='10.0.0.1/16', range=80) sta2 = net.addStation('sta2', mac='00:00:00:00:00:03', position='150,50,0', ip='10.0.0.2/16', range=80) sta3 = net.addStation('sta3', mac='00:00:00:00:00:04', position='250,300,0', ip='10.0.0.3/16', range=80) sta4 = net.addStation('sta4', mac='00:00:00:00:00:05', position='350,200,0', ip='10.0.0.4/16', range=80) #sta5 = net.addStation('sta5', mac='00:00:00:00:00:06', position='150,50,0', ip='10.0.0.5/16', range=80) #sta6 = net.addStation('sta6', mac='00:00:00:00:00:07', position='150,150,0', ip='10.0.0.6/16', range=80) #sta7 = net.addStation('sta7', mac='00:00:00:00:00:08', position='150,250,0', ip='10.0.0.7/16', range=80) #sta17 = net.addStation('sta17', mac='00:00:00:00:00:18', position='150,200,0', ip='10.0.0.17/16', range=80) #sta8 = net.addStation('sta8', mac='00:00:00:00:00:09', position='150,350,0', ip='10.0.0.8/16', range=80) #sta9 = net.addStation('sta9', mac='00:00:00:00:00:10', position='250,50,0', ip='10.0.0.9/16', range=80) #sta10 = net.addStation('sta10', mac='00:00:00:00:00:11', position='250,150,0', ip='10.0.0.10/16', range=80) #sta11 = net.addStation('sta11', mac='00:00:00:00:00:12', position='250,250,0', ip='10.0.0.11/16', range=80) #sta12 = net.addStation('sta12', mac='00:00:00:00:00:13', position='250,350,0', ip='10.0.0.12/16', range=80) #sta13 = net.addStation('sta13', mac='00:00:00:00:00:14', position='350,50,0', ip='10.0.0.13/16', range=80) #sta14 = net.addStation('sta14', mac='00:00:00:00:00:15', position='350,150,0', ip='10.0.0.14/16', range=80) #sta15 = net.addStation('sta15', mac='00:00:00:00:00:16', position='350,250,0', ip='10.0.0.15/16', range=80) #sta16 = net.addStation('sta16', mac='00:00:00:00:00:17', position='350,350,0', ip='10.0.0.16/16', range=80) ap1 = net.addAccessPoint('ap1', wlans=2, type='mesh', ssid="ssid1,", position='100,100,0', mode="g", channel="1") ap2 = net.addAccessPoint('ap2', wlans=2, type='mesh', ssid="ssid2,", position='300,250,0', mode='g', channel='1') mr1 = net.addStation('mr1', wlans=2, type='mesh', ssid="ssid3,", mode="g", channel="1", position='200,100,0') mr2 = net.addStation('mr2', wlans=2, type='mesh', ssid="ssid4,", mode="g", channel="1", position='250,200,0') #ap3 = net.addAccessPoint('ap3', wlans=2, type='mesh', ssid='ssid5,', position='200,120,0', mode="g", channel="1") #ap4 = net.addAccessPoint('ap4', wlans=2, type='mesh', ssid='ssid6,', position='250,210,0', mode='g', channel='5') #ap5 = net.addAccessPoint('ap5', wlans=2, type='mesh', ssid='ssid5,', position='200,200,0', mode='g', channel='5') #ap6 = net.addAccessPoint('ap6', wlans=2, type='mesh', ssid='ssid6,', position='200,300,0', mode='g', channel='5') #ap7 = net.addAccessPoint('ap7', wlans=2, type='mesh', ssid='ssid7,', position='300,100,0', mode='g', channel='11') #ap8 = net.addAccessPoint('ap8', wlans=2, type='mesh', ssid='ssid8,', position='300,200,0', mode='g', channel='11') #ap9 = net.addAccessPoint('ap9', wlans=2, type='mesh', ssid='ssid9,', position='300,300,0', mode='g', channel='11') #ap1.setMAC('40:00:00:00:00:18', ap9.params['mac'][0]) #ap1.setRange(110,ap1.params['wlan'][1]) #ap2.setRange(110,ap2.params['wlan'][0]) #ap3.setRange(110,ap3.params['wlan'][0]) #ap4.setRange(110,ap4.params['wlan'][0]) #ap5.setRange(110,ap5.params['wlan'][0]) #ap6.setRange(110,ap6.params['wlan'][0]) #ap7.setRange(110,ap7.params['wlan'][0]) #ap8.setRange(110,ap8.params['wlan'][0]) #ap9.setRange(110,ap9.params['wlan'][0]) c0 = net.addController('c0', controller=RemoteController, ip='172.31.132.232', port=6653) print "***configuring propagation model" net.propagationModel(model="logDistance", exp=3.6) print "*** Configuring wifi nodes" net.configureWifiNodes() print "*** Associating Stations" net.addMesh(ap1, intf='ap1-wlan2', ssid='mesh-ssid', channel=1) net.addMesh(ap2, intf='ap2-wlan2', ssid='mesh-ssid', channel=1) net.addMesh(mr1, intf='mr1-wlan0', ssid='mesh-ssid', channel=1) net.addMesh(mr2, intf='mr2-wlan0', ssid='mesh-ssid', channel=1) #net.addMesh(ap3, intf='ap3-wlan2', ssid='mesh-ssid', channel=1) #net.addMesh(ap4, intf='ap4-wlan2', ssid='mesh-ssid', channel=1) #net.addLink(ap5, intf='ap5-wlan2', cls=mesh, ssid='mesh-ssid', channel=5) #net.addLink(ap6, intf='ap6-wlan2', cls=mesh, ssid='mesh-ssid', channel=5) #net.addLink(ap7, intf='ap7-wlan2', cls=mesh, ssid='mesh-ssid', channel=5) #net.addLink(ap8, intf='ap8-wlan2', cls=mesh, ssid='mesh-ssid', channel=5) #net.addLink(ap9, intf='ap9-wlan2', cls=mesh, ssid='mesh-ssid', channel=5) print """plotting graph""" net.plotGraph(max_x=400, max_y=400) #"""association control""" net.associationControl('ssf') print """Seed""" net.seed(1) """ *** Available models: RandomWalk, TruncatedLevyWalk, RandomDirection, RandomWayPoint, GaussMarkov *** Association Control (AC) - mechanism that optimizes the use of the APs: llf (Least-Loaded-First) ssf (Strongest-Signal-First)""" #net.startMobility(time=0, model='RandomWayPoint', max_x=120, max_y=120, min_v=0.3, max_v=0.5) print "*** Starting network" net.build() c0.start() ap1.start([c0]) ap2.start([c0]) #ap3.start([c0]) #ap4.start([c0]) #ap5.start([c0]) #ap6.start([c0]) #ap7.start([c0]) #ap8.start([c0]) #ap9.start([c0]) #ap1.cmd(" ifconfig ap1-mp2 10.0.0.51") #ap2.cmd(" ifconfig ap2-mp2 10.0.0.52") #ap3.cmd(" ifconfig ap3-wlan1 172.31.0.3/16") #ap4.cmd(" ifconfig ap4-wlan1 172.31.0.4/16") #ap5.cmd(" ifconfig ap5-wlan1 172.31.0.5/16") #ap6.cmd(" ifconfig ap6-wlan1 172.31.0.6/16") #ap7.cmd(" ifconfig ap7-wlan1 172.31.0.7/16") #ap8.cmd(" ifconfig ap8-wlan1 172.31.0.8/16") #ap9.cmd(" ifconfig ap9-wlan1 172.31.0.9/16") #ap1.cmd(" iw dev ap1-wlan1 interface add mon0 type monitor") # ap1.cmd("ifconfig mon0 up") info("*** Running CLI\n") CLI_wifi(net) print "*** Stopping network" net.stop()
def topology(): "Create a network." net = Mininet_wifi(controller=RemoteController, accessPoint=OVSKernelAP, link=wmediumd, wmediumd_mode=interference) staList = [] print("*** Creating nodes") for n in range(10): staList.append(n) staList[n] = net.addStation('sta%s' % (n + 1), wlans=2, mac='00:00:00:00:00:' + '%02x' % (n + 1), ip='192.168.0.%s/24' % (n + 1)) phyap1 = net.addPhysicalBaseStation( 'phyap1', ssid='SBRC16-MininetWiFi,SBRC16-MininetWiFi', mode='g', channel='1', wlans=2, position='50,115,0', phywlan='wlan2') net.addStation('sta11', ip='10.0.0.111/8', position='120,200,0') ap2 = net.addAccessPoint('ap2', ssid='ap2', mode='g', channel='11', position='100,175,0') ap3 = net.addAccessPoint('ap3', ssid='ap3', mode='g', channel='6', position='150,50,0') ap4 = net.addAccessPoint('ap4', ssid='ap4', mode='g', channel='1', position='175,150,0') c1 = net.addController('c1', controller=Controller, port=6653) Node('root', inNamespace=False) net.propagationModel(model="logDistance", exp=4) print("*** Configuring wifi nodes") net.configureWifiNodes() 'plotting graph' net.plotGraph(max_x=220, max_y=220) 'Seed' net.seed(20) print("*** Associating and Creating links") for sta in staList: net.addLink(sta, cls=mesh, ssid='meshNet') net.addLink(phyap1, ap2) net.addLink(ap2, ap3) net.addLink(ap3, ap4) net.startMobility(time=0, model='RandomWalk', max_x=220, max_y=220, min_v=0.1, max_v=0.2) print("*** Starting network") net.build() c1.start() phyap1.start([c1]) ap2.start([c1]) ap3.start([c1]) ap4.start([c1]) ip = 201 for sta in staList: sta.setIP('10.0.0.%s/8' % ip, intf="%s-wlan1" % sta) ip += 1 print("*** Running CLI") CLI_wifi(net) print("*** Stopping network") net.stop()
def topology(): "Create a network." net = Mininet_wifi(controller=Controller, switch=OVSKernelSwitch, accessPoint=OVSKernelAP) print "*** Creating nodes" sta1 = net.addStation('sta1', wlans=2, ip='10.0.0.2/8', max_x=120, max_y=50, min_v=1.4, max_v=1.6) h1 = net.addHost('h1', mac='00:00:00:00:00:01', ip='10.0.0.1/8') ap1 = net.addAccessPoint('ap1', ssid='ssid_ap1', mode='g', channel=6, position='70,25,0') ap2 = net.addAccessPoint('ap2', ssid='ssid_ap2', mode='g', channel=1, position='30,25,0') ap3 = net.addAccessPoint('ap3', ssid='ssid_ap3', mode='g', channel=11, position='110,25,0') s4 = net.addSwitch('s4', mac='00:00:00:00:00:10') c1 = net.addController('c1', controller=Controller) print "*** Configuring wifi nodes" net.configureWifiNodes() print "*** Associating and Creating links" net.addLink(ap1, s4) net.addLink(ap2, s4) net.addLink(ap3, s4) net.addLink(s4, h1) sta1.cmd('modprobe bonding mode=3') sta1.cmd('ip link add bond0 type bond') sta1.cmd('ip link set bond0 address 02:01:02:03:04:08') sta1.cmd('ip link set sta1-wlan0 down') sta1.cmd('ip link set sta1-wlan0 address 00:00:00:00:00:11') sta1.cmd('ip link set sta1-wlan0 master bond0') sta1.cmd('ip link set sta1-wlan1 down') sta1.cmd('ip link set sta1-wlan1 address 00:00:00:00:00:12') sta1.cmd('ip link set sta1-wlan1 master bond0') sta1.cmd('ip addr add 10.0.0.10/8 dev bond0') sta1.cmd('ip link set bond0 up') 'seed' net.seed(12) 'plotting graph' net.plotGraph(max_x=140, max_y=140) net.startMobility(startTime=0, model='RandomDirection') print "*** Starting network" net.build() c1.start() s4.start([c1]) ap1.start([c1]) ap2.start([c1]) ap3.start([c1]) sta1.cmd('ip addr del 10.0.0.2/8 dev sta1-wlan0') os.system('ovs-ofctl add-flow s4 actions=normal') print "*** Running CLI" CLI_wifi(net) print "*** Stopping network" net.stop()