Ejemplo n.º 1
0
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()
Ejemplo n.º 2
0
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()
Ejemplo n.º 3
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()
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()
Ejemplo n.º 5
0
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()
Ejemplo n.º 6
0
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()
Ejemplo n.º 7
0
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():
    "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()
Ejemplo n.º 9
0
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()
Ejemplo n.º 10
0
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)

    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()
Ejemplo n.º 12
0
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()
Ejemplo n.º 13
0
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()
Ejemplo n.º 14
0
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()
Ejemplo n.º 15
0
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()
Ejemplo n.º 16
0
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()
Ejemplo n.º 17
0
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()
Ejemplo n.º 18
0
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()
Ejemplo n.º 19
0
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()
Ejemplo n.º 20
0
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()
Ejemplo n.º 21
0
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, 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()
Ejemplo n.º 23
0
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()
Ejemplo n.º 24
0
def topology():
    "Create a network."
    net = Mininet_wifi(controller=RemoteController,
                       link=TCLink,
                       switch=OVSKernelSwitch,
                       accessPoint=OVSKernelAP)

    print("*** Creating nodes")
    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)

    print("*** Configuring wifi nodes")
    net.configureWifiNodes()

    print("*** Adding Link")
    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)

    print("*** Starting network")
    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")

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

    print("*** Stopping network")
    net.stop()
Ejemplo n.º 25
0
def topology():

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

    info("*** Creating nodes\n")
    net.addStation('sta1', antennaHeight='1', antennaGain='5')
    net.addStation('sta2', antennaHeight='1', antennaGain='5')
    ap1 = net.addAccessPoint('ap1',
                             ssid='new-ssid',
                             equipmentModel='DI524',
                             mode='g',
                             channel='1',
                             position='50,50,0')
    c1 = net.addController('c1', controller=Controller)

    net.propagationModel(model="logDistance", exp=4)

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

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

    net.seed(1)

    net.startMobility(time=0,
                      model='RandomWayPoint',
                      max_x=100,
                      max_y=100,
                      min_v=0.5,
                      max_v=0.5)

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

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

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

    "Create a network."
    net = Mininet_wifi(controller=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.addAccessPoint('ap3',
                             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()

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

    print("*** Associating and Creating links")
    net.addLink(sta1, ap3)
    net.addLink(sta2, ap3)

    print("*** Starting network")
    net.build()
    c4.start()
    ap3.start([c4])

    sta2.cmd('pushd /home/alpha/Downloads; python3 -m http.server 80 &')

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

    print("*** Stopping network")
    net.stop()
Ejemplo n.º 27
0
def topology():
    "Create a network."
    net = Mininet_wifi(controller=Controller,
                       accessPoint=OVSKernelAP,
                       driver='capwap_wtp',
                       enable_wmediumd=True,
                       enable_interference=True)

    info("*** Creating nodes\n")
    ap1 = net.addAccessPoint('ap1',
                             ssid='new-ssid',
                             mode='g',
                             channel='1',
                             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,20,0')
    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()
Ejemplo n.º 28
0
def topology():
    "Create a network."
    net = Mininet_wifi(controller=Controller, switch=OVSKernelSwitch)

    info("*** Creating nodes\n")
    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='50,50,0')
    c1 = net.addController('c1', controller=Controller)

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

    info("*** Adding Link\n")
    sta1.params['associatedTo'][0] = ap1
    sta2.params['associatedTo'][0] = ap1

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

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

    getTrace(sta1, 'examples/replaying/replayingRSSI/node1_rssiData.dat')
    getTrace(sta2, 'examples/replaying/replayingRSSI/node2_rssiData.dat')

    replayingRSSI(net)

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

    info("*** Stopping network\n")
    net.stop()
Ejemplo n.º 29
0
def topology(nodes, rep):
    "Create a network."
    net = Mininet_wifi(controller=Controller, accessPoint=OVSKernelAP)

    info("*** Creating nodes\n")
    sta1 = net.addStation('sta1')
    sta2 = net.addStation('sta2')
    sta3 = net.addStation('sta3')
    sta4 = net.addStation('sta4')
    sta5 = net.addStation('sta5')
    sta6 = net.addStation('sta6')
    sta7 = net.addStation('sta7')
    sta8 = net.addStation('sta8')
    sta9 = net.addStation('sta9')
    sta10 = net.addStation('sta10')
    sta11 = net.addStation('sta11')
    sta12 = net.addStation('sta12')
    sta13 = net.addStation('sta13')
    sta14 = net.addStation('sta14')
    sta15 = net.addStation('sta15')
    sta16 = net.addStation('sta16')
    sta17 = net.addStation('sta17')
    sta18 = net.addStation('sta18')
    sta19 = net.addStation('sta19')
    sta20 = net.addStation('sta20')
    sta21 = net.addStation('sta21')
    sta22 = net.addStation('sta22')
    sta23 = net.addStation('sta23')
    sta24 = net.addStation('sta24')
    sta25 = net.addStation('sta25')

    h1 = net.addHost('h1')
    h2 = net.addHost('h2')

    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)
    net.addLink(sta3, ap1)
    net.addLink(sta4, ap1)
    net.addLink(sta5, ap1)
    net.addLink(sta6, ap1)
    net.addLink(sta7, ap1)
    net.addLink(sta8, ap1)
    net.addLink(sta9, ap1)
    net.addLink(sta10, ap1)
    net.addLink(sta11, ap1)
    net.addLink(sta12, ap1)
    net.addLink(sta13, ap1)
    net.addLink(sta14, ap1)
    net.addLink(sta15, ap1)
    net.addLink(sta16, ap1)
    net.addLink(sta17, ap1)
    net.addLink(sta18, ap1)
    net.addLink(sta19, ap1)
    net.addLink(sta20, ap1)
    net.addLink(sta21, ap1)
    net.addLink(sta22, ap1)
    net.addLink(sta23, ap1)
    net.addLink(sta24, ap1)
    net.addLink(sta25, ap1)

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

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

    info("*** Ping All\n")
    net.pingAll()

    h1.cmd('sudo iperf -s -u -i 1 -t 30 > iperf_s_n' + nodes + '_r' + rep + ' &')
    h2.sendCmd('iperf -u -c ' + h1.IP() + ' -b 10M -i 1 -t 30 > iperf_c_n'+ nodes +'_r' + rep)
    # removing the SDN Controller
    ap1.cmd("ovs-vsctl --db=unix:/var/run/openvswitch/db.sock del-controller ap1")

    makeTerm( sta1, cmd="python /media/sf_shared/node.py 10.0.0.1 -nodes 25 -rep 1;sleep 2" )
    makeTerm( sta2, cmd="python /media/sf_shared/node.py 10.0.0.2 -nodes 25 -rep 1;sleep 2" )
    makeTerm( sta3, cmd="python /media/sf_shared/node.py 10.0.0.3 -nodes 25 -rep 1;sleep 2" )
    makeTerm( sta4, cmd="python /media/sf_shared/node.py 10.0.0.4 -nodes 25 -rep 1;sleep 2" )
    makeTerm( sta5, cmd="python /media/sf_shared/node.py 10.0.0.5 -nodes 25 -rep 1;sleep 2" )
    makeTerm( sta6, cmd="python /media/sf_shared/node.py 10.0.0.6 -nodes 25 -rep 1;sleep 2" )
    makeTerm( sta7, cmd="python /media/sf_shared/node.py 10.0.0.7 -nodes 25 -rep 1;sleep 2" )
    makeTerm( sta8, cmd="python /media/sf_shared/node.py 10.0.0.8 -nodes 25 -rep 1;sleep 2" )
    makeTerm( sta9, cmd="python /media/sf_shared/node.py 10.0.0.9 -nodes 25 -rep 1;sleep 2" )
    makeTerm( sta10, cmd="python /media/sf_shared/node.py 10.0.0.10 -nodes 25 -rep 1;sleep 2" )
    makeTerm( sta11, cmd="python /media/sf_shared/node.py 10.0.0.11 -nodes 25 -rep 1;sleep 2" )
    makeTerm( sta12, cmd="python /media/sf_shared/node.py 10.0.0.12 -nodes 25 -rep 1;sleep 2" )
    makeTerm( sta13, cmd="python /media/sf_shared/node.py 10.0.0.13 -nodes 25 -rep 1;sleep 2" )
    makeTerm( sta14, cmd="python /media/sf_shared/node.py 10.0.0.14 -nodes 25 -rep 1;sleep 2" )
    makeTerm( sta15, cmd="python /media/sf_shared/node.py 10.0.0.15 -nodes 25 -rep 1;sleep 2" )
    makeTerm( sta16, cmd="python /media/sf_shared/node.py 10.0.0.16 -nodes 25 -rep 1;sleep 2" )
    makeTerm( sta17, cmd="python /media/sf_shared/node.py 10.0.0.17 -nodes 25 -rep 1;sleep 2" )
    makeTerm( sta18, cmd="python /media/sf_shared/node.py 10.0.0.18 -nodes 25 -rep 1;sleep 2" )
    makeTerm( sta19, cmd="python /media/sf_shared/node.py 10.0.0.19 -nodes 25 -rep 1;sleep 2" )
    makeTerm( sta20, cmd="python /media/sf_shared/node.py 10.0.0.20 -nodes 25 -rep 1;sleep 2" )
    makeTerm( sta21, cmd="python /media/sf_shared/node.py 10.0.0.21 -nodes 25 -rep 1;sleep 2" )
    makeTerm( sta22, cmd="python /media/sf_shared/node.py 10.0.0.22 -nodes 25 -rep 1;sleep 2" )
    makeTerm( sta23, cmd="python /media/sf_shared/node.py 10.0.0.23 -nodes 25 -rep 1;sleep 2" )
    makeTerm( sta24, cmd="python /media/sf_shared/node.py 10.0.0.24 -nodes 25 -rep 1;sleep 2" )
    makeTerm( sta25, cmd="python /media/sf_shared/node.py 10.0.0.25 -nodes 25 -rep 1;sleep 2" )

    info("*** Waiting for iperf to terminate.\n")
    results = {}
    results[h2] = h2.waitOutput()
    h1.cmd('kill $!')

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

    info("*** Stopping network\n")
    net.stop()
Ejemplo n.º 30
0
def topology():
    car_type = SD_Car
    op = raw_input("Choose Type of Experiment: (1)v2i \t (2)v2v \nChoice:")
    if(op == "1"):
        v2v = False
        pass
    else:
        v2v = True
        caching = input(
            "What do you prefere to run:\n (1)car-level caching enabled (2)car-level caching disbled \nChoice: ")
        if(caching == "1"):
            car_type = SD_C_Car
        else:
            car_type = SD_Car

    "Create a network."
    net = Mininet_wifi(controller=Vanet_controller, accessPoint=UserAP,
                       switch=SD_Car_Switch, station=SD_station,link=wmediumd,
                       wmediumd_mode=interference)

    print ("*** Creating nodes")
    cars = []
    stas = []
    for x in range(0, 10):
        cars.append(x)
        stas.append(x)
    for x in range(0, 10):
        cars[x] = net.addCar('car%s' % (x), wlans=1,
                             ip='10.0.0.%s/8' % (x + 1), encrypt='wpa2', cls=car_type)

    e1 = net.addAccessPoint('e1', wlans=2, ssid='vanet-ssid,', mac='00:00:00:11:00:01', mode='g', channel='1',
                            passwd='123456789a', encrypt='wpa2', position='3332.62,3253.92,0', cls=eNodeB, inNamespace=True)
    e2 = net.addAccessPoint('e2', wlans=2, ssid='vanet-ssid,', mac='00:00:00:11:00:02', mode='g', channel='1',
                            passwd='123456789a', encrypt='wpa2', position='3279.02,3736.27,0', cls=eNodeB, inNamespace=True)
    e3 = net.addAccessPoint('e3', wlans=2, ssid='vanet-ssid,', mac='00:00:00:11:00:03', mode='g', channel='11',
                            passwd='123456789a', encrypt='wpa2', position='2806.42,3395.22,0', cls=eNodeB, inNamespace=True)
    e4 = net.addAccessPoint('e4', wlans=2, ssid='vanet-ssid,', mac='00:00:00:11:00:04', mode='g', channel='6',
                            passwd='123456789a', encrypt='wpa2', position='2320.82,3565.75,0', cls=eNodeB, inNamespace=True)
    e5 = net.addAccessPoint('e5', wlans=2, ssid='vanet-ssid,', mac='00:00:00:11:00:05', mode='g', channel='6',
                            passwd='123456789a', encrypt='wpa2', position='2887.62,2935.61,0', cls=eNodeB, inNamespace=True)
    e6 = net.addAccessPoint('e6', wlans=2, ssid='vanet-ssid,', mac='00:00:00:11:00:06', mode='g', channel='11',
                            passwd='123456789a', encrypt='wpa2', position='2351.68,3083.40,0', cls=eNodeB, inNamespace=True)

    client = net.addHost('cloud', cls=Cloud_host)
    switch = net.addSwitch('switch', dpid='4000000000000000', cls=SD_Switch)
    c1 = net.addController(
        'c1', controller=Vanet_controller, ip='127.0.0.1', port=6653)
    # "logDistancePropagationLossModel"
    net.propagationModel(exp=2.8)

    if(v2v):
        print ("*** Setting bgscan")
        net.setBgscan(signal=-45, s_inverval=5, l_interval=10)

    print ("*** Configuring wifi nodes")
    net.configureWifiNodes()

    net.addLink(switch, e1)
    net.addLink(client, switch)
    """net.addLink(e1, e2)
    net.addLink(e2, e3)
    net.addLink(e3, e4)
    net.addLink(e4, e5)
    net.addLink(e5, e6)"""
    
    net.addLink(e1, intf = 'e1-wlan2', cls=mesh, ssid='mesh-ssid')
    net.addLink(e2, intf = 'e2-wlan2', cls=mesh, ssid='mesh-ssid')
    net.addLink(e3, intf = 'e3-wlan2', cls=mesh, ssid='mesh-ssid')
    net.addLink(e4, intf = 'e4-wlan2', cls=mesh, ssid='mesh-ssid')
    net.addLink(e5, intf = 'e5-wlan2', cls=mesh, ssid='mesh-ssid')
    net.addLink(e6, intf = 'e6-wlan2', cls=mesh, ssid='mesh-ssid')

    "Available Options: sumo, sumo-gui"
    net.useExternalProgram('sumo-gui', config_file='map.sumocfg')

    print ("*** Starting network")
    net.build()
    c1.start()
    e1.start([c1])
    e2.start([c1])
    e3.start([c1])
    e4.start([c1])
    e5.start([c1])
    e6.start([c1])

    i = 201
    for sw in net.carsSW:
        sw.start([c1])
        os.system('ifconfig %s 10.0.0.%s' % (sw, i))
        i += 1

    i = 1
    j = 2
    for car in cars:
        car.setIP('192.168.0.%s/24' % i, intf='%s-wlan0' % car)
        car.setIP('192.168.1.%s/24' % i, intf='%s-eth1' % car)
        car.cmd('ip route add 10.0.0.0/8 via 192.168.1.%s' % j)
        i += 2
        j += 2

    i = 1
    j = 2
    for carsta in net.carsSTA:
        carsta.setIP('10.0.0.%s/24' % i, intf='%s-mp0' % carsta)
        carsta.setIP('192.168.1.%s/24' % j, intf='%s-eth2' % carsta)
        # May be confuse, but it allows ping to the name instead of ip addr
        carsta.setIP('10.0.0.%s/24' % i, intf='%s-wlan0' % carsta)
        carsta.cmd('echo 1 > /proc/sys/net/ipv4/ip_forward')
        i += 1
        j += 2

    for carsta1 in net.carsSTA:
        i = 1
        j = 1
        for carsta2 in net.carsSTA:
            if carsta1 != carsta2:
                carsta1.cmd('route add -host 192.168.1.%s gw 10.0.0.%s' % (j, i))
            i += 1
            j += 2

    # Assigning IPs for Access points wlan interfaces
    IPs = ['90','91','92','93','94','95','96']
    for i in range(0,6):
        net.aps[i].cmd('ifconfig e%s-wlan1 192.168.0.%s'%(i+1,IPs[i]))
        net.aps[i].cmd('ifconfig e%s-mp2 192.168.2.%s'%(i+1,i+1))
        net.aps[i].extIP = '192.168.0.%s'%(IPs[i])

    c1.initializeNetworkResources(net)

    if(v2v):
        raw_input("Press Enter to continue (wait 30sec after t=28)...")
        os.system('clear')
        os.system('ovs-ofctl mod-flows car2SW in_port=2,actions=drop')
        cars[2].cmdPrint('iwconfig car2-wlan0')
        sleep(3)
        cars[6].cmdPrint('iwconfig car6-wlan0')
        print ("****************************************************")
        print ("*** Both car2 and car6 are associated to enodeB5 ***")
        print ("****************************************************")
        sleep(6)
        os.system('clear')
        print ("****************************************************************")
        print ("*** Car6 is so far from enodeB5. Trying to send data by car2 ***")
        print ("****************************************************************")
        sleep(6)
        os.system('clear')
        print ("**************************************")
        print ("*** Trying to send data to car6... ***")
        print ("**************************************")
        cars[2].cmdPrint('ping -c5 10.0.0.7')
        print ("****************************************************************************************************")
        print ("*** Car2: V2V is blocked! Car6 is unreachable! Controller, please let me talk directly with car6 ***")
        print ("****************************************************************************************************")
        sleep(6)
        os.system('clear')
        print ("***********************************************")
        print ("*** controller says: Car6 is now reachable! ***")
        print ("***********************************************")
        os.system('ovs-ofctl mod-flows car2SW in_port=2,actions=1')
        sleep(6)
        os.system('clear')
        cars[2].cmdPrint('ping -c5 10.0.0.7')
        os.system('clear')
        print ("***********************************")
        print ("*** Car2: Requesting Content for car6! ***")
        print ("***********************************")
        sleep(1)
        cars[2].RequestContent(net, 2)
        print ("***********************************")
        print ("*** Car2: Thank you Controller! ***")
        print ("***********************************")
    else:
        print ("***********************************")
        print ("********  V2I experiment **********")
        print ("***********************************")
        raw_input("PressEnter after T=28 ...")

        print ("type>> py car4.RequestContent(net)")

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

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