Пример #1
0
def topology():
    "Create a network."
    net = Mininet_wifi(link=wmediumd, wmediumd_mode=interference)

    info("*** Creating nodes\n")
    sta1 = net.addStation('sta1', ip='10.0.0.1/8',
                          position='10,10,0')
    sta2 = net.addStation('sta2', ip='10.0.0.2/8',
                          position='20,20,0')

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

    net.setModule('./mac80211_hwsim.ko')

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

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

    info("*** Starting ITS Links\n")
    net.addLink(sta1, intf='sta1-wlan0',
                cls=ITSLink, channel='161')
    net.addLink(sta2, intf='sta2-wlan0',
                cls=ITSLink, channel='161')

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

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

    info("*** Stopping network\n")
    net.stop()
Пример #2
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='ap1', mode='n',
                             channel='1', position='15,30,0')
    ap2 = net.addAccessPoint('ap2', ssid='ap2', mode='n',
                             channel='6', position='35,30,0')
    ap3 = net.addAccessPoint('ap3', ssid='ap3', mode='n',
                             channel='11', position='55,30,0')
    net.addStation('sta1', mac='00:00:00:00:00:10', ip='10.0.0.1/8',
                   position='30,30,0')

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

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

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

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

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

    info("*** Stopping network\n")
    net.stop()
Пример #3
0
def topology():
    "Create a network."
    net = Mininet_wifi()

    info("*** Creating nodes\n")
    sta1 = net.addStation('sta1', battery=100)
    sta2 = net.addStation('sta2', battery=100)
    ap1 = net.addAccessPoint('ap1', ssid="simplewifi", mode="g",
                             channel="5", failMode='standalone')

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

    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")
    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' )
    ap1 = net.addAccessPoint( 'ap3', ssid='ap-ssid', mode='b', channel='1',
                              position='50,50,0' )
    c1 = net.addController( 'c1' )

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

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

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

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

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

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

    info("*** Stopping network\n")
    net.stop()
Пример #5
0
def topology():
    "Create a network."
    net = Mininet_wifi()

    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)

    path = os.path.dirname(os.path.abspath(__file__)) + '/replayingBandwidth/'
    get_trace(sta1, '{}throughputData.dat'.format(path))

    info("*** Replaying Bandwidth\n")
    ReplayingBandwidth(net)

    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(net)

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

    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')
    ap1 = net.addAccessPoint('ap1', wlans=2, ssid='ssid1,ssid2', mode='g',
                             channel='1', failMode="standalone",
                             position='50,50,0')

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

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

    net.setMobilityModel(time=1, model='CRP',
                         pointlist=[(100,11,0), (101, 12,0), (102, 13,0), (103,14,0), (104, 15,0), (105, 16,0), 
                                    (106,17,0), (107,18,0), (108,19,0), (109,20,0), (110,21,0), (111,22,0)])

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

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

    info("*** Stopping network\n")
    net.stop()
Пример #8
0
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')
    ap1 = net.addAccessPoint('ap1',
                             ssid="ap1-ssid",
                             mode="g",
                             channel="1",
                             passwd='123456789a',
                             encrypt='wpa2',
                             failMode="standalone")

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

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

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

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

    info("*** Stopping network\n")
    net.stop()
Пример #9
0
def topology():
    "Create a network."
    net = Mininet_wifi()

    info("*** Creating nodes\n")
    sta1 = net.addStation('sta1', wlans=2)
    sta2 = net.addStation('sta2')
    ap1 = net.addAccessPoint('ap1',
                             ssid='ssid_1',
                             mode='g',
                             channel='5',
                             failMode="standalone")

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

    info("*** Associating...\n")
    net.addLink(ap1, sta1)
    net.addLink(sta1, intf='sta1-wlan0', cls=adhoc, ssid='adhoc1')
    net.addLink(sta2, intf='sta2-wlan0', cls=adhoc, ssid='adhoc1')

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

    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\n")
    CLI(net)

    info("*** Stopping network\n")
    net.stop()
Пример #10
0
def topology():
    "Create a network."
    net = Mininet_wifi(link=wmediumd, wmediumd_mode=interference)

    info("*** Creating nodes\n")
    sta1 = net.addStation('sta1', ip='10.0.0.1/8', position='100,150,0')
    sta2 = net.addStation('sta2', ip='10.0.0.2/8', position='150,150,0')
    sta3 = net.addStation('sta3', ip='10.0.0.3/8', position='200,150,0')

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

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

    info("*** Plotting Graph\n")
    net.plotGraph(max_x=300, max_y=300)

    info("*** Starting ITS Links\n")
    net.addLink(sta1, intf='sta1-wlan0', cls=ITSLink,
                band=20, channel='181', proto='batman_adv')
    net.addLink(sta2, intf='sta2-wlan0', cls=ITSLink,
                band=20, channel='181', proto='batman_adv')
    net.addLink(sta3, intf='sta3-wlan0', cls=ITSLink,
                band=20, channel='181', proto='batman_adv')

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

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

    info("*** Stopping network\n")
    net.stop()
Пример #11
0
def topology(args):

    "Create a network."
    net = Mininet_wifi(controller=Controller, roads=10,
                       link=wmediumd, wmediumd_mode=interference)

    info("*** Creating nodes\n")
    for id in range(0, 10):
        min_ = randint(1, 4)
        max_ = randint(11, 30)
        net.addCar('car%s' % (id+1), wlans=2, min_speed=min_, max_speed=max_)

    rsu11 = net.addAccessPoint('RSU11', ssid='RSU11', mode='g',
                               channel='1')
    rsu12 = net.addAccessPoint('RSU12', ssid='RSU12', mode='g',
                               channel='6')
    rsu13 = net.addAccessPoint('RSU13', ssid='RSU13', mode='g',
                               channel='11')
    rsu14 = net.addAccessPoint('RSU14', ssid='RSU14', mode='g',
                               channel='11')
    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(rsu11, rsu12)
    net.addLink(rsu11, rsu13)
    net.addLink(rsu11, rsu14)
    for car in net.cars:
        net.addLink(car, intf='%s-wlan1' % car,
                    cls=mesh, ssid='mesh-ssid', channel=5)

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

    net.startMobility(time=0)

    info("*** Starting network\n")
    net.build()
    c1.start()
    rsu11.start([c1])
    rsu12.start([c1])
    rsu13.start([c1])
    rsu14.start([c1])

    for car in net.cars:
        car.setIP('192.168.0.%s/24' % (int(net.cars.index(car))+1),
                  intf='%s-wlan0' % car)
        car.setIP('192.168.1.%s/24' % (int(net.cars.index(car))+1),
                  intf='%s-mp1' % car)

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

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

    info("*** Creating nodes\n")
    net.addStation('sta1', position='10,20,0')
    net.addStation('sta2', position='40,30,0')
    net.addStation('sta3', position='60,20,0')
    net.addAccessPoint('ap1',
                       ssid="my-ssid",
                       mode="a",
                       channel="36",
                       failMode='standalone',
                       position='10,10,0')

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

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

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

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

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

    info("*** Stopping network\n")
    net.stop()
Пример #13
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()
Пример #14
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()
Пример #15
0
def topology():
    "Create a network."
    net = Mininet_wifi(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')

    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(net)

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

    usbDongleIface = 'wlxf4f26d193319'

    info("*** Creating nodes\n")
    sta1 = net.addStation('sta1', mac='00:00:00:00:00:01',
                          ip='192.168.0.1/24', position='10,10,0')
    phyap1 = net.addAccessPoint('phyap1', ssid='ssid-ap1',
                                mode='g', channel='1',
                                position='50,50,0', phywlan=usbDongleIface,
                                cls=physicalAP)
    c0 = net.addController( 'c0' )

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

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

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

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

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

    info("*** Stopping network\n")
    net.stop()
Пример #17
0
def topology():
    "Create a network."
    net = Mininet_wifi(controller=Controller)

    info("*** Creating nodes\n")
    ap1 = net.addAccessPoint('ap1',
                             ssid='new-ssid',
                             mode='g',
                             channel='1',
                             position='10,10,0',
                             failMode="standalone")
    net.addStation('sta1', position='10,20,0')
    net.addStation('sta2', position='10,30,0')

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

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

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

    info("*** Stopping network\n")
    net.stop()
Пример #18
0
def topology():
    "Create a network."
    net = Mininet_wifi()

    info("*** Creating nodes\n")
    sta1 = net.addStation('sta1', ip='192.168.0.1/24')
    sta2 = net.addStation('sta2', ip='192.168.1.1/24')
    r1 = net.addStation('r1', wlans=2)

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

    r1.setMasterMode(intf='r1-wlan0', ssid='r1-ssid1', channel='1', mode='n')
    r1.setMasterMode(intf='r1-wlan1', ssid='r1-ssid2', channel='6', mode='n')

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

    r1.cmd('sysctl net.ipv4.ip_forward=1')
    r1.cmd('ifconfig r1-wlan0 192.168.0.100')
    r1.cmd('ifconfig r1-wlan1 192.168.1.100')
    r1.cmd('ip route add to 192.168.1.1 via 192.168.1.100')
    r1.cmd('ip route add to 192.168.0.1 via 192.168.0.100')
    sta1.cmd('iw dev sta1-wlan0 connect r1-ssid1')
    sta2.cmd('iw dev sta2-wlan0 connect r1-ssid2')

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

    info("*** Stopping network\n")
    net.stop()
Пример #19
0
def topology(args):
    "Create a network."
    net = Mininet_wifi()

    info("*** Creating nodes\n")
    net.addStation('sta1',
                   mac='00:00:00:00:00:02',
                   ip='10.0.0.2/8',
                   min_x=10,
                   max_x=30,
                   min_y=50,
                   max_y=70,
                   min_v=5,
                   max_v=10)
    net.addStation('sta2',
                   mac='00:00:00:00:00:03',
                   ip='10.0.0.3/8',
                   min_x=60,
                   max_x=70,
                   min_y=10,
                   max_y=20,
                   min_v=1,
                   max_v=5)
    if '-m' in args:
        ap1 = net.addAccessPoint('ap1',
                                 wlans=2,
                                 ssid='ssid1,ssid2',
                                 mode='g',
                                 channel='1',
                                 failMode="standalone",
                                 position='50,50,0')
    else:
        ap1 = net.addAccessPoint('ap1',
                                 ssid='new-ssid',
                                 mode='g',
                                 channel='1',
                                 failMode="standalone",
                                 position='50,50,0')

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

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

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

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

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

    info("*** Stopping network\n")
    net.stop()
Пример #20
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()
def topology():
    "Create a network."
    net = Mininet_wifi(controller=Controller, ac_method='ssf')

    info("*** Creating nodes\n")
    net.addStation('sta1',
                   mac='00:00:00:00:00:02',
                   ip='10.0.0.2/8',
                   position='20,50,0')
    net.addStation('sta2',
                   mac='00:00:00:00:00:03',
                   ip='10.0.0.3/8',
                   position='25,50,0')
    net.addStation('sta3',
                   mac='00:00:00:00:00:04',
                   ip='10.0.0.4/8',
                   position='35,50,0')
    net.addStation('sta4',
                   mac='00:00:00:00:00:05',
                   ip='10.0.0.5/8',
                   position='40,50,0')
    net.addStation('sta5',
                   mac='00:00:00:00:00:06',
                   ip='10.0.0.6/8',
                   position='45,50,0')
    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)
    c1 = net.addController('c1')

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

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

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

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

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

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

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

    info("*** Creating nodes\n")
    sta1 = net.addStation('sta1',
                          mac='00:00:00:00:00:02',
                          ip='10.0.0.1/8',
                          speed=4)
    sta2 = net.addStation('sta2',
                          mac='00:00:00:00:00:03',
                          ip='10.0.0.2/8',
                          speed=6)
    sta3 = net.addStation('sta3',
                          mac='00:00:00:00:00:04',
                          ip='10.0.0.3/8',
                          speed=3)
    sta4 = net.addStation('sta4',
                          mac='00:00:00:00:00:05',
                          ip='10.0.0.4/8',
                          speed=3)
    ap1 = net.addAccessPoint('ap1',
                             ssid='new-ssid',
                             mode='g',
                             channel='1',
                             position='45,45,0')
    c1 = net.addController('c1', controller=Controller)

    info("*** Configuring Propagation Model\n")
    net.setPropagationModel(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')

    path = os.path.dirname(os.path.abspath(__file__))
    getTrace(sta1, '%s/replayingMobility/node1.dat' % path)
    getTrace(sta2, '%s/replayingMobility/node2.dat' % path)
    getTrace(sta3, '%s/replayingMobility/node3.dat' % path)
    getTrace(sta4, '%s/replayingMobility/node4.dat' % path)

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

    replayingMobility(net)

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

    info("*** Stopping network\n")
    net.stop()
Пример #23
0
def topology():
    "Create a network."
    net = Mininet_wifi( controller=Controller, autoAssociation=False )

    info("*** Creating nodes\n")
    sta1 = net.addStation('sta1', position='10,60,0')
    sta2 = net.addStation('sta2', position='20,15,0')
    sta3 = net.addStation('sta3', position='10,25,0')
    sta4 = net.addStation('sta4', position='50,30,0')
    sta5 = net.addStation('sta5', position='45,65,0')
    ap1 = net.addAccessPoint('ap1', vssids=4, ssid=['ssid,ssid1,ssid2,ssid3,ssid4'],
                             mode="g", channel="1", position='30,40,0')
    c0 = net.addController('c0', controller=Controller)

    net.setPropagationModel(model='logDistance', exp=4)

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

    "plotting graph"
    net.plotGraph(max_x=100, max_y=100)

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

    sta1.setRange(15)
    sta2.setRange(15)
    sta3.setRange(15)
    sta4.setRange(15)
    sta5.setRange(15)

    sta1.cmd('iw dev %s connect %s %s'
             % (sta1.params['wlan'][0], ap1.wintfs[1].ssid,
                ap1.wintfs[1].mac))
    sta2.cmd('iw dev %s connect %s %s'
             % (sta2.params['wlan'][0], ap1.wintfs[2].ssid,
                ap1.wintfs[2].mac))
    sta3.cmd('iw dev %s connect %s %s'
             % (sta3.params['wlan'][0], ap1.wintfs[2].ssid,
                ap1.wintfs[2].mac))
    sta4.cmd('iw dev %s connect %s %s'
             % (sta4.params['wlan'][0], ap1.wintfs[3].ssid,
                ap1.wintfs[3].mac))
    sta5.cmd('iw dev %s connect %s %s'
             % (sta5.params['wlan'][0], ap1.wintfs[4].ssid,
                ap1.wintfs[4].mac))

    ap1.cmd('ovs-ofctl add-flow ap1 in_port=2,actions=3')
    ap1.cmd('ovs-ofctl add-flow ap1 in_port=3,actions=2')
    ap1.cmd('ovs-ofctl add-flow ap1 in_port=4,actions=5')
    ap1.cmd('ovs-ofctl add-flow ap1 in_port=5,actions=4')

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

    info("*** Stopping network\n")
    net.stop()
Пример #24
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()
Пример #25
0
def topology(mobility):
    "Create a network."
    net = Mininet_wifi(link=wmediumd, wmediumd_mode=interference)

    info("*** Creating nodes\n")
    if mobility:
        sta1 = net.addStation('sta1')
        sta2 = net.addStation('sta2')
        sta3 = net.addStation('sta3')
    else:
        sta1 = net.addStation('sta1', position='10,10,0')
        sta2 = net.addStation('sta2', position='50,10,0')
        sta3 = net.addStation('sta3', position='90,10,0')

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

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

    info("*** Creating links\n")
    net.addLink(sta1,
                cls=mesh,
                ssid='meshNet',
                intf='sta1-wlan0',
                channel=5,
                ht_cap='HT40+')  #, passwd='thisisreallysecret')
    net.addLink(sta2,
                cls=mesh,
                ssid='meshNet',
                intf='sta2-wlan0',
                channel=5,
                ht_cap='HT40+')  #, passwd='thisisreallysecret')
    net.addLink(sta3,
                cls=mesh,
                ssid='meshNet',
                intf='sta3-wlan0',
                channel=5,
                ht_cap='HT40+')  #, passwd='thisisreallysecret')

    if mobility:
        net.plotGraph(max_x=100, max_y=100)
        net.setMobilityModel(time=0,
                             model='RandomDirection',
                             max_x=100,
                             max_y=100,
                             min_v=0.5,
                             max_v=0.8,
                             seed=20)

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

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

    info("*** Stopping network\n")
    net.stop()
Пример #26
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()
Пример #27
0
def topology():
    "Create a network."
    net = Mininet_wifi(controller=Controller)

    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')

    net.setPropagationModel(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=11)

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

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

    info("*** Stopping network\n")
    net.stop()
Пример #28
0
def topology():
    "Create a network."
    net = Mininet_wifi(controller=Controller)

    info("*** Creating nodes\n")
    sta1 = net.addStation('sta1')
    sta2 = net.addStation('sta2')
    sta3 = net.addStation('sta3')
    sta4 = net.addStation('sta4')
    ap1 = net.addAccessPoint('ap1',
                             ssid="ssid-ap1",
                             mode="g",
                             channel="5",
                             failMode="standalone")
    ap2 = net.addAccessPoint('ap2',
                             ssid="ssid-ap2",
                             mode="g",
                             channel="11",
                             failMode="standalone")

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

    info("*** Associating Stations\n")
    net.addLink(ap1, ap2)
    net.addLink(sta1, ap1)
    net.addLink(sta2, ap1)
    net.addLink(sta3, ap2)
    net.addLink(sta4, ap2)

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

    sta1.cmd("ip link add link sta1-wlan0 name sta1-wlan0.10 type vlan id 10")
    sta2.cmd("ip link add link sta2-wlan0 name sta2-wlan0.10 type vlan id 10")
    sta3.cmd("ip link add link sta3-wlan0 name sta3-wlan0.20 type vlan id 20")
    sta4.cmd("ip link add link sta4-wlan0 name sta4-wlan0.20 type vlan id 20")

    sta1.cmd("route del -net 10.0.0.0 netmask 255.0.0.0")
    sta2.cmd("route del -net 10.0.0.0 netmask 255.0.0.0")
    sta3.cmd("route del -net 10.0.0.0 netmask 255.0.0.0")
    sta4.cmd("route del -net 10.0.0.0 netmask 255.0.0.0")

    sta1.cmd("ifconfig sta1-wlan0.10 10.0.0.1")
    sta2.cmd("ifconfig sta2-wlan0.10 10.0.0.2")
    sta3.cmd("ifconfig sta3-wlan0.20 10.0.0.3")
    sta4.cmd("ifconfig sta4-wlan0.20 10.0.0.4")

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

    info("*** Stopping network\n")
    net.stop()
Пример #29
0
def topology(stp):

    net = Mininet_wifi(accessPoint=OVSBridgeAP)

    info("*** Creating nodes\n")
    sta1 = net.addStation('sta1', mac='00:00:00:00:00:02', ip='10.0.0.1/8',
                          position='100,101,0')
    sta2 = net.addStation('sta2', mac='00:00:00:00:00:03', ip='10.0.0.2/8',
                          position='50,51,0')
    sta3 = net.addStation('sta3', mac='00:00:00:00:00:04', ip='10.0.0.3/8',
                          position='150,51,0')
    if stp:
        ap1 = net.addAccessPoint('ap1', ssid='new-ssid1', mode='g', channel='1',
                                 failMode="standalone", position='100,100,0',
                                 stp=True)
        ap2 = net.addAccessPoint('ap2', ssid='new-ssid2', mode='g', channel='1',
                                 failMode="standalone", position='50,50,0',
                                 stp=True)
        ap3 = net.addAccessPoint('ap3', ssid='new-ssid3', mode='g', channel='1',
                                 failMode="standalone", position='150,50,0',
                                 stp=True)
    else:
        ap1 = net.addAccessPoint('ap1', ssid='new-ssid1', mode='g', channel='1',
                                 failMode="standalone", position='100,100,0')
        ap2 = net.addAccessPoint('ap2', ssid='new-ssid2', mode='g', channel='1',
                                 failMode="standalone", position='50,50,0')
        ap3 = net.addAccessPoint('ap3', ssid='new-ssid3', mode='g', channel='1',
                                 failMode="standalone", position='150,50,0')

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

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

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

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

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

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

    info("*** Stopping network\n")
    net.stop()
Пример #30
0
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()