-
Notifications
You must be signed in to change notification settings - Fork 2
/
setup-topology.py
executable file
·46 lines (33 loc) · 1.13 KB
/
setup-topology.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
from mininet.topo import Topo
from mininet.net import Mininet
from mininet.node import Controller
from mininet.cli import CLI
from mininet.log import setLogLevel, info
def multipathTopo():
net = Mininet(build = False)
c0 = net.addController("controller")
server = net.addHost('server')
client = net.addHost('client')
router = net.addHost('router')
leftSwitch = net.addSwitch('s1')
rightSwitch = net.addSwitch('s2')
serverSwitch = net.addSwitch('s3')
net.addLink(client, leftSwitch)
net.addLink(client, rightSwitch)
net.addLink(router, leftSwitch)
net.addLink(router, rightSwitch)
net.addLink(router, serverSwitch)
net.addLink(serverSwitch, server)
net.build()
server.cmd('./mininet-topology/server-config.sh')
client.cmd('./mininet-topology/client-config.sh')
router.cmd('./mininet-topology/router-config.sh')
controller = net.controllers[0]
controller.start()
leftSwitch.start([controller])
rightSwitch.start([controller])
serverSwitch.start([controller])
return net
if __name__ == "__main__":
net = multipathTopo()
CLI(net)