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