mise a jour
This commit is contained in:
parent
c201c0c717
commit
66b581bcca
1 changed files with 32 additions and 0 deletions
32
topologie/test_communicat_2_dockers_in_loop.py
Executable file
32
topologie/test_communicat_2_dockers_in_loop.py
Executable file
|
@ -0,0 +1,32 @@
|
|||
#!/usr/bin/python
|
||||
"""
|
||||
This is the most simple example to showcase Containernet.
|
||||
"""
|
||||
from mininet.net import Containernet
|
||||
from mininet.node import Controller
|
||||
from mininet.cli import CLI
|
||||
from mininet.link import TCLink
|
||||
from mininet.log import info, setLogLevel
|
||||
setLogLevel('info')
|
||||
|
||||
net = Containernet(controller=Controller)
|
||||
info('*** Adding controller\n')
|
||||
net.addController('c0')
|
||||
info('*** Adding docker containers\n')
|
||||
d1 = net.addDocker('d1', ip='10.0.0.3', dimage="server:topo")
|
||||
d2 = net.addDocker('d2', ip='10.0.0.6', dimage="server:topo")
|
||||
info('*** Adding switches\n')
|
||||
s1 = net.addSwitch('s1')
|
||||
info('*** Creating link\n')
|
||||
net.addLink(d1, d2)
|
||||
net.addLink(d1, s1)
|
||||
net.addLink(s1, d2)
|
||||
info('*** Starting network\n')
|
||||
net.start()
|
||||
info('*** Testing connectivity\n')
|
||||
net.ping([d1, d2])
|
||||
info('*** Running CLI\n')
|
||||
CLI(net)
|
||||
info('*** Stopping network')
|
||||
net.stop()
|
||||
|
Loading…
Reference in a new issue