Cluster Library consolidation 1
[integration/test.git] / csit / suites / openflowplugin / Clustering / 030__Cluster_HA_Data_Recovery_Leader_Follower_Failover.robot
1 *** Settings ***
2 Documentation     Test suite for Cluster HA - Data Recovery at Leader Follower failover and cluster restart
3 Suite Setup       ClusterManagement Setup
4 Suite Teardown    Delete All Sessions
5 Library           RequestsLibrary
6 Resource          ../../../libraries/ClusterOpenFlow.robot
7 Resource          ../../../libraries/ClusterManagement.robot
8 Resource          ../../../libraries/MininetKeywords.robot
9 Variables         ../../../variables/Variables.py
10
11 *** Variables ***
12 ${flow_count_per_switch}    1
13 ${switch_count_per_node}    1
14 ${operation_timeout}    15s
15
16 *** Test Cases ***
17 Check Shards Status Before Leader Restart
18     [Documentation]    Check Status for all shards in OpenFlow application.
19     ClusterOpenFlow.Check OpenFlow Shards Status
20
21 Get inventory Leader Before Leader Restart
22     [Documentation]    Find leader in the inventory config shard
23     ${inventory_leader}    ${inventory_followers}    ClusterOpenFlow.Get InventoryConfig Shard Status
24     ${follower_node_1}=    Get From List    ${inventory_followers}    0
25     ${follower_node_2}=    Get From List    ${inventory_followers}    1
26     Set Suite Variable    ${inventory_leader_old}    ${inventory_leader}
27     Set Suite Variable    ${follower_node_1}
28     Set Suite Variable    ${follower_node_2}
29     Set Suite Variable    ${inventory_leader}
30
31 Start Mininet Connect To Follower Node1
32     [Documentation]    Start mininet with connection to Follower Node1.
33     ${mininet_conn_id}=    MininetKeywords.Start Mininet Single Controller    ${TOOLS_SYSTEM_IP}    ${ODL_SYSTEM_${follower_node_1}_IP}
34     Set Suite Variable    ${mininet_conn_id}
35
36 Add Flows In Follower Node2 and Verify Before Leader Restart
37     [Documentation]    Add Flow via Follower Node2 and verify it gets applied from all instances.
38     ClusterOpenFlow.Add Sample Flow And Verify    ${follower_node_2}
39
40 Stop Mininet Connected To Follower Node1 and Exit
41     [Documentation]    Stop mininet and exit connection.
42     MininetKeywords.Stop Mininet And Exit    ${mininet_conn_id}
43     Utils.Clean Mininet System
44
45 Restart Leader From Cluster Node
46     [Documentation]    Kill Leader Node and Start it Up, Verify it is sync with other controller node.
47     ClusterManagement.Kill Single Member    ${inventory_leader}
48     ClusterManagement.Start Single Member    ${inventory_leader}
49
50 Get inventory Follower After Leader Restart
51     [Documentation]    Find new Followers and Leader in the inventory config shard After Leader Restart.
52     ${inventory_leader}    ${inventory_followers}    ClusterOpenFlow.Get InventoryConfig Shard Status
53     ${follower_node_1}=    Get From List    ${inventory_followers}    0
54     ${follower_node_2}=    Get From List    ${inventory_followers}    1
55     Set Suite Variable    ${follower_node_1}
56     Set Suite Variable    ${follower_node_2}
57     Set Suite Variable    ${inventory_leader}
58
59 Start Mininet Connect To Old Leader
60     [Documentation]    Start mininet with connection to cluster old leader.
61     ${mininet_conn_id}=    MininetKeywords.Start Mininet Single Controller    ${TOOLS_SYSTEM_IP}    ${ODL_SYSTEM_${inventory_leader_old}_IP}
62     Set Suite Variable    ${mininet_conn_id}
63
64 Verify Flows In Switch After Leader Restart
65     [Documentation]    Verify flows are installed in switch after leader restart.
66     MininetKeywords.Verify Aggregate Flow From Mininet Session    ${mininet_conn_id}    ${switch_count_per_node}    ${flow_count_per_switch}    ${operation_timeout}
67
68 Stop Mininet Connected To Old Leader and Exit
69     [Documentation]    Stop mininet and exit connection.
70     MininetKeywords.Stop Mininet And Exit    ${mininet_conn_id}
71     Utils.Clean Mininet System
72
73 Restart Follower Node2
74     [Documentation]    Kill Follower Node2 and Start it Up, Verify it is sync with other controller node.
75     ClusterManagement.Kill Single Member    ${follower_node_2}
76     ClusterManagement.Start Single Member    ${follower_node_2}
77
78 Get inventory Follower After Follower Restart
79     [Documentation]    Find Followers and Leader in the inventory config shard After Follower Restart.
80     ${inventory_leader}    ${inventory_followers}    ClusterOpenFlow.Get InventoryConfig Shard Status
81     ${follower_node_1}=    Get From List    ${inventory_followers}    0
82     ${follower_node_2}=    Get From List    ${inventory_followers}    1
83     Set Suite Variable    ${follower_node_1}
84     Set Suite Variable    ${follower_node_2}
85     Set Suite Variable    ${inventory_leader}
86
87 Start Mininet Connect To Leader
88     [Documentation]    Start mininet with connection to Leader.
89     ${mininet_conn_id}=    MininetKeywords.Start Mininet Single Controller    ${TOOLS_SYSTEM_IP}    ${ODL_SYSTEM_${inventory_leader}_IP}
90     Set Suite Variable    ${mininet_conn_id}
91
92 Verify Flows In Switch After Follower Restart
93     [Documentation]    Verify flows are installed in switch after follower restart.
94     MininetKeywords.Verify Aggregate Flow From Mininet Session    ${mininet_conn_id}    ${switch_count_per_node}    ${flow_count_per_switch}    ${operation_timeout}
95
96 Stop Mininet Connected To Leader and Exit
97     [Documentation]    Stop mininet Connected To Other Follower and exit connection.
98     MininetKeywords.Stop Mininet And Exit    ${mininet_conn_id}
99     Utils.Clean Mininet System
100
101 Restart Full Cluster
102     [Documentation]    Kill all Cluster Nodes and Start it Up All.
103     ClusterManagement.Kill_Members_From_List_Or_All
104     ClusterManagement.Start_Members_From_List_Or_All
105
106 Get inventory Status After Cluster Restart
107     [Documentation]    Find New Followers and Leader in the inventory config shard After Cluster Restart.
108     ${inventory_leader}    ${inventory_followers}    ClusterOpenFlow.Get InventoryConfig Shard Status
109     ${follower_node_1}=    Get From List    ${inventory_followers}    0
110     ${follower_node_2}=    Get From List    ${inventory_followers}    1
111     Set Suite Variable    ${follower_node_1}
112     Set Suite Variable    ${follower_node_2}
113     Set Suite Variable    ${inventory_leader}
114
115 Start Mininet Connect To Follower Node2 After Cluster Restart
116     [Documentation]    Start mininet with connection to cluster Follower Node2.
117     ${mininet_conn_id}=    MininetKeywords.Start Mininet Single Controller    ${TOOLS_SYSTEM_IP}    ${ODL_SYSTEM_${follower_node_2}_IP}
118     Set Suite Variable    ${mininet_conn_id}
119
120 Verify Flows In Switch After Cluster Restart
121     [Documentation]    Verify flows are installed in switch after cluster restart.
122     MininetKeywords.Verify Aggregate Flow From Mininet Session    ${mininet_conn_id}    ${switch_count_per_node}    ${flow_count_per_switch}    ${operation_timeout}
123
124 Delete Flows In Follower Node1 and Verify After Leader Restart
125     [Documentation]    Delete Flow in Follower Node1.
126     ClusterOpenFlow.Delete Sample Flow and Verify    ${follower_node_1}
127
128 Stop Mininet Connected To Follower Node2 and Exit After Cluster Restart
129     [Documentation]    Stop mininet Connected To Other Follower and exit connection.
130     MininetKeywords.Stop Mininet And Exit    ${mininet_conn_id}
131     Utils.Clean Mininet System