a166f4a89f1d6da3c22a1270386026de0151ab11
[integration/test.git] / csit / suites / openflowplugin / Clustering_Bulkomatic / 020__Cluster_HA_Data_Recovery_BulkFlow_2Node_Cluster.robot
1 *** Settings ***
2 Documentation     Test suite for 2Node Cluster HA with Bulk Flows - Cluster node convergance and Data consistency after leader and follower restart with one switch connected
3 Suite Setup       ClusterManagement Setup
4 Suite Teardown    Delete All Sessions
5 Resource          ../../../libraries/BulkomaticKeywords.robot
6 Resource          ../../../libraries/MininetKeywords.robot
7 Resource          ../../../libraries/ClusterManagement.robot
8 Resource          ../../../libraries/ClusterOpenFlow.robot
9 Resource          ../../../libraries/Utils.robot
10 Variables         ../../../variables/Variables.py
11
12 *** Variables ***
13 ${operation_timeout}    100s
14 ${restart_timeout}    350s
15 ${flow_count_per_switch}    1000
16 ${switch_count}    1
17 ${flow_count_after_add}    1000
18 ${flow_count_after_del}    0
19 ${orig_json_config_add}    sal_add_bulk_flow_config.json
20 ${orig_json_config_get}    sal_get_bulk_flow_config.json
21 ${orig_json_config_del}    sal_del_bulk_flow_config.json
22
23 *** Test Cases ***
24 Check Shards Status and Initialize Variables
25     [Documentation]    Check Status for all shards in OpenFlow application.
26     ClusterOpenFlow.Check OpenFlow Shards Status
27     ${temp_json_config_add}    BulkomaticKeywords.Set DPN And Flow Count In Json Add    ${orig_json_config_add}    ${switch_count}    ${flow_count_per_switch}
28     ${temp_json_config_get}    BulkomaticKeywords.Set DPN And Flow Count In Json Get    ${orig_json_config_get}    ${switch_count}    ${flow_count_after_add}
29     ${temp_json_config_del}    BulkomaticKeywords.Set DPN And Flow Count In Json Del    ${orig_json_config_del}    ${switch_count}    ${flow_count_per_switch}
30     Set Suite Variable    ${temp_json_config_add}
31     Set Suite Variable    ${temp_json_config_get}
32     Set Suite Variable    ${temp_json_config_del}
33
34 Get Inventory Follower Before Cluster Restart
35     [Documentation]    Find a follower in the inventory config shard
36     ${inventory_leader}    ${inventory_followers}    ClusterOpenFlow.Get InventoryConfig Shard Status
37     ${Inventory_Leader_List}=    Create List    ${Inventory_Leader}
38     ${Follower_Node_1}=    Get From List    ${Inventory_Followers}    0
39     Set Suite Variable    ${Inventory_Followers}
40     Set Suite Variable    ${Follower_Node_1}
41     Set Suite Variable    ${Inventory_Leader}
42     Set Suite Variable    ${Inventory_Leader_List}
43
44 Shutdown Leader From Cluster Node
45     [Documentation]    Shutdown Leader Node and Start it Up.
46     ClusterManagement.Kill Single Member    ${Inventory_Leader}
47
48 Check Shards Status After Leader Shutdown
49     [Documentation]    Wait for node convergence and check status for all shards in OpenFlow application.
50     Wait Until Keyword Succeeds    ${operation_timeout}    2s    ClusterOpenFlow.Check OpenFlow Shards Status    ${Inventory_Followers}
51
52 Start Mininet Connect To Follower Node1
53     [Documentation]    Start mininet with connection to Follower Node1.
54     ${mininet_conn_id}=    MininetKeywords.Start Mininet Single Controller    ${TOOLS_SYSTEM_IP}    ${ODL_SYSTEM_${Follower_Node_1}_IP}
55     Set Suite Variable    ${mininet_conn_id}
56
57 Add Bulk Flow From Follower
58     [Documentation]    1000 Flows added via Follower Node1 and verify it gets applied in all instances.
59     BulkomaticKeywords.Add Bulk Flow In Node    ${temp_json_config_add}    ${Follower_Node_1}    ${operation_timeout}
60
61 Get Bulk Flows and Verify In Cluster
62     [Documentation]    Initiate get operation and check flow count across cluster nodes.
63     BulkomaticKeywords.Get Bulk Flow And Verify Count In Cluster    ${temp_json_config_get}    ${operation_timeout}    ${flow_count_after_add}    ${Inventory_Followers}
64
65 Verify Flows In Switch Before Cluster Restart
66     [Documentation]    Verify flows are installed in switch before cluster restart.
67     MininetKeywords.Verify Aggregate Flow From Mininet Session    ${mininet_conn_id}    ${switch_count}    ${flow_count_per_switch}    ${operation_timeout}
68
69 Restart Leader From Cluster Node
70     [Documentation]    Restart Leader Node.
71     ClusterManagement.Start Single Member    ${Inventory_Leader}
72
73 Verify Data Recovery After Leader Restart
74     [Documentation]    1000 Flows preserved in all controller instances.
75     Wait Until Keyword Succeeds    ${restart_timeout}    2s    BulkomaticKeywords.Get Bulk Flow And Verify Count In Cluster    ${temp_json_config_get}    ${operation_timeout}    ${flow_count_after_add}
76
77 Verify Flows In Switch After Leader Restart
78     [Documentation]    Verify flows are installed in switch after cluster restart.
79     MininetKeywords.Verify Aggregate Flow From Mininet Session    ${mininet_conn_id}    ${switch_count}    ${flow_count_per_switch}    ${operation_timeout}
80
81 Stop Mininet Connected To Follower Node1
82     [Documentation]    Stop mininet and exit connection.
83     MininetKeywords.Stop Mininet And Exit    ${mininet_conn_id}
84     Utils.Clean Mininet System
85
86 Delete All Flows From Follower Node1
87     [Documentation]    1000 Flows deleted via Follower Node1 and verify it gets applied in all instances.
88     BulkomaticKeywords.Delete Bulk Flow In Node    ${temp_json_config_del}    ${Follower_Node_1}    ${operation_timeout}
89
90 Verify No Flows In Cluster
91     [Documentation]    Verify flow count is 0 across cluster nodes.
92     BulkomaticKeywords.Get Bulk Flow And Verify Count In Cluster    ${temp_json_config_get}    ${operation_timeout}    ${flow_count_after_del}
93
94 Get Inventory Follower Before Follower Restart
95     [Documentation]    Find Leader and followers in the inventory config shard
96     ${inventory_leader}    ${inventory_followers}    ClusterOpenFlow.Get InventoryConfig Shard Status
97     ${Active_Nodes}=    Create List
98     ${Follower_Node_1}=    Get From List    ${Inventory_Followers}    0
99     ${Follower_Node_2}=    Get From List    ${Inventory_Followers}    1
100     Append To List    ${Active_Nodes}    ${inventory_leader}    ${Follower_Node_1}
101     Set Suite Variable    ${Active_Nodes}
102     Set Suite Variable    ${Follower_Node_1}
103     Set Suite Variable    ${Follower_Node_2}
104
105 Shutdown Follower From Cluster Node
106     [Documentation]    Shutdown Follower Node2 and Start it Up.
107     ClusterManagement.Kill Single Member    ${Follower_Node_2}
108
109 Check Shards Status After Follower Shutdown
110     [Documentation]    Wait for node convergence and check status for all shards in OpenFlow application.
111     Wait Until Keyword Succeeds    ${operation_timeout}    2s    ClusterOpenFlow.Check OpenFlow Shards Status    ${Active_Nodes}
112
113 Start Mininet Connect To Follower Node
114     [Documentation]    Start mininet with connection to Follower Node1.
115     ${mininet_conn_id}=    MininetKeywords.Start Mininet Single Controller    ${TOOLS_SYSTEM_IP}    ${ODL_SYSTEM_${Follower_Node_1}_IP}
116     Set Suite Variable    ${mininet_conn_id}
117
118 Add Bulk Flow From Follower Node1
119     [Documentation]    1000 Flows added via Follower Node1 and verify it gets applied in all instances.
120     BulkomaticKeywords.Add Bulk Flow In Node    ${temp_json_config_add}    ${Follower_Node_1}    ${operation_timeout}
121
122 Get Bulk Flows and Verify In Cluster Before Follower Restart
123     [Documentation]    Initiate get operation and check flow count only across active cluster nodes
124     BulkomaticKeywords.Get Bulk Flow And Verify Count In Cluster    ${temp_json_config_get}    ${operation_timeout}    ${flow_count_after_add}    ${Active_Nodes}
125
126 Verify Flows In Switch Before Follower Restart
127     [Documentation]    Verify flows are installed in switch before follower restart.
128     MininetKeywords.Verify Aggregate Flow From Mininet Session    ${mininet_conn_id}    ${switch_count}    ${flow_count_per_switch}    ${operation_timeout}
129
130 Restart Follower From Cluster Node
131     [Documentation]    Restart Follower Node2.
132     ClusterManagement.Start Single Member    ${Follower_Node_2}
133
134 Verify Data Recovery After Follower Restart
135     [Documentation]    1000 Flows preserved in all controller instances.
136     Wait Until Keyword Succeeds    ${restart_timeout}    2s    BulkomaticKeywords.Get Bulk Flow And Verify Count In Cluster    ${temp_json_config_get}    ${operation_timeout}    ${flow_count_after_add}
137
138 Verify Flows In Switch After Follower Restart
139     [Documentation]    Verify flows are installed in switch after cluster restart.
140     MininetKeywords.Verify Aggregate Flow From Mininet Session    ${mininet_conn_id}    ${switch_count}    ${flow_count_per_switch}    ${operation_timeout}
141
142 Stop Mininet Connected To Follower Node
143     [Documentation]    Stop mininet and exit connection.
144     MininetKeywords.Stop Mininet And Exit    ${mininet_conn_id}
145     Utils.Clean Mininet System
146
147 Delete All Flows From Follower Node
148     [Documentation]    1000 Flows deleted via Follower Node1 and verify it gets applied in all instances.
149     BulkomaticKeywords.Delete Bulk Flow In Node    ${temp_json_config_del}    ${Follower_Node_1}    ${operation_timeout}
150
151 Verify No Flows In Cluster After Follower Restart
152     [Documentation]    Verify flow count is 0 across cluster nodes.
153     BulkomaticKeywords.Get Bulk Flow And Verify Count In Cluster    ${temp_json_config_get}    ${operation_timeout}    ${flow_count_after_del}