def topology():
    "Create a network."
    net = Mininet_wifi(controller=RemoteController, accessPoint=UserAP,
                       link=wmediumd, wmediumd_mode=interference)

    info("*** Creating nodes\n")
    sta1 = net.addStation('sta1', position='15,20,0')
    sta2 = net.addStation('sta2', position='35,20,0')
    ap1 = net.addAccessPoint('ap1', mac='00:00:00:00:00:01', ssid="handover",
                             mode="g", channel="1", passwd='123456789a',
                             encrypt='wpa2', position='10,30,0')
    ap2 = net.addAccessPoint('ap2', mac='00:00:00:00:00:02', ssid="handover",
                             mode="g", channel="6", passwd='123456789a',
                             encrypt='wpa2', position='60,30,0')
    ap3 = net.addAccessPoint('ap3', mac='00:00:00:00:00:03', ssid="handover",
                             mode="g", channel="1", passwd='123456789a',
                             encrypt='wpa2', position='120,100,0')
    h1 = net.addHost('h1')
    h2 = net.addHost('h2')
    h3 = net.addHost('h3')
    c1 = net.addController('c1', controller=RemoteController)

    info("*** Configuring Propagation Model\n")
    net.setPropagationModel(model="logDistance", exp=3.5)

    info("*** Configuring wifi nodes\n")
    net.configureWifiNodes()

    info("*** Creating links\n")
    net.addLink(ap1, ap2)
    net.addLink(ap2, ap3)
    net.addLink(h1, ap1)
    net.addLink(h2, ap2)
    net.addLink(h3, ap3)

    net.plotGraph(min_x=-100, min_y=-100, max_x=200, max_y=200)

    info("*** Starting network\n")
    net.build()
    c1.start()
    ap1.start([c1])
    ap2.start([c1])
    ap3.start([c1])

    sta1.cmd('wpa_cli -i sta1-wlan0 roam 00:00:00:00:00:01')
    sta2.cmd('wpa_cli -i sta2-wlan0 roam 00:00:00:00:00:01')
    sta1.cmd('./sta1_2.py &')
    sta2.cmd('./sta2_2.py &')

    info("*** Running CLI\n")
    CLI(net)

    info("*** Stopping network\n")
    net.stop()
Esempio n. 2
0
def topology(broadcast):
    "Create a network."
    if broadcast:
        net = Mininet_wifi(controller=Controller)
    else:
        net = Mininet_wifi(controller=RemoteController)

    info("*** Creating nodes\n")
    s1 = net.addSwitch('s1')
    h1 = net.addHost('h1')
    h2 = net.addHost('h2')
    h3 = net.addHost('h3')
    c1 = net.addController('c1')

    info("*** Configuring wifi nodes\n")
    net.configureWifiNodes()

    info("*** Associating...\n")
    net.addLink(s1, h1, bw=10)
    net.addLink(s1, h1, bw=10)
    net.addLink(s1, h2)
    net.addLink(s1, h3)

    info("*** Starting network\n")
    net.build()
    c1.start()
    s1.start([c1])

    if broadcast:
        h1.cmd('modprobe bonding mode=3')
    else:
        h1.cmd('modprobe bonding mode=4')
    h1.cmd('ip link add bond0 type bond')
    h1.cmd('ip link set bond0 address 00:00:00:11:22:33')
    h1.cmd('ip link set h1-eth0 down')
    h1.cmd('ip link set h1-eth0 address 00:00:00:00:00:11')
    h1.cmd('ip link set h1-eth0 master bond0')
    h1.cmd('ip link set h1-eth1 down')
    h1.cmd('ip link set h1-eth1 address 00:00:00:00:00:22')
    h1.cmd('ip link set h1-eth1 master bond0')
    h1.cmd('ip addr add 10.0.0.1/8 dev bond0')
    h1.cmd('ip addr del 10.0.0.1/8 dev h1-eth0')
    h1.cmd('ip link set bond0 up')

    info("*** Running CLI\n")
    CLI_wifi(net)

    os.system('rmmod bonding')

    info("*** Stopping network\n")
    net.stop()
Esempio n. 3
0
def topology():
    "Create a network."
    net = Mininet_wifi()

    info("*** Creating nodes\n")
    sta1 = net.addStation('sta1', mac='08:01:01:01:01:11', ip='10.0.0.1/8', position='15,35,0',range=20)
    sta2 = net.addStation('sta2', mac='02:02:02:02:02:02', ip='10.0.0.2/8', position='25,35,0',range=20)
    h1 = net.addHost('h1', mac='8a:84:a4:92:34:9e', ip='10.0.0.3/8', position='27,35,0')
    ap1 = net.addAccessPoint('ap1', cls=UserAP, inNamespace=True, ssid='ssid-ap1', mode='g', channel='1', position='15,30,0', range=30)


    info("*** Configuring wifi nodes\n")
    net.configureWifiNodes()

    info("*** Creating links\n")
    net.addLink(sta1, ap1)
    net.addLink(sta2, ap1)
    net.addLink(h1, ap1)

    net.plotGraph(max_x=100, max_y=100)
    
    info("*** Starting network\n")
    net.build()
    ap1.start([])

    info("*** Loading XDP program\n")
    ap1.cmd("mount -t bpf bpf /sys/fs/bpf/")
    ap1.cmd("ulimit -l unlimited")

    info("*** Running CLI\n")
    CLI(net)

    info("*** Stopping network\n")
    net.stop()
Esempio n. 4
0
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()
Esempio n. 5
0
def topology(args):

    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', position='10,30,0')

    net.setPropagationModel(model="logDistance", exp=4.5)

    info("*** Configuring wifi nodes\n")
    net.configureWifiNodes()

    info("*** Creating links\n")
    net.addLink(ap1, h1)

    if '-p' not in args:
        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()
Esempio n. 6
0
def topology():
    'Create a network.'
    net = Mininet_wifi()

    info('*** Adding stations/hosts\n')
    sta1 = net.addStation('sta1', ip='10.0.1.1', mac='00:00:00:00:00:01')
    h1 = net.addHost('h1', ip='10.0.2.2', mac='00:00:00:00:00:02')

    info('*** Adding P4RuntimeAP\n')
    ap1 = net.addAccessPoint('ap1',
                             cls=P4RuntimeAP,
                             json_path='build/case01.json',
                             runtime_json_path='runtime/ap1-runtime.json',
                             log_console=True,
                             log_dir=os.path.abspath('logs'),
                             log_file='ap1.log',
                             pcap_dump=os.path.abspath('pcaps'))

    net.configureWifiNodes()

    info('*** Creating links\n')
    net.addLink(sta1, ap1)
    net.addLink(h1, ap1)

    info('*** Starting network\n')
    net.start()
    net.staticArp()

    info('*** Running CLI\n')
    CLI(net)

    info('*** Stopping network\n')
    net.stop()
def topology():
    "Create a network."
    net = Mininet_wifi( controller=Controller )

    info("*** Creating nodes\n")
    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')

    net.configureWifiNodes()

    info("*** Adding Link\n")
    net.addLink(sta1, ap1)
    net.addLink(sta2, ap1)
    net.addLink(h3, ap1)
    net.addLink(h4, 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()
Esempio n. 8
0
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()
def topo():

    net = Mininet_wifi(controller=Controller, accessPoint=OVSKernelAP)

    info("*** Creando nodos\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',
                          range='20')
    ap1 = net.addAccessPoint('ap1',
                             ssid='ap1-ssid',
                             mode='g',
                             channel='1',
                             position='30,50,0',
                             range='30')
    ap2 = net.addAccessPoint('ap2',
                             ssid='ap2-ssid',
                             mode='g',
                             channel='1',
                             position='90,50,0',
                             range='30')
    ap3 = net.addAccessPoint('ap3',
                             ssid='ap3-ssid',
                             mode='g',
                             channel='1',
                             position='150,50,0',
                             range='30')
    c1 = net.addController('c1', controller=Controller)

    info("*** Configurando nodos\n")
    net.configureWifiNodes()

    info("*** Creando links\n")
    net.addLink(ap1, h1)
    net.addLink(ap1, ap2)
    net.addLink(ap2, ap3)

    info("*** Dibujando Topo con matplotlib\n")
    net.plotGraph(max_x=200, max_y=200)

    info("*** Configurando Movilidad (sta1)\n")
    net.startMobility(time=0, AC='ssf')
    net.mobility(sta1, 'start', time=20, position='1,50,0')
    net.mobility(sta1, 'stop', time=79, position='159,50,0')
    net.stopMobility(time=200)

    info("*** Network UP!\n")
    net.build()
    c1.start()
    ap1.start([c1])
    ap2.start([c1])
    ap3.start([c1])

    info("*** Cargamos Mininet-Wifi CLI\n")
    CLI_wifi(net)

    info("*** Parando network\n")
    net.stop()
Esempio n. 10
0
def topology():
    "Create a network."
    net = Mininet_wifi(link=wmediumd, wmediumd_mode=interference)

    info("*** Creating nodes\n")
    h1 = net.addHost('h1', ip='10.0.0.3/8')
    h2 = net.addHost('h2', ip='10.0.0.4/8')
    sta1 = net.addStation('sta1',
                          ip='10.0.0.1/8',
                          min_x=55,
                          max_x=60,
                          min_y=55,
                          max_y=60,
                          min_v=5,
                          max_v=5)
    sta2 = net.addStation('sta2',
                          ip='10.0.0.2/8',
                          min_x=20,
                          max_x=30,
                          min_y=20,
                          max_y=30,
                          min_v=5,
                          max_v=5)
    ap1 = net.addAccessPoint('ap1',
                             ssid='new-ssid',
                             model='DI524',
                             mode='g',
                             channel='1',
                             position='50,50,0')
    c1 = net.addController(
        'c1', controller=lambda name: RemoteController(name, ip='127.0.0.1'))

    info("*** Configuring propagation model\n")
    net.setPropagationModel(model="logDistance", exp=4)

    info("*** Configuring wifi nodes\n")
    net.configureWifiNodes()

    net.addLink(ap1, h1)
    net.addLink(ap1, h2)

    net.plotGraph(max_x=100, max_y=100)

    net.setMobilityModel(time=0, model='RandomDirection', max_x=100, max_y=100)

    info("*** Starting network\n")
    net.build()
    c1.start()
    sta1.cmd('cd /var/www/html')
    sta1.cmd('python -m SimpleHTTPServer & ')
    sta2.cmd('cd /home/wifi/video/pensieve/real_exp')

    ap1.start([c1])

    info("*** Running CLI\n")
    CLI(net)

    info("*** Stopping network\n")
    net.stop()
Esempio n. 11
0
def topology():

    "Create a network."
    net = Mininet_wifi( controller=RemoteController )

    info ("*** Creating nodes\n")
    ap1 = net.addAccessPoint( 'ap1', ssid='new-ssid', mode='g', channel='1' )
    sta2 = net.addStation( 'sta2', wlans=1, mac='00:02:00:00:00:02', ip='10.0.0.2/8' )
    sta3 = net.addStation( 'sta3', wlans=1, mac='00:02:00:00:00:03', ip='10.0.0.3/8' )
    sta4 = net.addStation( 'sta4', wlans=1, mac='00:02:00:00:00:04', ip='10.0.0.4/8' )
    c5 = net.addController( 'c5', ip='127.0.0.1', port=6633 )
    h7 = net.addHost( 'h7', mac='00:00:00:00:00:07', ip='10.0.0.7/8' )

    info("*** Configuring wifi nodes\n")
    net.configureWifiNodes()

    info("*** Creating links\n")
    net.addLink(sta4, ap1)
    net.addLink(sta3, ap1)
    net.addLink(sta2, ap1)
    net.addLink(ap1, h7)

    info("*** Starting network\n")
    net.build()
    c5.start()
    ap1.start( [c5] )

    ap1.cmd("iw dev ap1-wlan0 interface add vwlan1 type managed")   
    ap1.cmd("iw dev ap1-wlan0 interface add vwlan2 type managed")
    ap1.cmd("ifconfig vwlan1 hw ether 00:00:00:aa:bb:11")
    ap1.cmd("ifconfig vwlan2 hw ether 00:00:00:aa:bb:22")
    ap1.cmd("ifconfig vwlan1 up")
    ap1.cmd("ifconfig vwlan2 up")
    ap1.cmd("ovs-vsctl add-port ap1 vwlan1")
    ap1.cmd("ovs-vsctl add-port ap1 vwlan2")
    ap1.cmd("echo -e 'interface=vwlan1\ndriver=nl80211\nssid=vwlan1\nhw_mode=g\nchannel=1\nwme_enabled=1\nwmm_enabled=1' > vwlan1.conf")
    ap1.cmd("hostapd -B vwlan1.conf &")
    ap1.cmd("echo -e 'interface=vwlan2\ndriver=nl80211\nssid=vwlan2\nhw_mode=g\nchannel=1\nwme_enabled=1\nwmm_enabled=1' > vwlan2.conf")
    ap1.cmd("hostapd -B vwlan2.conf &")

    sta2.cmd("ifconfig sta2-wlan0 down")
    sta2.cmd("iwconfig sta2-wlan0 essid 'vwlan1'")
    sta2.cmd("ifconfig sta2-wlan0 up")

    sta3.cmd("ifconfig sta3-wlan0 down")
    sta3.cmd("iwconfig sta3-wlan0 essid 'vwlan2'")
    sta3.cmd("ifconfig sta3-wlan0 up")

    ### after the above setting, sta2( sta3, or sta4) can ping h7. sta2 can also ping sta3/sta4.

    #the following rule can block sta2 from communicating with other host or station
    ap1.cmd("ovs-ofctl add-flow ap1 priority=65535,ip,nw_dst=10.0.0.2,actions=drop")

    info("*** Running CLI\n")
    CLI( net )

    info("*** Stopping network\n")
    net.stop()
Esempio n. 12
0
def topology(args):
    "Create a network."
    net = Mininet_wifi()

    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 propagation model\n")
    net.setPropagationModel(model="logDistance", exp=4.5)

    info("*** Configuring wifi nodes\n")
    net.configureWifiNodes()

    info("*** Associating and Creating links\n")
    net.addLink(ap1, h1)

    if '-p' not in args:
        net.plotGraph(max_x=200, max_y=200)

    if '-c' in args:
        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, mob_rep=1, reverse=False)

    p1, p2, p3, p4 = dict(), dict(), dict(), dict()
    if '-c' not in args:
        p1 = {'position': '40.0,30.0,0.0'}
        p2 = {'position': '40.0,40.0,0.0'}
        p3 = {'position': '31.0,10.0,0.0'}
        p4 = {'position': '55.0,31.0,0.0'}

    net.mobility(sta1, 'start', time=1, **p1)
    net.mobility(sta2, 'start', time=2, **p2)
    net.mobility(sta1, 'stop', time=12, **p3)
    net.mobility(sta2, 'stop', time=22, **p4)
    net.stopMobility(time=23)

    info("*** Starting network\n")
    net.build()
    c1.start()
    ap1.start([c1])

    info("*** Running CLI\n")
    CLI(net)

    info("*** Stopping network\n")
    net.stop()
Esempio n. 13
0
def topology():

    net = Mininet_wifi(controller=Controller,
                       link=TCLink,
                       switch=OVSKernelSwitch)

    print "*** Creating nodes"
    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',
                          range='20')
    ap1 = net.addAccessPoint('ap1',
                             ssid='ap1-ssid',
                             mode='g',
                             channel='1',
                             position='30,50,0',
                             range='30')
    ap2 = net.addAccessPoint('ap2',
                             ssid='ap2-ssid',
                             mode='g',
                             channel='1',
                             position='90,50,0',
                             range='30')
    ap3 = net.addAccessPoint('ap3',
                             ssid='ap3-ssid',
                             mode='g',
                             channel='1',
                             position='130,50,0',
                             range='30')
    c1 = net.addController('c1', controller=Controller)

    print "*** Associating and Creating links"
    net.addLink(ap1, h1)
    net.addLink(ap1, ap2)
    net.addLink(ap2, ap3)

    print "*** Starting network"
    net.build()
    c1.start()
    ap1.start([c1])
    ap2.start([c1])
    ap3.start([c1])

    net.startMobility(startTime=0, AC='ssf')
    net.mobility(sta1, 'start', time=20, position='1,50,0')
    net.mobility(sta1, 'stop', time=79, position='159,50,0')
    net.stopMobility(stopTime=80)

    net.plotGraph(max_x=160, max_y=160)

    print "*** Running CLI"
    CLI(net)

    print "*** Stopping network"
    net.stop()
Esempio n. 14
0
def topology():

    "Create a network."
    net = Mininet_wifi(controller=Controller,
                       switch=OVSKernelSwitch,
                       accessPoint=OVSKernelAP)

    info("*** Creating nodes\n")
    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)

    info("*** Configuring WiFi Nodes\n")
    net.configureWifiNodes()

    h1.plot(position='35,90,0')
    s3.plot(position='35,80,0')

    info("*** Creating links\n")
    net.addLink(ap1, s3)
    net.addLink(ap2, s3)
    net.addLink(h1, s3)

    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)

    info("*** Starting network\n")
    net.build()
    c1.start()
    ap1.start([c1])
    ap2.start([c1])
    s3.start([c1])

    info("*** Running CLI\n")
    CLI_wifi(net)

    info("*** Stopping network\n")
    net.stop()
Esempio n. 15
0
def topology():
    "Create a network."
    net = Mininet_wifi(controller=RemoteController, link=TCLink)

    info("*** Creating nodes\n")
    ap1 = net.addAccessPoint('ap1', ssid="ssid_1", mode="g", channel="5")
    sta1 = net.addStation('sta1', ip="192.168.0.100/24")
    h1 = net.addHost('h1', ip="192.168.0.1/24", mac="00:00:00:00:00:04")
    c0 = net.addController('c0',
                           controller=RemoteController,
                           ip='127.0.0.1',
                           port=6653)

    info("*** Configuring wifi nodes\n")
    net.configureWifiNodes()

    info("*** Adding Link\n")
    net.addLink(h1, ap1, bw=1000000000)
    net.addLink(ap1, sta1)

    info("*** Starting network\n")
    net.build()
    c0.start()
    ap1.start([c0])

    sleep(5)
    """drop tcp traffic to 80 port"""
    ap1.cmd(
        "ovs-ofctl add-flow ap1 priority=65535,ip,dl_type=0x0800,nw_proto=6,tp_dst=800,nw_dst=192.168.0.1,actions=drop"
    )
    """Create Queues"""

    ap1.cmd(
        "ovs-vsctl -- set port ap1-eth2 qos=@newqos -- --id=@newqos create qos type=linux-htb other-config:max-rate=1000000000 queues:1=@q1 queues:2=@q2 queues:3=@q3 queues:4=@q4 -- --id=@q1 create queue other-config:min-rate=10000 other-config:max-rate=20000 -- --id=@q2 create queue other-config:min-rate=200000 other-config:max-rate=300000 -- --id=@q3 create queue other-config:min-rate=3000000 other-config:max-rate=4000000 -- --id=@q4 create queue other-config:min-rate=40000000 other-config:max-rate=50000000"
    )

    ap1.cmd(
        "ovs-ofctl add-flow ap1 priority=65535,ip,dl_type=0x0800,nw_proto=6,tp_dst=80,nw_dst=192.168.0.1,actions=set_queue:1,normal"
    )
    ap1.cmd(
        "ovs-ofctl add-flow ap1 priority=65535,ip,dl_type=0x0800,nw_proto=17,tp_dst=3001,nw_dst=192.168.0.1,actions=set_queue:2,normal"
    )
    ap1.cmd(
        "ovs-ofctl add-flow ap1 priority=65535,ip,dl_type=0x0800,nw_proto=6,tp_dst=4001,nw_dst=192.168.0.1,actions=set_queue:3,normal"
    )
    ap1.cmd(
        "ovs-ofctl add-flow ap1 priority=65535,ip,dl_type=0x0800,nw_proto=6,tp_dst=5001,nw_dst=192.168.0.1,actions=set_queue:4,normal"
    )

    info("*** Running CLI\n")
    CLI_wifi(net)

    info("*** Stopping network\n")
    net.stop()
Esempio n. 16
0
def topology():

    net = Mininet_wifi(set_socket_ip='127.0.0.1', set_socket_port=12345)
    # set_socket_ip: localhost must be replaced by ip address
    # of the network interface of your system
    # The same must be done with socket_client.py

    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)

    info("*** Starting network\n")
    net.addNAT(linkTo='ap1').configDefault()
    net.build()
    ap1.start([])

    net.start_socket_server()

    nodes = net.stations + net.aps
    net.telemetry(nodes=nodes,
                  data_type='position',
                  min_x=0,
                  min_y=0,
                  max_x=100,
                  max_y=100)

    info("*** Running CLI\n")
    CLI_wifi(net)

    info("*** Stopping network\n")
    net.stop()
Esempio n. 17
0
def topology(args):
    "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)

    if '-p' not in args:
        net.plotGraph(max_x=200, max_y=200)

    if '-c' in args:
        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 '-c' in args:
        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()
Esempio n. 18
0
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()
Esempio n. 19
0
def topology():
    "Create a network."
    net = Mininet_wifi(controller=Controller, accessPoint=OVSKernelAP)

    info("*** Creating nodes\n")
    sta1 = net.addStation('sta1', position='10,10,0')
    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)
    s3 = net.addSwitch('s3')
    h1 = net.addHost('h1')
    c1 = net.addController('c1', controller=Controller)

    net.setPropagationModel(model="logDistance", exp=5)

    info("*** Configuring wifi nodes\n")
    net.configureWifiNodes()

    info("*** Creating links\n")
    net.addLink(ap1, s3)
    net.addLink(ap2, s3)
    net.addLink(s3, h1)

    net.plotGraph(max_x=100, max_y=100)

    info("*** Starting network\n")
    net.build()
    c1.start()
    ap1.start([c1])
    ap2.start([c1])
    s3.start([c1])

    info("*** Running CLI\n")
    CLI(net)

    info("*** Stopping network\n")
    net.stop()
Esempio n. 20
0
def topology(remote_controller):
    'Create a network.'
    net = Mininet_wifi()

    info('*** Adding stations/hosts\n')
    h1 = net.addHost('h1', ip='10.0.0.1', mac="00:00:00:00:00:01")
    h2 = net.addHost('h2', ip='10.0.0.2', mac="00:00:00:00:00:02")
    sta1 = net.addStation('sta1', ip='10.0.0.3', mac="00:00:00:00:00:03")
    sta2 = net.addStation('sta2', ip='10.0.0.4', mac="00:00:00:00:00:04")

    args1 = dict()
    args2 = dict()
    if not remote_controller:
        path = os.path.dirname(os.path.abspath(__file__))
        json_file = path + '/ap-runtime.json'
        config1 = path + '/commands_ap1.txt'
        config2 = path + '/commands_ap2.txt'
        args1 = {'json': json_file, 'switch_config': config1}
        args2 = {'json': json_file, 'switch_config': config2}

    info('*** Adding P4APs\n')
    ap1 = net.addAccessPoint('ap1', cls=ONOSBmv2AP, netcfg=True, **args1)
    ap2 = net.addAccessPoint('ap2', cls=ONOSBmv2AP, netcfg=True, **args2)

    if remote_controller:
        info('*** Adding Controller\n')
        net.addController('c0', controller=RemoteController)

    net.configureWifiNodes()

    info('*** Creating links\n')
    net.addLink(sta1, ap1)
    net.addLink(sta2, ap2)
    net.addLink(h1, ap1)
    net.addLink(h2, ap2)

    info('*** Starting network\n')
    net.start()
    if not remote_controller:
        net.staticArp()

    info('*** Running CLI\n')
    CLI(net)

    info('*** Stopping network\n')
    net.stop()
Esempio n. 21
0
def topology():
    'Create a network.'
    net = Mininet_wifi()

    info('*** Adding stations/hosts\n')
    h1 = net.addHost('h1', ip='10.0.0.1', mac="00:00:00:00:00:01")
    h2 = net.addHost('h2', ip='10.0.0.2', mac="00:00:00:00:00:02")
    sta1 = net.addStation('sta1', ip='10.0.0.3', mac="00:00:00:00:00:03")
    sta2 = net.addStation('sta2', ip='10.0.0.4', mac="00:00:00:00:00:04")

    info('*** Adding P4APs\n')
    path = os.path.dirname(os.path.abspath(__file__))
    json_file = path + '/ap-runtime.json'
    config1 = path + '/commands_ap1.txt'
    config2 = path + '/commands_ap2.txt'
    ap1 = net.addAccessPoint('ap1',
                             json=json_file,
                             loglevel='info',
                             pktdump=False,
                             switch_config=config1,
                             cls=Bmv2AP)
    ap2 = net.addAccessPoint('ap2',
                             json=json_file,
                             loglevel='info',
                             pktdump=False,
                             switch_config=config2,
                             cls=Bmv2AP)

    net.configureWifiNodes()

    info('*** Creating links\n')
    net.addLink(sta1, ap1)
    net.addLink(sta2, ap2)
    net.addLink(h1, ap1)
    net.addLink(h2, ap2)

    info('*** Starting network\n')
    net.start()
    net.staticArp()

    info('*** Running CLI\n')
    CLI(net)

    info('*** Stopping network\n')
    net.stop()
Esempio n. 22
0
def topology():
    "Create a network."
    net = Mininet_wifi(controller=RemoteController,
                       link=TCLink,
                       switch=OVSKernelSwitch,
                       accessPoint=OVSKernelAP)

    info("*** Creating nodes\n")
    ap1 = net.addAccessPoint('ap1', ssid="ssid_1", mode="g", channel="5")
    ap2 = net.addAccessPoint('ap2', ssid="ssid_2", mode="g", channel="11")
    sta3 = net.addStation('sta3', ip="192.168.0.100/24", wlans=2)
    h4 = net.addHost('h4', ip="192.168.0.1/24", mac="00:00:00:00:00:04")
    s5 = net.addSwitch('s5')
    c0 = net.addController('c0',
                           controller=RemoteController,
                           ip='127.0.0.1',
                           port=6653)

    info("*** Configuring wifi nodes\n")
    net.configureWifiNodes()

    info("*** Adding Link\n")
    net.addLink(h4, s5, bw=1000)
    net.addLink(ap1, s5, bw=1000)
    net.addLink(ap2, s5, bw=1000)
    net.addLink(ap1, sta3)
    net.addLink(sta3, ap2)

    info("*** Starting network\n")
    net.build()
    c0.start()
    s5.start([c0])
    ap1.start([c0])
    ap2.start([c0])

    sta3.cmd("ifconfig sta3-wlan1 192.168.1.100/24 up")
    h4.cmd("ifconfig h4-eth0:0 192.168.1.1/24")

    info("*** Running CLI\n")
    CLI_wifi(net)

    info("*** Stopping network\n")
    net.stop()
Esempio n. 23
0
def topology(qos):
    "Create a network."
    net = Mininet_wifi(controller=RemoteController)

    info("*** Creating nodes\n")
    sta1 = net.addStation('sta1', position='10,10,0')
    h1 = net.addHost('h1')
    ap1 = net.addAccessPoint('ap1',
                             ssid="simplewifi",
                             position='10,20,0',
                             mode="g",
                             channel="5",
                             protocols='OpenFlow13',
                             datapath='user')
    c0 = net.addController('c0')

    info("*** Configuring wifi nodes\n")
    net.configureWifiNodes()

    info("*** Associating Stations\n")
    net.addLink(sta1, ap1)
    net.addLink(h1, ap1)

    info("*** Starting network\n")
    net.build()
    c0.start()
    ap1.start([c0])

    if qos:
        ap1.cmdPrint('ovs-ofctl -O OpenFlow13 add-meter ap1 '
                     '\'meter=1,kbps,bands=type=drop,rate=5000\'')
        ap1.cmdPrint('ovs-ofctl -O OpenFlow13 add-flow ap1 '
                     '\'priority=1,in_port=1 action=meter:1,2\'')
        ap1.cmdPrint('ovs-ofctl -O OpenFlow13 add-flow ap1 '
                     '\'priority=1,in_port=2 action=meter:1,1\'')

    info("*** Running CLI\n")
    CLI_wifi(net)

    info("*** Stopping network\n")
    net.stop()
Esempio n. 24
0
def topology():

    net = Mininet_wifi()

    info("*** Creating nodes\n")
    net.addStation('sta1',
                   mac='00:00:00:00:00:02',
                   ip='0/0',
                   position='30,60,0')
    ap1 = net.addAccessPoint('ap1',
                             ssid='new-ssid',
                             mode='g',
                             channel='1',
                             position='50,50,0',
                             failMode='standalone')
    h1 = net.addHost('h1', ip='192.168.11.1/24', inNamespace=False)

    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([])

    h1.cmd("echo 1 > /proc/sys/net/ipv4/ip_forward")

    info("*** Running CLI\n")
    CLI_wifi(net)

    info("*** Stopping network\n")
    net.stop()
Esempio n. 25
0
def topology():
    "Create a network."
    net = Mininet_wifi(link=wmediumd, wmediumd_mode=interference)

    info("*** Creating nodes\n")
    net.addStation('sta1',
                   ip='192.168.0.1',
                   radius_passwd='sdnteam',
                   encrypt='wpa2',
                   radius_identity='joe',
                   position='110,120,0')
    net.addStation('sta2',
                   ip='192.168.0.2',
                   radius_passwd='hello',
                   encrypt='wpa2',
                   radius_identity='bob',
                   position='200,100,0')
    ap1 = net.addStation('ap1', ip='192.168.0.100', position='150,100,0')
    h1 = net.addHost('h1', ip='10.0.0.100/8')
    s1 = net.addSwitch('s1')
    c0 = net.addController('c0',
                           controller=RemoteController,
                           ip='127.0.0.1',
                           port=6653)

    info("*** Configuring Propagation Model\n")
    net.setPropagationModel(model="logDistance", exp=3.5)

    info("*** Configuring wifi nodes\n")
    net.configureWifiNodes()

    ap1.setMasterMode(intf='ap1-wlan0',
                      ssid='ap1-ssid',
                      channel='1',
                      mode='n',
                      authmode='8021x',
                      encrypt='wpa2',
                      radius_server='10.0.0.100')

    info("*** Associating Stations\n")
    net.addLink(ap1, s1)
    net.addLink(s1, h1)

    info("*** Starting network\n")
    net.build()
    c0.start()
    s1.start([c0])

    ap1.cmd('ifconfig ap1-eth2 10.0.0.200')
    ap1.cmd('ifconfig ap1-wlan0 0')

    h1.cmdPrint('rc.radiusd start')
    ap1.cmd('echo 1 > /proc/sys/net/ipv4/ip_forward')
    s1.cmd('ovs-ofctl add-flow s1 in_port=1,priority=65535,'
           'dl_type=0x800,nw_proto=17,tp_dst=1812,actions=2,controller')

    info("*** Running CLI\n")
    CLI_wifi(net)

    os.system('pkill radiusd')

    info("*** Stopping network\n")
    net.stop()
Esempio n. 26
0
def topology():
    "Create a network."
    net = Mininet_wifi(controller=RemoteController,
                       accessPoint=UserAP,
                       switch=UserSwitch,
                       link=wmediumd,
                       wmediumd_mode=interference)

    info("*** Creating nodes\n")
    sta1 = net.addStation('sta1', position='15,20,0')
    sta2 = net.addStation('sta2', position='35,20,0')
    ap1 = net.addAccessPoint('ap1',
                             mac='00:00:00:00:00:01',
                             ssid="handover",
                             mode="g",
                             channel="1",
                             passwd='123456789a',
                             encrypt='wpa2',
                             position='10,30,0')
    ap2 = net.addAccessPoint('ap2',
                             mac='00:00:00:00:00:02',
                             ssid="handover",
                             mode="g",
                             channel="6",
                             passwd='123456789a',
                             encrypt='wpa2',
                             position='60,30,0')
    ap3 = net.addAccessPoint('ap3',
                             mac='00:00:00:00:00:03',
                             ssid="handover",
                             mode="g",
                             channel="1",
                             passwd='123456789a',
                             encrypt='wpa2',
                             position='120,100,0')
    s4 = net.addSwitch('s4')
    h1 = net.addHost('h1')
    controller_ = net.addHost('con', ip='10.0.0.100/8', inNamespace=False)
    c1 = net.addController('c1', controller=RemoteController, ip='127.0.0.1')

    info("*** Configuring Propagation Model\n")
    net.setPropagationModel(model="logDistance", exp=3.5)

    info("*** Configuring wifi nodes\n")
    net.configureWifiNodes()

    net.plotGraph(max_x=300, max_y=300)

    info("*** Creating links\n")
    net.addLink(h1, ap1)
    net.addLink(s4, ap1)
    net.addLink(s4, ap2)
    net.addLink(s4, ap3)
    net.addLink(s4, controller_)

    info("*** Starting network\n")
    net.build()
    net.addNAT().configDefault()
    c1.start()
    ap1.start([c1])
    ap2.start([c1])
    ap3.start([c1])
    s4.start([c1])

    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')
    sta1.cmd('wpa_cli -i sta1-wlan0 roam 00:00:00:00:00:01')
    sta2.cmd('wpa_cli -i sta2-wlan0 roam 00:00:00:00:00:01')
    sta1.cmd('./sta1_1.py &')
    sta2.cmd('./sta2_1.py &')

    info("*** Running CLI\n")
    CLI_wifi(net)

    info("*** Stopping network\n")
    net.stop()
Esempio n. 27
0
def topology():
    "Create a network."
    net = Mininet_wifi(controller=Controller,
                       link=wmediumd,
                       wmediumd_mode=interference)

    info("*** Creating nodes\n")

    ap1 = net.addAccessPoint('ap1', wlans=2, ssid='ssid1,', position='25,25,0')
    ap2 = net.addAccessPoint('ap2', wlans=2, ssid='ssid2,', position='50,50,0')
    ap3 = net.addAccessPoint('ap3', wlans=2, ssid='ssid3,', position='50,75,0')
    ap4 = net.addAccessPoint('ap4', wlans=2, ssid='ssid4,', position='75,75,0')

    #Gateway APs
    ap5 = net.addAccessPoint('ap5', wlans=2, ssid='ssid5,', position='40,40,0')
    ap6 = net.addAccessPoint('ap6', wlans=2, ssid='ssid6,', position='80,40,0')
    ap7 = net.addAccessPoint('ap7', wlans=2, ssid='ssid7,', position='50,60,0')

    #ap8 = net.addAccessPoint('ap8', wlans=2, ssid='ssid8', position = '33, 33,0')

    nodes1 = []
    nodes2 = []
    nodes3 = []
    nodes4 = []
    nodes5 = []
    nodes6 = []

    c0 = net.addController('c0')
    i = 1

    sta1 = net.addStation('sta1', position='0,0,0')
    sta2 = net.addStation('sta2', position='15,15,0')
    sta3 = net.addStation('sta3', position='25,10,0')
    sta4 = net.addStation('sta4', position='25,30,0')
    sta5 = net.addStation('sta5', position='45,5,0')
    sta6 = net.addStation('sta6', position='45,25,0')
    sta7 = net.addStation('sta7', position='37,18,0')
    sta8 = net.addStation('sta8', position='37,48,0')
    sta9 = net.addStation('sta9', position='10,25,0')
    sta10 = net.addStation('sta10', position='10,45,0')

    nodes1.append(sta1)
    nodes1.append(sta2)
    nodes1.append(sta3)
    nodes1.append(sta4)
    nodes1.append(sta5)
    nodes1.append(sta6)
    nodes1.append(sta7)
    nodes1.append(sta8)
    nodes1.append(sta9)
    nodes1.append(sta10)

    sta11 = net.addStation('sta11', position='50,0,0')
    sta12 = net.addStation('sta12', position='55,15,0')
    sta13 = net.addStation('sta13', position='75,10,0')
    sta14 = net.addStation('sta14', position='75,30,0')
    sta15 = net.addStation('sta15', position='95,5,0')
    sta16 = net.addStation('sta16', position='95,25,0')
    sta17 = net.addStation('sta17', position='87,18,0')
    sta18 = net.addStation('sta18', position='87,48,0')
    sta19 = net.addStation('sta19', position='60,25,0')
    sta20 = net.addStation('sta20', position='60,45,0')
    nodes2.append(sta11)
    nodes2.append(sta12)
    nodes2.append(sta13)
    nodes2.append(sta14)
    nodes2.append(sta15)
    nodes2.append(sta16)
    nodes2.append(sta17)
    nodes2.append(sta18)
    nodes2.append(sta19)
    nodes2.append(sta20)

    sta21 = net.addStation('sta21', position='0,50,0')
    sta22 = net.addStation('sta22', position='15,65,0')
    sta23 = net.addStation('sta23', position='25,60,0')
    sta24 = net.addStation('sta24', position='25,80,0')
    sta25 = net.addStation('sta25', position='45,55,0')
    sta26 = net.addStation('sta26', position='45,75,0')
    sta27 = net.addStation('sta27', position='37,68,0')
    sta28 = net.addStation('sta28', position='37,98,0')
    sta29 = net.addStation('sta29', position='10,75,0')
    sta30 = net.addStation('sta30', position='10,95,0')
    nodes3.append(sta21)
    nodes3.append(sta22)
    nodes3.append(sta23)
    nodes3.append(sta24)
    nodes3.append(sta25)
    nodes3.append(sta26)
    nodes3.append(sta27)
    nodes3.append(sta28)
    nodes3.append(sta29)
    nodes3.append(sta30)

    sta31 = net.addStation('sta31', position='50,50,0')
    sta32 = net.addStation('sta32', position='55,65,0')
    sta33 = net.addStation('sta33', position='75,60,0')
    sta34 = net.addStation('sta34', position='75,80,0')
    sta35 = net.addStation('sta35', position='95,55,0')
    sta36 = net.addStation('sta36', position='95,75,0')
    sta37 = net.addStation('sta37', position='87,68,0')
    sta38 = net.addStation('sta38', position='87,98,0')
    sta39 = net.addStation('sta39', position='60,75,0')
    sta40 = net.addStation('sta40', position='60,95,0')
    nodes4.append(sta31)
    nodes4.append(sta32)
    nodes4.append(sta33)
    nodes4.append(sta34)
    nodes4.append(sta35)
    nodes4.append(sta36)
    nodes4.append(sta37)
    nodes4.append(sta38)
    nodes4.append(sta39)
    nodes4.append(sta40)

    g1 = net.addHost('g1', cls=Host, position='15,15,0')  #ap5
    g2 = net.addHost('g2', cls=Host, position='35,35,0')  #ap5
    g3 = net.addHost('g3', cls=Host, position='55,55,0')  #ap6
    g4 = net.addHost('g4', cls=Host, position='75,75,0')  #ap7
    g5 = net.addHost('g5', cls=Host, position='85,15,0')  #ap6
    g6 = net.addHost('g6', cls=Host, position='65,35,0')  #ap6
    g7 = net.addHost('g7', cls=Host, position='45,55,0')  #ap5
    g8 = net.addHost('g8', cls=Host, position='25,75,0')  #ap7
    g9 = net.addHost('g9', cls=Host, position='50,50,0')  #ap5
    g10 = net.addHost('g10', cls=Host, position='75,25,0')  #ap6

    net.addLink(g1, ap5)
    net.addLink(g2, ap5)
    net.addLink(g3, ap6)
    net.addLink(g4, ap7)
    net.addLink(g5, ap6)
    net.addLink(g6, ap6)
    net.addLink(g7, ap5)
    net.addLink(g8, ap7)
    net.addLink(g9, ap5)
    net.addLink(g10, ap6)

    sta41 = net.addStation('sta41', position='34,29,0')
    sta42 = net.addStation('sta42', position='14,56,0')
    sta43 = net.addStation('sta43', position='27,46,0')
    sta44 = net.addStation('sta44', position='5,12,0')
    sta45 = net.addStation('sta45', position='41,4,0')
    sta46 = net.addStation('sta46', position='13,23,0')
    sta47 = net.addStation('sta47', position='38,12,0')
    sta48 = net.addStation('sta48', position='47,20,0')
    sta49 = net.addStation('sta49', position='21,39,0')
    sta50 = net.addStation('sta50', position='17,3,0')
    nodes1.append(sta41)
    nodes1.append(sta42)
    nodes1.append(sta43)
    nodes1.append(sta44)
    nodes1.append(sta45)
    nodes1.append(sta46)
    nodes1.append(sta47)
    nodes1.append(sta48)
    nodes1.append(sta49)
    nodes1.append(sta50)

    sta51 = net.addStation('sta51', position='85,29,0')
    sta52 = net.addStation('sta52', position='67,46,0')
    sta53 = net.addStation('sta53', position='73,15,0')
    sta54 = net.addStation('sta54', position='55,38,0')
    sta55 = net.addStation('sta55', position='91,4,0')
    sta56 = net.addStation('sta56', position='71,40,0')
    sta57 = net.addStation('sta57', position='64,50,0')
    sta58 = net.addStation('sta58', position='92,27,0')
    sta59 = net.addStation('sta59', position='91,13,0')
    sta60 = net.addStation('sta60', position='67,8,0')
    nodes2.append(sta51)
    nodes2.append(sta52)
    nodes2.append(sta53)
    nodes2.append(sta54)
    nodes2.append(sta55)
    nodes2.append(sta56)
    nodes2.append(sta57)
    nodes2.append(sta58)
    nodes2.append(sta59)
    nodes2.append(sta60)

    net.plotGraph(max_x=100, max_y=100)
    info("*** Configuring wifi nodes\n")
    net.configureWifiNodes()
    #net.setMobilityModel(time=0, model='RandomDirection', max_x=150, max_y=150)

    info("*** Associating Stations\n")
    for node in nodes1:
        net.addLink(node, ap1)

    for node in nodes2:
        net.addLink(node, ap2)

    for node in nodes3:
        net.addLink(node, ap3)

    for node in nodes4:
        net.addLink(node, ap4)

    for node in nodes6:
        net.addLink(node, ap1)

    #BAD GATEWAYS
    g1.cmdPrint("tc qdisc add dev g1-eth0 root netem delay 40ms")
    g4.cmdPrint("tc qdisc add dev g4-eth0 root netem delay 40ms")
    g7.cmdPrint("tc qdisc add dev g7-eth0 root netem delay 40ms")

    # RANDOM DELAY GATEWAYS
    g2.cmdPrint(
        "tc qdisc add dev g2-eth0 root netem delay 5ms 4ms distribution normal"
    )
    g5.cmdPrint(
        "tc qdisc add dev g5-eth0 root netem delay 5ms 5ms distribution normal"
    )

    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)
    net.addLink(ap3, intf='ap3-wlan2', cls=mesh, ssid='mesh-ssid', channel=5)
    net.addLink(ap4, intf='ap4-wlan2', cls=mesh, ssid='mesh-ssid', channel=5)
    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)

    info("*** Starting network\n")
    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])

    info("*** Running CLI\n")
    CLI_wifi(net)

    info("*** Stopping network\n")
    net.stop()
Esempio n. 28
0
def build_adhocnet(adhocTopo, isManet, isAdhoc, ssid, channel, mode, wmediumd,
                   interference, cluster, placement, servers, tunnelType,
                   ctime, nPings, pctTraffic, experimentName, nlsrSecurity):
    """Create an ad hoc network from a topology object
       At the end of this function, everything should be connected
       and up..
       adhocTopo:topology object that be builded according to a file of network topology configure;
       isManet: mobile ad hoc network;
       isAdhoc: stationary ad hoc network;
       channel: channel parames;
       ssid: service set identifier;
       wmedimd:param for 802.11 simulation tool;
       interference: param for 802.11 simulation tool;
       placement:
       servers:
       tunnelType:
       the following paramters are for experiments.
       ctime: specific time that the nentwork covergence;
       nPings: number that perform
    """
    t = datetime.datetime.now()
    cls = Association
    cls.printCon = False
    #build a wire network or a wirelesswork network.
    #topology object adhocTopo can't make as  params in Mininet object definination.
    if adhocTopo.isTCLink == True and adhocTopo.isLimited == True:
        adhocnet = Mininet_wifi(host=CpuLimitedNdnHost,
                                station=NdnStation,
                                link=wmediumd,
                                controller=Controller,
                                ssid=ssid,
                                channel=channel,
                                mode=mode,
                                wmediumd_mode=interference)
    elif adhocTopo.isTCLink == True and adhocTopo.isLimited == False:
        if cluster is not None:
            mn = partial(MininetCluster, servers=servers, placement=placement)
            adhocnet = mn(host=NdnHost,
                          station=NdnStation,
                          link=wmediumd,
                          controller=Controller,
                          ssid=ssid,
                          channel=channel,
                          mode=mode,
                          wmediumd_mode=interference)
        else:
            adhocnet = Mininet_wifi(host=NdnHost,
                                    station=NdnStation,
                                    link=wmediumd,
                                    controller=Controller,
                                    ssid=ssid,
                                    channel=channel,
                                    mode=mode,
                                    wmediumd_mode=interference)

    elif adhocTopo.isTCLink == False and adhocTopo.isLimited == True:
        adhocnet = Mininet_wifi(host=CpuLimitedNdnHost,
                                station=NdnStation,
                                controller=Controller,
                                ssid=ssid,
                                channel=channel,
                                mode=mode,
                                link=wmediumd,
                                wmediumd_mode=interference)

    else:
        adhocnet = Mininet_wifi(host=NdnHost,
                                station=NdnStation,
                                controller=Controller,
                                ssid=ssid,
                                channel=channel,
                                mode=mode,
                                link=wmediumd,
                                wmediumd_mode=interference)

    info('*** Creating adhoc network\n')
    if not adhocnet.controllers and adhocnet.controller:
        # Add a default controller
        info('*** Adding controller\n')
        classes = adhocnet.controller
        if not isinstance(classes, list):
            classes = [classes]
        for i, cls in enumerate(classes):
            # Allow Controller objects because nobody understands partial()
            if isinstance(cls, Controller):
                adhocnet.addController(cls)
            else:
                adhocnet.addController('c%d' % i, cls)
            info('c%d' % i)

    info('\n*** Adding hosts and stations:\n')
    if isAdhoc:  # build a stationary ad hoc network
        for hostName in adhocTopo.hosts():
            pos_x = random.randrange(0, 100, 10)
            pos_y = random.randrange(0, 100, 10)
            pos_z = 0  #modify this coordinate if you need to 3D space
            posStr = '%f,%f,%f' % (pos_x, pos_y, pos_z)
            if 'sta' in str(hostName):
                adhocnet.addStation(hostName,
                                    position=posStr,
                                    **adhocTopo.nodeInfo(hostName))
            else:
                adhocnet.addHost(hostName,
                                 position=posStr,
                                 **adhocTopo.nodeInfo(hostName))
            info(hostName + ' ')
    else:  # build a mobile ad hoc network
        for hostName in adhocTopo.hosts():
            if 'sta' in str(hostName):
                adhocnet.addStation(hostName, **adhocTopo.nodeInfo(hostName))
            else:
                adhocnet.addHost(hostName, **adhocTopo.nodeInfo(hostName))
            info(hostName + ' ')

    info('\n*** Configuring propagation model...\n')
    # this code line must be put here
    adhocnet.propagationModel(model="logDistance", exp=5)
    #Only can use this propagation model

    info('\n*** Configuring wifi nodes...\n')
    adhocnet.configureWifiNodes()

    info('\n*** Adding link(s):\n')
    for station in adhocnet.stations:
        adhocnet.addLink(station, cls=adhoc, ssid=ssid, mode=mode)
    t2 = datetime.datetime.now()
    delta = t2 - t
    info('Setup time: ' + str(delta.seconds) + '\n')
    print "*** Starting network"
    adhocnet.plotGraph(max_x=100, max_y=100, max_z=0)

    if isManet:
        adhocnet.seed(random.randint(0, 100))
        # this code line must be put here
        adhocnet.startMobility(time=0,
                               model='RandomWayPoint',
                               max_x=100,
                               max_y=100,
                               max_z=0,
                               min_v=0.5,
                               max_v=0.8)
    adhocnet.build()

    # Load experiment

    if experimentName is not None:
        print("Loading experiment: %s" % experimentName)

        experimentArgs = {
            "isWiFi": True,
            "net": adhocnet,
            "ctime": ctime,
            "nPings": nPings,
            "strategy": Nfd.STRATEGY_BEST_ROUTE,
            "pctTraffic": pctTraffic,
            "nlsrSecurity": nlsrSecurity
        }

        experiment = WifiExperimentManager.create(experimentName,
                                                  experimentArgs)

        if experiment is not None:
            experiment.start()
        else:
            print("ERROR: Experiment '%s' does not exist" % experimentName)
            return
    """Running CLI....."""
    MiniNdnWifiCLI(adhocnet)

    print "*** Stopping network"
    adhocnet.stop()

    print('Cleaning up...')
    call(["nfd-stop"])
    call(["sudo", "mn", "--clean"])
    sys.exit(1)
def topology(args):
    net = Mininet_wifi(controller=Controller,
                       link=TCLink,
                       switch=OVSKernelSwitch)
    stations = []
    batch_n = 3
    batch_size = 10
    pause = 300.0  # 5 minutes

    info('*** Creating nodes\n')
    ip_network = ipaddress.ip_network(u'10.0.0.0/8')
    hosts = ip_network.hosts()
    ap1 = net.addAccessPoint('ap1',
                             ssid='ap1',
                             mode='n',
                             channel='1',
                             failMode='standalone',
                             position='0.0, 0.0, 0.0')
    srv1 = net.addHost('srv1', ip=str(next(hosts)))

    for i in range(1, batch_n * batch_size + 1):
        x, y, z = random.uniform(-20.0, 20.0), random.uniform(-20.0, 20.0), 0.0
        station = net.addStation('sta' + str(i),
                                 ip=str(next(hosts)),
                                 position=str(x) + ', ' + str(y) + ', ' +
                                 str(z))
        stations.append(station)

    info('*** Configuring propagation model\n')
    net.setPropagationModel(model='logDistance', exp=4.5)

    info('*** Configuring Wi-Fi nodes\n')
    net.configureWifiNodes()

    info('*** Creating links\n')
    net.addLink(ap1, srv1)

    info('*** Plotting graph\n')
    net.plotGraph(min_x=-100, max_x=100, min_y=-100, max_y=100)

    info('*** Starting network\n')
    net.build()
    ap1.start([])

    info('*** Starting web server\n')
    srv1.cmd('/usr/local/nginx/sbin/nginx')
    time.sleep(5.0)

    info('*** Starting dashc on all stations\n')
    with open('/tmp/dashc/start.log', 'w') as out:
        out.write('Id,Time\n')
    with open('/tmp/dashc/finish.log', 'w') as out:
        out.write('Id,Time\n')

    for i in range(0, batch_n):
        for j in range(0, batch_size):
            idx = i * batch_size + j
            cmd = 'echo ' + str(idx + 1) + ',' + '$(date +%s%3N)' + ' >> ' + \
                  logs + 'start.log && ' + dashc + ' play http://' +         \
                  str(srv1.IP()) + manifest + ' > ' + logs + 'sta' +         \
                  str(idx + 1) + '.log && ' + 'echo ' + str(idx + 1) + ',' + \
                  '$(date +%s%3N)' + ' >> ' + logs + 'finish.log &'
            stations[idx].cmdPrint(cmd)
        time.sleep(pause)

    info('*** Starting CLI\n')
    CLI(net)

    info('*** Stopping network\n')
    net.stop()
Esempio n. 30
0
def topology():
    total_switches = 1
    total_clients = 1
    total_servers = 3

    switches = []
    clients = []
    servers = []

    servers_running = []

    net = Mininet_wifi(
        controller=lambda name: RemoteController(
            name, ip='10.0.2.15', port=6633),
        switch=lambda name, **kwargs: OVSSwitch(
            name, protocols="OpenFlow13", **kwargs),
        waitConnected=True
    )

    # net = Mininet_wifi()
    c0 = net.addController(
        'c0', controller=RemoteController, ip='127.0.0.1', port=6633)

    # s0, s1       #switch IP start at 10.0.2.0 / switch MAC start at 00:00:00:00:00:20 / switch DPID start at 1
    for i in range(total_switches):
        print("Creating switch s" + str(i))
        thisip = '10.0.2.'
        thisip += str(i+1)
        thisip += '/8'
        thismac = '00:00:00:00:00:2'
        thismac += str(i+1)
        thisdpid = '000000000000000'  # START FROM 1 HEXADECIMAL
        thisdpid += str(i+1)
        switches.append(net.addSwitch(
            's' + str(i), ip=thisip, mac=thismac, dpid=thisdpid))

    # h0, h1 h2       #hostsudo ps IP start at 10.0.0.0 / hosts MAC start at 00:00:00:00:00:00
    for i in range(1, 1 + total_clients):
        print("Creating client h" + str(i))
        thisip = '10.0.0.'
        thisip += str(i)
        thisip += '/8'
        thismac = '00:00:00:00:00:0'
        thismac += str(i)
        clients.append(net.addHost('h' + str(i), ip=thisip, mac=thismac))

    # s0 ... s5    #stations IP start at 10.0.1.0 / stations MAC start at 00:00:00:00:01:00
    for i in range(1 + total_clients, 1 + total_clients + total_servers):
        print("Creating server h" + str(i))
        thisip = '10.0.1.'
        thisip += str(i)
        thisip += '/8'
        thismac = '00:00:00:00:00:1'
        thismac += str(i)
        servers.append(net.addHost('h' + str(i), ip=thisip, mac=thismac))

    # info("*** Configuring wifi nodes\n")
    net.configureWifiNodes()

    for c in clients:
        net.addLink(c, switches[0])
    for srv in servers:
        net.addLink(srv, switches[0])

    # turn server online
    for i in range(0, total_servers):
        initServer(servers[i], i+2)
        startServer(servers[i], i+2)
        servers_running.append(True)

    info("*** Starting network\n")
    net.build()
    c0.start()

    for s in switches:
        s.start([c0])

    # menu:
    # 1. start server 2 (10.0.1.2)
    # 2. start server 3 (10.0.1.3)
    # 3. start server 4 (10.0.1.4)
    # 4. stop server 2 (10.0.1.2)
    # 5. stop server 3 (10.0.1.3)
    # 6. stop server 4 (10.0.1.4)
    # 7. curl to server 2 (10.0.1.2)
    # 8. curl to server 3 (10.0.1.3)
    # 9. curl to server 4 (10.0.1.4)
    # 10. curl cluster (10.0.1.5)

    while True:
        print("+-----------------------------------+")
        print("|  menu:                            |")

        if not servers_running[0]:
            print("|   1. start server 2 (10.0.1.2)    |")

        if not servers_running[1]:    
            print("|   2. start server 3 (10.0.1.3)    |")
        
        if not servers_running[2]:
            print("|   3. start server 4 (10.0.1.4)    |")

        if servers_running[0]:
            print("|   4. stop server 2 (10.0.1.2)     |")

        if servers_running[1]:
            print("|   5. stop server 3 (10.0.1.3)     |")

        if servers_running[2]:
            print("|   6. stop server 4 (10.0.1.4)     |")
            
        print("|   7. curl to server 2 (10.0.1.2)  |")
        print("|   8. curl to server 3 (10.0.1.3)  |")
        print("|   9. curl to server 4 (10.0.1.4)  |")
        print("|   10. curl cluster (10.0.1.1)     |")
        print("+-----------------------------------+")

        line = raw_input("INPUT ('c' for CLI):")

        tokens = line.split(" ")

        x = tokens[0]

        if x == 'e' or x == "exit":
            break

        if x == 'c':
            CLI(net)
        if x == "1":
            print("1)   start server 2 (10.0.1.2)\n")
            startServer(servers[0], 2)
            servers_running[0] = True
        if x == "2":
            print("2)   start server 3 (10.0.1.3)\n")
            startServer(servers[1], 3)
            servers_running[1] = True
        if x == "3":
            print("3)   start server 4 (10.0.1.4)\n")
            startServer(servers[2], 4)
            servers_running[2] = True
        if x == "4":
            print("4)   stop server 2 (10.0.1.2)\n")
            stopServer(servers[0], 2)
            servers_running[0] = False
        if x == "5":
            print("5)    stop server 3 (10.0.1.3)\n")
            stopServer(servers[1], 3)
            servers_running[1] = False
        if x == "6":
            print("6)    stop server 4 (10.0.1.4)\n")
            stopServer(servers[2], 4)
            servers_running[2] = False
        if x == "7":
            print("7)   curl to server 2 (10.0.1.2)\n")
            curlServer(clients[0], servers[0])
        if x == "8":
            print("8)   curl to server 3 (10.0.1.3)\n")
            curlServer(clients[0], servers[1])
        if x == "9":
            print("9)   curl to server 4 (10.0.1.4) \n")
            curlServer(clients[0], servers[2])
        if x == "10" or x == "0":
            print("10)  curl cluster (10.0.1.1) \n")
            curlCluster(clients[0])

    net.stop()
Esempio n. 31
0
def topology():

    "Create a network."
    net = Mininet_wifi(controller=RemoteController,
                       accessPoint=UserAP,
                       link=wmediumd,
                       wmediumd_mode=interference)

    internetIface = 'enp3s0'
    usbDongleIface = 'wlxf4f26d193319'

    info("*** Creating nodes\n")
    for n in range(10):
        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))
    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)

    phyap1 = net.addAccessPoint('phyap1',
                                protocols='OpenFlow13',
                                ssid='Sigcomm-2016',
                                mode='g',
                                channel='1',
                                position='50,115,0',
                                phywlan=usbDongleIface,
                                cls=physicalAP)
    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)

    info("*** Configuring Propagation Model\n")
    net.setPropagationModel(model="logDistance", exp=4)

    info("*** Configuring wifi nodes\n")
    net.configureWifiNodes()

    info("*** Creating links\n")
    for sta in net.stations:
        net.addLink(sta, cls=mesh, intf='%s-wlan0' % sta.name, ssid='meshNet')

    info("*** Associating and Creating links")
    net.addLink(phyap1, ap2)
    net.addLink(ap2, ap3)
    net.addLink(sta11, phyap1)
    net.addLink(ap3, ap4)
    net.addLink(ap4, phyap1)
    net.addLink(root, ap3)
    net.addLink(phyap1, h12)

    net.plotGraph(max_x=240, max_y=240)

    net.setMobilityModel(time=0,
                         model='RandomWalk',
                         max_x=200,
                         max_y=200,
                         min_v=0.1,
                         max_v=0.2,
                         seed=20)

    info("*** Starting network\n")
    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 &')

    for id, sta in enumerate(net.stations):
        if sta.name != 'sta11':
            sta.setIP('10.0.0.%s/8' % (id + 201), intf="%s-wlan1" % sta)
            sta.cmd('ip route add default via 10.0.0.254')

    info("*** Running CLI\n")
    CLI(net)

    info("*** Stopping network\n")
    net.stop()
Esempio n. 32
0
def myNetwork():

    net = Mininet_wifi(topo=None,
                       build=False,
                       link=wmediumd,
                       wmediumd_mode=interference,
                       ipBase='10.0.0.0/8')

    info('*** Adding controller\n')
    c0 = net.addController(name='c0',
                           controller=Controller,
                           protocol='tcp',
                           port=6633)

    info('*** Add switches/APs\n')
    ap3 = net.addAccessPoint('ap3',
                             cls=OVSKernelAP,
                             ssid='ap3-ssid',
                             channel='1',
                             mode='g',
                             position='1196.0,769.0,0')
    ap1 = net.addAccessPoint('ap1',
                             cls=OVSKernelAP,
                             ssid='ap1-ssid',
                             channel='1',
                             mode='g',
                             position='527.0,256.0,0')
    ap4 = net.addAccessPoint('ap4',
                             cls=OVSKernelAP,
                             ssid='ap4-ssid',
                             channel='1',
                             mode='g',
                             position='1395.0,523.0,0')
    ap2 = net.addAccessPoint('ap2',
                             cls=OVSKernelAP,
                             ssid='ap2-ssid',
                             channel='1',
                             mode='g',
                             ip='',
                             position='871.0,346.0,0',
                             range=600)

    info('*** Add hosts/stations\n')
    sta25 = net.addStation('sta25', ip='10.0.0.28', position='1345.0,660.0,0')
    sta11 = net.addStation('sta11', ip='10.0.0.23', position='1033.0,812.0,0')
    sta1 = net.addStation('sta1', ip='10.0.0.1', position='372.0,71.0,0')
    sta21 = net.addStation('sta21', ip='10.0.0.21', position='1193.0,458.0,0')
    sta19 = net.addStation('sta19', ip='10.0.0.19', position='1175.0,953.0,0')
    sta29 = net.addStation('sta29', ip='10.0.0.29', position='1526.0,318.0,0')
    sta17 = net.addStation('sta17', ip='10.0.0.17', position='1471.0,807.0,0')
    h1 = net.addHost('h1', cls=Host, ip='10.0.0.1', defaultRoute=None)
    h8 = net.addHost('h8', cls=Host, ip='10.0.0.8', defaultRoute=None)
    h2 = net.addHost('h2', cls=Host, ip='10.0.0.2', defaultRoute=None)
    h4 = net.addHost('h4', cls=Host, ip='10.0.0.4', defaultRoute=None)
    h9 = net.addHost('h9', cls=Host, ip='10.0.0.9', defaultRoute=None)
    sta9 = net.addStation('sta9', ip='10.0.0.9', position='316.0,187.0,0')
    sta8 = net.addStation('sta8', ip='10.0.0.8', position='298.0,316.0,0')
    h3 = net.addHost('h3', cls=Host, ip='10.0.0.3', defaultRoute=None)
    sta15 = net.addStation('sta15', ip='10.0.0.15', position='1273.0,546.0,0')
    sta23 = net.addStation('sta23', ip='10.0.0.23', position='1409.0,413.0,0')
    sta2 = net.addStation('sta2', ip='10.0.0.2', position='562.0,60.0,0')
    sta5 = net.addStation('sta5', ip='10.0.0.5', position='705.0,368.0,0')
    sta22 = net.addStation('sta22', ip='10.0.0.25', position='58.0,-40.0,0')
    h10 = net.addHost('h10', cls=Host, ip='10.0.0.10', defaultRoute=None)
    sta30 = net.addStation('sta30', ip='10.0.0.30', position='1268.0,413.0,0')
    sta6 = net.addStation('sta6', ip='10.0.0.6', position='560.0,468.0,0')
    h7 = net.addHost('h7', cls=Host, ip='10.0.0.7', defaultRoute=None)
    sta14 = net.addStation('sta14', ip='10.0.0.14', position='1141.0,583.0,0')
    sta26 = net.addStation('sta26', ip='10.0.0.26', position='1523.0,633.0,0')
    sta10 = net.addStation('sta10', ip='10.0.0.10', position='474.0,136.0,0')
    sta20 = net.addStation('sta20', ip='10.0.0.20', position='1026.0,913.0,0')
    sta12 = net.addStation('sta12', ip='10.0.0.12', position='979.0,727.0,0')
    sta24 = net.addStation('sta24', ip='10.0.0.24', position='1233.0,636.0,0')
    sta22 = net.addStation('sta22', ip='10.0.0.25', position='1282.0,278.0,0')
    sta28 = net.addStation('sta28', ip='10.0.0.31', position='1620.0,398.0,0')
    sta3 = net.addStation('sta3', ip='10.0.0.3', position='727.0,105.0,0')
    sta7 = net.addStation('sta7', ip='10.0.0.7', position='379.0,434.0,0')
    sta16 = net.addStation('sta16', ip='10.0.0.16', position='1424.0,680.0,0')
    sta13 = net.addStation('sta13', ip='10.0.0.13', position='1044.0,619.0,0')
    h5 = net.addHost('h5', cls=Host, ip='10.0.0.5', defaultRoute=None)
    sta18 = net.addStation('sta18', ip='10.0.0.18', position='1356.0,950.0,0')
    sta27 = net.addStation('sta27', ip='10.0.0.27', position='1642.0,524.0,0')
    h6 = net.addHost('h6', cls=Host, ip='10.0.0.6')
    sta4 = net.addStation('sta4', ip='10.0.0.4', position='781.0,266.0,0')

    info("*** Configuring Propagation Model\n")
    net.setPropagationModel(model="logDistance", exp=3)

    info("*** Configuring wifi nodes\n")
    net.configureWifiNodes()

    info('*** Add links\n')
    net.addLink(sta27, ap4)
    net.addLink(sta28, ap4)
    net.addLink(sta23, ap4)
    net.addLink(sta29, ap4)
    net.addLink(sta22, ap4)
    net.addLink(ap2, cls=mesh, ssid='new-ssid', mode='g', channel=1)
    net.addLink(ap3, cls=mesh, ssid='new-ssid', mode='g', channel=1)
    net.addLink(ap4, cls=mesh, ssid='new-ssid', mode='g', channel=1)
    net.addLink(ap1, cls=mesh, ssid='new-ssid', mode='g', channel=1)
    net.addLink(sta10, ap1)
    net.addLink(sta2, ap1)
    net.addLink(sta3, ap1)
    net.addLink(sta1, ap1)
    net.addLink(sta9, ap1)
    net.addLink(sta8, ap1)
    net.addLink(sta7, ap1)
    net.addLink(sta6, ap1)
    net.addLink(sta5, ap1)
    net.addLink(sta4, ap1)
    net.addLink(h10, ap2)
    net.addLink(h4, ap2)
    net.addLink(h5, ap2)
    net.addLink(h7, ap2)
    net.addLink(h1, ap2)
    net.addLink(h8, ap2)
    net.addLink(h2, ap2)
    net.addLink(h9, ap2)
    net.addLink(h3, ap2)
    net.addLink(h6, ap2)
    net.addLink(sta11, ap3)
    net.addLink(sta12, ap3)
    net.addLink(sta13, ap3)
    net.addLink(sta14, ap3)
    net.addLink(sta15, ap3)
    net.addLink(sta16, ap3)
    net.addLink(sta17, ap3)
    net.addLink(sta18, ap3)
    net.addLink(sta19, ap3)
    net.addLink(sta20, ap3)
    net.addLink(sta30, ap4)
    net.addLink(sta21, ap4)
    net.addLink(sta24, ap4)
    net.addLink(sta25, ap4)
    net.addLink(sta26, ap4)

    net.plotGraph(max_x=1000, max_y=1000)

    info('*** Starting network\n')
    net.build()
    info('*** Starting controllers\n')
    for controller in net.controllers:
        controller.start()

    info('*** Starting switches/APs\n')
    net.get('ap3').start([c0])
    net.get('ap1').start([c0])
    net.get('ap4').start([c0])
    net.get('ap2').start([c0])

    info('*** Post configure nodes\n')

    CLI_wifi(net)
    net.stop()