2 Documentation Test suite for entity ownership service and openflowplugin. Makes changes on switch side.
3 Suite Setup Start Suite
4 Suite Teardown End Suite
5 Test Setup SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
6 Test Template Reconnecting Switch Scenario
8 Library RequestsLibrary
10 Resource ${CURDIR}/../../../libraries/SetupUtils.robot
11 Resource ${CURDIR}/../../../libraries/Utils.robot
12 Resource ${CURDIR}/../../../libraries/FlowLib.robot
13 Resource ${CURDIR}/../../../libraries/OvsManager.robot
14 Resource ${CURDIR}/../../../libraries/ClusterManagement.robot
15 Resource ${CURDIR}/../../../libraries/ClusterOpenFlow.robot
20 ${START_CMD} sudo mn --topo linear,${SWITCHES}
21 @{cntls_idx_list} ${1} ${2} ${3}
24 Switches To Be Connected To All Nodes
25 [Documentation] Initial check for correct connected topology.
27 BuiltIn.Wait Until Keyword Succeeds 5x 3s Check All Switches Connected To All Cluster Nodes
29 Reconnecting Switch s1
32 Switches Still Be Connected To All Nodes
34 BuiltIn.Wait Until Keyword Succeeds 5x 3s Check All Switches Connected To All Cluster Nodes
38 SetupUtils.Setup_Utils_For_Setup_And_Teardown
39 ${mininet_conn_id}= SSHLibrary.Open Connection ${TOOLS_SYSTEM_IP} prompt=${TOOLS_SYSTEM_PROMPT}
40 BuiltIn.Set Suite Variable ${mininet_conn_id}
41 SSHLibrary.Login With Public Key ${TOOLS_SYSTEM_USER} ${USER_HOME}/.ssh/id_rsa any
42 SSHLibrary.Put File ${CURDIR}/../../../libraries/DynamicMininet.py .
43 SSHLibrary.Execute Command sudo ovs-vsctl set-manager ptcp:6644
44 SSHLibrary.Execute Command sudo mn -c
45 SSHLibrary.Write ${START_CMD}
46 SSHLibrary.Read Until mininet>
47 ${cntls_list} BuiltIn.Create List ${ODL_SYSTEM_1_IP} ${ODL_SYSTEM_2_IP} ${ODL_SYSTEM_3_IP}
48 ${switch_list} BuiltIn.Create List
49 : FOR ${i} IN RANGE 0 ${SWITCHES}
50 \ ${sid}= BuiltIn.Evaluate ${i}+1
51 \ Collections.Append To List ${switch_list} s${sid}
52 BuiltIn.Set Suite Variable ${active_member} 1
53 OvsManager.Setup Clustered Controller For Switches ${switch_list} ${cntls_list}
54 BuiltIn.Wait Until Keyword Succeeds 10s 1s ClusterOpenFlow.Verify Switch Connections Running On Member ${SWITCHES} 1
57 RequestsLibrary.Delete All Sessions
60 Check All Switches Connected To All Cluster Nodes
61 [Documentation] Verifies all switches are connected to all cluster nodes
62 OvsManager.Get Ovsdb Data
63 : FOR ${i} IN RANGE 0 ${SWITCHES}
64 \ ${sid}= BuiltIn.Evaluate ${i}+1
65 \ OvsManager.Should Be Connected s${sid} ${ODL_SYSTEM_1_IP} update_data=${False}
66 \ OvsManager.Should Be Connected s${sid} ${ODL_SYSTEM_2_IP} update_data=${False}
67 \ OvsManager.Should Be Connected s${sid} ${ODL_SYSTEM_3_IP} update_data=${False}
69 Reconnecting Switch Scenario
70 [Arguments] ${switch_name}
71 [Documentation] Disconnect and connect master and slave and check switch data to be consistent
72 BuiltIn.Set Test Variable ${disc_cntl} ${Empty}
73 ${idx}= BuiltIn.Evaluate str("${switch_name}"[1:])
74 BuiltIn.Set Test Variable ${idx}
75 Disconnect Switchs Old Master ${switch_name}
76 Reconnect Switchs Old Master ${switch_name}
77 Disconnect Switchs Slave ${switch_name}
78 Reconnect Switchs Slave ${switch_name}
79 [Teardown] Run Keyword If "${disc_cntl}"!="${Empty}" OvsManager.Reconnect Switch To Controller And Verify Connected ${switch_name} ${disc_cntl}
81 Disconnect Switchs Old Master
82 [Arguments] ${switch_name}
83 ${old_owner} ${old_successors}= ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device openflow:${idx} ${active_member}
84 ${old_master}= BuiltIn.Set Variable ${ODL_SYSTEM_${old_owner}_IP}
85 OvsManager.Disconnect Switch From Controller And Verify Disconnected ${switch_name} ${old_master}
86 BuiltIn.Set Test Variable ${disc_cntl} ${old_master}
87 ${owner} ${successors}= ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device openflow:${idx} ${active_member} ${old_successors} after_stop=True
88 ${new_master}= BuiltIn.Wait Until Keyword Succeeds 5x 3s Verify New Master Controller Node ${switch_name} ${old_master}
89 BuiltIn.Should Be Equal As Strings ${new_master} ${ODL_SYSTEM_${owner}_IP}
90 BuiltIn.Set Test Variable ${old_owner}
91 BuiltIn.Set Test Variable ${old_successors}
92 BuiltIn.Set Test Variable ${old_master}
93 BuiltIn.Set Test Variable ${owner}
94 BuiltIn.Set Test Variable ${new_master}
96 Reconnect Switchs Old Master
97 [Arguments] ${switch_name}
98 OvsManager.Reconnect Switch To Controller And Verify Connected ${switch_name} ${old_master}
99 BuiltIn.Set Test Variable ${disc_cntl} ${Empty}
100 ${new_owner} ${new_successors}= ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device openflow:${idx} ${active_member}
101 BuiltIn.Should Be Equal ${owner} ${new_owner}
103 Disconnect Switchs Slave
104 [Arguments] ${switch_name}
105 ${old_owner} ${old_successors}= ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device openflow:${idx} ${active_member}
106 ${old_successor}= Collections.Get From List ${old_successors} 0
107 ${old_slave}= BuiltIn.Set Variable ${ODL_SYSTEM_${old_successor}_IP}
108 OvsManager.Disconnect Switch From Controller And Verify Disconnected ${switch_name} ${old_slave}
109 BuiltIn.Set Test Variable ${disc_cntl} ${old_slave}
110 ${tmp_candidates}= BuiltIn.Create List @{ClusterManagement__member_index_list}
111 Collections.Remove Values From List ${tmp_candidates} ${old_successor}
112 ${owner} ${successors}= ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device openflow:${idx} ${active_member} ${tmp_candidates} after_stop=True
113 BuiltIn.Should Be Equal ${owner} ${old_owner}
114 BuiltIn.Should Be Equal As Strings ${new_master} ${ODL_SYSTEM_${owner}_IP}
115 BuiltIn.Set Test Variable ${old_owner}
116 BuiltIn.Set Test Variable ${old_successors}
117 BuiltIn.Set Test Variable ${old_successor}
118 BuiltIn.Set Test Variable ${old_slave}
119 BuiltIn.Set Test Variable ${owner}
121 Reconnect Switchs Slave
122 [Arguments] ${switch_name}
123 OvsManager.Reconnect Switch To Controller And Verify Connected ${switch_name} ${old_slave}
124 BuiltIn.Set Test Variable ${disc_cntl} ${Empty}
125 ${new_owner} ${new_successors}= ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device openflow:${idx} ${active_member}
126 BuiltIn.Should Be Equal ${old_owner} ${new_owner}
128 Verify New Master Controller Node
129 [Arguments] ${switch_name} ${old_master}
130 [Documentation] Checks if given node is different from actual master
131 ${idx}= BuiltIn.Evaluate "${switch_name}"[1:]
132 ${owner} ${successors}= ClusterManagement.Get Owner And Candidates For Device openflow:${idx} openflow ${active_member}
133 ${new_master} BuiltIn.Set Variable ${ODL_SYSTEM_${owner}_IP}
134 BuiltIn.Should Not Be Equal ${old_master} ${new_master}
135 Return From Keyword ${new_master}