2 Documentation Test suite for entity ownership service and openflowplugin. Makes changes on switch side.
5 Library RequestsLibrary
7 Resource ${CURDIR}/../../../libraries/SetupUtils.robot
8 Resource ${CURDIR}/../../../libraries/Utils.robot
9 Resource ${CURDIR}/../../../libraries/FlowLib.robot
10 Resource ${CURDIR}/../../../libraries/OvsManager.robot
11 Resource ${CURDIR}/../../../libraries/ClusterManagement.robot
12 Resource ${CURDIR}/../../../libraries/ClusterOpenFlow.robot
15 Suite Setup Start Suite
16 Suite Teardown End Suite
17 Test Setup SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
18 Test Template Reconnecting Switch Scenario
23 ${START_CMD} sudo mn --topo linear,${SWITCHES}
24 @{cntls_idx_list} ${1} ${2} ${3}
28 Switches To Be Connected To All Nodes
29 [Documentation] Initial check for correct connected topology.
31 BuiltIn.Wait Until Keyword Succeeds 5x 3s Check All Switches Connected To All Cluster Nodes
32 Reconnecting Switch s1
34 Switches Still Be Connected To All Nodes
36 BuiltIn.Wait Until Keyword Succeeds 5x 3s Check All Switches Connected To All Cluster Nodes
41 SetupUtils.Setup_Utils_For_Setup_And_Teardown
42 ${mininet_conn_id}= SSHLibrary.Open Connection ${TOOLS_SYSTEM_IP} prompt=${TOOLS_SYSTEM_PROMPT}
43 BuiltIn.Set Suite Variable ${mininet_conn_id}
44 SSHLibrary.Login With Public Key ${TOOLS_SYSTEM_USER} ${USER_HOME}/.ssh/id_rsa any
45 SSHLibrary.Put File ${CURDIR}/../../../libraries/DynamicMininet.py .
46 SSHLibrary.Execute Command sudo ovs-vsctl set-manager ptcp:6644
47 SSHLibrary.Execute Command sudo mn -c
48 SSHLibrary.Write ${START_CMD}
49 SSHLibrary.Read Until mininet>
50 ${cntls_list}= BuiltIn.Create List ${ODL_SYSTEM_1_IP} ${ODL_SYSTEM_2_IP} ${ODL_SYSTEM_3_IP}
51 ${switch_list}= BuiltIn.Create List
52 FOR ${i} IN RANGE 0 ${SWITCHES}
53 ${sid}= BuiltIn.Evaluate ${i}+1
54 Collections.Append To List ${switch_list} s${sid}
56 BuiltIn.Set Suite Variable ${active_member} 1
57 OvsManager.Setup Clustered Controller For Switches ${switch_list} ${cntls_list}
58 BuiltIn.Wait Until Keyword Succeeds
61 ... ClusterOpenFlow.Verify Switch Connections Running On Member
66 RequestsLibrary.Delete All Sessions
69 Check All Switches Connected To All Cluster Nodes
70 [Documentation] Verifies all switches are connected to all cluster nodes
71 OvsManager.Get Ovsdb Data
72 FOR ${i} IN RANGE 0 ${SWITCHES}
73 ${sid}= BuiltIn.Evaluate ${i}+1
74 OvsManager.Should Be Connected s${sid} ${ODL_SYSTEM_1_IP} update_data=${False}
75 OvsManager.Should Be Connected s${sid} ${ODL_SYSTEM_2_IP} update_data=${False}
76 OvsManager.Should Be Connected s${sid} ${ODL_SYSTEM_3_IP} update_data=${False}
79 Reconnecting Switch Scenario
80 [Documentation] Disconnect and connect master and slave and check switch data to be consistent
81 [Arguments] ${switch_name}
82 BuiltIn.Set Test Variable ${disc_cntl} ${Empty}
83 ${idx}= BuiltIn.Evaluate str("${switch_name}"[1:])
84 BuiltIn.Set Test Variable ${idx}
85 Disconnect Switchs Old Master ${switch_name}
86 Reconnect Switchs Old Master ${switch_name}
87 Disconnect Switchs Slave ${switch_name}
88 Reconnect Switchs Slave ${switch_name}
89 [Teardown] Run Keyword If "${disc_cntl}"!="${Empty}" OvsManager.Reconnect Switch To Controller And Verify Connected ${switch_name} ${disc_cntl}
91 Disconnect Switchs Old Master
92 [Arguments] ${switch_name}
93 ${old_owner} ${old_successors}= ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device
96 ${old_master}= BuiltIn.Set Variable ${ODL_SYSTEM_${old_owner}_IP}
97 OvsManager.Disconnect Switch From Controller And Verify Disconnected ${switch_name} ${old_master}
98 BuiltIn.Set Test Variable ${disc_cntl} ${old_master}
99 ${owner} ${successors}= ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device
102 ... ${old_successors}
104 ${new_master}= BuiltIn.Wait Until Keyword Succeeds
107 ... Verify New Master Controller Node
110 BuiltIn.Should Be Equal As Strings ${new_master} ${ODL_SYSTEM_${owner}_IP}
111 BuiltIn.Set Test Variable ${old_owner}
112 BuiltIn.Set Test Variable ${old_successors}
113 BuiltIn.Set Test Variable ${old_master}
114 BuiltIn.Set Test Variable ${owner}
115 BuiltIn.Set Test Variable ${new_master}
117 Reconnect Switchs Old Master
118 [Arguments] ${switch_name}
119 OvsManager.Reconnect Switch To Controller And Verify Connected ${switch_name} ${old_master}
120 BuiltIn.Set Test Variable ${disc_cntl} ${Empty}
121 ${new_owner} ${new_successors}= ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device
124 BuiltIn.Should Be Equal ${owner} ${new_owner}
126 Disconnect Switchs Slave
127 [Arguments] ${switch_name}
128 ${old_owner} ${old_successors}= ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device
131 ${old_successor}= Collections.Get From List ${old_successors} 0
132 ${old_slave}= BuiltIn.Set Variable ${ODL_SYSTEM_${old_successor}_IP}
133 OvsManager.Disconnect Switch From Controller And Verify Disconnected ${switch_name} ${old_slave}
134 BuiltIn.Set Test Variable ${disc_cntl} ${old_slave}
135 ${tmp_candidates}= BuiltIn.Create List @{ClusterManagement__member_index_list}
136 Collections.Remove Values From List ${tmp_candidates} ${old_successor}
137 ${owner} ${successors}= ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device
140 ... ${tmp_candidates}
142 BuiltIn.Should Be Equal ${owner} ${old_owner}
143 BuiltIn.Should Be Equal As Strings ${new_master} ${ODL_SYSTEM_${owner}_IP}
144 BuiltIn.Set Test Variable ${old_owner}
145 BuiltIn.Set Test Variable ${old_successors}
146 BuiltIn.Set Test Variable ${old_successor}
147 BuiltIn.Set Test Variable ${old_slave}
148 BuiltIn.Set Test Variable ${owner}
150 Reconnect Switchs Slave
151 [Arguments] ${switch_name}
152 OvsManager.Reconnect Switch To Controller And Verify Connected ${switch_name} ${old_slave}
153 BuiltIn.Set Test Variable ${disc_cntl} ${Empty}
154 ${new_owner} ${new_successors}= ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device
157 BuiltIn.Should Be Equal ${old_owner} ${new_owner}
159 Verify New Master Controller Node
160 [Documentation] Checks if given node is different from actual master
161 [Arguments] ${switch_name} ${old_master}
162 ${idx}= BuiltIn.Evaluate "${switch_name}"[1:]
163 ${owner} ${successors}= ClusterManagement.Get Owner And Candidates For Device
167 ${new_master}= BuiltIn.Set Variable ${ODL_SYSTEM_${owner}_IP}
168 BuiltIn.Should Not Be Equal ${old_master} ${new_master}