Update Robot Framework format - step 12
[integration/test.git] / csit / suites / openflowplugin / Clustering / 020__Cluster_HA_Leader_Follower_Failover.robot
1 *** Settings ***
2 Documentation       Test suite for Cluster HA - Device Leader Follower failover
3
4 Library             RequestsLibrary
5 Resource            ../../../libraries/ClusterOpenFlow.robot
6 Resource            ../../../libraries/ClusterManagement.robot
7 Resource            ../../../libraries/MininetKeywords.robot
8 Variables           ../../../variables/Variables.py
9
10 Suite Setup         ClusterManagement Setup
11 Suite Teardown      Delete All Sessions
12
13
14 *** Test Cases ***
15 Check Shards Status Before Leader Restart
16     [Documentation]    Check Status for all shards in OpenFlow application.
17     ClusterOpenFlow.Check OpenFlow Shards Status
18
19 Get inventory Leader Before Leader Restart
20     [Documentation]    Find leader in the inventory config shard
21     ${inventory_leader}    ${inventory_followers}=    ClusterOpenFlow.Get InventoryConfig Shard Status
22     ${follower_node_1}=    Get From List    ${inventory_followers}    0
23     ${follower_node_2}=    Get From List    ${inventory_followers}    1
24     Set Suite Variable    ${follower_node_1}
25     Set Suite Variable    ${follower_node_2}
26     Set Suite Variable    ${inventory_leader}
27
28 Start Mininet Connect To Leader
29     [Documentation]    Start mininet with connection to cluster Leader.
30     ${mininet_conn_id}=    MininetKeywords.Start Mininet Single Controller
31     ...    ${TOOLS_SYSTEM_IP}
32     ...    ${ODL_SYSTEM_${inventory_leader}_IP}
33     Set Suite Variable    ${mininet_conn_id}
34
35 Add Flows In Leader and Verify Before Leader Restart
36     [Documentation]    Add Flow via Leader and verify it gets applied from all instances.
37     ClusterOpenFlow.Add Sample Flow And Verify    ${inventory_leader}
38
39 Modify Flows In Leader and Verify Before Leader Restart
40     [Documentation]    Modify Flow in Leader and verify it gets applied from all instances.
41     ClusterOpenFlow.Modify Sample Flow and Verify    ${inventory_leader}
42
43 Delete Flows In Leader and Verify Before Leader Restart
44     [Documentation]    Delete Flow in Leader and verify it gets applied from all instances.
45     ClusterOpenFlow.Delete Sample Flow and Verify    ${inventory_leader}
46
47 Send RPC Add to Leader and Verify Before Leader Restart
48     [Documentation]    Add Flow in Leader and verify it gets applied from all Controller instances.
49     ClusterOpenFlow.Send RPC Add Sample Flow and Verify    ${inventory_leader}
50
51 Send RPC Delete to Leader and Verify Before Leader Restart
52     [Documentation]    Delete Flow in Owner and verify it gets removed from all Controller instances.
53     ClusterOpenFlow.Send RPC Delete Sample Flow and Verify    ${inventory_leader}
54
55 Send RPC Add to Follower Node1 and Verify Before Leader Restart
56     [Documentation]    Add Flow in Follower and verify it gets applied from all Controller instances.
57     ClusterOpenFlow.Send RPC Add Sample Flow and Verify    ${follower_node_1}
58
59 Send RPC Delete to Follower Node2 and Verify Before Leader Restart
60     [Documentation]    Delete Flow in Follower and verify it gets removed from all Controller instances.
61     ClusterOpenFlow.Send RPC Delete Sample Flow and Verify    ${follower_node_2}
62
63 Stop Mininet Connected To Leader and Exit
64     [Documentation]    Stop mininet and exit connection.
65     MininetKeywords.Stop Mininet And Exit    ${mininet_conn_id}
66     Utils.Clean Mininet System
67
68 Restart Leader From Cluster Node
69     [Documentation]    Kill Leader Node and Start it Up, Verify it is sync with other controller node.
70     ClusterManagement.Kill Single Member    ${inventory_leader}
71     ClusterManagement.Start Single Member    ${inventory_leader}
72
73 Get inventory Follower After Leader Restart
74     [Documentation]    Find new Followers and Leader in the inventory config shard After Leader Restart
75     ${inventory_leader}    ${inventory_followers}=    ClusterOpenFlow.Get InventoryConfig Shard Status
76     ${follower_node_1}=    Get From List    ${inventory_followers}    0
77     ${follower_node_2}=    Get From List    ${inventory_followers}    1
78     Set Suite Variable    ${follower_node_1}
79     Set Suite Variable    ${follower_node_2}
80     Set Suite Variable    ${inventory_leader}
81
82 Start Mininet Connect To Follower Node1
83     [Documentation]    Start mininet with connection to cluster Follower Node1.
84     ${mininet_conn_id}=    MininetKeywords.Start Mininet Single Controller
85     ...    ${TOOLS_SYSTEM_IP}
86     ...    ${ODL_SYSTEM_${follower_node_1}_IP}
87     Set Suite Variable    ${mininet_conn_id}
88
89 Add Flows In Follower Node2 and Verify Before Follower Restart
90     [Documentation]    Add Flow via cluster Follower Node2 and verify it gets applied from all instances.
91     ClusterOpenFlow.Add Sample Flow And Verify    ${follower_node_2}
92
93 Modify Flows In Follower Node2 and Verify Before Follower Restart
94     [Documentation]    Modify Flow in Follower Node2 and verify it gets applied from all instances.
95     ClusterOpenFlow.Modify Sample Flow and Verify    ${follower_node_2}
96
97 Delete Flows In Follower Node2 and Verify Follower Restart
98     [Documentation]    Delete Flow in Follower Node2 and verify it gets applied from all instances.
99     ClusterOpenFlow.Delete Sample Flow and Verify    ${follower_node_2}
100
101 Send RPC Add to Leader and Verify Before Follower Restart
102     [Documentation]    Add Flow in Leader and verify it gets applied from all Controller instances.
103     ClusterOpenFlow.Send RPC Add Sample Flow and Verify    ${inventory_leader}
104
105 Send RPC Delete to Leader and Verify Before Follower Restart
106     [Documentation]    Delete Flow in Owner and verify it gets removed from all Controller instances.
107     ClusterOpenFlow.Send RPC Delete Sample Flow and Verify    ${inventory_leader}
108
109 Send RPC Add to First Follower Node1 and Verify Before Follower Restart
110     [Documentation]    Add Flow in Follower and verify it gets applied from all Controller instances.
111     ClusterOpenFlow.Send RPC Add Sample Flow and Verify    ${follower_node_1}
112
113 Send RPC Delete to Follower Node2 and Verify Before Follower Restart
114     [Documentation]    Delete Flow in Follower Node2 and verify it gets removed from all Controller instances.
115     ClusterOpenFlow.Send RPC Delete Sample Flow and Verify    ${follower_node_2}
116
117 Stop Mininet Connected To Follower and Exit
118     [Documentation]    Stop mininet and exit connection.
119     MininetKeywords.Stop Mininet And Exit    ${mininet_conn_id}
120     Utils.Clean Mininet System
121
122 Restart Follower Node2
123     [Documentation]    Kill Follower Node2 and Start it Up, Verify it is sync with other controller node.
124     ClusterManagement.Kill Single Member    ${follower_node_2}
125     ClusterManagement.Start Single Member    ${follower_node_2}
126
127 Get inventory Follower After Follower Restart
128     [Documentation]    Find Followers and Leader in the inventory config shard After Follower Restart
129     ${inventory_leader}    ${inventory_followers}=    ClusterOpenFlow.Get InventoryConfig Shard Status
130     ${follower_node_1}=    Get From List    ${inventory_followers}    0
131     ${follower_node_2}=    Get From List    ${inventory_followers}    1
132     Set Suite Variable    ${follower_node_1}
133     Set Suite Variable    ${follower_node_2}
134     Set Suite Variable    ${inventory_leader}
135
136 Start Mininet Connect To Follower Node2
137     [Documentation]    Start mininet with connection to cluster Follower Node1.
138     ${mininet_conn_id}=    MininetKeywords.Start Mininet Single Controller
139     ...    ${TOOLS_SYSTEM_IP}
140     ...    ${ODL_SYSTEM_${follower_node_2}_IP}
141     Set Suite Variable    ${mininet_conn_id}
142
143 Add Flows In Follower Node1 and Verify Before Cluster Restart
144     [Documentation]    Add Flow via cluster Follower Node1 and verify it gets applied from all instances.
145     ClusterOpenFlow.Add Sample Flow And Verify    ${follower_node_1}
146
147 Modify Flows In Follower Node1 and Verify Before Cluster Restart
148     [Documentation]    Modify Flow in Follower Node1 and verify it gets applied from all instances.
149     ClusterOpenFlow.Modify Sample Flow and Verify    ${follower_node_1}
150
151 Delete Flows In Follower Node1 and Verify Before Cluster Restart
152     [Documentation]    Delete Flow in Follower Node1 and verify it gets applied from all instances.
153     ClusterOpenFlow.Delete Sample Flow and Verify    ${follower_node_1}
154
155 Send RPC Add to Leader and Verify Before Cluster Restart
156     [Documentation]    Add Flow in Leader and verify it gets applied from all Controller instances.
157     ClusterOpenFlow.Send RPC Add Sample Flow and Verify    ${inventory_leader}
158
159 Send RPC Delete to Leader and Verify Before Cluster Restart
160     [Documentation]    Delete Flow in Owner and verify it gets removed from all Controller instances.
161     ClusterOpenFlow.Send RPC Delete Sample Flow and Verify    ${inventory_leader}
162
163 Send RPC Add to Follower Node2 and Verify Before Cluster Restart
164     [Documentation]    Add Flow in Follower and verify it gets applied from all Controller instances.
165     ClusterOpenFlow.Send RPC Add Sample Flow and Verify    ${follower_node_2}
166
167 Send RPC Delete to Follower Node1 and Verify Before Cluster Restart
168     [Documentation]    Delete Flow in Follower and verify it gets removed from all Controller instances.
169     ClusterOpenFlow.Send RPC Delete Sample Flow and Verify    ${follower_node_1}
170
171 Stop Mininet Connected To Other Follower and Exit
172     [Documentation]    Stop mininet Connected To Other Follower and exit connection.
173     MininetKeywords.Stop Mininet And Exit    ${mininet_conn_id}
174     Utils.Clean Mininet System
175
176 Restart Full Cluster
177     [Documentation]    Kill all Cluster Nodes and Start it Up All.
178     ClusterManagement.Kill Members From List Or All
179     ClusterManagement.Start Members From List Or All
180
181 Get inventory Status After Cluster Restart
182     [Documentation]    Find New Followers and Leader in the inventory config shard After Cluster Restart
183     ${inventory_leader}    ${inventory_followers}=    ClusterOpenFlow.Get InventoryConfig Shard Status
184     ${follower_node_1}=    Get From List    ${inventory_followers}    0
185     ${follower_node_2}=    Get From List    ${inventory_followers}    1
186     Set Suite Variable    ${follower_node_1}
187     Set Suite Variable    ${follower_node_2}
188     Set Suite Variable    ${inventory_leader}
189
190 Start Mininet Connect To Follower Node2 After Cluster Restart
191     [Documentation]    Start mininet with connection to cluster Follower Node1.
192     ${mininet_conn_id}=    MininetKeywords.Start Mininet Single Controller
193     ...    ${TOOLS_SYSTEM_IP}
194     ...    ${ODL_SYSTEM_${follower_node_2}_IP}
195     Set Suite Variable    ${mininet_conn_id}
196
197 Add Flows In Follower Node1 and Verify After Cluster Restart
198     [Documentation]    Add Flow via cluster Follower Node1 and verify it gets applied from all instances.
199     ClusterOpenFlow.Add Sample Flow And Verify    ${follower_node_1}
200
201 Modify Flows In Follower Node1 and Verify After Cluster Restart
202     [Documentation]    Modify Flow in Follower Node1 and verify it gets applied from all instances.
203     ClusterOpenFlow.Modify Sample Flow and Verify    ${follower_node_1}
204
205 Delete Flows In Follower Node1 and Verify After Cluster Restart
206     [Documentation]    Delete Flow in Follower Node1 and verify it gets applied from all instances.
207     ClusterOpenFlow.Delete Sample Flow and Verify    ${follower_node_1}
208
209 Send RPC Add to Leader and Verify After Cluster Restart
210     [Documentation]    Add Flow in Leader and verify it gets applied from all Controller instances.
211     ClusterOpenFlow.Send RPC Add Sample Flow and Verify    ${inventory_leader}
212
213 Send RPC Delete to Leader and Verify After Cluster Restart
214     [Documentation]    Delete Flow in Owner and verify it gets removed from all Controller instances.
215     ClusterOpenFlow.Send RPC Delete Sample Flow and Verify    ${inventory_leader}
216
217 Send RPC Add to Follower Node2 and Verify After Cluster Restart
218     [Documentation]    Add Flow in Follower and verify it gets applied from all Controller instances.
219     ClusterOpenFlow.Send RPC Add Sample Flow and Verify    ${follower_node_2}
220
221 Send RPC Delete to Follower Node2 and Verify After Cluster Restart
222     [Documentation]    Delete Flow in Follower and verify it gets removed from all Controller instances.
223     ClusterOpenFlow.Send RPC Delete Sample Flow and Verify    ${follower_node_1}
224
225 Stop Mininet Connected To Follower Node2 and Exit After Cluster Restart
226     [Documentation]    Stop mininet Connected To Other Follower and exit connection.
227     MininetKeywords.Stop Mininet And Exit    ${mininet_conn_id}
228     Utils.Clean Mininet System