def topology(coord): "Create a network." net = Mininet_wifi(controller=Controller) 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') 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(): net = Mininet_wifi() 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', failMode="standalone", position='50,50,0') h1 = net.addHost('h1', ip='10.0.0.3/8') net.setPropagationModel(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() ap1.start([]) info("*** Running CLI\n") CLI_wifi(net) info("*** Stopping network\n") net.stop()