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 Template Reconnecting Switch Scenario
7 Library RequestsLibrary
9 Resource ${CURDIR}/../../../libraries/Utils.robot
10 Resource ${CURDIR}/../../../libraries/OvsManager.robot
11 Resource ${CURDIR}/../../../libraries/ClusterManagement.robot
16 # this is for mininet 2.2.1 ${START_CMD} sudo mn --controller=remote,ip=${ODL_SYSTEM_1_IP} --controller=remote,ip=${ODL_SYSTEM_2_IP} --controller=remote,ip=${ODL_SYSTEM_3_IP} --topo linear,${SWITCHES} --switch ovsk,protocols=OpenFlow13
17 ${START_CMD} sudo mn --topo linear,${SWITCHES} --switch ovsk,protocols=OpenFlow13
18 @{cntls_idx_list} ${1} ${2} ${3}
21 Switches To Be Connected To All Nodes
22 [Documentation] Initial check for correct connected topology.
24 BuiltIn.Wait Until Keyword Succeeds 5x 3s Check All Switches Connected To All Cluster Nodes
26 Reconnecting Switch s1
29 Switches Still Be Connected To All Nodes
31 BuiltIn.Wait Until Keyword Succeeds 5x 3s Check All Switches Connected To All Cluster Nodes
35 ClusterManagement.ClusterManagement Setup
36 ${mininet_conn_id}= SSHLibrary.Open Connection ${TOOLS_SYSTEM_IP} prompt=${TOOLS_SYSTEM_PROMPT}
37 BuiltIn.Set Suite Variable ${mininet_conn_id}
38 SSHLibrary.Login With Public Key ${TOOLS_SYSTEM_USER} ${USER_HOME}/.ssh/id_rsa any
39 SSHLibrary.Put File ${CURDIR}/../../../libraries/DynamicMininet.py .
40 SSHLibrary.Execute Command sudo ovs-vsctl set-manager ptcp:6644
41 SSHLibrary.Execute Command sudo mn -c
42 SSHLibrary.Write ${START_CMD}
43 SSHLibrary.Read Until mininet>
44 ${cntls_list} BuiltIn.Create List ${ODL_SYSTEM_1_IP} ${ODL_SYSTEM_2_IP} ${ODL_SYSTEM_3_IP}
45 ${switch_list} BuiltIn.Create List
46 : FOR ${i} IN RANGE 0 ${SWITCHES}
47 \ ${sid}= BuiltIn.Evaluate ${i}+1
48 \ Collections.Append To List ${switch_list} s${sid}
49 BuiltIn.Set Suite Variable ${active_member} 1
50 OvsManager.Setup Clustered Controller For Switches ${switch_list} ${cntls_list}
51 BuiltIn.Wait Until Keyword Succeeds 10s 1s Are Switches Connected Topo
54 RequestsLibrary.Delete All Sessions
57 Are Switches Connected Topo
58 [Documentation] Checks wheather switches are connected to controller
59 ${resp}= ClusterManagement.Get From Member ${OPERATIONAL_TOPO_API}/topology/flow:1 ${active_member} access=${ACCEPT_XML}
61 ${count}= XML.Get Element Count ${resp} xpath=node
62 BuiltIn.Should Be Equal As Numbers ${count} ${SWITCHES}
64 Check All Switches Connected To All Cluster Nodes
65 [Documentation] Verifies all switches are connected to all cluster nodes
66 OvsManager.Get Ovsdb Data
67 : FOR ${i} IN RANGE 0 ${SWITCHES}
68 \ ${sid}= BuiltIn.Evaluate ${i}+1
69 \ OvsManager.Should Be Connected s${sid} ${ODL_SYSTEM_1_IP} update_data=${False}
70 \ OvsManager.Should Be Connected s${sid} ${ODL_SYSTEM_2_IP} update_data=${False}
71 \ OvsManager.Should Be Connected s${sid} ${ODL_SYSTEM_3_IP} update_data=${False}
73 Reconnecting Switch Scenario
74 [Arguments] ${switch_name}
75 [Documentation] Disconnect and connect master and follower and check switch data to be consistent
76 ${idx}= BuiltIn.Evaluate str("${switch_name}"[1:])
77 BuiltIn.Set Test Variable ${idx}
78 Disconnect Switchs Old Master ${switch_name}
79 Reconnect Switchs Old Master ${switch_name}
80 Disconnect Switchs Follower ${switch_name}
81 Reconnect Switchs Follower ${switch_name}
82 [Teardown] Run Keyword If "${disc_cntl}"!="${Empty}" OvsManager.Reconnect Switch To Controller And Verify Connected ${switch_name} ${disc_cntl}
84 Disconnect Switchs Old Master
85 [Arguments] ${switch_name}
86 BuiltIn.Set Test Variable ${disc_cntl} ${Empty}
87 Check Count Integrity ${switch_name} expected_controllers=3
88 ${old_owner} ${old_followers}= ClusterManagement.Get Owner And Candidates For Device openflow:${idx} openflow ${active_member}
89 ${old_master}= BuiltIn.Set Variable ${ODL_SYSTEM_${old_owner}_IP}
90 OvsManager.Disconnect Switch From Controller And Verify Disconnected ${switch_name} ${old_master}
91 BuiltIn.Set Test Variable ${disc_cntl} ${old_master}
92 ${new_master}= BuiltIn.Wait Until Keyword Succeeds 5x 3s Verify New Master Controller Node ${switch_name} ${old_master}
93 ${owner} ${followers}= ClusterManagement.Get Owner And Candidates For Device openflow:${idx} openflow ${active_member}
94 Collections.List Should Contain Value ${old_followers} ${owner}
95 BuiltIn.Run Keyword If '${ODL_STREAM}' != 'beryllium' and '${ODL_OF_PLUGIN}' == 'lithium' BuiltIn.Wait Until Keyword Succeeds 5x 3s Check Count Integrity ${switch_name}
96 ... expected_controllers=3
97 ... ELSE BuiltIn.Wait Until Keyword Succeeds 5x 3s Check Count Integrity ${switch_name}
98 ... expected_controllers=2
99 BuiltIn.Should Be Equal As Strings ${new_master} ${ODL_SYSTEM_${owner}_IP}
100 BuiltIn.Set Test Variable ${old_owner}
101 BuiltIn.Set Test Variable ${old_followers}
102 BuiltIn.Set Test Variable ${old_master}
103 BuiltIn.Set Test Variable ${owner}
104 BuiltIn.Set Test Variable ${new_master}
106 Reconnect Switchs Old Master
107 [Arguments] ${switch_name}
108 OvsManager.Reconnect Switch To Controller And Verify Connected ${switch_name} ${old_master}
109 BuiltIn.Set Test Variable ${disc_cntl} ${Empty}
110 BuiltIn.Wait Until Keyword Succeeds 5x 3s Verify Follower Added ${switch_name} ${old_owner}
111 ${new_owner} ${new_followers}= ClusterManagement.Get Owner And Candidates For Device openflow:${idx} openflow ${active_member}
112 Check Count Integrity ${switch_name} expected_controllers=3
113 BuiltIn.Should Be Equal ${owner} ${new_owner}
114 Collections.List Should Contain Value ${new_followers} ${old_owner}
116 Disconnect Switchs Follower
117 [Arguments] ${switch_name}
118 ${old_owner} ${old_followers}= ClusterManagement.Get Owner And Candidates For Device openflow:${idx} openflow ${active_member}
119 ${old_follower}= Collections.Get From List ${old_followers} 0
120 ${old_slave}= BuiltIn.Set Variable ${ODL_SYSTEM_${old_follower}_IP}
121 OvsManager.Disconnect Switch From Controller And Verify Disconnected ${switch_name} ${old_slave}
122 BuiltIn.Set Test Variable ${disc_cntl} ${old_slave}
123 BuiltIn.Run Keyword If '${ODL_STREAM}' != 'beryllium' and '${ODL_OF_PLUGIN}' == 'lithium' Check Count Integrity ${switch_name} expected_controllers=3
124 ... ELSE Check Count Integrity ${switch_name} expected_controllers=2
125 ${owner} ${followers}= ClusterManagement.Get Owner And Candidates For Device openflow:${idx} openflow ${active_member}
126 BuiltIn.Should Be Equal ${owner} ${old_owner}
127 BuiltIn.Run Keyword If '${ODL_STREAM}' != 'beryllium' and '${ODL_OF_PLUGIN}' == 'lithium' Collections.Lists Should Be Equal ${followers} ${old_followers}
128 ... ELSE Collections.List Should Not Contain Value ${followers} ${old_follower}
129 BuiltIn.Should Be Equal As Strings ${new_master} ${ODL_SYSTEM_${owner}_IP}
130 BuiltIn.Set Test Variable ${old_owner}
131 BuiltIn.Set Test Variable ${old_followers}
132 BuiltIn.Set Test Variable ${old_follower}
133 BuiltIn.Set Test Variable ${old_slave}
134 BuiltIn.Set Test Variable ${owner}
136 Reconnect Switchs Follower
137 [Arguments] ${switch_name}
138 OvsManager.Reconnect Switch To Controller And Verify Connected ${switch_name} ${old_slave}
139 BuiltIn.Set Test Variable ${disc_cntl} ${Empty}
140 BuiltIn.Wait Until Keyword Succeeds 5x 3s Check Count Integrity ${switch_name} expected_controllers=3
141 ${new_owner} ${new_followers}= ClusterManagement.Get Owner And Candidates For Device openflow:${idx} openflow ${active_member}
142 BuiltIn.Should Be Equal ${old_owner} ${new_owner}
143 Collections.List Should Contain Value ${new_followers} ${old_follower}
145 Check Count Integrity
146 [Arguments] ${switch_name} ${expected_controllers}=3
147 [Documentation] Every switch must have only one master and rest must be followers and together must be of expected nodes count
148 ${idx}= BuiltIn.Evaluate "${switch_name}"[1:]
149 ${owner} ${candidates}= ClusterManagement.Get Owner And Candidates For Device openflow:${idx} openflow ${active_member}
150 ${count}= BuiltIn.Get Length ${candidates}
151 BuiltIn.Should Be Equal As Numbers ${expected_controllers} ${count}
153 Verify New Master Controller Node
154 [Arguments] ${switch_name} ${old_master}
155 [Documentation] Checks if given node is different from actual master
156 ${idx}= BuiltIn.Evaluate "${switch_name}"[1:]
157 ${owner} ${followers}= ClusterManagement.Get Owner And Candidates For Device openflow:${idx} openflow ${active_member}
158 ${new_master} BuiltIn.Set Variable ${ODL_SYSTEM_${owner}_IP}
159 BuiltIn.Should Not Be Equal ${old_master} ${new_master}
160 Return From Keyword ${new_master}
162 Verify Follower Added
163 [Arguments] ${switch_name} ${expected_node}
164 [Documentation] Checks if given node is in the list of active followers
165 ${idx}= BuiltIn.Evaluate "${switch_name}"[1:]
166 ${owner} ${followers}= ClusterManagement.Get Owner And Candidates For Device openflow:${idx} openflow ${active_member}
167 Collections.List Should Contain Value ${followers} ${expected_node}