Mininet Script Error: type object 'OVSSwitch' has no attribute 'OVSVersion'
Mininet Script Error: type object 'OVSSwitch' has no attribute '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 生成。 node.py 第 1070 行的代码似乎没问题。
这有效我不知道为什么:
#!/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=RemoteController,
ip='127.0.0.1',
protocol='tcp',
port=6633)
info( '*** Add switches\n')
s1 = net.addSwitch('s1', cls=OVSKernelSwitch)
s2 = net.addSwitch('s2', cls=OVSKernelSwitch)
r3 = net.addHost('r3', cls=Node, ip='0.0.0.0')
r3.cmd('sysctl -w net.ipv4.ip_forward=1')
r4 = net.addHost('r4', cls=Node, ip='0.0.0.0')
r4.cmd('sysctl -w net.ipv4.ip_forward=1')
info( '*** Add hosts\n')
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)
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)
info( '*** Add links\n')
net.addLink(h1, s1)
net.addLink(h2, s1)
net.addLink(h3, s2)
net.addLink(h4, s2)
net.addLink(s1, r3)
net.addLink(s1, r4)
net.addLink(s2, r3)
net.addLink(s2, r4)
info( '*** Starting network\n')
net.build()
info( '*** Starting controllers\n')
for controller in net.controllers:
controller.start()
info( '*** Starting switches\n')
net.get('s1').start([c0])
net.get('s2').start([c0])
info( '*** Post configure switches and hosts\n')
CLI(net)
net.stop()
if __name__ == '__main__':
setLogLevel( 'info' )
myNetwork()
在您的原始版本中,您有
net.addLink(r1, s3)
你需要的地方
net.addLink(s3, r1)
您似乎在重构变量名时无意中修复了它。
面临同样的问题,似乎库在 net.addSwitch()
处进行了一些初始化,即您需要 首先调用 net.addSwitch()
至少一次,在任何 addHost()
/ addLink()
之前。
我收到以下错误:
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 生成。 node.py 第 1070 行的代码似乎没问题。
这有效我不知道为什么:
#!/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=RemoteController,
ip='127.0.0.1',
protocol='tcp',
port=6633)
info( '*** Add switches\n')
s1 = net.addSwitch('s1', cls=OVSKernelSwitch)
s2 = net.addSwitch('s2', cls=OVSKernelSwitch)
r3 = net.addHost('r3', cls=Node, ip='0.0.0.0')
r3.cmd('sysctl -w net.ipv4.ip_forward=1')
r4 = net.addHost('r4', cls=Node, ip='0.0.0.0')
r4.cmd('sysctl -w net.ipv4.ip_forward=1')
info( '*** Add hosts\n')
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)
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)
info( '*** Add links\n')
net.addLink(h1, s1)
net.addLink(h2, s1)
net.addLink(h3, s2)
net.addLink(h4, s2)
net.addLink(s1, r3)
net.addLink(s1, r4)
net.addLink(s2, r3)
net.addLink(s2, r4)
info( '*** Starting network\n')
net.build()
info( '*** Starting controllers\n')
for controller in net.controllers:
controller.start()
info( '*** Starting switches\n')
net.get('s1').start([c0])
net.get('s2').start([c0])
info( '*** Post configure switches and hosts\n')
CLI(net)
net.stop()
if __name__ == '__main__':
setLogLevel( 'info' )
myNetwork()
在您的原始版本中,您有
net.addLink(r1, s3)
你需要的地方
net.addLink(s3, r1)
您似乎在重构变量名时无意中修复了它。
面临同样的问题,似乎库在 net.addSwitch()
处进行了一些初始化,即您需要 首先调用 net.addSwitch()
至少一次,在任何 addHost()
/ addLink()
之前。