本文整理汇总了Python中mininet.net.Mininet.addDockerLink方法的典型用法代码示例。如果您正苦于以下问题:Python Mininet.addDockerLink方法的具体用法?Python Mininet.addDockerLink怎么用?Python Mininet.addDockerLink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mininet.net.Mininet
的用法示例。
在下文中一共展示了Mininet.addDockerLink方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: dockerNet
# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import addDockerLink [as 别名]
def dockerNet():
"Create an empty network and add nodes to it."
net = Mininet( controller=Controller )
info( '*** Adding controller\n' )
net.addController( 'c0' )
info( '*** Adding hosts\n' )
h1 = net.addHost( 'h1', ip = '10.0.0.1')
h2 = net.addHost( 'h2', ip = '11.0.0.2')
h3 = net.addHost( 'h3', ip = '11.0.0.3')
d1 = net.addDocker( 'd1', 'wsipt/cp', 'p')
info( '*** Adding switch\n' )
s1 = net.addSwitch( 's1' )
s2 = net.addSwitch( 's2' )
s3 = net.addSwitch( 's3' )
s4 = net.addSwitch( 's4' )
info( '*** Creating links\n' )
net.addLink( h1, s1 )
net.addLink( h2, s2 )
net.addLink( s1, s3 )
net.addLink( s2, s3 )
net.addLink( s4, h3 )
info( '*** Starting network\n')
net.start()
net.addDockerLink( 's1', 'd1', '10.0.0.25' )
net.addDockerLink( 's2', 'd1', '11.0.0.25' )
info( '*** Running CLI\n' )
CLI( net )
info( '*** Stopping network' )
net.stop()