本文整理汇总了Python中mininet.net.Mininet.addWlan方法的典型用法代码示例。如果您正苦于以下问题:Python Mininet.addWlan方法的具体用法?Python Mininet.addWlan怎么用?Python Mininet.addWlan使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mininet.net.Mininet
的用法示例。
在下文中一共展示了Mininet.addWlan方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: topology
# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import addWlan [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()