当前位置: 首页>>代码示例>>Python>>正文


Python Mininet.addBaseStation方法代码示例

本文整理汇总了Python中mininet.net.Mininet.addBaseStation方法的典型用法代码示例。如果您正苦于以下问题:Python Mininet.addBaseStation方法的具体用法?Python Mininet.addBaseStation怎么用?Python Mininet.addBaseStation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mininet.net.Mininet的用法示例。


在下文中一共展示了Mininet.addBaseStation方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: topology

# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import addBaseStation [as 别名]
def topology():
    "Create a network."
    net = Mininet( controller=Controller, link=TCLink, switch=OVSKernelSwitch )

    print "*** Creating nodes"
    sta1 = net.addStation( 'sta1', wlans=2, ip='10.0.0.2/8' )
    h1 = net.addHost( 'h1', mac='00:00:00:00:00:01', ip='10.0.0.1/8' )
    h2 = net.addHost( 'h2', mac='00:00:00:00:00:11', ip='10.0.0.11/8' )
    ap1 = net.addBaseStation( 'ap1', ssid='ssid_ap1', mode= 'g', channel=6, position='70,25,0' )
    ap2 = net.addBaseStation( 'ap2', ssid='ssid_ap2', mode= 'g', channel=1, position='30,25,0' )
    ap3 = net.addBaseStation( 'ap3', ssid='ssid_ap3', mode= 'g', channel=11, position='110,25,0' )
    s4 = net.addSwitch( 's4', mac='00:00:00:00:00:10' )
    c1 = net.addController( 'c1', controller=Controller )

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

    sta1.cmd('modprobe bonding mode=3')
    sta1.cmd('ip link add bond0 type bond')
    sta1.cmd('ip link set bond0 address 02:01:02:03:04:08')
    sta1.cmd('ip link set sta1-wlan0 down')
    sta1.cmd('ip link set sta1-wlan0 address 00:00:00:00:00:11')
    sta1.cmd('ip link set sta1-wlan0 master bond0')
    sta1.cmd('ip link set sta1-wlan1 down')
    sta1.cmd('ip link set sta1-wlan1 address 00:00:00:00:00:12')
    sta1.cmd('ip link set sta1-wlan1 master bond0')
    sta1.cmd('ip addr add 10.0.0.10/8 dev bond0')
    sta1.cmd('ip link set bond0 up')

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

    sta1.cmd('ip addr del 10.0.0.2/8 dev sta1-wlan0')
    os.system('ovs-ofctl add-flow s4 actions=normal')

    """seed"""
    net.seed(12)

    """uncomment to plot graph"""
    net.plotGraph(max_x=140, max_y=140)
    
    "*** Available models: RandomWalk, TruncatedLevyWalk, RandomDirection, RandomWaypoint, GaussMarkov ***"
    net.startMobility(startTime=0, model='RandomDirection', max_x=120, max_y=50, min_v=0.4, max_v=0.6)

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

    print "*** Stopping network"
    net.stop()
开发者ID:EliseuTorres,项目名称:mininet-wifi-1,代码行数:60,代码来源:allWirelessNetworksAroundUs.py

示例2: topology

# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import addBaseStation [as 别名]
def topology():

    "Create a network."
    net = Mininet( controller=RemoteController, link=TCLink, switch=OVSKernelSwitch )
    sta = []

    print "*** Creating nodes"
    for n in range(10):
	sta.append(n)
	sta[n] = net.addStation( 'sta%s' % (n+1), wlans=2, mac='00:00:00:00:00:%s' % (n+1), ip='192.168.0.%s/24' % (n+1) )
    phyap1 = net.addPhysicalBaseStation( 'phyap1', ssid= 'SBRC16-MininetWiFi', mode= 'g', channel= '1', position='50,115,0', wlan='wlan11' )
    sta11 = net.addStation( 'sta11', ip='10.0.0.111/8', position='120,200,0')
    ap2 = net.addBaseStation( 'ap2', ssid= 'ap2', mode= 'g', channel= '11', position='100,175,0' )
    ap3 = net.addBaseStation( 'ap3', ssid= 'ap3', mode= 'g', channel= '6', position='150,50,0' )
    ap4 = net.addBaseStation( 'ap4', ssid= 'ap4', mode= 'g', channel= '1', position='175,150,0' )
    c1 = net.addController( 'c1', controller=Controller, port=6653 )
    root = Node( 'root', inNamespace=False )

    print "*** Creating links"
    for station in sta:
        net.addMesh(station, ssid='meshNet')

    """uncomment to plot graph"""
    net.plotGraph(max_x=240, max_y=240)

    """Routing"""
    net.meshRouting('custom')

    """Seed"""
    net.seed(20)

    print "*** Associating and Creating links"
    net.addLink(phyap1, ap2)
    net.addLink(ap2, ap3)
    net.addLink(ap3, ap4)

    print "*** Starting network"
    net.build()

    c1.start()
    phyap1.start( [c1] )
    ap2.start( [c1] )
    ap3.start( [c1] )
    ap4.start( [c1] )

    ip = 201
    for station in sta:
        station.cmd('ifconfig %s-wlan1 10.0.0.%s/8' % (station, ip))
        ip+=1

    "*** Available models: RandomWalk, TruncatedLevyWalk, RandomDirection, RandomWayPoint, GaussMarkov, ReferencePoint, TimeVariantCommunity ***"
    net.startMobility(startTime=0, model='RandomWalk', max_x=200, max_y=220, min_v=0.1, max_v=0.2)

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

    print "*** Stopping network"
    net.stop()
开发者ID:lavvy,项目名称:mininet-wifi,代码行数:60,代码来源:sbrc.py

示例3: topology

# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import addBaseStation [as 别名]
def topology():

    "Create a network."
    net = Mininet( controller=Controller, link=TCLink, switch=OVSKernelSwitch )

    print "*** Creating nodes"
    h1 = net.addHost( 'h1', mac='00:00:00:00:00:01', ip='10.0.0.1/8' )
    sta1 = net.addStation( 'sta1', mac='00:00:00:00:00:02', ip='10.0.0.2/8' )
    sta2 = net.addStation( 'sta2', wlans=2, ip='10.0.0.3/8' )
    sta3 = net.addStation( 'sta3', mac='00:00:00:00:00:04', ip='10.0.0.4/8' )
    sta4 = net.addStation( 'sta4', wlans=2, ip='10.0.0.5/8' )
    sta5 = net.addStation( 'sta5', mac='00:00:00:00:00:06', ip='10.0.0.6/8' )
    sta6 = net.addStation( 'sta6', wlans=2,ip='10.0.0.7/8' )

    ap1 = net.addBaseStation( 'ap1', ssid= 'new-ssid1', mode= 'g', channel= '1', position='30,30,0', range= 30)
    ap2 = net.addBaseStation( 'ap2', ssid= 'new-ssid2', mode= 'g', channel= '2', position='60,30,0', range= 40 )
    ap3 = net.addBaseStation( 'ap3', ssid= 'new-ssid3', mode= 'g', channel= '3', position='30,50,0', range= 35 )
    ap4 = net.addBaseStation( 'ap4', ssid= 'new-ssid4', mode= 'g', channel= '4', position='60,50,0', range= 45 )
    c1 = net.addController( 'c1', controller=Controller )


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

    net.addLink(ap1, h1)
    net.addLink(ap1, sta1)
    net.addLink(ap1, sta2)
    net.addLink(ap2, sta3)
    net.addLink(ap3, sta4)
    net.addLink(ap4, sta5)
    net.addLink(ap4, sta6)
    print "*** Starting network"
    net.build()
    c1.start()
    ap1.start( [c1] )
    ap2.start( [c1] )
    ap3.start( [c1] )
    ap4.start( [c1] )
    
    net.seed(10)

    """uncomment to plot graph"""
    net.plotGraph(max_x=100, max_y=100)

    net.startMobility(startTime=0, model='RandomWayPoint', max_x=60, max_y=60, min_v=0.1, max_v=0.5, AC='ssf')

   

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

    print "*** Stopping network"
    net.stop()
开发者ID:AsmaSwapna,项目名称:SDWN-Mobility-Solution,代码行数:60,代码来源:wifiMobility5.py

示例4: topology

# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import addBaseStation [as 别名]
def topology():
    "Create a network."
    net = Mininet( controller=Controller, link=TCLink, switch=OVSKernelSwitch )

    print "*** Creating nodes"
    sta1 = net.addStation( 'sta1', mac='00:00:00:00:00:02', ip='10.0.0.2/8' )
    sta2 = net.addStation( 'sta2', mac='00:00:00:00:00:03', ip='10.0.0.3/8' )
    sta3 = net.addStation( 'sta3', mac='00:00:00:00:00:04', ip='10.0.0.4/8' )
    sta4 = net.addStation( 'sta4', mac='00:00:00:00:00:05', ip='10.0.0.5/8' )
    sta5 = net.addStation( 'sta5', mac='00:00:00:00:00:06', ip='10.0.0.6/8' )
    sta6 = net.addStation( 'sta6', mac='00:00:00:00:00:07', ip='10.0.0.7/8' )
    sta7 = net.addStation( 'sta7', mac='00:00:00:00:00:08', ip='10.0.0.8/8' )
    sta8 = net.addStation( 'sta8', mac='00:00:00:00:00:09', ip='10.0.0.9/8' )
    sta9 = net.addStation( 'sta9', mac='00:00:00:00:00:10', ip='10.0.0.10/8' )
    sta10 = net.addStation( 'sta10', mac='00:00:00:00:00:11', ip='10.0.0.11/8' )
    ap1 = net.addBaseStation( 'ap1', ssid= 'new-ssid1', mode= 'g', channel= '1', position='50,50,0' )
    ap2 = net.addBaseStation( 'ap2', ssid= 'new-ssid2', mode= 'g', channel= '1', position='70,50,0', range=30 ) #range: set the AP range
    ap3 = net.addBaseStation( 'ap3', ssid= 'new-ssid3', mode= 'g', channel= '1', position='90,50,0' )
    c1 = net.addController( 'c1', controller=Controller )

    print "*** Associating and Creating links"
    net.addLink(ap1, ap2)
    net.addLink(ap2, ap3)
    
    print "*** Starting network"
    net.build()
    c1.start()
    ap1.start( [c1] )
    ap2.start( [c1] )
    ap3.start( [c1] )
    
    """uncomment to plot graph"""
    net.plotGraph(max_x=120, max_y=120)

    """association control"""
    net.associationControl('ssf')

    """Seed"""
    net.seed(1) 

    """ *** Available models: 
                RandomWalk, TruncatedLevyWalk, RandomDirection, RandomWayPoint, GaussMarkov
	*** Association Control (AC) - mechanism that optimizes the use of the APs:
                llf (Least-Loaded-First)
                ssf (Strongest-Signal-First)"""
    net.startMobility(startTime=0, model='RandomWayPoint', max_x=120, max_y=120, min_v=0.3, max_v=0.5)
   
    print "*** Running CLI"
    CLI( net )

    print "*** Stopping network"
    net.stop()
开发者ID:EliseuTorres,项目名称:mininet-wifi-1,代码行数:54,代码来源:wifiAssociationControl.py

示例5: topology

# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import addBaseStation [as 别名]
def topology():

    "Create a network."
    net = Mininet( controller=Controller, link=TCLink, switch=OVSKernelSwitch )

    print "*** Creating nodes"
    car1 = net.addVehicle( 'car1', wlans=2, mac='00:00:00:00:00:01', ip='10.0.0.1/8', min_speed=1, max_speed=5 )
    car2 = net.addVehicle( 'car2', wlans=2, mac='00:00:00:00:00:02', ip='10.0.0.2/8', min_speed=5, max_speed=10 )
    car3 = net.addVehicle( 'car3', mac='00:00:00:00:00:03', ip='10.0.0.3/8', min_speed=10, max_speed=15 )
    car4 = net.addVehicle( 'car4', mac='00:00:00:00:00:04', ip='10.0.0.4/8', min_speed=15, max_speed=20 )
    car5 = net.addVehicle( 'car5', mac='00:00:00:00:00:05', ip='10.0.0.5/8', min_speed=15, max_speed=20 )
    bs1 = net.addBaseStation( 'BS1', ssid= 'new-ssid1', mode= 'g', channel= '1' )
    bs2 = net.addBaseStation( 'BS2', ssid= 'new-ssid2', mode= 'g', channel= '6' )
    bs3 = net.addBaseStation( 'BS3', ssid= 'new-ssid3', mode= 'g', channel= '11' )
    c1 = net.addController( 'c1', controller=Controller )

    print "*** Associating and Creating links"
    net.addMesh(car1, ssid='mesh')
    net.addMesh(car2, ssid='mesh')
    net.addMesh(car3, ssid='mesh')
    net.addMesh(car4, ssid='mesh')
    net.addMesh(car5, ssid='mesh')
    net.addLink(bs1, bs2)
    net.addLink(bs1, bs3)
       
    print "*** Starting network"
    net.build()
    c1.start()
    bs1.start( [c1] )
    bs2.start( [c1] )
    bs3.start( [c1] )
    
    """uncomment to plot graph"""
    net.plotGraph(max_x=500, max_y=500)

    """Number of Roads"""
    net.roads(4)

    """Seed"""
    net.seed(20) 

    """Start Mobility"""
    net.startMobility(startTime=0)
   
    print "*** Running CLI"
    CLI( net )

    print "*** Stopping network"
    net.stop()
开发者ID:EliseuTorres,项目名称:mininet-wifi-1,代码行数:51,代码来源:vanet.py

示例6: topology

# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import addBaseStation [as 别名]
def topology():

    "Create a network."
    net = Mininet(controller=Controller, link=TCLink, switch=OVSKernelSwitch)

    print "*** Creating nodes"
    sta1 = net.addStation("sta1", mac="00:00:00:00:00:02", ip="10.0.0.2/8", speed=1)
    sta2 = net.addStation("sta2", mac="00:00:00:00:00:03", ip="10.0.0.3/8", speed=3)
    ap1 = net.addBaseStation("ap1", ssid="new-ssid", mode="g", channel="1", position="50,50,0")
    c1 = net.addController("c1", controller=Controller)

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

    """uncomment to plot graph"""
    net.plotGraph(max_x=100, max_y=100)

    getTrace(sta1, "examples/replaying/replayingMobility/node1.dat")
    getTrace(sta2, "examples/replaying/replayingMobility/node2.dat")

    replayingMobility()

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

    print "*** Stopping network"
    net.stop()
开发者ID:XianliangJ,项目名称:Mininet-WiFi,代码行数:31,代码来源:replayingMobility.py

示例7: topology

# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import addBaseStation [as 别名]
def topology():
    "Create a network."
    net = Mininet( controller=Controller, link=TCLink, switch=OVSKernelSwitch )

    image = 'shub1905/chaos:hostapd_latest'
    image2 = 'shub1905/ubuntu:updated_wpa'
    cmd = '/bin/ash'
    cmd2 = '/bin/bash'

    print "*** Creating nodes"
    sta1 = net.addStation( 'sta1', ip='10.0.0.1', passwd='123456789a', encrypt='wpa2', cls=Docker, dimage=image2, dcmd=cmd2 )
    sta2 = net.addStation( 'sta2', ip='10.0.0.2', passwd='12346789a', encrypt='wpa2', cls=Docker, dimage=image2, dcmd=cmd2 )
    sta3 = net.addStation( 'sta3', ip='10.0.0.3', passwd='123456789a', encrypt='wpa2', cls=Docker, dimage=image2, dcmd=cmd2 )

    # sta1 = net.addStation( 'sta1', passwd='123456789a', encrypt='wpa2' ) #encrypt=(wpa,wpa2,wep)
    # sta2 = net.addStation( 'sta2', passwd='123456789a', encrypt='wpa2' ) #encrypt=(wpa,wpa2,wep)
    ap1 = net.addBaseStation( 'ap1', ssid="simplewifi", mode="g", channel="5", passwd='123456789a', encrypt='wpa2' ) #encrypt=(wpa,wpa2,wep)

    c0 = net.addController('c0', controller=Controller, ip='127.0.0.1', port=6633 )

    print "*** Associating Stations"
    net.addLink(sta1, ap1)
    net.addLink(sta2, ap1)
    net.addLink(sta3, ap1)

    print "*** Starting network"
    net.build()
    c0.start()
    ap1.start( [c0] )

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

    print "*** Stopping network"
    net.stop()
开发者ID:shub1905,项目名称:mininet-wifi,代码行数:37,代码来源:docker-integrations.py

示例8: topology

# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import addBaseStation [as 别名]
def topology():

    "Create a network."
    net = Mininet( controller=Controller, link=TCLink, switch=OVSKernelSwitch )

    print "*** Creating nodes"
    sta1 = net.addStation( 'sta1', mac='00:00:00:00:00:02', ip='10.0.0.2/8' )
    ap1 = net.addBaseStation( 'ap1', ssid= 'new-ssid', mode= 'g', channel= '1', position='50,50,0' )
    c1 = net.addController( 'c1', controller=Controller )

    print "*** adding Link"
    net.addLink(sta1, ap1)

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

    """uncomment to plot graph"""
    net.plotGraph(max_x=100, max_y=100)

    getTrace(sta1, 'examples/replaying/replayingBandwidth/throughputData.dat')

    replayingBandwidth()

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

    print "*** Stopping network"
    net.stop()
开发者ID:EliseuTorres,项目名称:mininet-wifi-1,代码行数:32,代码来源:replayingBandwidth.py

示例9: topology

# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import addBaseStation [as 别名]
def topology():
    "Create a network."
    net = Mininet( wirelessRadios=6, controller=RemoteController, link=TCLink, switch=OVBaseStation )

    print "*** Creating nodes"
    sta1 = net.addStation( 'sta1' )
    sta2 = net.addStation( 'sta2' )
    bs1 = net.addBaseStation( 'bs1' )

    c0 = net.addController('c0', controller=OVSController, port=6633 )

    print "*** Adding Link"
    net.addLink(sta1, bs1)
    net.addLink(sta2, bs1)

    print "*** Starting network"
    net.build()
    c0.start()
    bs1.start( [c0] )


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

    print "*** Stopping network"
    net.stop()
开发者ID:unixcore,项目名称:mininet-wifi,代码行数:28,代码来源:simplewifitopology.py

示例10: topology

# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import addBaseStation [as 别名]
def topology():
    "Create a network."
    net = Mininet( controller=Controller, link=TCLink, switch=OVSKernelSwitch )

    print "*** Creating nodes"
    sta1 = net.addStation( 'sta1', wlans=3 ) # 3 wlan added
    sta2 = net.addStation( 'sta2' ) # 1 wlan added
    ap1 = net.addBaseStation( 'ap1', ssid="ssid_1", mode="g", channel=5 ) # 1 wlan added
    c0 = net.addController('c0', controller=Controller)

    print "*** Associating..."
    net.addLink(ap1, sta1)

    net.addHoc(sta1, ssid='adhoc1', mode='g')
    net.addHoc(sta2, ssid='adhoc1', mode='g')

    print "*** Starting network"
    net.build()
    c0.start()
    ap1.start( [c0] )

    print "***Addressing..."
    sta1.setIP('192.168.10.1/24', intf="sta1-wlan1")
    sta2.setIP('192.168.10.2/24', intf="sta2-wlan0")

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

    print "*** Stopping network"
    net.stop()
开发者ID:alitalpur99,项目名称:mininet-wifi,代码行数:32,代码来源:multipleWlan.py

示例11: topology

# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import addBaseStation [as 别名]
def topology():

    "Create a network."
    net = Mininet( controller=Controller, link=TCLink, switch=OVSKernelSwitch )

    print "*** Creating nodes"
    sta1 = net.addStation( 'sta1', mac='00:00:00:00:00:02', ip='10.0.0.2/8' )
    sta2 = net.addStation( 'sta2', mac='00:00:00:00:00:03', ip='10.0.0.3/8' )
    ap1 = net.addBaseStation( 'ap1', ssid= 'new-ssid', mode= 'g', channel= '1', position='50,50,0' )
    c1 = net.addController( 'c1', controller=Controller )

    print "*** Associating and Creating links"
    net.addLink(ap1, sta1)
    net.addLink(ap1, sta2)
    
    print "*** Starting network"
    net.build()
    c1.start()
    ap1.start( [c1] )
    
    """uncomment to plot graph"""
    net.plotGraph(max_x=100, max_y=100)

    """Seed"""
    net.seed(20) 

    "*** Available models: RandomWalk, TruncatedLevyWalk, RandomDirection, RandomWayPoint, GaussMarkov, ReferencePoint, TimeVariantCommunity ***"
    net.startMobility(startTime=0, model='RandomDirection', max_x=60, max_y=60, min_v=0.5, max_v=0.5)
   
    print "*** Running CLI"
    CLI( net )

    print "*** Stopping network"
    net.stop()
开发者ID:EliseuTorres,项目名称:mininet-wifi-1,代码行数:36,代码来源:wifiMobilityModel.py

示例12: topology

# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import addBaseStation [as 别名]
def topology():

    "Create a network."
    net = Mininet(controller=Controller, link=TCLink, switch=OVSKernelSwitch)

    print "*** Creating nodes"
    h1 = net.addHost("h1", mac="00:00:00:00:00:01", ip="10.0.0.1/8")
    sta1 = net.addStation("sta1", mac="00:00:00:00:00:02", ip="10.0.0.2/8", position="10,20,0")
    sta2 = net.addStation("sta2", mac="00:00:00:00:00:03", ip="10.0.0.3/8", position="10,30,0")
    ap1 = net.addBaseStation("ap1", ssid="new-ssid", mode="g", channel="1", position="15,30,0")
    c1 = net.addController("c1", controller=Controller)

    """uncomment to plot graph"""
    # net.plotGraph(max_x=60, max_y=60)

    print "*** Creating links"
    net.addLink(ap1, h1, 1, 0)
    net.addLink(ap1, sta1)
    net.addLink(ap1, sta2)

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

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

    print "*** Stopping network"
    net.stop()
开发者ID:unixcore,项目名称:mininet-wifi-1,代码行数:32,代码来源:wifiPosition.py

示例13: topology

# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import addBaseStation [as 别名]
def topology():
    "Create a network."
    net = Mininet( controller=Controller, link=TCLink, switch=OVSKernelSwitch )

    print "*** Creating nodes"
    sta1 = net.addStation( 'sta1', ip="192.168.0.1/24" )
    sta2 = net.addStation( 'sta2', ip="192.168.0.2/24" )
    sta3 = net.addStation( 'sta3', ip="192.168.0.3/24" )
    sta4 = net.addStation( 'sta4', ip="192.168.0.4/24" )
    ap1 = net.addBaseStation( 'ap1', ssid="ssid_1", mode="g", channel="1" )
    ap2 = net.addBaseStation( 'ap2', ssid="ssid_2", mode="b", channel="6" )
    c0 = net.addController('c0', controller=Controller, ip='127.0.0.1', port=6653 )

    print "*** Adding Link"
    net.addLink(ap1, ap2) #wired connection
    net.addLink(sta1, ap1)
    net.addLink(sta2, ap1)
    net.addLink(sta3, ap2)
    net.addLink(sta4, ap2)

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

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

    print "*** Stopping network"
    net.stop()
开发者ID:EliseuTorres,项目名称:mininet-wifi-1,代码行数:33,代码来源:2AccessPoints.py

示例14: topology

# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import addBaseStation [as 别名]
def topology():

    "Create a network."
    net = Mininet( controller=Controller, link=TCLink, switch=OVSKernelSwitch )

    print "*** Creating nodes"
    sta1 = net.addStation( 'sta1', mac='00:00:00:00:00:02', ip='10.0.0.2/8', position='10,20,0' )
    sta2 = net.addStation( 'sta2', mac='00:00:00:00:00:03', ip='10.0.0.3/8', position='10,30,0' )
    ap1 = net.addBaseStation( 'ap1', ssid= 'new-ssid', mode= 'g', channel= '1', position='15,30,0' )
    c1 = net.addController( 'c1', controller=Controller )

    """uncomment to plot graph"""
    #net.plotGraph(max_x=60, max_y=60)

    print "*** Creating links"
    net.addLink(ap1, sta1)
    net.addLink(ap1, sta2)

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

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

    print "*** Stopping network"
    net.stop()
开发者ID:HerrOber,项目名称:mininet-wifi,代码行数:30,代码来源:wifiPosition.py

示例15: topology

# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import addBaseStation [as 别名]
def topology():
    "Create a network."
    net = Mininet( controller=Controller, link=TCLink, switch=OVSKernelSwitch )
    #wirelessRadios = Number of STAs + APs
    
    print "*** Creating nodes"
    ap1 = net.addBaseStation( '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', port=6633 )

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

    print "*** Stopping network"
    net.stop()
开发者ID:unixcore,项目名称:mininet-wifi-1,代码行数:32,代码来源:wifiStationsAndHosts.py


注:本文中的mininet.net.Mininet.addBaseStation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。