mininet python in centos7

19 篇文章 0 订阅

>>> from mininet.net import Mininet
>>> net = Mininet()
>>> h3 = net.addHost('h3')
>>> h4 = net.addHost('h4')
>>> s3 = net.addSwitch('s3')
>>> c0 = net.addController('c0', port=6634)
>>> net.addLink(h3, s3)
<mininet.link.Link object at 0x2edb210>
>>> net.addLink(h4, s3)
<mininet.link.Link object at 0x2eb0c90>

>>> net.build()
*** defaultIntf: warning: h1 has no interfaces
*** defaultIntf: warning: h2 has no interfaces
>>> net.start()

>>> h4.IP()
'10.0.0.4'
>>> h4.cmd('python -m SimpleHTTPServer 80 &')
''

>>> h3.cmd('curl', h4.IP())
'curl: (7) Failed connect to 10.0.0.4:80; No route to host\r\n'
>>> h4.cmd('python -m SimpleHTTPServer 80 &')
''
>>> h3.cmd('curl', h4.IP())
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "mininet/node.py", line 355, in cmd
    self.sendCmd( *args, **kwargs )
  File "mininet/node.py", line 272, in sendCmd
    assert self.shell and not self.waiting
AssertionError
>>> h3.waiting = False
>>> h3.cmd('curl', h4.IP())
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "mininet/node.py", line 356, in cmd
    return self.waitOutput( verbose )
  File "mininet/node.py", line 343, in waitOutput
    data = self.monitor( findPid=findPid )
  File "mininet/node.py", line 310, in monitor
    data = self.read( 1024 )
  File "mininet/node.py", line 219, in read
    data = os.read( self.stdout.fileno(), maxbytes - count )
KeyboardInterrupt
>>> exit()

显然centos7安装的mininet是存在问题的。

# mn
*** Creating network                                                                                                                                                                                     
*** Adding controller                                                                                                                                                                                    
--------------------------------------------------------------------------------                                                                                                                         
Caught exception. Cleaning up...                                                                                                                                                                         
                                                                                                                                                                                                         
Exception: Please shut down the controller which is running on port 6653:                                                                                                                                
Active Internet connections (servers and established)                                                                                                                                                    
tcp        0      0 0.0.0.0:6653            0.0.0.0:*               LISTEN      8044/controller                                                                                                          
tcp        0      0 127.0.0.1:6653          127.0.0.1:60633         ESTABLISHED 8044/controller                                                                                                          
tcp        0      0 127.0.0.1:60633         127.0.0.1:6653          ESTABLISHED 912/ovs-vswitchd                                                                                                         
tcp        0      0 127.0.0.1:39872         127.0.0.1:6653          TIME_WAIT   -                                                                                                                        
--------------------------------------------------------------------------------                                                                                                                         
*** Removing excess controllers/ofprotocols/ofdatapaths/pings/noxes                                                                                                                                      
killall controller ofprotocol ofdatapath ping nox_core lt-nox_core ovs-openflowd ovs-controller udpbwtest mnexec ivs 2> /dev/null                                                                        
killall -9 controller ofprotocol ofdatapath ping nox_core lt-nox_core ovs-openflowd ovs-controller udpbwtest mnexec ivs 2> /dev/null                                                                     
pkill -9 -f "sudo mnexec"                                                                                                                                                                                
*** Removing junk from /tmp                                                                                                                                                                              
rm -f /tmp/vconn* /tmp/vlogs* /tmp/*.out /tmp/*.log                                                                                                                                                      
*** Removing old X11 tunnels                                                                                                                                                                             
*** Removing excess kernel datapaths                                                                                                                                                                     
ps ax | egrep -o 'dp[0-9]+' | sed 's/dp/nl:/'                                                                                                                                                            
***  Removing OVS datapaths                                                                                                                                                                              
ovs-vsctl --timeout=1 list-br                                                                                                                                                                            
ovs-vsctl --if-exists del-br daolinet -- --if-exists del-br s1                                                                                                                                           
ovs-vsctl --timeout=1 list-br                                                                                                                                                                            
*** Removing all links of the pattern foo-ethX                                                                                                                                                           
ip link show | egrep -o '([-_.[:alnum:]]+-eth[[:digit:]]+)'                                                                                                                                              
( ip link del s1-eth1;ip link del s1-eth2;ip link del s3-eth1;ip link del s3-eth2 ) 2> /dev/null                                                                                                         
ip link show
*** Killing stale mininet node processes
pkill -9 -f mininet:
*** Shutting down stale tunnels
pkill -9 -f Tunnel=Ethernet
pkill -9 -f .ssh/mn
rm -f ~/.ssh/mn/*
*** Cleanup complete.
You have new mail in /var/spool/mail/root


显示mn本身也存在异常。


# ovs-vsctl show
1d7f21ea-b400-4a0f-913b-288fe5501b3b
    ovs_version: "2.5.0"
# ip netns list
h2
h1

通过python添加的命名空间都未成功。


来自:http://openvswitch.org/support/ovscon2015/16/1305-lantz.pdf


mininet文档推荐:http://mininet.org/api/annotated.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值