本文整理汇总了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()
示例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()
示例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()
示例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()
示例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()