f2be310e457ef163f946ca36f2658edb314014c7
[osm/vim-emu.git] / emuvim / example_topology.py
1 """
2 This is an example topology for the distributed cloud emulator (dcemulator).
3 (c) 2015 by Manuel Peuster <manuel.peuster@upb.de>
4
5 The original Mininet API has to be completely hidden and not be used by this
6 script.
7 """
8 import logging
9 from dcemulator.net import DCNetwork
10
11 logging.basicConfig(level=logging.DEBUG)
12
13
14 def create_topology1():
15 # initialize network
16 net = DCNetwork()
17
18 # add data centers
19 dc1 = net.addDatacenter("dc1")
20 dc2 = net.addDatacenter("dc2")
21 dc3 = net.addDatacenter("dc3")
22 dc4 = net.addDatacenter("dc4")
23 # add additional SDN switches to our topology
24 s1 = net.addSwitch("s1")
25 # add links between data centers
26 net.addLink(dc1, dc2)
27 net.addLink("dc1", s1)
28 net.addLink(s1, "dc3")
29 net.addLink(s1, dc4)
30 # start network
31 net.start()
32 net.CLI() # TODO remove this when we integrate APIs?
33 net.stop() # TODO remove this when we integrate APIs?
34 # start APIs (to access emulated cloud data centers)
35 pass # TODO: how to reflect one API endpoint per DC?
36
37
38 def main():
39 create_topology1()
40
41
42 if __name__ == '__main__':
43 main()