Adds test suits for Cluster HA Leader follower failover
[integration/test.git] / csit / suites / openflowplugin / Clustering / 020__Cluster_HA_Leader_Follower_Failover.robot
1 *** Settings ***
2 Documentation     Test suite for Cluster HA - Device Leader Follower 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 *** Variables ***
12 ${INVENTORY_SHARD}    shard-inventory-config
13 ${START_TIMEOUT}    300s
14
15 *** Test Cases ***
16 Create Original Cluster List
17     [Documentation]    Create original cluster list.
18     ${original_cluster_list}    ClusterKeywords.Create Controller Index List
19     Set Suite Variable    ${original_cluster_list}
20
21 Check Shards Status Before Leader Restart
22     [Documentation]    Check Status for all shards in OpenFlow application.
23     ClusterOpenFlow.Check OpenFlow Shards Status    ${original_cluster_list}
24
25 Get inventory Leader Before Leader Restart
26     [Documentation]    Find leader in the inventory config shard
27     ${inventory_leader}    ${inventory_followers}    ClusterOpenFlow.Get InventoryConfig Shard Status    ${original_cluster_list}
28     ${follower_node_1}=    Get From List    ${inventory_followers}    0
29     ${follower_node_2}=    Get From List    ${inventory_followers}    1
30     Set Suite Variable    ${follower_node_1}
31     Set Suite Variable    ${follower_node_2}
32     Set Suite Variable    ${inventory_leader}
33
34 Start Mininet Connect To Leader
35     [Documentation]    Start mininet with connection to cluster Leader.
36     ${mininet_conn_id}=    MininetKeywords.Start Mininet Single Controller    ${TOOLS_SYSTEM_IP}    ${ODL_SYSTEM_${inventory_leader}_IP}
37     Set Suite Variable    ${mininet_conn_id}
38
39 Add Flows In Leader and Verify Before Leader Restart
40     [Documentation]    Add Flow via Leader and verify it gets applied from all instances.
41     ClusterOpenFlow.Add Sample Flow And Verify    ${original_cluster_list}    ${inventory_leader}
42
43 Modify Flows In Leader and Verify Before Leader Restart
44     [Documentation]    Modify Flow in Leader and verify it gets applied from all instances.
45     ClusterOpenFlow.Modify Sample Flow and Verify    ${original_cluster_list}    ${inventory_leader}
46
47 Delete Flows In Leader and Verify Before Leader Restart
48     [Documentation]    Delete Flow in Leader and verify it gets applied from all instances.
49     ClusterOpenFlow.Delete Sample Flow and Verify    ${original_cluster_list}    ${inventory_leader}
50
51 Send RPC Add to Leader and Verify Before Leader Restart
52     [Documentation]    Add Flow in Leader and verify it gets applied from all Controller instances.
53     ClusterOpenFlow.Send RPC Add Sample Flow and Verify    ${original_cluster_list}    ${inventory_leader}
54
55 Send RPC Delete to Leader and Verify Before Leader Restart
56     [Documentation]    Delete Flow in Owner and verify it gets removed from all Controller instances.
57     ClusterOpenFlow.Send RPC Delete Sample Flow and Verify    ${original_cluster_list}    ${inventory_leader}
58
59 Send RPC Add to Follower Node1 and Verify Before Leader Restart
60     [Documentation]    Add Flow in Follower and verify it gets applied from all Controller instances.
61     ClusterOpenFlow.Send RPC Add Sample Flow and Verify    ${original_cluster_list}    ${follower_node_1}
62
63 Send RPC Delete to Follower Node2 and Verify Before Leader Restart
64     [Documentation]    Delete Flow in Follower and verify it gets removed from all Controller instances.
65     ClusterOpenFlow.Send RPC Delete Sample Flow and Verify    ${original_cluster_list}    ${follower_node_2}
66
67 Stop Mininet Connected To Leader and Exit
68     [Documentation]    Stop mininet and exit connection.
69     MininetKeywords.Stop Mininet And Exit    ${mininet_conn_id}
70     Utils.Clean Mininet System
71
72 Restart Leader From Cluster Node
73     [Documentation]    Kill Leader Node and Start it Up, Verify it is sync with other controller node.
74     ClusterKeywords.Kill Multiple Controllers    ${inventory_leader}
75     ClusterKeywords.Start Multiple Controllers    ${START_TIMEOUT}    ${inventory_leader}
76
77 Get inventory Follower After Leader Restart
78     [Documentation]    Find new Followers and Leader in the inventory config shard After Leader Restart
79     ${inventory_leader}    ${inventory_followers}    ClusterOpenFlow.Get InventoryConfig Shard Status    ${original_cluster_list}
80     ${follower_node_1}=    Get From List    ${inventory_followers}    0
81     ${follower_node_2}=    Get From List    ${inventory_followers}    1
82     Set Suite Variable    ${follower_node_1}
83     Set Suite Variable    ${follower_node_2}
84     Set Suite Variable    ${inventory_leader}
85
86 Start Mininet Connect To Follower Node1
87     [Documentation]    Start mininet with connection to cluster Follower Node1.
88     ${mininet_conn_id}=    MininetKeywords.Start Mininet Single Controller    ${TOOLS_SYSTEM_IP}    ${ODL_SYSTEM_${follower_node_1}_IP}
89     Set Suite Variable    ${mininet_conn_id}
90
91 Add Flows In Follower Node2 and Verify Before Follower Restart
92     [Documentation]    Add Flow via cluster Follower Node2 and verify it gets applied from all instances.
93     ClusterOpenFlow.Add Sample Flow And Verify    ${original_cluster_list}    ${follower_node_2}
94
95 Modify Flows In Follower Node2 and Verify Before Follower Restart
96     [Documentation]    Modify Flow in Follower Node2 and verify it gets applied from all instances.
97     ClusterOpenFlow.Modify Sample Flow and Verify    ${original_cluster_list}    ${follower_node_2}
98
99 Delete Flows In Follower Node2 and Verify Follower Restart
100     [Documentation]    Delete Flow in Follower Node2 and verify it gets applied from all instances.
101     ClusterOpenFlow.Delete Sample Flow and Verify    ${original_cluster_list}    ${follower_node_2}
102
103 Send RPC Add to Leader and Verify Before Follower Restart
104     [Documentation]    Add Flow in Leader and verify it gets applied from all Controller instances.
105     ClusterOpenFlow.Send RPC Add Sample Flow and Verify    ${original_cluster_list}    ${inventory_leader}
106
107 Send RPC Delete to Leader and Verify Before Follower Restart
108     [Documentation]    Delete Flow in Owner and verify it gets removed from all Controller instances.
109     ClusterOpenFlow.Send RPC Delete Sample Flow and Verify    ${original_cluster_list}    ${inventory_leader}
110
111 Send RPC Add to First Follower Node1 and Verify Before Follower Restart
112     [Documentation]    Add Flow in Follower and verify it gets applied from all Controller instances.
113     ClusterOpenFlow.Send RPC Add Sample Flow and Verify    ${original_cluster_list}    ${follower_node_1}
114
115 Send RPC Delete to Follower Node2 and Verify Before Follower Restart
116     [Documentation]    Delete Flow in Follower Node2 and verify it gets removed from all Controller instances.
117     ClusterOpenFlow.Send RPC Delete Sample Flow and Verify    ${original_cluster_list}    ${follower_node_2}
118
119 Stop Mininet Connected To Follower and Exit
120     [Documentation]    Stop mininet and exit connection.
121     MininetKeywords.Stop Mininet And Exit    ${mininet_conn_id}
122     Utils.Clean Mininet System
123
124 Restart Follower Node2
125     [Documentation]    Kill Follower Node2 and Start it Up, Verify it is sync with other controller node.
126     ClusterKeywords.Kill Multiple Controllers    ${follower_node_2}
127     ClusterKeywords.Start Multiple Controllers    ${START_TIMEOUT}    ${follower_node_2}
128
129 Get inventory Follower After Follower Restart
130     [Documentation]    Find Followers and Leader in the inventory config shard After Follower Restart
131     ${inventory_leader}    ${inventory_followers}    ClusterOpenFlow.Get InventoryConfig Shard Status    ${original_cluster_list}
132     ${follower_node_1}=    Get From List    ${inventory_followers}    0
133     ${follower_node_2}=    Get From List    ${inventory_followers}    1
134     Set Suite Variable    ${follower_node_1}
135     Set Suite Variable    ${follower_node_2}
136     Set Suite Variable    ${inventory_leader}
137
138 Start Mininet Connect To Follower Node2
139     [Documentation]    Start mininet with connection to cluster Follower Node1.
140     ${mininet_conn_id}=    MininetKeywords.Start Mininet Single Controller    ${TOOLS_SYSTEM_IP}    ${ODL_SYSTEM_${follower_node_2}_IP}
141     Set Suite Variable    ${mininet_conn_id}
142
143 Add Flows In Follower Node1 and Verify Before Cluster Restart
144     [Documentation]    Add Flow via cluster Follower Node1 and verify it gets applied from all instances.
145     ClusterOpenFlow.Add Sample Flow And Verify    ${original_cluster_list}    ${follower_node_1}
146
147 Modify Flows In Follower Node1 and Verify Before Cluster Restart
148     [Documentation]    Modify Flow in Follower Node1 and verify it gets applied from all instances.
149     ClusterOpenFlow.Modify Sample Flow and Verify    ${original_cluster_list}    ${follower_node_1}
150
151 Delete Flows In Follower Node1 and Verify Before Cluster Restart
152     [Documentation]    Delete Flow in Follower Node1 and verify it gets applied from all instances.
153     ClusterOpenFlow.Delete Sample Flow and Verify    ${original_cluster_list}    ${follower_node_1}
154
155 Send RPC Add to Leader and Verify Before Cluster Restart
156     [Documentation]    Add Flow in Leader and verify it gets applied from all Controller instances.
157     ClusterOpenFlow.Send RPC Add Sample Flow and Verify    ${original_cluster_list}    ${inventory_leader}
158
159 Send RPC Delete to Leader and Verify Before Cluster Restart
160     [Documentation]    Delete Flow in Owner and verify it gets removed from all Controller instances.
161     ClusterOpenFlow.Send RPC Delete Sample Flow and Verify    ${original_cluster_list}    ${inventory_leader}
162
163 Send RPC Add to Follower Node2 and Verify Before Cluster Restart
164     [Documentation]    Add Flow in Follower and verify it gets applied from all Controller instances.
165     ClusterOpenFlow.Send RPC Add Sample Flow and Verify    ${original_cluster_list}    ${follower_node_2}
166
167 Send RPC Delete to Follower Node1 and Verify Before Cluster Restart
168     [Documentation]    Delete Flow in Follower and verify it gets removed from all Controller instances.
169     ClusterOpenFlow.Send RPC Delete Sample Flow and Verify    ${original_cluster_list}    ${follower_node_1}
170
171 Stop Mininet Connected To Other Follower and Exit
172     [Documentation]    Stop mininet Connected To Other Follower and exit connection.
173     MininetKeywords.Stop Mininet And Exit    ${mininet_conn_id}
174     Utils.Clean Mininet System
175
176 Restart Full Cluster
177     [Documentation]    Kill all Cluster Nodes and Start it Up All.
178     ClusterKeywords.Kill Multiple Controllers    @{original_cluster_list}
179     ClusterKeywords.Start Multiple Controllers    ${START_TIMEOUT}    @{original_cluster_list}
180
181 Get inventory Status After Cluster Restart
182     [Documentation]    Find New Followers and Leader in the inventory config shard After Cluster Restart
183     ${inventory_leader}    ${inventory_followers}    ClusterOpenFlow.Get InventoryConfig Shard Status    ${original_cluster_list}
184     ${follower_node_1}=    Get From List    ${inventory_followers}    0
185     ${follower_node_2}=    Get From List    ${inventory_followers}    1
186     Set Suite Variable    ${follower_node_1}
187     Set Suite Variable    ${follower_node_2}
188     Set Suite Variable    ${inventory_leader}
189
190 Start Mininet Connect To Follower Node2 After Cluster Restart
191     [Documentation]    Start mininet with connection to cluster Follower Node1.
192     ${mininet_conn_id}=    MininetKeywords.Start Mininet Single Controller    ${TOOLS_SYSTEM_IP}    ${ODL_SYSTEM_${follower_node_2}_IP}
193     Set Suite Variable    ${mininet_conn_id}
194
195 Add Flows In Follower Node1 and Verify After Cluster Restart
196     [Documentation]    Add Flow via cluster Follower Node1 and verify it gets applied from all instances.
197     ClusterOpenFlow.Add Sample Flow And Verify    ${original_cluster_list}    ${follower_node_1}
198
199 Modify Flows In Follower Node1 and Verify After Cluster Restart
200     [Documentation]    Modify Flow in Follower Node1 and verify it gets applied from all instances.
201     ClusterOpenFlow.Modify Sample Flow and Verify    ${original_cluster_list}    ${follower_node_1}
202
203 Delete Flows In Follower Node1 and Verify After Cluster Restart
204     [Documentation]    Delete Flow in Follower Node1 and verify it gets applied from all instances.
205     ClusterOpenFlow.Delete Sample Flow and Verify    ${original_cluster_list}    ${follower_node_1}
206
207 Send RPC Add to Leader and Verify After Cluster Restart
208     [Documentation]    Add Flow in Leader and verify it gets applied from all Controller instances.
209     ClusterOpenFlow.Send RPC Add Sample Flow and Verify    ${original_cluster_list}    ${inventory_leader}
210
211 Send RPC Delete to Leader and Verify After Cluster Restart
212     [Documentation]    Delete Flow in Owner and verify it gets removed from all Controller instances.
213     ClusterOpenFlow.Send RPC Delete Sample Flow and Verify    ${original_cluster_list}    ${inventory_leader}
214
215 Send RPC Add to Follower Node2 and Verify After Cluster Restart
216     [Documentation]    Add Flow in Follower and verify it gets applied from all Controller instances.
217     ClusterOpenFlow.Send RPC Add Sample Flow and Verify    ${original_cluster_list}    ${follower_node_2}
218
219 Send RPC Delete to Follower Node2 and Verify After Cluster Restart
220     [Documentation]    Delete Flow in Follower and verify it gets removed from all Controller instances.
221     ClusterOpenFlow.Send RPC Delete Sample Flow and Verify    ${original_cluster_list}    ${follower_node_1}
222
223 Stop Mininet Connected To Follower Node2 and Exit After Cluster Restart
224     [Documentation]    Stop mininet Connected To Other Follower and exit connection.
225     MininetKeywords.Stop Mininet And Exit    ${mininet_conn_id}
226     Utils.Clean Mininet System