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