Migrate Get Requests invocations(libraries)
[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
4 Library             RequestsLibrary
5 Resource            ../../../libraries/SetupUtils.robot
6 Resource            ../../../libraries/ClusterOpenFlow.robot
7 Resource            ../../../libraries/MininetKeywords.robot
8 Resource            ../../../libraries/ClusterManagement.robot
9 Variables           ../../../variables/Variables.py
10
11 Suite Setup         SetupUtils.Setup_Utils_For_Setup_And_Teardown
12 Suite Teardown      Delete All Sessions
13
14
15 *** Test Cases ***
16 Check Shards Status Before Fail
17     [Documentation]    Check Status for all shards in OpenFlow application.
18     ClusterOpenFlow.Check OpenFlow Shards Status
19
20 Start Mininet Multiple Connections
21     [Documentation]    Start mininet tree,2 with connection to all cluster instances.
22     ${mininet_conn_id}=    MininetKeywords.Start Mininet Multiple Controllers
23     ...    ${TOOLS_SYSTEM_IP}
24     ...    ${ClusterManagement__member_index_list}
25     ...    --topo tree,2
26     BuiltIn.Set Suite Variable    ${mininet_conn_id}
27     BuiltIn.Wait Until Keyword Succeeds    10s    1s    OVSDB.Check OVS OpenFlow Connections    ${TOOLS_SYSTEM_IP}    9
28
29 Check Entity Owner Status And Find Owner and Successor Before Fail
30     [Documentation]    Check Entity Owner Status and identify owner and successor for first switch s1.
31     ${original_owner}    ${original_successor_list}=    ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device
32     ...    openflow:1
33     ...    1
34     ${original_successor}=    Collections.Get From List    ${original_successor_list}    0
35     BuiltIn.Set Suite Variable    ${original_owner}
36     BuiltIn.Set Suite Variable    ${original_successor_list}
37     BuiltIn.Set Suite Variable    ${original_successor}
38
39 Reconnect Extra Switches To Successors And Check OVS Connections
40     [Documentation]    Connect switches s2 and s3 to successor instances.
41     ${controller_opt}=    BuiltIn.Set Variable
42     FOR    ${index}    IN    @{original_successor_list}
43         ${controller_opt}=    BuiltIn.Catenate
44         ...    ${controller_opt}
45         ...    ${SPACE}tcp:${ODL_SYSTEM_${index}_IP}:${ODL_OF_PORT}
46         Log    ${controller_opt}
47     END
48     OVSDB.Set Controller In OVS Bridge    ${TOOLS_SYSTEM_IP}    s2    ${controller_opt}
49     OVSDB.Set Controller In OVS Bridge    ${TOOLS_SYSTEM_IP}    s3    ${controller_opt}
50     BuiltIn.Wait Until Keyword Succeeds    10s    1s    OVSDB.Check OVS OpenFlow Connections    ${TOOLS_SYSTEM_IP}    7
51
52 Check Network Operational Information Before Fail
53     [Documentation]    Check devices in operational inventory and topology in all cluster instances.
54     ClusterOpenFlow.Check OpenFlow Network Operational Information For Sample Topology
55
56 Add Configuration In Owner and Verify Before Fail
57     [Documentation]    Add Flow in Owner and verify it gets applied from all instances.
58     ClusterOpenFlow.Add Sample Flow and Verify    ${original_owner}
59
60 Modify Configuration In Owner and Verify Before Fail
61     [Documentation]    Modify Flow in Owner and verify it gets applied from all instances.
62     ClusterOpenFlow.Modify Sample Flow and Verify    ${original_owner}
63
64 Delete Configuration In Owner and Verify Before Fail
65     [Documentation]    Delete Flow in Owner and verify it gets applied from all instances.
66     ClusterOpenFlow.Delete Sample Flow and Verify    ${original_owner}
67
68 Add Configuration In Successor and Verify Before Fail
69     [Documentation]    Add Flow in Successor and verify it gets applied from all instances.
70     ClusterOpenFlow.Add Sample Flow and Verify    ${original_successor}
71
72 Modify Configuration In Successor and Verify Before Fail
73     [Documentation]    Modify Flow in successor and verify it gets applied from all instances.
74     ClusterOpenFlow.Modify Sample Flow and Verify    ${original_successor}
75
76 Delete Configuration In Successor and Verify Before Fail
77     [Documentation]    Delete Flow in Successor and verify it gets removed from all instances.
78     ClusterOpenFlow.Delete Sample Flow and Verify    ${original_successor}
79
80 Send RPC Add to Owner and Verify Before Fail
81     [Documentation]    Add Flow in Owner and verify it gets applied from all instances.
82     ClusterOpenFlow.Send RPC Add Sample Flow and Verify    ${original_owner}
83
84 Send RPC Delete to Owner and Verify Before Fail
85     [Documentation]    Delete Flow in Owner and verify it gets removed from all instances.
86     ClusterOpenFlow.Send RPC Delete Sample Flow and Verify    ${original_owner}
87
88 Send RPC Add to Successor and Verify Before Fail
89     [Documentation]    Add Flow in Successor and verify it gets applied from all instances.
90     ClusterOpenFlow.Send RPC Add Sample Flow and Verify    ${original_successor}
91
92 Send RPC Delete to Successor and Verify Before Fail
93     [Documentation]    Delete Flow in Successor and verify it gets removed from all instances.
94     ClusterOpenFlow.Send RPC Delete Sample Flow and Verify    ${original_successor}
95
96 Modify Network And Verify Before Fail
97     [Documentation]    Take a link down and verify port status in all instances.
98     ClusterOpenFlow.Take OpenFlow Device Link Down and Verify
99
100 Restore Network And Verify Before Fail
101     [Documentation]    Take the link up and verify port status in all instances.
102     ClusterOpenFlow.Take OpenFlow Device Link Up and Verify
103
104 Kill Owner Instance
105     [Documentation]    Kill Owner Instance and verify it is dead
106     ClusterManagement.Kill Single Member    ${original_owner}
107     BuiltIn.Set Suite Variable    ${new_cluster_list}    ${original_successor_list}
108
109 Check Shards Status After Fail
110     [Documentation]    Create original cluster list and check Status for all shards in OpenFlow application.
111     ClusterOpenFlow.Check OpenFlow Shards Status After Cluster Event    ${new_cluster_list}
112
113 Check Entity Owner Status And Find Owner and Successor After Fail
114     [Documentation]    Check Entity Owner Status and identify owner and successor.
115     ${new_owner}    ${new_successor_list}=    ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device
116     ...    openflow:1
117     ...    ${original_successor}
118     ...    ${new_cluster_list}
119     ${new_successor}=    Collections.Get From List    ${new_successor_list}    0
120     BuiltIn.Set Suite Variable    ${new_owner}
121     BuiltIn.Set Suite Variable    ${new_successor}
122
123 Check Network Operational Information After Fail
124     [Documentation]    Check devices in operational inventory and topology in all cluster instances.
125     ClusterOpenFlow.Check OpenFlow Network Operational Information For Sample Topology    ${new_cluster_list}
126
127 Add Configuration In Owner and Verify After Fail
128     [Documentation]    Add Flow in Owner and verify it gets applied from all instances.
129     ClusterOpenFlow.Add Sample Flow and Verify    ${new_owner}    ${new_cluster_list}
130
131 Modify Configuration In Owner and Verify After Fail
132     [Documentation]    Modify Flow in Owner and verify it gets applied from all instances.
133     ClusterOpenFlow.Modify Sample Flow and Verify    ${new_owner}    ${new_cluster_list}
134
135 Delete Configuration In Owner and Verify After Fail
136     [Documentation]    Delete Flow in Owner and verify it gets applied from all instances.
137     ClusterOpenFlow.Delete Sample Flow and Verify    ${new_owner}    ${new_cluster_list}
138
139 Add Configuration In Successor and Verify After Fail
140     [Documentation]    Add Flow in Successor and verify it gets applied from all instances.
141     ClusterOpenFlow.Add Sample Flow and Verify    ${new_successor}    ${new_cluster_list}
142
143 Modify Configuration In Successor and Verify After Fail
144     [Documentation]    Modify Flow in Successor and verify it gets applied from all instances.
145     ClusterOpenFlow.Modify Sample Flow and Verify    ${new_successor}    ${new_cluster_list}
146
147 Delete Configuration In Successor and Verify After Fail
148     [Documentation]    Delete Flow in Successor and verify it gets applied from all instances.
149     ClusterOpenFlow.Delete Sample Flow and Verify    ${new_successor}    ${new_cluster_list}
150
151 Send RPC Add to Owner and Verify After Fail
152     [Documentation]    Add Flow in Owner and verify it gets applied from all instances.
153     ClusterOpenFlow.Send RPC Add Sample Flow and Verify    ${new_owner}    ${new_cluster_list}
154
155 Send RPC Delete to Owner and Verify After Fail
156     [Documentation]    Delete Flow in Owner and verify it gets removed from all instances.
157     ClusterOpenFlow.Send RPC Delete Sample Flow and Verify    ${new_owner}    ${new_cluster_list}
158
159 Send RPC Add to Successor and Verify After Fail
160     [Documentation]    Add Flow in Successor and verify it gets applied from all instances.
161     ClusterOpenFlow.Send RPC Add Sample Flow and Verify    ${new_successor}    ${new_cluster_list}
162
163 Send RPC Delete to Successor and Verify After Fail
164     [Documentation]    Delete Flow in Successor and verify it gets removed from all instances.
165     ClusterOpenFlow.Send RPC Delete Sample Flow and Verify    ${new_successor}    ${new_cluster_list}
166
167 Modify Network and Verify After Fail
168     [Documentation]    Take a link down and verify port status in all instances.
169     ClusterOpenFlow.Take OpenFlow Device Link Down and Verify    ${new_cluster_list}
170
171 Restore Network and Verify After Fail
172     [Documentation]    Take the link up and verify port status in all instances.
173     ClusterOpenFlow.Take OpenFlow Device Link Up and Verify    ${new_cluster_list}
174
175 Start Old Owner Instance
176     [Documentation]    Start old Owner Instance and verify it is up
177     ClusterManagement.Start Single Member    ${original_owner}
178     [Teardown]    Utils.Report Failure Due To Bug    CONTROLLER-1849
179
180 Check Shards Status After Recover
181     [Documentation]    Create original cluster list and check Status for all shards in OpenFlow application.
182     ClusterOpenFlow.Check OpenFlow Shards Status After Cluster Event
183
184 Check Entity Owner Status After Recover
185     [Documentation]    Check Entity Owner Status and identify owner and successor.
186     ${new_owner}    ${new_successors_list}=    ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device
187     ...    openflow:1
188     ...    1
189     BuiltIn.Set Suite Variable    ${new_owner}
190
191 Check Network Operational Information After Recover
192     [Documentation]    Check devices in operational inventory and topology in all cluster instances.
193     ClusterOpenFlow.Check OpenFlow Network Operational Information For Sample Topology
194
195 Add Configuration In Owner and Verify After Recover
196     [Documentation]    Add Flow in Owner and verify it gets applied from all instances.
197     ClusterOpenFlow.Add Sample Flow and Verify    ${new_owner}
198
199 Modify Configuration In Owner and Verify After Recover
200     [Documentation]    Modify Flow in Owner and verify it gets applied from all instances.
201     ClusterOpenFlow.Modify Sample Flow and Verify    ${new_owner}
202
203 Delete Configuration In Owner and Verify After Recover
204     [Documentation]    Delete Flow in Owner and verify it gets applied from all instances.
205     ClusterOpenFlow.Delete Sample Flow and Verify    ${new_owner}
206
207 Add Configuration In Old Owner and Verify After Recover
208     [Documentation]    Add Flow in Owner and verify it gets applied from all instances.
209     ClusterOpenFlow.Add Sample Flow and Verify    ${original_owner}
210
211 Modify Configuration In Old Owner and Verify After Recover
212     [Documentation]    Modify Flow in Owner and verify it gets applied from all instances.
213     ClusterOpenFlow.Modify Sample Flow and Verify    ${original_owner}
214
215 Delete Configuration In Old Owner and Verify After Recover
216     [Documentation]    Delete Flow in Owner and verify it gets applied from all instances.
217     ClusterOpenFlow.Delete Sample Flow and Verify    ${original_owner}
218
219 Send RPC Add to Owner and Verify After Recover
220     [Documentation]    Add Flow in Owner and verify it gets applied from all instances.
221     ClusterOpenFlow.Send RPC Add Sample Flow and Verify    ${new_owner}
222
223 Send RPC Delete to Owner and Verify After Recover
224     [Documentation]    Delete Flow in Owner and verify it gets removed from all instances.
225     ClusterOpenFlow.Send RPC Delete Sample Flow and Verify    ${new_owner}
226
227 Send RPC Add to Old Owner and Verify After Recover
228     [Documentation]    Add Flow in Owner and verify it gets applied from all instances.
229     ClusterOpenFlow.Send RPC Add Sample Flow and Verify    ${original_owner}
230
231 Send RPC Delete to Old Owner and Verify After Recover
232     [Documentation]    Delete Flow in Owner and verify it gets removed from all instances.
233     ClusterOpenFlow.Send RPC Delete Sample Flow and Verify    ${original_owner}
234
235 Modify Network and Verify After Recover
236     [Documentation]    Take a link down and verify port status in all instances.
237     ClusterOpenFlow.Take OpenFlow Device Link Down and Verify
238
239 Restore Network and Verify After Recover
240     [Documentation]    Take the link up and verify port status in all instances.
241     ClusterOpenFlow.Take OpenFlow Device Link Up and Verify
242
243 Stop Mininet and Exit
244     [Documentation]    Stop mininet and exit connection.
245     MininetKeywords.Stop Mininet And Exit    ${mininet_conn_id}
246     Utils.Clean Mininet System
247
248 Check No Network Operational Information
249     [Documentation]    Check device is not in operational inventory or topology in all cluster instances.
250     ClusterOpenFlow.Check No OpenFlow Network Operational Information