def topology(autoTxPower): "Create a network." net = Mininet_wifi(link=wmediumd, wmediumd_mode=interference) info("*** Creating nodes\n") if autoTxPower: sta1 = net.addStation('sta1', position='10,10,0', range=100) sta2 = net.addStation('sta2', position='50,10,0', range=100) sta3 = net.addStation('sta3', position='90,10,0', range=100) 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') net.propagationModel(model="logDistance", exp=4) info("*** Configuring wifi nodes\n") net.configureWifiNodes() info("*** Creating links\n") net.addLink(sta1, cls=adhoc, ssid='adhocNet', mode='g', channel=5) net.addLink(sta2, cls=adhoc, ssid='adhocNet', mode='g', channel=5) net.addLink(sta3, cls=adhoc, ssid='adhocNet', mode='g', channel=5) info("*** Starting network\n") net.build() info("*** Running CLI\n") CLI_wifi(net) info("*** Stopping network\n") net.stop()
def topology(wmediumd): "Create a network." if wmediumd: net = Mininet_wifi(controller=Controller, accessPoint=UserAP, enable_wmediumd=True, enable_interference=True) else: net = Mininet_wifi(controller=Controller, accessPoint=UserAP) print "*** Creating nodes" sta1 = net.addStation('sta1', mac='00:00:00:00:00:01', ip='10.0.0.1/8', position='120,140,0') sta2 = net.addStation('sta2', mac='00:00:00:00:00:02', ip='10.0.0.2/8', position='10,30,0') sta3 = net.addStation('sta3', mac='00:00:00:00:00:03', ip='10.0.0.3/8', position='10,50,0') ap1 = net.addAccessPoint('ap1', ssid='new-ssid', mode='g', channel='1', position='15,30,0', ieee80211r='yes', mobility_domain='a1b2', passwd='123456789a', encrypt='wpa2') c1 = net.addController('c1', controller=Controller) print "*** Configuring Propagation Model" net.propagationModel(model="logDistance", exp = 4.2) print "*** Configuring wifi nodes" net.configureWifiNodes() 'plotting graph' net.plotGraph(max_x=150, max_y=150) print "*** Starting network" net.build() c1.start() ap1.start([c1]) print "*** Running CLI" CLI_wifi(net) print "*** Stopping network" net.stop()
def topology(): "Create a network." net = Mininet_wifi(controller=Controller, accessPoint=OVSKernelAP, link=wmediumd, wmediumd_mode=interference) info("*** Creating nodes\n") sta1 = net.addStation('sta1', mac='00:00:00:00:00:11', position='1,1,0') sta2 = net.addStation('sta2', mac='00:00:00:00:00:12', position='31,11,0') ap1 = net.addAccessPoint('ap1', wlans=2, ssid='ssid1,', position='10,10,0') ap2 = net.addAccessPoint('ap2', wlans=2, ssid='ssid2,', position='30,10,0') c0 = net.addController('c0', controller=Controller, ip='127.0.0.1', port=6633) info("*** Configuring wifi nodes\n") net.configureWifiNodes() info("*** Associating Stations\n") net.addLink(sta1, ap1) net.addLink(sta2, ap2) net.addLink(ap1, intf='ap1-wlan2', cls=mesh, ssid='mesh-ssid', channel=5) net.addLink(ap2, intf='ap2-wlan2', cls=mesh, ssid='mesh-ssid', channel=5) info("*** Starting network\n") net.build() c0.start() ap1.start([c0]) ap2.start([c0]) info("*** Running CLI\n") CLI_wifi(net) info("*** Stopping network\n") net.stop()
def topology(isVirtual): "Create a network." net = Mininet_wifi(controller=Controller, accessPoint=OVSKernelAP) info("*** Creating nodes\n") if isVirtual: sta1 = net.addStation('sta1', nvif=2) else: sta1 = net.addStation('sta1') sta2 = net.addStation('sta2') ap1 = net.addAccessPoint('ap1', ssid="simplewifi", mode="g", channel="5") c0 = net.addController('c0', controller=Controller, ip='127.0.0.1', port=6633) info("*** Configuring wifi nodes\n") net.configureWifiNodes() info("*** Associating Stations\n") net.addLink(sta1, ap1) net.addLink(sta2, ap1) info("*** Starting network\n") net.build() c0.start() ap1.start([c0]) info("*** Running CLI\n") CLI_wifi(net) info("*** Stopping network\n") net.stop()
def topology(): "Create a network." net = Mininet_wifi(link=wmediumd, enable_interference=True) print "*** Creating nodes" net.addStation('sta1', position='10,20,0') net.addStation('sta2', position='40,30,0') net.addStation('sta3', position='60,20,0') net.addAccessPoint('ap1', ssid="my-ssid", mode="a", channel="36", failMode='standalone', position='10,10,0') print "*** Configuring Propagation Model" net.propagationModel(model="logDistance", exp=4) net.plotGraph(max_x=100, max_y=100) print "*** Configuring wifi nodes" net.configureWifiNodes() print "*** Starting network" net.build() print "*** Running CLI" CLI_wifi(net) print "*** Stopping network" net.stop()
def topology(): "Create a network." net = Mininet_wifi(controller=Controller, accessPoint=UserAP) info("*** Creating nodes\n") net.addStation('sta1', passwd='123456789a,123456789a', encrypt='wpa2,wpa2', wlans=2, active_scan=1, scan_freq='2412,2437', position='5,10,0') net.addStation('sta2', passwd='123456789a', encrypt='wpa2', active_scan=1, scan_freq='2437', position='45,10,0') ap1 = net.addAccessPoint('ap1', ssid="ssid-1", mode="g", channel="1", passwd='123456789a', encrypt='wpa2', position='10,10,0') ap2 = net.addAccessPoint('ap2', ssid="ssid-1", mode="g", channel="6", passwd='123456789a', encrypt='wpa2', position='40,10,0') c0 = net.addController('c0', controller=Controller, ip='127.0.0.1', port=6633) info("*** Configuring wifi nodes\n") net.configureWifiNodes() net.plotGraph(max_x=120, max_y=120) info("*** Starting network\n") net.build() c0.start() ap1.start([c0]) ap2.start([c0]) info("*** Running CLI\n") CLI_wifi(net) info("*** Stopping network\n") net.stop()
def topology(): "Create a network." net = Mininet_wifi(controller=Controller, switch=OVSKernelSwitch) info("*** Creating nodes\n") sta1 = net.addStation('sta1', wlans=3) # 3 wlan added sta2 = net.addStation('sta2') # 1 wlan added ap1 = net.addAccessPoint('ap1', ssid='ssid_1', mode='g', channel='5') c0 = net.addController('c0', controller=Controller) info("*** Configuring wifi nodes\n") net.configureWifiNodes() info("*** Associating...\n") net.addLink(ap1, sta1) net.addHoc(sta1, ssid='adhoc1') net.addHoc(sta2, ssid='adhoc1') info("*** Starting network\n") net.build() c0.start() ap1.start([c0]) info("***Addressing...\n") sta1.setIP('192.168.10.1/24', intf="sta1-wlan1") sta2.setIP('192.168.10.2/24', intf="sta2-wlan0") info("*** Running CLI") CLI_wifi(net) info("*** Stopping network\n") net.stop()
def topology(): "Create a network." net = Mininet_wifi( controller=Controller, link=TCLink, switch=OVSKernelSwitch ) info("*** Creating nodes\n") sta1 = net.addStation( 'sta1', mac='00:00:00:00:00:02', ip='10.0.0.2/8' ) 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() info("*** adding Link\n") net.addLink(sta1, ap1) info("*** Starting network\n") net.build() c1.start() ap1.start( [c1] ) net.plotGraph(max_x=100, max_y=100) getTrace(sta1, 'examples/replaying/replayingBandwidth/throughputData.dat') replayingBandwidth(net) info("*** Running CLI\n") CLI_wifi(net) info("*** Stopping network\n") net.stop()
def topology(): "Create a network." net = Mininet_wifi() info("*** Creating nodes\n") node1 = net.add6LoWPAN('node1', ip='2001::1/64') node2 = net.add6LoWPAN('node2', ip='2001::2/64') node3 = net.add6LoWPAN('node3', ip='2001::3/64') info("*** Configuring nodes\n") net.configureWifiNodes() info("*** Associating Nodes\n") net.addLink(node1, cls=sixLoWPANLink, panid='0xbeef') net.addLink(node2, cls=sixLoWPANLink, panid='0xbeef') net.addLink(node3, cls=sixLoWPANLink, panid='0xbeef') info("*** Starting network\n") net.build() info("*** Running CLI\n") CLI_wifi(net) info("*** Stopping network\n") net.stop()
def topology(): 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.1/8', position='30,60,0') net.addStation('sta2', mac='00:00:00:00:00:03', ip='10.0.0.2/8', position='70,30,0') ap1 = net.addAccessPoint('ap1', ssid='new-ssid', mode='g', channel='1', position='50,50,0') c1 = net.addController('c1', controller=Controller) h1 = net.addHost('h1', ip='10.0.0.3/8') net.propagationModel(model="logDistance", exp=4.5) info("*** Configuring wifi nodes\n") net.configureWifiNodes() info("*** Creating links\n") net.addLink(ap1, h1) net.plotGraph(max_x=100, max_y=100) 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=UserAP) info("*** Creating nodes\n") sta1 = net.addStation('sta1', passwd='123456789a', encrypt='wpa2') sta2 = net.addStation('sta2', passwd='123456789a', encrypt='wpa2') ap1 = net.addAccessPoint('ap1', ssid="simplewifi", mode="g", channel="1", passwd='123456789a', encrypt='wpa2') c0 = net.addController('c0', controller=Controller, ip='127.0.0.1', port=6633) info("*** Configuring wifi nodes\n") net.configureWifiNodes() info("*** Associating Stations\n") net.addLink(sta1, ap1) net.addLink(sta2, ap1) info("*** Starting network\n") net.build() c0.start() ap1.start([c0]) 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 ) print("*** Creating nodes") ap1 = net.addAccessPoint( 'ap1', ssid="simplewifi", mode="g", channel="5" ) sta1 = net.addStation( 'sta1', ip='192.168.0.1/24' ) sta2 = net.addStation( 'sta2', ip='192.168.0.2/24' ) h3 = net.addHost( 'h3', ip='192.168.0.3/24' ) h4 = net.addHost( 'h4', ip='192.168.0.4/24' ) c0 = net.addController('c0', controller=Controller, ip='127.0.0.1' ) net.configureWifiNodes() print("*** Adding Link") net.addLink(sta1, ap1) net.addLink(sta2, ap1) net.addLink(h3, ap1) net.addLink(h4, ap1) print("*** Starting network") net.build() c0.start() ap1.start( [c0] ) print("*** Running CLI") CLI_wifi( net ) print("*** Stopping network") net.stop()
def topology(): "Create a network." net = Mininet_wifi(controller=Controller, link=wmediumd, accessPoint=OVSKernelAP, wmediumd_mode=interference, noise_threshold=-91, fading_coefficient=3) info("*** Creating nodes\n") ap1 = net.addAccessPoint('ap1', ssid='new-ssid', mode='a', channel='36', position='15,30,0') net.addStation('sta1', mac='00:00:00:00:00:02', ip='10.0.0.1/8', position='10,20,0') net.addStation('sta2', mac='00:00:00:00:00:03', ip='10.0.0.2/8', position='20,50,0') net.addStation('sta3', mac='00:00:00:00:00:04', ip='10.0.0.3/8', position='20,60,10') c1 = net.addController('c1', controller=Controller) info("*** Configuring Propagation Model\n") net.propagationModel(model="logDistance", exp=4) info("*** Configuring wifi nodes\n") net.configureWifiNodes() net.plotGraph(max_x=100, max_y=100) 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) print "*** Creating nodes" sta1 = net.addStation('sta1', mac='00:00:00:00:00:01', ip='192.168.0.1/24', position='47.28,50,0') sta2 = net.addStation('sta2', mac='00:00:00:00:00:02', ip='192.168.0.2/24', position='54.08,50,0') ap3 = net.addBaseStation('ap3', ssid='ap-ssid3', mode='g', channel='1', position='50,50,0') c0 = net.addController('c0', controller=Controller, port=6653) print "*** Configuring wifi nodes" net.configureWifiNodes() print "*** Starting network" net.build() c0.start() ap3.start([c0]) sta1.cmd('iw dev sta1-wlan0 interface add mon0 type monitor &') sta1.cmd('ifconfig mon0 up &') sta2.cmd('iw dev sta2-wlan0 interface add mon0 type monitor &') sta2.cmd('ifconfig mon0 up &') sta2.cmd('pushd /home/alpha/Downloads; python3 -m http.server 80 &') getTrace(sta1, 'clientTrace.txt') getTrace(sta2, 'serverTrace.txt') replayingNetworkBehavior.addNode(sta1) replayingNetworkBehavior.addNode(sta2) replayingNetworkBehavior(net) #sta1.cmd('tcpdump -i mon0 -s 0 -vvv -w client.pcap &&') #sta2.cmd('tcpdump -i mon0 -s 0 -vvv -w server.pcap &&') #sta1 tcpdump -i mon0 -s 0 -vvv -w client.pcap && sta1 wget http://192.168.0.2/virtualbox-5.0_5.0.20-106931~Ubuntu~xenial_amd64.deb #sta1.cmd('wget http://'+sta2.IP()+'/virtualbox-5.0_5.0.20-106931~Ubuntu~xenial_amd64.deb') #sta1.cmd('nohup ping ' + sta2.IP() + ' -c 180 > ping1.log &') #sta2.cmd('nohup ping ' + sta1.IP() + ' -c 180 > ping2.log &') #sta2.cmd('iperf -s &') #sta1.cmd('iperf -c ' + sta2.IP() + ' -i 0.5 -t 60 | awk \'t=120{if(NR>=7 && NR<=25) print $8; else if(NR>=26 && NR<=t+6) print $7}\' > replay1.dat') #sta2.cmd('iperf -c ' + sta1.IP() + ' -i 0.5 -t 60 | awk \'t=120{if(NR>=7 && NR<=25) print $8; else if(NR>=26 && NR<=t+6) print $7}\' > replay2.dat &') print "*** Running CLI" CLI_wifi(net) print "*** Stopping network" net.stop()
def topology(isVirtual): "Create a network." net = Mininet_wifi(controller=Controller, accessPoint=OVSKernelAP) info("*** Creating nodes\n") if isVirtual: sta1 = net.addStation('sta1', nvif=2) else: sta1 = net.addStation('sta1') sta2 = net.addStation('sta2') if isVirtual: ap1 = net.addAccessPoint('ap1', ssid="simplewifi", mode="g", channel="5") else: # isolate_clientes: Client isolation can be used to prevent low-level # bridging of frames between associated stations in the BSS. # By default, this bridging is allowed. # OpenFlow rules are required to allow communication among nodes ap1 = net.addAccessPoint('ap1', ssid="simplewifi", isolate_clientes=True, mode="g", channel="5") c0 = net.addController('c0', controller=Controller, ip='127.0.0.1', port=6633) info("*** Configuring wifi nodes\n") net.configureWifiNodes() info("*** Associating Stations\n") net.addLink(sta1, ap1) net.addLink(sta2, ap1) info("*** Starting network\n") net.build() c0.start() ap1.start([c0]) if not isVirtual: ap1.cmd('ovs-ofctl add-flow ap1 "priority=0,arp,in_port=1,' 'actions=output:in_port,normal"') ap1.cmd('ovs-ofctl add-flow ap1 "priority=0,icmp,in_port=1,' 'actions=output:in_port,normal"') ap1.cmd('ovs-ofctl add-flow ap1 "priority=0,udp,in_port=1,' 'actions=output:in_port,normal"') ap1.cmd('ovs-ofctl add-flow ap1 "priority=0,tcp,in_port=1,' 'actions=output:in_port,normal"') info("*** Running CLI\n") CLI_wifi(net) info("*** Stopping network\n") net.stop()
def topology(): "Create a network." net = Mininet_wifi(controller=Controller, switch=OVSKernelSwitch, accessPoint=OVSKernelAP) print("*** Creating nodes") sta1 = net.addStation('sta1', mac='00:00:00:00:00:01', ip='10.0.0.1/8') ap1 = net.addAccessPoint('ap1', ssid='new-ssid1', mode='g', channel='1', position='15,30,0') ap2 = net.addAccessPoint('ap2', ssid='new-ssid1', mode='g', channel='6', position='55,30,0') s3 = net.addSwitch('s3') h1 = net.addHost('h1', mac='00:00:00:00:00:02', ip='10.0.0.2/8') c1 = net.addController('c1', controller=Controller, port=6653) net.propagationModel(model="logDistance", exp=4.3) print("*** Configuring WiFi Nodes") net.configureWifiNodes() h1.plot(position='35,90,0') s3.plot(position='35,80,0') print("*** Creating links") net.addLink(ap1, s3) net.addLink(ap2, s3) net.addLink(h1, s3) 'plotting graph' net.plotGraph(max_x=100, max_y=100) net.startMobility(time=0) net.mobility(sta1, 'start', time=1, position='10,30,0') net.mobility(sta1, 'stop', time=80, position='60,30,0') net.stopMobility(time=80) print("*** Starting network") net.build() c1.start() ap1.start([c1]) ap2.start([c1]) s3.start([c1]) print("*** Running CLI") CLI_wifi(net) print("*** Stopping network") net.stop()
def topology(): "Create a network." net = Mininet_wifi(controller=Controller, accessPoint=OVSKernelAP) info("*** Creating nodes\n") sta1 = net.addStation('sta1', mac='00:00:00:00:00:02', ip='10.0.0.2/8', range=20) sta2 = net.addStation('sta2', mac='00:00:00:00:00:03', ip='10.0.0.3/8', range=20) ap1 = net.addAccessPoint('ap1', ssid='ssid-ap1', mode='g', channel='1', position='15,30,0', range=30) ap2 = net.addAccessPoint('ap2', ssid='ssid-ap2', mode='g', channel='6', position='55,30,0', range=30) c1 = net.addController('c1', controller=Controller) net.propagationModel(model="logDistance", exp=5) info("*** Configuring wifi nodes\n") net.configureWifiNodes() info("*** Creating links\n") net.addLink(ap1, ap2) net.plotGraph(max_x=100, max_y=100) net.startMobility(time=0) net.mobility(sta1, 'start', time=1, position='10,30,0') net.mobility(sta2, 'start', time=2, position='10,40,0') net.mobility(sta1, 'stop', time=10, position='60,30,0') net.mobility(sta2, 'stop', time=10, position='25,40,0') net.stopMobility(time=40) info("*** Starting network\n") net.build() c1.start() ap1.start([c1]) ap2.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', 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, link=wmediumd, wmediumd_mode=error_prob) info("*** Creating nodes\n") ap1 = net.addAccessPoint('ap1', ssid='new-ssid', mode='a', channel='36', position='15,30,0', max_sector=4, sector=2, main_dB=-20, side_dB=-5, test=2) sta1 = net.addStation('sta1', mac='00:00:00:00:00:02', ip='10.0.0.1/8', position='10,20,0', sector=1) sta2 = net.addStation('sta2', mac='00:00:00:00:00:03', ip='10.0.0.2/8', position='20,50,0') sta3 = net.addStation('sta3', mac='00:00:00:00:00:04', ip='10.0.0.3/8', position='20,60,10') c1 = net.addController('c1', controller=Controller) info("*** Configuring wifi nodes\n") net.configureWifiNodes() net.addLink(sta1, ap1, error_prob=0.01) net.addLink(sta2, ap1, error_prob=0.02) net.addLink(sta3, ap1, error_prob=1) net.plotGraph(max_x=100, max_y=100) 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=UserAP, enable_wmediumd=True, enable_interference=True) info("*** Creating nodes\n") sta1 = net.addStation('sta1', radius_passwd='sdnteam', encrypt='wpa2', radius_identity='joe', position='110,120,0') sta2 = net.addStation('sta2', radius_passwd='hello', encrypt='wpa2', radius_identity='bob', position='200,100,0') ap1 = net.addAccessPoint('ap1', ssid='simplewifi', authmode='8021x', mode='a', channel='36', encrypt='wpa2', position='150,100,0') c0 = net.addController('c0', controller=Controller, ip='127.0.0.1', port=6633) info("*** Configuring Propagation Model\n") net.propagationModel(model="logDistance", exp=3.5) info("*** Configuring wifi nodes\n") net.configureWifiNodes() info("*** Associating Stations\n") net.addLink(sta1, ap1) net.addLink(sta2, ap1) net.plotGraph(max_x=300, max_y=300) info("*** Starting network\n") net.build() c0.start() ap1.start([c0]) info("*** Running CLI\n") CLI_wifi(net) info("*** Stopping network\n") net.stop()
def topology(coord): "Create a network." net = Mininet_wifi(controller=Controller, accessPoint=OVSKernelAP) info("*** Creating nodes\n") h1 = net.addHost('h1', mac='00:00:00:00:00:01', ip='10.0.0.1/8') sta1 = net.addStation('sta1', mac='00:00:00:00:00:02', ip='10.0.0.2/8') sta2 = net.addStation('sta2', mac='00:00:00:00:00:03', ip='10.0.0.3/8') ap1 = net.addAccessPoint('ap1', ssid='new-ssid', mode='g', channel='1', position='45,40,0') c1 = net.addController('c1', controller=Controller) info("*** Configuring wifi nodes\n") net.configureWifiNodes() info("*** Associating and Creating links\n") net.addLink(ap1, h1) net.plotGraph(max_x=200, max_y=200) if coord: sta1.coord = ['40.0,30.0,0.0', '31.0,10.0,0.0', '31.0,30.0,0.0'] sta2.coord = ['40.0,40.0,0.0', '55.0,31.0,0.0', '55.0,81.0,0.0'] net.startMobility(time=0, repetitions=1) if coord: net.mobility(sta1, 'start', time=1) net.mobility(sta2, 'start', time=2) net.mobility(sta1, 'stop', time=12) net.mobility(sta2, 'stop', time=22) else: net.mobility(sta1, 'start', time=1, position='40.0,30.0,0.0') net.mobility(sta2, 'start', time=2, position='40.0,40.0,0.0') net.mobility(sta1, 'stop', time=12, position='31.0,10.0,0.0') net.mobility(sta2, 'stop', time=22, position='55.0,31.0,0.0') net.stopMobility(time=23) 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, switch=OVSKernelSwitch) print "*** Creating nodes" sta1 = net.addStation('sta1', mac='00:00:00:00:00:01', ip='192.168.0.1/24', position='47.28,50,0') sta2 = net.addStation('sta2', mac='00:00:00:00:00:02', ip='192.168.0.2/24', position='54.08,50,0') ap3 = net.addBaseStation('ap3', range=20, ssid='ap-ssid3', mode='b', channel='1', position='50,50,0') c4 = net.addController('c4', controller=Controller, port=6653) print "*** Configuring wifi nodes" net.configureWifiNodes() print "*** Starting network" net.build() c4.start() ap3.start([c4]) sta1.cmd('iw dev sta1-wlan0 interface add mon0 type monitor &') sta1.cmd('ifconfig mon0 up &') sta2.cmd('iw dev sta2-wlan0 interface add mon0 type monitor &') sta2.cmd('ifconfig mon0 up &') sta2.cmd('pushd /home/alpha/Downloads; python3 -m http.server 80 &') getTrace(sta1, 'clientTrace.txt') getTrace(sta2, 'serverTrace.txt') replayingNetworkBehavior.addNode(sta1) replayingNetworkBehavior.addNode(sta2) replayingNetworkBehavior(net) net.autoAssociation() print "*** Running CLI" CLI_wifi(net) print "*** Stopping network" net.stop()
def topology(): "Create a network." net = Mininet_wifi(accessPoint=OVSKernelAP) print "*** Creating nodes" sta1 = net.addStation('sta1', mac='00:00:00:00:00:02', ip='10.0.0.2/8') sta2 = net.addStation('sta2', mac='00:00:00:00:00:03', ip='10.0.0.3/8') ap1 = net.addAccessPoint('ap1', ssid='ssid-ap1', mode='g', channel='1', failMode='standalone', position='15,30,0') ap2 = net.addAccessPoint('ap2', ssid='ssid-ap2', mode='g', channel='6', failMode='standalone', position='55,30,0') net.propagationModel(model='logDistance', exp=5) print "*** Configuring wifi nodes" net.configureWifiNodes() print "*** Creating links" net.addLink(ap1, ap2) net.addLink(ap1, sta1) net.addLink(ap1, sta2) 'plotting graph' net.plotGraph(max_x=100, max_y=100) net.startMobility(time=0) net.mobility(sta1, 'start', time=1, position='10,30,0') net.mobility(sta2, 'start', time=2, position='10,40,0') net.mobility(sta1, 'stop', time=30, position='60,30,0') net.mobility(sta2, 'stop', time=10, position='25,40,0') net.stopMobility(time=40) print "*** Starting network" net.build() print "*** Running CLI" CLI_wifi(net) print "*** Stopping network" net.stop()
def topobuild(): net = Mininet_wifi(controller=None, link=TCLink, switch=OVSSwitch, waitConnected=True, autoSetMacs=True) c0 = net.addController('c0', controller=RemoteController, ip='127.0.0.1', port=6653) # net.addController(c) net.start() graph = nx.DiGraph() edges = [(0, 1, 1), (0, 5, 1), (1, 5, 1), (1, 2, 1), (2, 6, 1), (2, 3, 1), (2, 4, 1), (3, 6, 1), (3, 4, 1), (4, 7, 1), (5, 6, 1), (5, 8, 1), (5, 10, 1), (6, 7, 1), (6, 8, 1), (7, 9, 1), (8, 9, 1)] for (x, y, z) in edges: if (y, x, z) in edges: edges.remove((y, x, z)) graph.add_weighted_edges_from(edges) total_node = len(graph.nodes) aps = {} host = [] for node in range(total_node): print 'node:', node aps['ap%s' % (node + 1)] = net.addAccessPoint('ap%s' % (node + 1), ssid='ssid%s' % (node + 1)) sta1 = net.addStation('sta%s' % (node + 1), cpu=.5 / total_node) info("*** Configuring wifi nodes\n") net.configureWifiNodes() for node in range(total_node): net.addLink('sta%s' % (node + 1), 'ap%s' % (node + 1)) for (sw1, sw2, z) in edges: sw1 = int(sw1) + 1 sw2 = int(sw2) + 1 if (sw1 < total_node) and (sw2 < total_node): net.addLink("ap%d" % sw1, "ap%d" % sw2) net.build() c0.start() for node in range(total_node): aps['ap%s' % (node + 1)].start([c0]) return net
def topology(): "Create a network." net = Mininet_wifi(controller=Controller, switch=OVSKernelSwitch) print "*** Creating nodes" ap1 = net.addAccessPoint('ap1', ssid="ssid_ap1", txpower=15, mode="g", channel=1, position="10,10,0") sta1 = net.addStation('sta1', ip='192.168.0.1/24', txpower=15, position='10,10,0') sta2 = net.addStation('sta2', ip='192.168.0.2/24', txpower=15, position='11.36,10,0') net.propagationModel(model='logDistance', exp=3, sL=1) # net.propagationModel('ITUPropagationLossModel', pL=50) # net.propagationModel('twoRayGroundPropagationLossModel') # net.propagationModel('friisPropagationLossModel', sL=2) print "*** Configuring wifi nodes" net.configureWifiNodes() print "*** Adding Link" net.addLink(sta1, ap1) net.addLink(sta2, ap1) print "*** Starting network" net.build() for i in range(1, 8): x = 10 + i * 1.36 y = 10 z = 0 pos = '%s,%s,%s' % (x, y, z) sta1.moveStationTo(pos) print sta1.params['rssi'][0] print "*** Running CLI" CLI_wifi(net) print "*** Stopping network" net.stop()
def topology(): "Create a network." net = Mininet_wifi(link=wmediumd, wmediumd_mode=interference, configureWiFiDirect=True, autoAssociation=False) info("*** Creating nodes\n") sta1 = net.addStation('sta1', ip='10.0.0.1/8', position='10,10,0', inNamespace=False) sta2 = net.addStation('sta2', ip='10.0.0.2/8', position='20,20,0') info("*** Configuring Propagation Model\n") net.propagationModel(model="logDistance", exp=3.5) info("*** Configuring wifi nodes\n") net.configureWifiNodes() net.plotGraph(max_x=200, max_y=200) info("*** Starting WiFi Direct\n") intf='wlxf4f26d193319' net.addLink(sta1, cls=physicalWifiDirectLink, intf=intf) net.addLink(sta2, cls=wifiDirectLink) info("*** Starting network\n") net.build() sta1.cmd('wpa_cli -ista1-wlan0 p2p_find') sta2.cmd('wpa_cli -ista2-wlan0 p2p_find') sta2.cmd('wpa_cli -ista2-wlan0 p2p_peers') sleep(3) sta1.cmd('wpa_cli -ista1-wlan0 p2p_peers') sleep(3) pin = sta1.cmd('wpa_cli -ista1-wlan0 p2p_connect %s pin auth' % sta2.params['mac'][1]) sleep(3) sta2.cmd('wpa_cli -ista2-wlan0 p2p_connect %s %s' % (sta1.params['mac'][1], pin)) # This is the interface/ip addr of the physical node os.system('ip addr add 10.0.0.3/8 dev %s' % intf) info("*** Running CLI\n") CLI_wifi(net) info("*** Stopping network\n") net.stop()
def topology(): "Create a network." net = Mininet_wifi(controller=Controller, accessPoint=OVSAP, link=wmediumd, wmediumd_mode=interference) info("*** Creating nodes\n") sta1 = net.addStation('sta1', mac='00:00:00:00:00:02', ip='10.0.0.1/8', speed=4) sta2 = net.addStation('sta2', mac='00:00:00:00:00:03', ip='10.0.0.2/8', speed=6) sta3 = net.addStation('sta3', mac='00:00:00:00:00:04', ip='10.0.0.3/8', speed=3) sta4 = net.addStation('sta4', mac='00:00:00:00:00:05', ip='10.0.0.4/8', speed=3) ap1 = net.addAccessPoint('ap1', ssid='new-ssid', mode='g', channel='1', position='45,45,0') c1 = net.addController('c1', controller=Controller) info("*** Configuring Propagation Model\n") net.propagationModel(model="logDistance", exp=4.5) info("*** Configuring wifi nodes\n") net.configureWifiNodes() info("*** Creating links\n") net.addLink(sta3, cls=adhoc, ssid='adhocNet') net.addLink(sta4, cls=adhoc, ssid='adhocNet') 'ploting graph' #net.plotGraph(max_x=200, max_y=200) info("*** Starting network\n") net.build() c1.start() ap1.start([c1]) getTrace(sta1, 'examples/replaying/replayingMobility/node1.dat') getTrace(sta2, 'examples/replaying/replayingMobility/node2.dat') getTrace(sta3, 'examples/replaying/replayingMobility/node3.dat') getTrace(sta4, 'examples/replaying/replayingMobility/node4.dat') replayingMobility(net) 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(): "Create a network." net = Mininet_wifi(link=wmediumd, wmediumd_mode=interference, configureWiFiDirect=True, autoAssociation=False) info("*** Creating nodes\n") sta1 = net.addStation('sta1', ip='10.0.0.1/8', position='10,10,0') sta2 = net.addStation('sta2', ip='10.0.0.2/8', position='20,20,0') info("*** Configuring Propagation Model\n") net.propagationModel(model="logDistance", exp=3.5) info("*** Configuring wifi nodes\n") net.configureWifiNodes() net.plotGraph(max_x=200, max_y=200) info("*** Starting WiFi Direct\n") net.addLink(sta1, cls=wifiDirectLink) net.addLink(sta2, cls=wifiDirectLink) info("*** Starting network\n") net.build() sta1.cmd('wpa_cli -ista1-wlan0 p2p_find') sta2.cmd('wpa_cli -ista2-wlan0 p2p_find') sta2.cmd('wpa_cli -ista2-wlan0 p2p_peers') sleep(3) sta1.cmd('wpa_cli -ista1-wlan0 p2p_peers') sleep(3) pin = sta1.cmd('wpa_cli -ista1-wlan0 p2p_connect %s pin auth' % sta2.params['mac'][0]) sleep(3) sta2.cmd('wpa_cli -ista2-wlan0 p2p_connect %s %s' % (sta1.params['mac'][0], pin)) info("*** Running CLI\n") CLI_wifi(net) info("*** Stopping network\n") net.stop()