2
我收到以下錯誤:Mininet腳本錯誤:對象類型 'OVSSwitch' 沒有屬性 'OVSVersion'
File "build/bdist.linux-x86_64/egg/mininet/node.py", line 1162, in start
File "build/bdist.linux-x86_64/egg/mininet/node.py", line 1163, in <genexpr>
File "build/bdist.linux-x86_64/egg/mininet/node.py", line 1129, in intfOpts
File "build/bdist.linux-x86_64/egg/mininet/node.py", line 1072, in isOldOVS
AttributeError: type object 'OVSSwitch' has no attribute 'OVSVersion'
而我跑以下Mininet腳本:
#!/usr/bin/python
from mininet.net import Mininet
from mininet.node import Controller, RemoteController, OVSController
from mininet.node import CPULimitedHost, Host, Node
from mininet.node import OVSKernelSwitch, UserSwitch
from mininet.node import IVSSwitch
from mininet.cli import CLI
from mininet.log import setLogLevel, info
from mininet.link import TCLink, Intf
from subprocess import call
def myNetwork():
net = Mininet(topo=None,
build=False,
ipBase='10.0.0.0/8')
info('*** Adding controller\n')
c0=net.addController(name='c0',
controller=Controller,
protocol='tcp',
port=6633)
info('*** Add switches\n')
r1 = net.addHost('r1', cls=Node, ip='0.0.0.0')
r1.cmd('sysctl -w net.ipv4.ip_forward=1')
s3 = net.addSwitch('s3', cls=OVSKernelSwitch)
r2 = net.addHost('r2', cls=Node, ip='0.0.0.0')
r2.cmd('sysctl -w net.ipv4.ip_forward=1')
s5 = net.addSwitch('s5', cls=OVSKernelSwitch)
info('*** Add hosts\n')
h3 = net.addHost('h3', cls=Host, ip='10.0.0.3', defaultRoute=None)
h4 = net.addHost('h4', cls=Host, ip='10.0.0.4', defaultRoute=None)
h1 = net.addHost('h1', cls=Host, ip='10.0.0.1', defaultRoute=None)
h2 = net.addHost('h2', cls=Host, ip='10.0.0.2', defaultRoute=None)
info('*** Add links\n')
net.addLink(h1, s3)
net.addLink(h2, s3)
net.addLink(r1, s3)
net.addLink(s3, r2)
net.addLink(h3, s5)
net.addLink(h4, s5)
net.addLink(s5, r1)
net.addLink(s5, r2)
info('*** Starting network\n')
net.build()
info('*** Starting controllers\n')
for controller in net.controllers:
controller.start()
info('*** Starting switches\n')
net.get('s3').start([c0])
net.get('s5').start([c0])
info('*** Post configure switches and hosts\n')
CLI(net)
net.stop()
if __name__ == '__main__':
setLogLevel('info')
myNetwork()
通過miniedit產生的.py。行號爲1070的代碼在node.py似乎很好。