Reconcilliation in a 3 node cluster multi DPN environment
[integration/test.git] / csit / suites / openflowplugin / Clustering_Bulkomatic / 030__Cluster_Reconcilliation_Multi_DPN.robot
1 *** Settings ***
2 Documentation     Test suite for Cluster with Bulk Flows - Reconcilliation in a multi DPN environment
3 Suite Setup       Create Controller Sessions
4 Suite Teardown    Delete All Sessions
5 Resource          ../../../libraries/BulkomaticKeywords.robot
6 Resource          ../../../libraries/MininetKeywords.robot
7 Resource          ../../../libraries/ClusterKeywords.robot
8 Resource          ../../../libraries/ClusterOpenFlow.robot
9 Resource          ../../../libraries/Utils.robot
10 Variables         ../../../variables/Variables.py
11
12 *** Variables ***
13 ${operation_timeout}    100s
14 ${flow_count_per_switch}    1000
15 ${switch_count}    3
16 ${flow_count_after_add}    3000
17 ${flow_count_after_del}    0
18 ${orig_json_config_add}    sal_add_bulk_flow_config.json
19 ${orig_json_config_get}    sal_get_bulk_flow_config.json
20 ${orig_json_config_del}    sal_del_bulk_flow_config.json
21
22 *** Test Cases ***
23 Create Original Cluster List
24     [Documentation]    Create original cluster list.
25     ${original_cluster_list}    ClusterKeywords.Create Controller Index List
26     Set Suite Variable    ${original_cluster_list}
27
28 Check Shards Status Before Leader Restart
29     [Documentation]    Check Status for all shards in OpenFlow application.
30     ClusterOpenFlow.Check OpenFlow Shards Status    ${original_cluster_list}
31
32 Get Inventory Follower Before Cluster Restart
33     [Documentation]    Find a follower in the inventory config shard
34     ${inventory_leader}    ${inventory_followers}    ClusterOpenFlow.Get InventoryConfig Shard Status    ${original_cluster_list}
35     ${Follower_Node_1}=    Get From List    ${Inventory_Followers}    0
36     ${Follower_Node_2}=    Get From List    ${Inventory_Followers}    1
37     Set Suite Variable    ${Follower_Node_1}
38     Set Suite Variable    ${Follower_Node_2}
39     Set Suite Variable    ${Inventory_Leader}
40
41 Start Mininet Connect To Follower Node1
42     [Documentation]    Start mininet with connection to Follower Node1.
43     ${mininet_conn_id}=    MininetKeywords.Start Mininet Single Controller    ${TOOLS_SYSTEM_IP}    ${ODL_SYSTEM_${Follower_Node_1}_IP}    --topo linear,${switch_count} --switch ovsk,protocols=OpenFlow13
44     Set Suite Variable    ${mininet_conn_id}
45
46 Add Bulk Flow From Follower
47     [Documentation]    3000 Flows (1K per DPN) in 3 DPN added via Follower Node1 and verify it gets applied in all instances.
48     ${temp_json_config_add}    BulkomaticKeywords.Set DPN And Flow Count In Json Add    ${orig_json_config_add}    ${switch_count}    ${flow_count_per_switch}
49     BulkomaticKeywords.Add Bulk Flow In Node    ${Follower_Node_1}    ${temp_json_config_add}    ${operation_timeout}
50
51 Get Bulk Flows and Verify In Cluster
52     [Documentation]    Initiate get operation and check flow count across cluster nodes
53     ${temp_json_config_get}    BulkomaticKeywords.Set DPN And Flow Count In Json Get    ${orig_json_config_get}    ${switch_count}    ${flow_count_after_add}
54     Set Suite Variable    ${temp_json_config_get}
55     BulkomaticKeywords.Get Bulk Flow And Verify Count In Cluster    ${original_cluster_list}    ${temp_json_config_get}    ${operation_timeout}    ${flow_count_after_add}
56
57 Verify Flows In Switch Before Cluster Restart
58     [Documentation]    Verify flows are installed in switch before cluster restart.
59     MininetKeywords.Verify Aggregate Flow From Mininet Session    ${mininet_conn_id}    ${switch_count}    ${flow_count_per_switch}    ${operation_timeout}
60
61 Stop Mininet Connected To Follower Node1 and Exit
62     [Documentation]    Stop mininet and exit connection.
63     MininetKeywords.Stop Mininet And Exit    ${mininet_conn_id}
64     Utils.Clean Mininet System
65
66 Start Mininet Reconnect To Follower Node1
67     [Documentation]    Start mininet with reconnection to follower node1.
68     ${mininet_conn_id}=    MininetKeywords.Start Mininet Single Controller    ${TOOLS_SYSTEM_IP}    ${ODL_SYSTEM_${Follower_Node_1}_IP}    --topo linear,${switch_count} --switch ovsk,protocols=OpenFlow13
69     Set Suite Variable    ${mininet_conn_id}
70
71 Verify Flows In Switch Reconnected To Follower Node1
72     [Documentation]    Verify 1K flows per DPN installed in switch after it is reconnected to follower node1.
73     MininetKeywords.Verify Aggregate Flow From Mininet Session    ${mininet_conn_id}    ${switch_count}    ${flow_count_per_switch}    ${operation_timeout}
74
75 Stop Mininet Connected To Follower Node1
76     [Documentation]    Stop mininet and exit connection.
77     MininetKeywords.Stop Mininet And Exit    ${mininet_conn_id}
78     Utils.Clean Mininet System
79
80 Start Mininet Connect To Follower Node2
81     [Documentation]    Start mininet with connection to follower node2.
82     ${mininet_conn_id}=    MininetKeywords.Start Mininet Single Controller    ${TOOLS_SYSTEM_IP}    ${ODL_SYSTEM_${Follower_Node_2}_IP}    --topo linear,${switch_count} --switch ovsk,protocols=OpenFlow13
83     Set Suite Variable    ${mininet_conn_id}
84
85 Verify Flows In Switch Connected To Follower Node2
86     [Documentation]    Verify 1K flows per DPN installed in switch after it is connected to follower node2.
87     MininetKeywords.Verify Aggregate Flow From Mininet Session    ${mininet_conn_id}    ${switch_count}    ${flow_count_per_switch}    ${operation_timeout}
88
89 Stop Mininet Connected To Follower Node2
90     [Documentation]    Stop mininet and exit connection.
91     MininetKeywords.Stop Mininet And Exit    ${mininet_conn_id}
92     Utils.Clean Mininet System
93
94 Start Mininet Connect To Inventory Leader
95     [Documentation]    Start mininet with connection to inventroy leader.
96     ${mininet_conn_id}=    MininetKeywords.Start Mininet Single Controller    ${TOOLS_SYSTEM_IP}    ${ODL_SYSTEM_${Inventory_Leader}_IP}    --topo linear,${switch_count} --switch ovsk,protocols=OpenFlow13
97     Set Suite Variable    ${mininet_conn_id}
98
99 Verify Flows In Switch Connected To Leader
100     [Documentation]    Verify 1K flows per DPN installed in switch after it is connected to inventory leader.
101     MininetKeywords.Verify Aggregate Flow From Mininet Session    ${mininet_conn_id}    ${switch_count}    ${flow_count_per_switch}    ${operation_timeout}
102
103 Stop Mininet Connected To Inventory Leader
104     [Documentation]    Stop mininet and exit connection.
105     MininetKeywords.Stop Mininet And Exit    ${mininet_conn_id}
106     Utils.Clean Mininet System
107
108 Delete All Flows From Follower Node1
109     [Documentation]    3000 Flows deleted via Follower Node1 and verify it gets applied in all instances.
110     ${temp_json_config_del}    BulkomaticKeywords.Set DPN And Flow Count In Json Del    ${orig_json_config_del}    ${switch_count}    ${flow_count_per_switch}
111     BulkomaticKeywords.Delete Bulk Flow In Node    ${Follower_Node_1}    ${temp_json_config_del}    ${operation_timeout}
112
113 Verify No Flows In Cluster
114     [Documentation]    Verify flow count is 0 across cluster nodes.
115     BulkomaticKeywords.Get Bulk Flow And Verify Count In Cluster    ${original_cluster_list}    ${temp_json_config_get}    ${operation_timeout}    ${flow_count_after_del}