OpenFlow cluster test rework
[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/CompareStream.robot
9 Resource          ../../../libraries/MininetKeywords.robot
10 Variables         ../../../variables/Variables.py
11
12 *** Test Cases ***
13 Check Shards Status Before Leader Restart
14     [Documentation]    Check Status for all shards in OpenFlow application and set default flows variable.
15     ...    Note that Boron and beyond use latest OVS 2.5 which means controller has to push table miss flow,
16     ...    therefore Boron+ has 1 flow/switch more than Beryllium.
17     ClusterOpenFlow.Check OpenFlow Shards Status
18
19 Get inventory Leader Before Leader Restart
20     [Documentation]    Find leader in the inventory config shard
21     ${inventory_leader}    ${inventory_followers}    ClusterOpenFlow.Get InventoryConfig Shard Status
22     ${follower_node_1}=    Get From List    ${inventory_followers}    0
23     ${follower_node_2}=    Get From List    ${inventory_followers}    1
24     Set Suite Variable    ${inventory_leader_old}    ${inventory_leader}
25     Set Suite Variable    ${follower_node_1}
26     Set Suite Variable    ${follower_node_2}
27     Set Suite Variable    ${inventory_leader}
28
29 Start Mininet Connect To Follower Node1
30     [Documentation]    Start mininet with connection to Follower Node1.
31     ${mininet_conn_id}=    MininetKeywords.Start Mininet Single Controller    ${TOOLS_SYSTEM_IP}    ${ODL_SYSTEM_${follower_node_1}_IP}
32     Set Suite Variable    ${mininet_conn_id}
33
34 Add Flows In Follower Node2 and Verify Before Leader Restart
35     [Documentation]    Add Flow via Follower Node2 and verify it gets applied from all instances.
36     ClusterOpenFlow.Add Sample Flow And Verify    ${follower_node_2}
37
38 Stop Mininet Connected To Follower Node1 and Exit
39     [Documentation]    Stop mininet and exit connection.
40     MininetKeywords.Stop Mininet And Exit    ${mininet_conn_id}
41     Utils.Clean Mininet System
42
43 Restart Leader From Cluster Node
44     [Documentation]    Kill Leader Node and Start it Up, Verify it is sync with other controller node.
45     ClusterManagement.Kill Single Member    ${inventory_leader}
46     ClusterManagement.Start Single Member    ${inventory_leader}
47
48 Get inventory Follower After Leader Restart
49     [Documentation]    Find new Followers and Leader in the inventory config shard After Leader Restart.
50     ${inventory_leader}    ${inventory_followers}    ClusterOpenFlow.Get InventoryConfig Shard Status
51     ${follower_node_1}=    Get From List    ${inventory_followers}    0
52     ${follower_node_2}=    Get From List    ${inventory_followers}    1
53     Set Suite Variable    ${follower_node_1}
54     Set Suite Variable    ${follower_node_2}
55     Set Suite Variable    ${inventory_leader}
56
57 Start Mininet Connect To Old Leader
58     [Documentation]    Start mininet with connection to cluster old leader.
59     ${mininet_conn_id}=    MininetKeywords.Start Mininet Single Controller    ${TOOLS_SYSTEM_IP}    ${ODL_SYSTEM_${inventory_leader_old}_IP}
60     Set Suite Variable    ${mininet_conn_id}
61
62 Verify Flows In Switch After Leader Restart
63     [Documentation]    Verify flows are installed in switch after leader restart.
64     ClusterOpenFlow.Verify Sample Flow
65
66 Stop Mininet Connected To Old Leader and Exit
67     [Documentation]    Stop mininet and exit connection.
68     MininetKeywords.Stop Mininet And Exit    ${mininet_conn_id}
69     Utils.Clean Mininet System
70
71 Restart Follower Node2
72     [Documentation]    Kill Follower Node2 and Start it Up, Verify it is sync with other controller node.
73     ClusterManagement.Kill Single Member    ${follower_node_2}
74     ClusterManagement.Start Single Member    ${follower_node_2}
75
76 Get inventory Follower After Follower Restart
77     [Documentation]    Find Followers and Leader in the inventory config shard After Follower Restart.
78     ${inventory_leader}    ${inventory_followers}    ClusterOpenFlow.Get InventoryConfig Shard Status
79     ${follower_node_1}=    Get From List    ${inventory_followers}    0
80     ${follower_node_2}=    Get From List    ${inventory_followers}    1
81     Set Suite Variable    ${follower_node_1}
82     Set Suite Variable    ${follower_node_2}
83     Set Suite Variable    ${inventory_leader}
84
85 Start Mininet Connect To Leader
86     [Documentation]    Start mininet with connection to Leader.
87     ${mininet_conn_id}=    MininetKeywords.Start Mininet Single Controller    ${TOOLS_SYSTEM_IP}    ${ODL_SYSTEM_${inventory_leader}_IP}
88     Set Suite Variable    ${mininet_conn_id}
89
90 Verify Flows In Switch After Follower Restart
91     [Documentation]    Verify flows are installed in switch after follower restart.
92     ClusterOpenFlow.Verify Sample Flow
93
94 Stop Mininet Connected To Leader and Exit
95     [Documentation]    Stop mininet Connected To Other Follower and exit connection.
96     MininetKeywords.Stop Mininet And Exit    ${mininet_conn_id}
97     Utils.Clean Mininet System
98
99 Restart Full Cluster
100     [Documentation]    Kill all Cluster Nodes and Start it Up All.
101     ClusterManagement.Kill_Members_From_List_Or_All
102     ClusterManagement.Start_Members_From_List_Or_All
103
104 Get inventory Status After Cluster Restart
105     [Documentation]    Find New Followers and Leader in the inventory config shard After Cluster Restart.
106     ${inventory_leader}    ${inventory_followers}    ClusterOpenFlow.Get InventoryConfig Shard Status
107     ${follower_node_1}=    Get From List    ${inventory_followers}    0
108     ${follower_node_2}=    Get From List    ${inventory_followers}    1
109     Set Suite Variable    ${follower_node_1}
110     Set Suite Variable    ${follower_node_2}
111     Set Suite Variable    ${inventory_leader}
112
113 Start Mininet Connect To Follower Node2 After Cluster Restart
114     [Documentation]    Start mininet with connection to cluster Follower Node2.
115     ${mininet_conn_id}=    MininetKeywords.Start Mininet Single Controller    ${TOOLS_SYSTEM_IP}    ${ODL_SYSTEM_${follower_node_2}_IP}
116     Set Suite Variable    ${mininet_conn_id}
117
118 Verify Flows In Switch After Cluster Restart
119     [Documentation]    Verify flows are installed in switch after cluster restart.
120     ClusterOpenFlow.Verify Sample Flow
121
122 Delete Flows In Follower Node1 and Verify After Leader Restart
123     [Documentation]    Delete Flow in Follower Node1.
124     ClusterOpenFlow.Delete Sample Flow and Verify    ${follower_node_1}
125
126 Stop Mininet Connected To Follower Node2 and Exit After Cluster Restart
127     [Documentation]    Stop mininet Connected To Other Follower and exit connection.
128     MininetKeywords.Stop Mininet And Exit    ${mininet_conn_id}
129     Utils.Clean Mininet System