Add topology check in OpenFlow cluster test
[integration/test.git] / csit / suites / openflowplugin / Clustering / 010__Cluster_HA_Owner_Failover.robot
1 *** Settings ***
2 Documentation     Test suite for Cluster HA - Device Owner failover
3 Suite Setup       Create Controller Sessions
4 Suite Teardown    Delete All Sessions
5 Library           RequestsLibrary
6 Resource          ../../../libraries/ClusterOpenFlow.robot
7 Resource          ../../../libraries/ClusterKeywords.robot
8 Resource          ../../../libraries/MininetKeywords.robot
9 Variables         ../../../variables/Variables.py
10
11 *** Test Cases ***
12 Create Original Cluster List
13     [Documentation]    Create original cluster list.
14     ${original_cluster_list}    ClusterKeywords.Create Controller Index List
15     Set Suite Variable    ${original_cluster_list}
16
17 Check Shards Status Before Fail
18     [Documentation]    Check Status for all shards in OpenFlow application.
19     ClusterOpenFlow.Check OpenFlow Shards Status    ${original_cluster_list}
20
21 Start Mininet Multiple Connections
22     [Documentation]    Start mininet tree,2 with connection to all cluster instances.
23     ${mininet_conn_id}=    MininetKeywords.Start Mininet Multiple Controllers    ${TOOLS_SYSTEM_IP}    ${original_cluster_list}    --topo tree,2 --switch ovsk,protocols=OpenFlow13
24     Set Suite Variable    ${mininet_conn_id}
25
26 Check Entity Owner Status And Find Owner and Candidate Before Fail
27     [Documentation]    Check Entity Owner Status and identify owner and candidate for first switch s1.
28     ${original_owner}    ${original_candidates_list}    ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device    ${original_cluster_list}    openflow:1
29     ${original_candidate}=    Get From List    ${original_candidates_list}    0
30     Set Suite Variable    ${original_owner}
31     Set Suite Variable    ${original_candidate}
32
33 Reconnect Extra Switches To Candidate And Check Entity Owner
34     [Documentation]    Connect switches s2 and s3 to candidate instance.
35     OVSDB.Set Controller In OVS Bridge    ${TOOLS_SYSTEM_IP}    s2    tcp:${ODL_SYSTEM_${original_candidate}_IP}:6633
36     OVSDB.Set Controller In OVS Bridge    ${TOOLS_SYSTEM_IP}    s3    tcp:${ODL_SYSTEM_${original_candidate}_IP}:6633
37     ${original_candidate_list}=    Create List    ${original_candidate}
38     ${owner}    ${candidates_list}    ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device    ${original_candidate_list}    openflow:2
39     Should Be Equal    ${owner}    ${original_candidate}
40     ${owner}    ${candidates_list}    ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device    ${original_candidate_list}    openflow:3
41     Should Be Equal    ${owner}    ${original_candidate}
42
43 Check Network Operational Information Before Fail
44     [Documentation]    Check devices in operational inventory and topology in all cluster instances.
45     ClusterOpenFlow.Check OpenFlow Network Operational Information For Sample Topology    ${original_cluster_list}
46
47 Add Configuration In Owner and Verify Before Fail
48     [Documentation]    Add Flow in Owner and verify it gets applied from all instances.
49     ClusterOpenFlow.Add Sample Flow and Verify    ${original_cluster_list}    ${original_owner}
50
51 Modify Configuration In Owner and Verify Before Fail
52     [Documentation]    Modify Flow in Owner and verify it gets applied from all instances.
53     ClusterOpenFlow.Modify Sample Flow and Verify    ${original_cluster_list}    ${original_owner}
54
55 Delete Configuration In Owner and Verify Before Fail
56     [Documentation]    Delete Flow in Owner and verify it gets applied from all instances.
57     ClusterOpenFlow.Delete Sample Flow and Verify    ${original_cluster_list}    ${original_owner}
58
59 Add Configuration In Candidate and Verify Before Fail
60     [Documentation]    Add Flow in Owner and verify it gets applied from all instances.
61     ClusterOpenFlow.Add Sample Flow and Verify    ${original_cluster_list}    ${original_candidate}
62
63 Modify Configuration In Candidate and Verify Before Fail
64     [Documentation]    Modify Flow in Owner and verify it gets applied from all instances.
65     ClusterOpenFlow.Modify Sample Flow and Verify    ${original_cluster_list}    ${original_candidate}
66
67 Delete Configuration In Candidate and Verify Before Fail
68     [Documentation]    Delete Flow in Owner and verify it gets removed from all instances.
69     ClusterOpenFlow.Delete Sample Flow and Verify    ${original_cluster_list}    ${original_candidate}
70
71 Send RPC Add to Owner and Verify Before Fail
72     [Documentation]    Add Flow in Owner and verify it gets applied from all instances.
73     ClusterOpenFlow.Send RPC Add Sample Flow and Verify    ${original_cluster_list}    ${original_owner}
74
75 Send RPC Delete to Owner and Verify Before Fail
76     [Documentation]    Delete Flow in Owner and verify it gets removed from all instances.
77     ClusterOpenFlow.Send RPC Delete Sample Flow and Verify    ${original_cluster_list}    ${original_owner}
78
79 Send RPC Add to Candidate and Verify Before Fail
80     [Documentation]    Add Flow in Candidate and verify it gets applied from all instances.
81     ClusterOpenFlow.Send RPC Add Sample Flow and Verify    ${original_cluster_list}    ${original_candidate}
82
83 Send RPC Delete to Candidate and Verify Before Fail
84     [Documentation]    Delete Flow in Candidate and verify it gets removed from all instances.
85     ClusterOpenFlow.Send RPC Delete Sample Flow and Verify    ${original_cluster_list}    ${original_candidate}
86
87 Modify Network And Verify Before Fail
88     [Documentation]    Take a link down and verify port status in all instances.
89     ClusterOpenFlow.Take OpenFlow Device Link Down and Verify    ${original_cluster_list}
90
91 Restore Network And Verify Before Fail
92     [Documentation]    Take the link up and verify port status in all instances.
93     ClusterOpenFlow.Take OpenFlow Device Link Up and Verify    ${original_cluster_list}
94
95 Kill Owner Instance
96     [Documentation]    Kill Owner Instance and verify it is dead
97     ClusterKeywords.Kill Multiple Controllers    ${original_owner}
98     ${new_cluster_list}    Create Controller Index List
99     Remove Values From List    ${new_cluster_list}    ${original_owner}
100     Set Suite Variable    ${new_cluster_list}
101
102 Check Shards Status After Fail
103     [Documentation]    Create original cluster list and check Status for all shards in OpenFlow application.
104     ClusterOpenFlow.Check OpenFlow Shards Status After Cluster Event    ${new_cluster_list}
105
106 Check Entity Owner Status And Find Owner and Candidate After Fail
107     [Documentation]    Check Entity Owner Status and identify owner and candidate.
108     ${new_owner}    ${new_candidates_list}    ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device    ${new_cluster_list}    openflow:1
109     Run Keyword And Continue On Failure    List Should Not Contain Value    ${new_candidates_list}    ${original_owner}    Original owner ${original_owner} still in candidate list.
110     Remove Values From List    ${new_candidates_list}    ${original_owner}
111     ${new_candidate}=    Get From List    ${new_candidates_list}    0
112     Set Suite Variable    ${new_owner}
113     Set Suite Variable    ${new_candidate}
114     [Teardown]    Utils.Report_Failure_Due_To_Bug    5004
115
116 Check Network Operational Information After Fail
117     [Documentation]    Check devices in operational inventory and topology in all cluster instances.
118     ClusterOpenFlow.Check OpenFlow Network Operational Information For Sample Topology    ${new_cluster_list}
119
120 Add Configuration In Owner and Verify After Fail
121     [Documentation]    Add Flow in Owner and verify it gets applied from all instances.
122     ClusterOpenFlow.Add Sample Flow and Verify    ${new_cluster_list}    ${new_owner}
123
124 Modify Configuration In Owner and Verify After Fail
125     [Documentation]    Modify Flow in Owner and verify it gets applied from all instances.
126     ClusterOpenFlow.Modify Sample Flow and Verify    ${new_cluster_list}    ${new_owner}
127
128 Delete Configuration In Owner and Verify After Fail
129     [Documentation]    Delete Flow in Owner and verify it gets applied from all instances.
130     ClusterOpenFlow.Delete Sample Flow and Verify    ${new_cluster_list}    ${new_owner}
131
132 Add Configuration In Candidate and Verify After Fail
133     [Documentation]    Add Flow in Owner and verify it gets applied from all instances.
134     ClusterOpenFlow.Add Sample Flow and Verify    ${new_cluster_list}    ${new_candidate}
135
136 Modify Configuration In Candidate and Verify After Fail
137     [Documentation]    Modify Flow in Owner and verify it gets applied from all instances.
138     ClusterOpenFlow.Modify Sample Flow and Verify    ${new_cluster_list}    ${new_candidate}
139
140 Delete Configuration In Candidate and Verify After Fail
141     [Documentation]    Delete Flow in Owner and verify it gets applied from all instances.
142     ClusterOpenFlow.Delete Sample Flow and Verify    ${new_cluster_list}    ${new_candidate}
143
144 Send RPC Add to Owner and Verify After Fail
145     [Documentation]    Add Flow in Owner and verify it gets applied from all instances.
146     ClusterOpenFlow.Send RPC Add Sample Flow and Verify    ${new_cluster_list}    ${new_owner}
147
148 Send RPC Delete to Owner and Verify After Fail
149     [Documentation]    Delete Flow in Owner and verify it gets removed from all instances.
150     ClusterOpenFlow.Send RPC Delete Sample Flow and Verify    ${new_cluster_list}    ${new_owner}
151
152 Send RPC Add to Candidate and Verify After Fail
153     [Documentation]    Add Flow in Owner and verify it gets applied from all instances.
154     ClusterOpenFlow.Send RPC Add Sample Flow and Verify    ${new_cluster_list}    ${new_candidate}
155
156 Send RPC Delete to Candidate and Verify After Fail
157     [Documentation]    Delete Flow in Owner and verify it gets removed from all instances.
158     ClusterOpenFlow.Send RPC Delete Sample Flow and Verify    ${new_cluster_list}    ${new_candidate}
159
160 Modify Network and Verify After Fail
161     [Documentation]    Take a link down and verify port status in all instances.
162     ClusterOpenFlow.Take OpenFlow Device Link Down and Verify    ${new_cluster_list}
163
164 Restore Network and Verify After Fail
165     [Documentation]    Take the link up and verify port status in all instances.
166     ClusterOpenFlow.Take OpenFlow Device Link Up and Verify    ${new_cluster_list}
167
168 Start Old Owner Instance
169     [Documentation]    Start old Owner Instance and verify it is up
170     ClusterKeywords.Start Multiple Controllers    300s    ${original_owner}
171
172 Check Shards Status After Recover
173     [Documentation]    Create original cluster list and check Status for all shards in OpenFlow application.
174     ClusterOpenFlow.Check OpenFlow Shards Status After Cluster Event    ${original_cluster_list}
175
176 Check Entity Owner Status After Recover
177     [Documentation]    Check Entity Owner Status and identify owner and candidate.
178     ${new_owner}    ${new_candidates_list}    ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device    ${original_cluster_list}    openflow:1
179     Set Suite Variable    ${new_owner}
180
181 Check Network Operational Information After Recover
182     [Documentation]    Check devices in operational inventory and topology in all cluster instances.
183     ClusterOpenFlow.Check OpenFlow Network Operational Information For Sample Topology    ${original_cluster_list}
184
185 Add Configuration In Owner and Verify After Recover
186     [Documentation]    Add Flow in Owner and verify it gets applied from all instances.
187     ClusterOpenFlow.Add Sample Flow and Verify    ${original_cluster_list}    ${new_owner}
188
189 Modify Configuration In Owner and Verify After Recover
190     [Documentation]    Modify Flow in Owner and verify it gets applied from all instances.
191     ClusterOpenFlow.Modify Sample Flow and Verify    ${original_cluster_list}    ${new_owner}
192
193 Delete Configuration In Owner and Verify After Recover
194     [Documentation]    Delete Flow in Owner and verify it gets applied from all instances.
195     ClusterOpenFlow.Delete Sample Flow and Verify    ${original_cluster_list}    ${new_owner}
196
197 Add Configuration In Old Owner and Verify After Recover
198     [Documentation]    Add Flow in Owner and verify it gets applied from all instances.
199     ClusterOpenFlow.Add Sample Flow and Verify    ${originalcluster_list}    ${original_owner}
200
201 Modify Configuration In Old Owner and Verify After Recover
202     [Documentation]    Modify Flow in Owner and verify it gets applied from all instances.
203     ClusterOpenFlow.Modify Sample Flow and Verify    ${original_cluster_list}    ${original_owner}
204
205 Delete Configuration In Old Owner and Verify After Recover
206     [Documentation]    Delete Flow in Owner and verify it gets applied from all instances.
207     ClusterOpenFlow.Delete Sample Flow and Verify    ${original_cluster_list}    ${original_owner}
208
209 Send RPC Add to Owner and Verify After Recover
210     [Documentation]    Add Flow in Owner and verify it gets applied from all instances.
211     ClusterOpenFlow.Send RPC Add Sample Flow and Verify    ${original_cluster_list}    ${new_owner}
212
213 Send RPC Delete to Owner and Verify After Recover
214     [Documentation]    Delete Flow in Owner and verify it gets removed from all instances.
215     ClusterOpenFlow.Send RPC Delete Sample Flow and Verify    ${original_cluster_list}    ${new_owner}
216
217 Send RPC Add to Old Owner and Verify After Recover
218     [Documentation]    Add Flow in Owner and verify it gets applied from all instances.
219     ClusterOpenFlow.Send RPC Add Sample Flow and Verify    ${original_cluster_list}    ${original_owner}
220
221 Send RPC Delete to Old Owner and Verify After Recover
222     [Documentation]    Delete Flow in Owner and verify it gets removed from all instances.
223     ClusterOpenFlow.Send RPC Delete Sample Flow and Verify    ${original_cluster_list}    ${original_owner}
224
225 Modify Network and Verify After Recover
226     [Documentation]    Take a link down and verify port status in all instances.
227     ClusterOpenFlow.Take OpenFlow Device Link Down and Verify    ${original_cluster_list}
228
229 Restore Network and Verify After Recover
230     [Documentation]    Take the link up and verify port status in all instances.
231     ClusterOpenFlow.Take OpenFlow Device Link Up and Verify    ${original_cluster_list}
232
233 Stop Mininet and Exit
234     [Documentation]    Stop mininet and exit connection.
235     MininetKeywords.Stop Mininet And Exit    ${mininet_conn_id}
236     Utils.Clean Mininet System
237
238 Check No Network Operational Information
239     [Documentation]    Check device is not in operational inventory or topology in all cluster instances.
240     ClusterOpenFlow.Check No OpenFlow Network Operational Information    ${original_cluster_list}