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


Python Mininet.addHoc方法代码示例

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


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

示例1: topology

# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import addHoc [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

示例2: topology

# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import addHoc [as 别名]
def topology():
    "Create a network."
    net = Mininet( )

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

    print "*** Creating links"
    net.addHoc(sta1, ssid='adhocNet', mode='g')
    net.addHoc(sta2, ssid='adhocNet', mode='g')
    net.addHoc(sta3, ssid='adhocNet', mode='g')

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

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

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

示例3: topology

# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import addHoc [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.100")
    sta2 = net.addStation("sta2")
    ap1 = net.addBaseStation("ap1", ssid="ssid_1", mode="g", channel="5")
    c0 = net.addController("c0", controller=Controller)

    net.addWlan(5)  # more 5 wlans available to be used

    print "*** Associating..."
    net.addLink(ap1, sta1)  # Automaticaly add interface wlan0 in sta1

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

    print "*** Adding new Interfaces to STAs"
    station.addWlan(sta1)  # add wlan1 in sta1
    station.addWlan(sta1)  # add wlan2 (unused) in sta1
    station.addWlan(sta2)  # add wlan0 in sta2
    station.addWlan(sta2)  # add wlan1 (unused) in sta2
    station.addWlan(sta2)  # add wlan2 (unused) in sta2

    print "***Creating adhoc network"
    net.addHoc(sta1, "adhoc1", "g", interface="wlan1")
    net.addHoc(sta2, "adhoc1", "g", interface="wlan0")
    sta1.cmd("ifconfig sta1-wlan1 192.168.10.1")
    sta2.cmd("ifconfig sta2-wlan0 192.168.10.2")

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

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

示例4: topology

# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import addHoc [as 别名]
def topology():
    "Create a network."
    net = Mininet( )
    #wirelessRadios = Number of STAs + APs

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

    print "*** Creating links"
    net.addHoc(sta1, 'adhocNet', 'g') #node, ssid, mode
    net.addHoc(sta2, 'adhocNet', 'g') #node, ssid, mode
    net.addHoc(sta3, 'adhocNet', 'g') #node, ssid, mode

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

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

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

示例5: topology

# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import addHoc [as 别名]
def topology():
    "Create a network."
    net = Mininet( wirelessRadios=3, waitTime=10 )
    #wirelessRadios = Number of STAs + APs
    #waitTime = Time (sec) necessary to connect STAs in Ad-hoc mode (it depends of each machine)

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

    print "*** Creating links"
    net.addHoc(sta1, 'adhocNet', 'g') #node, ssid, mode
    net.addHoc(sta2, 'adhocNet', 'g') #node, ssid, mode
    net.addHoc(sta3, 'adhocNet', 'g') #node, ssid, mode

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

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

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


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