from mininet.net import Mininet
from mininet.node import Controller,OVSKernelAP
from mininet.link import TCLink
from mininet.cli import CLI
from mininet.log import setLogLevel
def topology():
net = Mininet(controller=Controller, link=TCLink, accessPoint= OVSKernelAP)
print "***Creating nodes"
ap1 = net.addAccessPoint('ap1', ssid='ssid-ap1', mode='g', channel= '1', position= '25,50,0', range='35')
ap2 = net.addAccessPoint('ap2', ssid='ssid-ap2', mode='g', channel= '6', position = '75,50,0', range='35')
sta1 = net.addStation('sta1', mac='00:00:00:00:00:01', ip='10.0.0.1',position='50,50,0')
sta2 = net.addStation('sta2', mac='00:00:00:00:00:02', ip='10.0.0.2',position='40,50,0')
c1 = net.addController('c1', controller=Controller)
#print "*** Enabling assciation control (AP)"
#net.associationControl('ssf')
print "*** Configuring wifi nodes"
net.configureWifiNodes()
print "Creating Links"
net.addLink(ap1, ap2)
net.addLink(ap1, sta1)
net.addLink(ap2, sta2)
print "Starting Network"
net.build()
c1.start()
ap1.start([c1])
ap2.start([c1])
"""Plot Graph"""
net.plotGraph(max_x=100, max_y=100)
print "****Running CLI"
CLI(net)
print "****Stopping Network"
net.stop()
if __name__ == '__main__':
setLogLevel('info')
topology()
当我运行代码时,我不断收到错误:
***创建节点
***配置wifi节点
***错误:tx功率为负! (-15)
这是我在教程中找到的基本代码,我对此感到困惑,我不确定是什么问题。
答案 0 :(得分:0)
如果删除范围参数并在net.build()之前使用net.plotGraph(max_x=100, max_y=100)
,代码将起作用。