bd0b20e9a4d9ffe7ce3605e7372dee74fa3a0436
[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 Test Setup        SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
6 Library           RequestsLibrary
7 Resource          ../../../libraries/SetupUtils.robot
8 Resource          ../../../libraries/ClusterOpenFlow.robot
9 Resource          ../../../libraries/MininetKeywords.robot
10 Resource          ../../../libraries/ClusterManagement.robot
11 Variables         ../../../variables/Variables.py
12
13 *** Test Cases ***
14 Check Shards Status Before Fail
15     [Documentation]    Check Status for all shards in OpenFlow application.
16     ClusterOpenFlow.Check OpenFlow Shards Status
17
18 Start Mininet Multiple Connections
19     [Documentation]    Start mininet tree,2 with connection to all cluster instances.
20     ${mininet_conn_id}=    MininetKeywords.Start Mininet Multiple Controllers    ${TOOLS_SYSTEM_IP}    ${ClusterManagement__member_index_list}    --topo tree,2
21     BuiltIn.Set Suite Variable    ${mininet_conn_id}
22     BuiltIn.Wait Until Keyword Succeeds    10s    1s    OVSDB.Check OVS OpenFlow Connections    ${TOOLS_SYSTEM_IP}    9
23
24 Check Entity Owner Status And Find Owner and Successor Before Fail
25     [Documentation]    Check Entity Owner Status and identify owner and successor for first switch s1.
26     ${original_owner}    ${original_successor_list}    ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device    openflow:1    1
27     ${original_successor}=    Collections.Get From List    ${original_successor_list}    0
28     BuiltIn.Set Suite Variable    ${original_owner}
29     BuiltIn.Set Suite Variable    ${original_successor_list}
30     BuiltIn.Set Suite Variable    ${original_successor}
31
32 Reconnect Extra Switches To Successors And Check OVS Connections
33     [Documentation]    Connect switches s2 and s3 to successor instances.
34     ${controller_opt} =    BuiltIn.Set Variable
35     : FOR    ${index}    IN    @{original_successor_list}
36     \    ${controller_opt} =    BuiltIn.Catenate    ${controller_opt}    ${SPACE}tcp:${ODL_SYSTEM_${index}_IP}:${ODL_OF_PORT}
37     \    Log    ${controller_opt}
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
166 Check Shards Status After Recover
167     [Documentation]    Create original cluster list and check Status for all shards in OpenFlow application.
168     ClusterOpenFlow.Check OpenFlow Shards Status After Cluster Event
169
170 Check Entity Owner Status After Recover
171     [Documentation]    Check Entity Owner Status and identify owner and successor.
172     ${new_owner}    ${new_successors_list}    ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device    openflow:1    1
173     BuiltIn.Set Suite Variable    ${new_owner}
174
175 Check Network Operational Information After Recover
176     [Documentation]    Check devices in operational inventory and topology in all cluster instances.
177     ClusterOpenFlow.Check OpenFlow Network Operational Information For Sample Topology
178
179 Add Configuration In Owner and Verify After Recover
180     [Documentation]    Add Flow in Owner and verify it gets applied from all instances.
181     ClusterOpenFlow.Add Sample Flow and Verify    ${new_owner}
182
183 Modify Configuration In Owner and Verify After Recover
184     [Documentation]    Modify Flow in Owner and verify it gets applied from all instances.
185     ClusterOpenFlow.Modify Sample Flow and Verify    ${new_owner}
186
187 Delete Configuration In Owner and Verify After Recover
188     [Documentation]    Delete Flow in Owner and verify it gets applied from all instances.
189     ClusterOpenFlow.Delete Sample Flow and Verify    ${new_owner}
190
191 Add Configuration In Old Owner and Verify After Recover
192     [Documentation]    Add Flow in Owner and verify it gets applied from all instances.
193     ClusterOpenFlow.Add Sample Flow and Verify    ${original_owner}
194
195 Modify Configuration In Old Owner and Verify After Recover
196     [Documentation]    Modify Flow in Owner and verify it gets applied from all instances.
197     ClusterOpenFlow.Modify Sample Flow and Verify    ${original_owner}
198
199 Delete Configuration In Old Owner and Verify After Recover
200     [Documentation]    Delete Flow in Owner and verify it gets applied from all instances.
201     ClusterOpenFlow.Delete Sample Flow and Verify    ${original_owner}
202
203 Send RPC Add to Owner and Verify After Recover
204     [Documentation]    Add Flow in Owner and verify it gets applied from all instances.
205     ClusterOpenFlow.Send RPC Add Sample Flow and Verify    ${new_owner}
206
207 Send RPC Delete to Owner and Verify After Recover
208     [Documentation]    Delete Flow in Owner and verify it gets removed from all instances.
209     ClusterOpenFlow.Send RPC Delete Sample Flow and Verify    ${new_owner}
210
211 Send RPC Add to Old Owner and Verify After Recover
212     [Documentation]    Add Flow in Owner and verify it gets applied from all instances.
213     ClusterOpenFlow.Send RPC Add Sample Flow and Verify    ${original_owner}
214
215 Send RPC Delete to Old Owner and Verify After Recover
216     [Documentation]    Delete Flow in Owner and verify it gets removed from all instances.
217     ClusterOpenFlow.Send RPC Delete Sample Flow and Verify    ${original_owner}
218
219 Modify Network and Verify After Recover
220     [Documentation]    Take a link down and verify port status in all instances.
221     ClusterOpenFlow.Take OpenFlow Device Link Down and Verify
222
223 Restore Network and Verify After Recover
224     [Documentation]    Take the link up and verify port status in all instances.
225     ClusterOpenFlow.Take OpenFlow Device Link Up and Verify
226
227 Stop Mininet and Exit
228     [Documentation]    Stop mininet and exit connection.
229     MininetKeywords.Stop Mininet And Exit    ${mininet_conn_id}
230     Utils.Clean Mininet System
231
232 Check No Network Operational Information
233     [Documentation]    Check device is not in operational inventory or topology in all cluster instances.
234     ClusterOpenFlow.Check No OpenFlow Network Operational Information