fixing pep8 problems for test verify tox job
[integration/test.git] / csit / suites / lacp / Lacp_Feature_OF13 / LACP_custom1.py
1 """Custom LACP topology for LACP Module testing
2
3 1.Two hosts(H1,H2) two interface each  connected with Switch(S1)
4 2.Two hosts(H3,H4) one interface each  connected with Switch(S1)
5
6
7                    - - - -
8                    | H2   |
9                    |      |
10                    - - - -
11                      |  |
12                      |  |
13                    - - - - -
14 - - -  eth1        |        |         - - -
15 | H1 |- - - - - - -| S1     |- - - - -| H3 |
16 |    |- - - - - - -|        |         |    |
17 - - -  eth2         - - - - -         - - -
18                        |
19                      - - -
20                     |  H4 |
21                      - - -
22
23 Execute Custom topology:
24 sudo mn  --custom LACP_custom1.py --switch ovsk,protocols=OpenFlow13 --topo=lacp
25
26 Note:
27  1.remoteController IP will be replaced in LACP_custom1.py using sed command during the robot execution
28  2.bonding.conf will be copied the mininet server under /etc/modprobe.d
29  3.h1-bonding.sh h2-bonding.sh will be executed in respective h1,h2 host console
30 """
31
32 from mininet.cli import CLI
33 from mininet.net import Mininet
34 from mininet.node import RemoteController
35 from mininet.topo import Topo
36 from mininet.link import Link
37
38
39 class LacpTopo(Topo):
40     net = Mininet(controller=RemoteController)
41     c0 = net.addController('c0', controller=RemoteController, ip='CONTROLLER')
42     s1 = net.addSwitch('s1')
43     h1 = net.addHost('h1', mac='00:00:00:00:00:11')
44     h2 = net.addHost('h2', mac='00:00:00:00:00:22')
45     h3 = net.addHost('h3', mac='00:00:00:00:00:33', ip='10.1.1.3')
46     h4 = net.addHost('h4', mac='00:00:00:00:00:44', ip='10.1.1.4')
47
48     Link(s1, h1)
49     Link(s1, h1)
50     Link(s1, h2)
51     Link(s1, h2)
52     Link(s1, h3)
53     Link(s1, h4)
54     net.build()
55     s1.start([c0])
56     s1.cmd('sudo ovs-vsctl set bridge s1 protocols=OpenFlow13')
57     print h1.cmd('./h1-bond0.sh')
58     print h2.cmd('./h2-bond0.sh')
59     CLI(net)
60     net.stop()
61
62
63 topos = {'lacp': (lambda: LacpTopo())}