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