Step 1: Move vm scripts to the right place
[integration/test.git] / test / csit / suites / vpnservice / custom.py
1 """Topology description for configuring vpnservice for hosts on 2 switches
2
3      MININET                  MININET1
4    -------------    gre     -------------
5    | h1-----s1 |------------| s2------h3|
6    |        |  |            | |         |
7    |        |  |            | |         |
8    |        h2 |            | h4        |
9    -------------            -------------
10 1)The topology consits of switch s1 in one VM connected to hosts h1,h2.Switch s2 in another VM connected to hosts h3,h4.
11 2)GRE tunnel is configured between s1 and s2 using ovs-vsctl commands.
12 3)h1 and h3 will be configured for vpn instance testVpn1 and h2,h4 for testVpn2.
13 """
14
15 from mininet.topo import Topo
16
17
18 class Switch1(Topo):
19     """Single switch s1 connected to n=2 hosts."""
20     def __init__(self):
21         Topo.__init__(self)
22         switch = self.addSwitch('s1')
23         n = 2
24         for h in range(n):
25             host = self.addHost('h%s' % (h + 1), mac="00:00:00:00:00:0"+str(h+1), ip="10.0.0."+str(h+1))
26             self.addLink(host, switch)
27
28
29 class Switch2(Topo):
30     """Single switch s2 connected to n=2 hosts."""
31     def __init__(self):
32         Topo.__init__(self)
33         switch = self.addSwitch('s2')
34         n = 2
35         for h in range(n):
36             host = self.addHost('h%s' % (h + 3), mac="00:00:00:00:00:0"+str(h+3), ip="10.0.0."+str(h+3))
37             self.addLink(host, switch)
38
39 topos = {'Switch1': (lambda: Switch1()),
40          'Switch2': (lambda: Switch2())}