blob: 475e2205aec68e5e308c8153e444d456caa20580 [file] [log] [blame]
Kailash92764922019-07-25 08:21:39 -07001# Copyright 2017-present Open Networking Foundation
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
Kailash92764922019-07-25 08:21:39 -070014# robot test functions
15
16*** Settings ***
17Documentation Library for various utilities
18Library SSHLibrary
Kailash92764922019-07-25 08:21:39 -070019Library String
20Library DateTime
21Library Process
22Library Collections
23Library RequestsLibrary
24Library OperatingSystem
Andy Bavier63460da2020-02-20 14:35:12 -070025Library CORDRobot
26Library ImportResource resources=CORDRobot
TorstenThiemed4f48962020-12-08 12:17:19 +000027Resource ./voltctl.robot
Kailash92764922019-07-25 08:21:39 -070028
29*** Keywords ***
Kailash528f7c02019-07-31 10:55:49 -070030Check CLI Tools Configured
31 [Documentation] Tests that use 'voltctl' and 'kubectl' should execute this keyword in suite setup
32 # check voltctl and kubectl configured
Zack Williamsa8fe75a2020-01-10 14:25:27 -070033 ${voltctl_rc}= Run And Return RC voltctl device list
34 ${kubectl_rc}= Run And Return RC kubectl get pods
Gilles Depatie675a2062019-10-22 12:44:42 -040035 Run Keyword If ${voltctl_rc} != 0 or ${kubectl_rc} != 0 FATAL ERROR
36 ... VOLTCTL and KUBECTL not configured. Please configure before executing tests.
Gilles Depatieb5682f82019-10-31 10:39:45 -040037
38Send File To Onos
Zack Williamsa8fe75a2020-01-10 14:25:27 -070039 [Documentation] Send the content of the file to Onos to selected section of configuration
40 ... using Post Request
41 [Arguments] ${CONFIG_FILE} ${section}
42 ${Headers}= Create Dictionary Content-Type application/json
43 ${File_Data}= OperatingSystem.Get File ${CONFIG_FILE}
44 Log ${Headers}
45 Log ${File_Data}
46 ${resp}= Post Request ONOS
47 ... /onos/v1/network/configuration/${section} headers=${Headers} data=${File_Data}
48 Should Be Equal As Strings ${resp.status_code} 200
Andy Bavier88cd9f62019-11-26 16:22:33 -070049
50Common Test Suite Setup
51 [Documentation] Setup the test suite
Andy Bavier88cd9f62019-11-26 16:22:33 -070052 Set Global Variable ${KUBECTL_CONFIG} export KUBECONFIG=%{KUBECONFIG}
Matteo Scandolo5899be12020-11-11 15:38:07 -080053 Set Global Variable ${VOLTCTL_CONFIG} %{VOLTCONFIG}
Andy Bavier88cd9f62019-11-26 16:22:33 -070054 ${k8s_node_ip}= Evaluate ${nodes}[0].get("ip")
ubuntu6b6e7d42020-03-02 12:35:42 -080055 ${ONOS_REST_IP}= Get Environment Variable ONOS_REST_IP ${k8s_node_ip}
56 ${ONOS_SSH_IP}= Get Environment Variable ONOS_SSH_IP ${k8s_node_ip}
57 Set Global Variable ${ONOS_REST_IP}
58 Set Global Variable ${ONOS_SSH_IP}
Andy Bavier88cd9f62019-11-26 16:22:33 -070059 ${k8s_node_user}= Evaluate ${nodes}[0].get("user")
60 ${k8s_node_pass}= Evaluate ${nodes}[0].get("pass")
61 Check CLI Tools Configured
62 ${onos_auth}= Create List karaf karaf
63 ${HEADERS} Create Dictionary Content-Type=application/json
ubuntu6b6e7d42020-03-02 12:35:42 -080064 Create Session ONOS http://${ONOS_REST_IP}:${ONOS_REST_PORT} auth=${ONOS_AUTH}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -080065 #${olt_ip}= Evaluate ${olts}[0].get("ip")
66 #${olt_ssh_ip}= Evaluate ${olts}[0].get("sship")
67 #${olt_user}= Evaluate ${olts}[0].get("user")
68 #${olt_pass}= Evaluate ${olts}[0].get("pass")
69 #${olt_serial_number}= Evaluate ${olts}[0].get("serial")
70 ${num_olts} Get Length ${olts}
71 ${list_olts} Create List
72 FOR ${I} IN RANGE 0 ${num_olts}
73 ${ip} Evaluate ${olts}[${I}].get("ip")
74 ${user} Evaluate ${olts}[${I}].get("user")
75 ${pass} Evaluate ${olts}[${I}].get("pass")
76 ${serial_number} Evaluate ${olts}[${I}].get("serial")
77 ${olt_ssh_ip} Evaluate ${olts}[${I}].get("sship")
78 ${onu_count}= Get ONU Count For OLT ${hosts.src} ${serial_number}
Suchitra Vemurife309412020-12-01 19:19:52 -080079 ${onu_list}= Get ONU List For OLT ${hosts.src} ${serial_number}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -080080 ${olt} Create Dictionary ip ${ip} user ${user} pass
81 ... ${pass} sn ${serial_number} onucount ${onu_count}
Suchitra Vemurife309412020-12-01 19:19:52 -080082 ... sship ${olt_ssh_ip} onus ${onu_list}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -080083 Append To List ${list_olts} ${olt}
84 END
85 ${num_all_onus}= Get Length ${hosts.src}
86 ${num_all_onus}= Convert to String ${num_all_onus}
Andy Bavier88cd9f62019-11-26 16:22:33 -070087 #send sadis file to onos
Andy Baviera2691752019-11-27 12:18:38 -070088 ${sadis_file}= Get Variable Value ${sadis.file}
Zack Williamsa8fe75a2020-01-10 14:25:27 -070089 Log To Console \nSadis File:${sadis_file}
Andy Bavier88cd9f62019-11-26 16:22:33 -070090 Run Keyword Unless '${sadis_file}' is '${None}' Send File To Onos ${sadis_file} apps/
Suchitra Vemuria6879aa2020-11-03 11:03:11 -080091 Set Suite Variable ${num_all_onus}
92 Set Suite Variable ${num_olts}
93 Set Suite Variable ${list_olts}
94 ${olt_count}= Get Length ${list_olts}
95 Set Suite Variable ${olt_count}
96 #Set Suite Variable ${olt_serial_number}
97 #Set Suite Variable ${olt_ip}
98 #Set Suite Variable ${olt_ssh_ip}
99 #Set Suite Variable ${olt_user}
100 #Set Suite Variable ${olt_pass}
Andy Bavier88cd9f62019-11-26 16:22:33 -0700101 @{container_list}= Create List adapter-open-olt adapter-open-onu voltha-api-server
102 ... voltha-ro-core voltha-rw-core-11 voltha-rw-core-12 voltha-ofagent
103 Set Suite Variable ${container_list}
104 ${datetime}= Get Current Date
suraj gour7f6d5fe2019-11-29 10:56:35 +0000105 Set Suite Variable ${datetime}
106
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800107Get ONU Count For OLT
108 [Arguments] ${src} ${serial_number}
109 [Documentation] Gets ONU Count for the specified OLT
110 ${src_length}= Get Length ${src}
111 ${count}= Set Variable 0
112 FOR ${I} IN RANGE 0 ${src_length}
113 ${sn} Evaluate ${src}[${I}].get("olt")
TorstenThiemed4f48962020-12-08 12:17:19 +0000114 ${count}= Run Keyword If '${serial_number}' == '${sn}' Evaluate ${count} + 1
115 ... ELSE Set Variable ${count}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800116 END
117 [Return] ${count}
118
Suchitra Vemurife309412020-12-01 19:19:52 -0800119Get ONU List For OLT
120 [Arguments] ${src} ${serial_number}
121 [Documentation] Gets ONU List for the specified OLT
122 ${src_length}= Get Length ${src}
123 ${onu_list}= Create List
124 FOR ${I} IN RANGE 0 ${src_length}
125 ${sn} Evaluate ${src}[${I}].get("olt")
126 Run Keyword If '${serial_number}' == '${sn}' Append To List ${onu_list} ${src}[${I}].get("onu")
127 ... ELSE Set Variable ${onu_list}
128 END
129 [Return] ${onu_list}
130
suraj gour7f6d5fe2019-11-29 10:56:35 +0000131WPA Reassociate
suraj gour7f6d5fe2019-11-29 10:56:35 +0000132 [Documentation] Executes a particular wpa_cli reassociate, which performs force reassociation
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700133 [Arguments] ${iface} ${ip} ${user} ${pass}=${None}
134 ... ${container_type}=${None} ${container_name}=${None}
suraj gour7f6d5fe2019-11-29 10:56:35 +0000135 #Below for loops are used instead of sleep time, to execute reassociate command and check status
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700136 FOR ${i} IN RANGE 70
137 ${output}= Login And Run Command On Remote System
138 ... wpa_cli -i ${iface} reassociate ${ip} ${user}
139 ... ${pass} ${container_type} ${container_name}
140 ${passed}= Run Keyword And Return Status Should Contain ${output} OK
Andy Bavierb63f6d22020-03-12 15:34:37 -0700141 Exit For Loop If ${passed}
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700142 END
Andy Bavierb63f6d22020-03-12 15:34:37 -0700143 Should Be True ${passed} Status does not contain 'SUCCESS'
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700144 FOR ${i} IN RANGE 70
145 ${output}= Login And Run Command On Remote System
Andy Bavierae4a17e2020-02-25 14:54:36 -0700146 ... wpa_cli -i ${iface} status | grep SUCCESS ${ip} ${user}
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700147 ... ${pass} ${container_type} ${container_name}
148 ${passed}= Run Keyword And Return Status Should Contain ${output} SUCCESS
Andy Bavierb63f6d22020-03-12 15:34:37 -0700149 Exit For Loop If ${passed}
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700150 END
Andy Bavierb63f6d22020-03-12 15:34:37 -0700151 Should Be True ${passed} Status does not contain 'SUCCESS'
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700152
suraj gour7f6d5fe2019-11-29 10:56:35 +0000153Validate Authentication After Reassociate
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700154 [Arguments] ${auth_pass} ${iface} ${ip} ${user} ${pass}=${None}
155 ... ${container_type}=${None} ${container_name}=${None}
156 [Documentation]
157 ... Executes a particular reassociate request on the RG using wpa_cli.
158 ... auth_pass determines if authentication should pass
Andy Bavier84834d42020-02-25 13:49:50 -0700159 ${wpa_log}= Catenate SEPARATOR=. /tmp/wpa ${iface} log
160 ${output}= Login And Run Command On Remote System truncate -s 0 ${wpa_log}; cat ${wpa_log}
161 ... ${ip} ${user} ${pass} ${container_type} ${container_name}
162 Log ${output}
163 Should Not Contain ${output} authentication completed successfully
suraj gour7f6d5fe2019-11-29 10:56:35 +0000164 WPA Reassociate ${iface} ${ip} ${user} ${pass} ${container_type} ${container_name}
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700165 Run Keyword If '${auth_pass}' == 'True' Wait Until Keyword Succeeds ${timeout} 2s
Andy Bavier84834d42020-02-25 13:49:50 -0700166 ... Check Remote File Contents True ${wpa_log} ${iface}.*authentication completed successfully
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700167 ... ${ip} ${user} ${pass} ${container_type} ${container_name}
suraj gour7f6d5fe2019-11-29 10:56:35 +0000168 Run Keyword If '${auth_pass}' == 'False' Sleep 20s
Suchitra Vemuri3cb29f82020-02-25 13:59:58 -0800169 Run Keyword If '${auth_pass}' == 'False' Check Remote File Contents False /tmp/wpa.log
Andy Bavier84834d42020-02-25 13:49:50 -0700170 ... ${iface}.*authentication completed successfully ${ip} ${user} ${pass}
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700171 ... ${container_type} ${container_name}
suraj gourd5cfdbb2019-12-13 12:44:55 +0000172
173Send Dhclient Request To Release Assigned IP
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700174 [Arguments] ${iface} ${ip} ${user} ${path_dhcpleasefile} ${pass}=${None}
175 ... ${container_type}=${None} ${container_name}=${None}
suraj gourd5cfdbb2019-12-13 12:44:55 +0000176 [Documentation] Executes a dhclient with option to release ip against a particular interface on the RG (src)
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700177 ${result}= Login And Run Command On Remote System
178 ... dhclient -nw -r ${iface} && rm ${path_dhcpleasefile}/dhclient.* ${ip} ${user}
suraj gourd5cfdbb2019-12-13 12:44:55 +0000179 ... ${pass} ${container_type} ${container_name}
180 Log ${result}
181 #Should Contain ${result} DHCPRELEASE
182 [Return] ${result}
suraj gour1ecfae92019-12-20 15:11:40 +0000183
184Check Remote File Contents For WPA Logs
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700185 [Arguments] ${file_should_exist} ${file} ${pattern} ${ip} ${user} ${pass}=${None}
186 ... ${container_type}=${None} ${container_name}=${None} ${prompt}=~$
suraj gour1ecfae92019-12-20 15:11:40 +0000187 [Documentation] Checks for particular pattern count in a file
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700188 ${result}= Login And Run Command On Remote System
189 ... cat ${file} | grep '${pattern}' | wc -l ${ip} ${user} ${pass}
suraj gour1ecfae92019-12-20 15:11:40 +0000190 ... ${container_type} ${container_name} ${prompt}
191 [Return] ${result}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000192
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800193
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000194Perform Sanity Test
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800195 [Documentation] This keyword iterate all OLTs and performs Sanity Test Procedure
196 ... for all the ONUs connected to each OLT - ATT workflow
197 FOR ${J} IN RANGE 0 ${num_olts}
198 ${olt_serial_number}= Set Variable ${list_olts}[${J}][sn]
199 ${onu_count}= Set Variable ${list_olts}[${J}][onucount]
200 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS
201 ... ${olt_serial_number}
202 Set Global Variable ${of_id}
203 ${nni_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
204 ... Get NNI Port in ONOS ${of_id}
205 Set Global Variable ${nni_port}
206 # Verify Default Meter in ONOS (valid only for ATT)
207 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
208 ... Verify Default Meter Present in ONOS ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
209 Perform Sanity Test Per OLT ${of_id} ${nni_port} ${olt_serial_number} ${onu_count}
210 END
211
212Perform Sanity Test Per OLT
213 [Arguments] ${of_id} ${nni_port} ${olt_serial_number} ${num_onus}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000214 [Documentation] This keyword performs Sanity Test Procedure
215 ... Sanity test performs authentication, dhcp and pings for all the ONUs given for the POD
216 ... This keyword can be used to call in any other tests where sanity check is required
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800217 ... and avoids duplication of code. - ATT workflow
TorstenThiemed4f48962020-12-08 12:17:19 +0000218 #${of_id}= Wait Until Keyword Succeeds ${timeout} 15s
219 #... Validate OLT Device in ONOS ${olt_serial_number}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800220 #Set Global Variable ${of_id}
221 #${nni_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
222 #... Get NNI Port in ONOS ${of_id}
223 #Set Global Variable ${nni_port}
Hardik Windlass2a9b1592020-07-23 18:28:13 +0530224 # Verify Default Meter in ONOS (valid only for ATT)
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800225 #Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
226 #... Verify Default Meter Present in ONOS ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
227 FOR ${I} IN RANGE 0 ${num_all_onus}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000228 ${src}= Set Variable ${hosts.src[${I}]}
229 ${dst}= Set Variable ${hosts.dst[${I}]}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800230 Continue For Loop If "${olt_serial_number}"!="${src['olt']}"
Suchitra Vemuri03005912020-02-20 18:59:46 -0800231 Run Keyword and Ignore Error Collect Logs
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000232 ${onu_device_id}= Get Device ID From SN ${src['onu']}
233 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
234 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
Suchitra Vemuri8078b972020-02-06 19:07:41 -0800235 # Check ONU port is Enabled in ONOS
236 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
Suchitra Vemuri760bdd32020-06-17 12:34:48 -0700237 ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
Suchitra Vemuri8078b972020-02-06 19:07:41 -0800238 # Verify EAPOL flows are added for the ONU port
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000239 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
ubuntu6b6e7d42020-03-02 12:35:42 -0800240 ... Verify Eapol Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Suchitra Vemuri8078b972020-02-06 19:07:41 -0800241 # Verify ONU state in voltha
242 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
243 ... ENABLED ACTIVE REACHABLE
244 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
245 # Perform Authentication
Andy Bavier84834d42020-02-25 13:49:50 -0700246 ${wpa_log}= Run Keyword If ${has_dataplane} Catenate SEPARATOR=.
247 ... /tmp/wpa ${src['dp_iface_name']} log
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000248 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate Authentication True
249 ... ${src['dp_iface_name']} wpa_supplicant.conf ${src['ip']} ${src['user']} ${src['pass']}
Andy Bavier84834d42020-02-25 13:49:50 -0700250 ... ${src['container_type']} ${src['container_name']} ${wpa_log}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000251 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
ubuntu6b6e7d42020-03-02 12:35:42 -0800252 ... Verify ONU in AAA-Users ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000253 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
ubuntu6b6e7d42020-03-02 12:35:42 -0800254 ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000255 ... volt-add-subscriber-access ${of_id} ${onu_port}
Suchitra Vemuri9da44302020-03-04 14:24:49 -0800256 # Verify that no pending flows exist for the ONU port
257 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
258 ... Verify No Pending Flows For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Hardik Windlass21807632020-04-14 16:24:55 +0530259 # Verify subscriber access flows are added for the ONU port
260 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
261 ... Verify Subscriber Access Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
262 ... ${onu_port} ${nni_port} ${src['c_tag']} ${src['s_tag']}
Hardik Windlass2a9b1592020-07-23 18:28:13 +0530263 # Verify Meters in ONOS
264 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
265 ... Verify Meters in ONOS ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id} ${onu_port}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000266 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate DHCP and Ping True
267 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
268 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
269 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
270 ... ${dst['container_name']}
271 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
ubuntu6b6e7d42020-03-02 12:35:42 -0800272 ... Validate Subscriber DHCP Allocation ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000273 Run Keyword and Ignore Error Get Device Output from Voltha ${onu_device_id}
274 Run Keyword and Ignore Error Collect Logs
275 END
276
Hardik Windlassa3d04b92020-02-17 15:06:05 +0000277Perform Sanity Test DT
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800278 [Documentation] This keyword iterate all OLTs and performs Sanity Test Procedure for DT workflow
279 FOR ${J} IN RANGE 0 ${num_olts}
280 ${olt_serial_number}= Set Variable ${list_olts}[${J}][sn]
281 ${num_onus}= Set Variable ${list_olts}[${J}][onucount]
282 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
Suchitra Vemuri4b8f4f52020-11-17 19:12:50 -0800283 Run Keyword and Ignore Error Collect Logs
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800284 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS
285 ... ${olt_serial_number}
286 Set Global Variable ${of_id}
287 ${nni_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
288 ... Get NNI Port in ONOS ${of_id}
289 Set Global Variable ${nni_port}
290 Perform Sanity Test DT Per OLT ${of_id} ${nni_port} ${olt_serial_number} ${num_onus}
291 # Verify ONOS Flows
292 # Number of Access Flows on ONOS equals 4 * the Number of Active ONUs (2 for each downstream and upstream)
293 ${onos_flows_count}= Evaluate 4 * ${num_onus}
294 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
295 ... Verify Subscriber Access Flows Added Count DT ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
296 ... ${onos_flows_count}
297 # Verify VOLTHA Flows
298 # Number of per OLT Flows equals Twice the Number of Active ONUs (each for downstream and upstream) + 1 for LLDP
299 ${olt_flows}= Evaluate 2 * ${num_onus} + 1
300 # Number of per ONU Flows equals 2 (one each for downstream and upstream)
301 ${onu_flows}= Set Variable 2
302 Run Keyword Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Flows ${olt_flows}
303 ... ${olt_device_id}
304 ${List_ONU_Serial} Create List
305 Set Suite Variable ${List_ONU_Serial}
Suchitra Vemuri21a47fd2020-11-16 18:39:09 -0800306 Build ONU SN List ${List_ONU_Serial} ${olt_serial_number}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800307 Log ${List_ONU_Serial}
308 Run Keyword Wait Until Keyword Succeeds ${timeout} 5s Validate ONU Flows
309 ... ${List_ONU_Serial} ${onu_flows}
310 END
311
312
313Perform Sanity Test DT Per OLT
314 [Arguments] ${of_id} ${nni_port} ${olt_serial_number} ${num_onus}
Hardik Windlassa3d04b92020-02-17 15:06:05 +0000315 [Documentation] This keyword performs Sanity Test Procedure for DT Workflow
316 ... Sanity test performs dhcp and pings (without EAPOL and DHCP flows) for all the ONUs given for the POD
317 ... This keyword can be used to call in any other tests where sanity check is required
318 ... and avoids duplication of code.
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800319 #${of_id}= Wait Until Keyword Succeeds 360s 15s Validate OLT Device in ONOS ${olt_serial_number}
320 #Set Global Variable ${of_id}
321 #${nni_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
322 #... Get NNI Port in ONOS ${of_id}
323 #Set Global Variable ${nni_port}
324 FOR ${I} IN RANGE 0 ${num_all_onus}
Hardik Windlassa3d04b92020-02-17 15:06:05 +0000325 ${src}= Set Variable ${hosts.src[${I}]}
326 ${dst}= Set Variable ${hosts.dst[${I}]}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800327 Continue For Loop If "${olt_serial_number}"!="${src['olt']}"
Suchitra Vemuri4b8f4f52020-11-17 19:12:50 -0800328 Run Keyword and Ignore Error Collect Logs
Hardik Windlassa3d04b92020-02-17 15:06:05 +0000329 ${onu_device_id}= Get Device ID From SN ${src['onu']}
330 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
331 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
332 # Check ONU port is Enabled in ONOS
333 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
Suchitra Vemuri760bdd32020-06-17 12:34:48 -0700334 ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
Hardik Windlassa3d04b92020-02-17 15:06:05 +0000335 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
ubuntu6b6e7d42020-03-02 12:35:42 -0800336 ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
Hardik Windlassa3d04b92020-02-17 15:06:05 +0000337 ... volt-add-subscriber-access ${of_id} ${onu_port}
Hardik Windlassfb5eace2020-03-26 14:49:01 +0530338 # Verify subscriber access flows are added for the ONU port
339 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
Hardik Windlass25e11702020-03-30 20:05:19 +0530340 ... Verify Subscriber Access Flows Added For ONU DT ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
341 ... ${onu_port} ${nni_port} ${src['s_tag']}
Hardik Windlassa3d04b92020-02-17 15:06:05 +0000342 # Verify ONU state in voltha
343 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
344 ... ENABLED ACTIVE REACHABLE
345 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
Hardik Windlass2a9b1592020-07-23 18:28:13 +0530346 # Verify Meters in ONOS
347 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
348 ... Verify Meters in ONOS ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id} ${onu_port}
Hardik Windlassfb5eace2020-03-26 14:49:01 +0530349 # TODO: Yet to Verify on the GPON based Physical POD (VOL-2652)
Hardik Windlassa3d04b92020-02-17 15:06:05 +0000350 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate DHCP and Ping True
351 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
352 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
353 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
354 ... ${dst['container_name']}
355 Run Keyword and Ignore Error Get Device Output from Voltha ${onu_device_id}
356 Run Keyword and Ignore Error Collect Logs
357 END
Hardik Windlassfb5eace2020-03-26 14:49:01 +0530358 # Verify ONOS Flows
359 # Number of Access Flows on ONOS equals 4 * the Number of Active ONUs (2 for each downstream and upstream)
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800360 #${onos_flows_count}= Evaluate 4 * ${num_onus}
361 #Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
362 #... Verify Subscriber Access Flows Added Count DT ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
363 #... ${onos_flows_count}
Hardik Windlassfb5eace2020-03-26 14:49:01 +0530364 # Verify VOLTHA Flows
Hardik Windlassa3d04b92020-02-17 15:06:05 +0000365 # Number of per OLT Flows equals Twice the Number of Active ONUs (each for downstream and upstream) + 1 for LLDP
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800366 #${olt_flows}= Evaluate 2 * ${num_onus} + 1
Hardik Windlassa3d04b92020-02-17 15:06:05 +0000367 # Number of per ONU Flows equals 2 (one each for downstream and upstream)
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800368 #${onu_flows}= Set Variable 2
369 #Run Keyword Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Flows ${olt_flows}
370 #${List_ONU_Serial} Create List
371 #Set Suite Variable ${List_ONU_Serial}
Andrea Campanella6391f842020-11-16 10:01:18 +0100372 #Build ONU SN List ${List_ONU_Serial} ${olt_serial_number}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800373 #Log ${List_ONU_Serial}
374 #Run Keyword Wait Until Keyword Succeeds ${timeout} 5s Validate ONU Flows
375 #... ${List_ONU_Serial} ${onu_flows}
376
377Validate All OLT Flows
378 [Documentation] This keyword iterate all OLTs and performs Sanity Test Procedure for DT workflow
379 FOR ${J} IN RANGE 0 ${num_olts}
380 ${olt_serial_number}= Set Variable ${list_olts}[${J}][sn]
381 ${num_onus}= Set Variable ${list_olts}[${J}][onucount]
382 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
383 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS
384 ... ${olt_serial_number}
385 Set Global Variable ${of_id}
386 # Verify ONOS Flows
387 # Number of Access Flows on ONOS equals 4 * the Number of Active ONUs (2 for each downstream and upstream)
388 ${onos_flows_count}= Evaluate 4 * ${num_onus}
389 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
390 ... Verify Subscriber Access Flows Added Count DT ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
391 ... ${onos_flows_count}
392 # Verify VOLTHA Flows
393 # Number of per OLT Flows equals Twice the Number of Active ONUs (each for downstream and upstream) + 1 for LLDP
394 ${olt_flows}= Evaluate 2 * ${num_onus} + 1
395 # Number of per ONU Flows equals 2 (one each for downstream and upstream)
396 ${onu_flows}= Set Variable 2
397 Run Keyword Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Flows ${olt_flows}
398 ... ${olt_device_id}
399 ${List_ONU_Serial} Create List
400 Set Suite Variable ${List_ONU_Serial}
Andrea Campanella6391f842020-11-16 10:01:18 +0100401 Build ONU SN List ${List_ONU_Serial} ${olt_serial_number}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800402 Log ${List_ONU_Serial}
403 Run Keyword Wait Until Keyword Succeeds ${timeout} 5s Validate ONU Flows
404 ... ${List_ONU_Serial} ${onu_flows}
405 END
Hardik Windlassa3d04b92020-02-17 15:06:05 +0000406
Suchitra Vemuri2f1e07d2020-06-26 19:18:01 -0700407Perform Sanity Test TT
408 [Documentation] This keyword performs Sanity Test Procedure for TT Workflow
409 ... Sanity test performs dhcp and pings (without EAPOL and DHCP flows) for all the ONUs given for the POD
410 ... This keyword can be used to call in any other tests where sanity check is required
411 ... and avoids duplication of code.
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800412 FOR ${I} IN RANGE 0 ${num_all_onus}
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -0700413 ${src}= Set Variable ${hosts.src[${I}]}
414 ${dst}= Set Variable ${hosts.dst[${I}]}
415 ${service_type}= Get Variable Value ${src['service_type']} "null"
416 Run Keyword IF '${service_type}' != 'mcast' Sanity Test TT one ONU ${src} ${dst}
417 Run Keyword and Ignore Error Collect Logs
418 END
419 Run Keyword and Ignore Error Collect Logs
420
421Sanity Test TT one ONU
422 [Documentation] This keyword performs sanity test for a single ONU for TT workflow
423 ... Tests for one ONU
424 ... Assertions apply to HSIA, VoD, VoIP services
425 [Arguments] ${src} ${dst}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800426 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${src['olt']}
Suchitra Vemuri2f1e07d2020-06-26 19:18:01 -0700427 Set Global Variable ${of_id}
428 ${nni_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
429 ... Get NNI Port in ONOS ${of_id}
430 Set Global Variable ${nni_port}
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -0700431 ${onu_device_id}= Get Device ID From SN ${src['onu']}
432 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
433 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
434 # Check ONU port is Enabled in ONOS
435 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
436 ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
437 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
438 ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
439 ... volt-add-subscriber-access ${of_id} ${onu_port}
440 Sleep 30s
441 # Verify ONU state in voltha
Matteo Scandolo74bd5c32020-12-08 09:52:19 -0800442 ${onu_reasons}= Create List tech-profile-config-download-success omci-flows-pushed
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -0700443 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
444 ... ENABLED ACTIVE REACHABLE
Matteo Scandolo74bd5c32020-12-08 09:52:19 -0800445 ... ${src['onu']} onu=True onu_reason=${onu_reasons}
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -0700446 # TODO: Yet to Verify on the GPON based Physical POD (VOL-2652)
447 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate DHCP and Ping True
448 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
449 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
450 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
451 ... ${dst['container_name']}
Suchitra Vemuri16644bd2020-10-03 14:06:12 -0700452 Run Keyword IF ${has_dataplane}
Suchitra Vemurib4d9e8d2020-10-05 20:49:21 -0700453 ... Run Keyword IF '${src['service_type']}'!='hsia'
Suchitra Vemuri42819412020-10-01 17:45:43 -0700454 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
Suchitra Vemuri8d3b0032020-09-11 17:49:08 -0700455 ... Validate Subscriber DHCP Allocation ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Suchitra Vemuri42819412020-10-01 17:45:43 -0700456 ... ${src['c_tag']}
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -0700457 Run Keyword and Ignore Error Get Device Output from Voltha ${onu_device_id}
458 Run Keyword and Ignore Error Collect Logs
459
460Perform Sanity Test TT MCAST
461 [Documentation] This keyword performs Sanity Test Procedure for TT Workflow
462 ... Adds subscribers
463 ... Validates for MCAST
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800464 FOR ${I} IN RANGE 0 ${num_all_onus}
Suchitra Vemuri2f1e07d2020-06-26 19:18:01 -0700465 ${src}= Set Variable ${hosts.src[${I}]}
466 ${dst}= Set Variable ${hosts.dst[${I}]}
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -0700467 ${service_type}= Get Variable Value ${src['service_type']} "null"
468 Run Keyword IF '${service_type}' == 'mcast' Sanity Test TT MCAST one ONU ${src}
469 ... ${dst}
Suchitra Vemuri2f1e07d2020-06-26 19:18:01 -0700470 Run Keyword and Ignore Error Collect Logs
471 END
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -0700472 Run Keyword and Ignore Error Collect Logs
473
474Sanity Test TT MCAST one ONU
475 [Documentation] This keyword performs sanity test for a single ONU for TT workflow
476 ... Tests for one ONU
477 ... Assertions apply to MCAST services
478 [Arguments] ${src} ${dst}
479 # Check for iperf and jq tools
480 ${stdout} ${stderr} ${rc}= Execute Remote Command which iperf jq
481 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']}
482 ... ${src['container_name']}
483 Pass Execution If ${rc} != 0 Skipping test: iperf / jq not found on the RG
484
485 #Reset the IP on the interface
486 ${output}= Login And Run Command On Remote System sudo ifconfig ${src['dp_iface_name']} 0
487 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
488 # Kill iperf on BNG
489 ${rg_output}= Run Keyword and Continue On Failure Login And Run Command On Remote System
490 ... sudo kill -9 `pidof iperf`
491 ... ${dst['bng_ip']} ${dst['bng_user']} ${dst['bng_pass']} ${dst['container_type']}
492 ... ${dst['container_name']}
493
494 # Setup RG for Multi-cast test
495 ${output}= Login And Run Command On Remote System
496 ... sudo ifconfig ${src['dp_iface_name']} ${src['mcast_rg']} up ; sudo kill -9 `pidof iperf`
497 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
498 ${output}= Login And Run Command On Remote System
499 ... sudo ip route add ${src['mcast_grp_subnet_mask']} dev ${src['dp_iface_name']} scope link
500 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
501
502 # Perform operations for adding subscriber
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800503 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${src['olt']}
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -0700504 Set Global Variable ${of_id}
505 ${nni_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
506 ... Get NNI Port in ONOS ${of_id}
507 Set Global Variable ${nni_port}
508 ${onu_device_id}= Get Device ID From SN ${src['onu']}
509 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
510 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
511 # Check ONU port is Enabled in ONOS
512 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
513 ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
514 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
515 ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
516 ... volt-add-subscriber-access ${of_id} ${onu_port}
517 Sleep 30s
518 # Verify ONU state in voltha
Matteo Scandolo74bd5c32020-12-08 09:52:19 -0800519 ${onu_reasons}= Create List tech-profile-config-download-success omci-flows-pushed
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -0700520 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
521 ... ENABLED ACTIVE REACHABLE
Matteo Scandolo74bd5c32020-12-08 09:52:19 -0800522 ... ${src['onu']} onu=True onu_reason=${onu_reasons}
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -0700523
524 # Setup iperf on the BNG
525 ${server_output}= Login And Run Command On Remote System
526 ... sudo iperf -c ${dst['dp_iface_ip_qinq']} -u -T 32 -t 60 -i 1 &
527 ... ${dst['bng_ip']} ${dst['bng_user']} ${dst['bng_pass']} ${dst['container_type']}
528 ... ${dst['container_name']}
529
530 # Setup iperf on the RG
531 ${rg_output}= Run Keyword and Continue On Failure Wait Until Keyword Succeeds 90s 5s
532 ... Login And Run Command On Remote System
533 ... rm -rf /tmp/rg_output ; sudo iperf -s -u -B ${dst['dp_iface_ip_qinq']} -i 1 -D >> /tmp/rg_output
534 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
535 Log ${rg_output}
536 Sleep 60s
537 ${output}= Run Keyword and Continue On Failure Wait Until Keyword Succeeds 90s 5s
538 ... Login And Run Command On Remote System
539 ... cat /tmp/rg_output | grep KBytes
540 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
541 Log ${output}
542 Should Contain ${output} KBytes
543
544 # Kill iperf on BNG
545 ${rg_output}= Run Keyword and Continue On Failure Login And Run Command On Remote System
546 ... sudo kill -9 `pidof iperf`
547 ... ${dst['bng_ip']} ${dst['bng_user']} ${dst['bng_pass']} ${dst['container_type']}
548 ... ${dst['container_name']}
549
550 # Kill iperf on the RG
551 ${output}= Run Keyword and Continue On Failure Login And Run Command On Remote System
552 ... sudo kill -9 `pidof iperf`
553 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
554
Suchitra Vemuri2f1e07d2020-06-26 19:18:01 -0700555
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000556Setup
557 [Documentation] Pre-test Setup
558 #test for empty device list
559 Test Empty Device List
Suchitra Vemuri3158f3c2020-05-28 17:58:26 -0700560 #Run Keyword If ${has_dataplane} Wait Until Keyword Succeeds 120s 10s Openolt is Up
561 #... ${olt_ip} ${olt_user} ${olt_pass}
Suchitra Vemuri1d8e8172020-06-17 17:43:56 -0700562 Run Keyword If ${has_dataplane} Sleep 230s
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800563 # Create a list of olt ids (logical and device_id)
564 ${olt_ids} Create List
565 FOR ${I} IN RANGE 0 ${num_olts}
566 #create/preprovision device
567 ${olt_device_id}= Create Device ${list_olts}[${I}][ip] ${OLT_PORT}
568 ${olt_serial_number}= Set Variable ${list_olts}[${I}][sn]
569 #Set Suite Variable ${olt_device_id}
570 #validate olt states
571 Wait Until Keyword Succeeds ${timeout} 5s
572 ... Validate OLT Device PREPROVISIONED UNKNOWN UNKNOWN ${olt_device_id}
573 Sleep 5s
574 Enable Device ${olt_device_id}
575 Wait Until Keyword Succeeds 380s 5s
576 ... Validate OLT Device ENABLED ACTIVE REACHABLE ${olt_serial_number}
577 ${logical_id}= Get Logical Device ID From SN ${olt_serial_number}
578 # Set Suite Variable ${logical_id}
579 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS
580 ... ${olt_serial_number}
581 ${olt} Create Dictionary device_id ${olt_device_id} logical_id ${logical_id}
582 ... of_id ${of_id} sn ${olt_serial_number}
583 Append To List ${olt_ids} ${olt}
584 END
585 Set Global Variable ${olt_ids}
586
587Get ofID From OLT List
588 [Documentation] Retrieves the corresponding of_id for the OLT serial number specified
589 [Arguments] ${serial_number}
590 FOR ${I} IN RANGE 0 ${olt_count}
591 ${sn}= Get From Dictionary ${olt_ids}[${I}] sn
Andrea Campanella317a94c2020-11-13 10:38:19 +0100592 ${of_id}= Run Keyword IF "${serial_number}"=="${sn}"
593 ... Get From Dictionary ${olt_ids}[${I}] of_id ELSE Set Variable ${of_id}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800594 END
595 [Return] ${of_id}
596
597Get OLTDeviceID From OLT List
598 [Documentation] Retrieves the corresponding olt_device_id for the OLT serial number specified
599 [Arguments] ${serial_number}
Suchitra Vemuri4b8f4f52020-11-17 19:12:50 -0800600 ${olt_device_id}= Set Variable 0
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800601 FOR ${I} IN RANGE 0 ${olt_count}
602 ${sn}= Get From Dictionary ${olt_ids}[${I}] sn
Andrea Campanella317a94c2020-11-13 10:38:19 +0100603 ${olt_device_id}= Run Keyword IF "${serial_number}"=="${sn}"
604 ... Get From Dictionary ${olt_ids}[${I}] device_id ELSE Set Variable ${olt_device_id}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800605 END
606 [Return] ${olt_device_id}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000607
Andrea Campanellad848de02020-11-24 10:23:41 +0100608Get Num of Onus From OLT SN
609 [Documentation] Retrieves the corresponding number of ONUs for a given OLT based on serial number specified
610 [Arguments] ${serial_number}
611 ${num_of_olt_onus}= Set Variable 0
612 FOR ${I} IN RANGE 0 ${olt_count}
613 ${sn}= Get From Dictionary ${olt_ids}[${I}] sn
614 ${num_of_olt_onus}= Run Keyword IF "${serial_number}"=="${sn}"
615 ... Get From Dictionary ${list_olts}[${I}] onucount ELSE Set Variable ${num_of_olt_onus}
616 END
617 [Return] ${num_of_olt_onus}
618
Hardik Windlassaaea3402020-03-10 19:45:45 +0530619Validate ONUs After OLT Disable
620 [Documentation] Validates the ONUs state in Voltha, ONUs port state in ONOS
621 ... and that pings do not succeed After corresponding OLT is Disabled
Andrea Campanella4e507882020-11-26 11:33:11 +0100622 [Arguments] ${num_onus} ${olt_serial_number}
Hardik Windlassaaea3402020-03-10 19:45:45 +0530623 FOR ${I} IN RANGE 0 ${num_onus}
624 ${src}= Set Variable ${hosts.src[${I}]}
625 ${dst}= Set Variable ${hosts.dst[${I}]}
Andrea Campanella4e507882020-11-26 11:33:11 +0100626 Continue For Loop If "${olt_serial_number}"!="${src['olt']}"
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800627 ${of_id}= Get ofID From OLT List ${src['olt']}
Hardik Windlassaaea3402020-03-10 19:45:45 +0530628 ${onu_device_id}= Get Device ID From SN ${src['onu']}
629 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
630 ... ${of_id}
631 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
632 ... Validate Device ENABLED DISCOVERED
633 ... UNREACHABLE ${src['onu']} onu=True onu_reason=stopping-openomci
634 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
Suchitra Vemuri760bdd32020-06-17 12:34:48 -0700635 ... Verify ONU Port Is Disabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
Hardik Windlassaaea3402020-03-10 19:45:45 +0530636 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
637 ... Wait Until Keyword Succeeds 60s 2s
638 ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
639 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
640 Run Keyword and Ignore Error Get Device Output from Voltha ${onu_device_id}
641 Run Keyword and Ignore Error Collect Logs
642 END
643
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000644Delete All Devices and Verify
645 [Documentation] Remove any devices from VOLTHA and ONOS
646 # Clear devices from VOLTHA
647 Disable Devices In Voltha Root=true
Suchitra Vemuri970747f2020-03-30 17:31:34 -0700648 Sleep 5s
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000649 Wait Until Keyword Succeeds ${timeout} 2s Test Devices Disabled In Voltha Root=true
650 Delete Devices In Voltha Root=true
Matteo Scandolof6cea382020-04-20 14:32:00 -0700651 Run Keyword If ${has_dataplane} Sleep 30s
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000652 Wait Until Keyword Succeeds ${timeout} 2s Test Empty Device List
653 # Clear devices from ONOS
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800654 #Remove All Devices From ONOS
ubuntu6b6e7d42020-03-02 12:35:42 -0800655 #... http://karaf:karaf@${ONOS_REST_IP}:${ONOS_REST_PORT}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000656
657Teardown
658 [Documentation] kills processes and cleans up interfaces on src+dst servers
659 Run Keyword If ${has_dataplane} Clean Up Linux
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000660
661Teardown Suite
662 [Documentation] Clean up device if desired
663 Run Keyword If ${teardown_device} Delete All Devices and Verify
664
665Delete Device and Verify
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800666 [Arguments] ${olt_serial_number}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000667 [Documentation] Disable -> Delete devices via voltctl and verify its removed
Suchitra Vemuri2fa9bba2020-01-22 17:38:48 -0800668 ${olt_device_id}= Get Device ID From SN ${olt_serial_number}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000669 ${rc} ${output}= Run and Return Rc and Output
Matteo Scandolo5899be12020-11-11 15:38:07 -0800670 ... voltctl -c ${VOLTCTL_CONFIG} device disable ${olt_device_id}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000671 Should Be Equal As Integers ${rc} 0
672 Sleep 5s
673 Wait Until Keyword Succeeds ${timeout} 5s
674 ... Validate OLT Device DISABLED UNKNOWN REACHABLE ${olt_serial_number}
675 ${rc} ${output}= Run and Return Rc and Output
Matteo Scandolo5899be12020-11-11 15:38:07 -0800676 ... voltctl -c ${VOLTCTL_CONFIG} device delete ${olt_device_id}
Matteo Scandolof6cea382020-04-20 14:32:00 -0700677 Run Keyword If ${has_dataplane} Sleep 50s
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000678 Should Be Equal As Integers ${rc} 0
679 Wait Until Keyword Succeeds ${timeout} 5s Validate Device Removed ${olt_device_id}
680
Gayathri.Selvan283a63c2020-01-23 04:09:18 +0000681Repeat Sanity Test
682 [Documentation] This keyword performs Sanity Test Procedure
683 ... Sanity test performs authentication, dhcp and pings for all the ONUs given for the POD
684 ... This keyword can be used to call in any other tests where sanity check is required
685 ... with wpa reassociation
686 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${olt_serial_number}
687 Set Global Variable ${of_id}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800688 FOR ${I} IN RANGE 0 ${num_all_onus}
Suchitra Vemuri03005912020-02-20 18:59:46 -0800689 Run Keyword and Ignore Error Collect Logs
Gayathri.Selvan283a63c2020-01-23 04:09:18 +0000690 ${src}= Set Variable ${hosts.src[${I}]}
691 ${dst}= Set Variable ${hosts.dst[${I}]}
Suchitra Vemuri8078b972020-02-06 19:07:41 -0800692 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
693 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
694 # Check ONU port is Enabled in ONOD
695 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
Suchitra Vemuri760bdd32020-06-17 12:34:48 -0700696 ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
Suchitra Vemuri8078b972020-02-06 19:07:41 -0800697 # Verify EAPOL flows are added for the ONU port
698 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
David K. Bainbridgec0617c92020-03-05 21:17:19 -0800699 ... Verify Eapol Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Suchitra Vemuri8078b972020-02-06 19:07:41 -0800700 # Verify ONU state in voltha
Suchitra Vemurid1e27fb2020-02-01 16:34:37 -0800701 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
Suchitra Vemuri81e4f022020-02-01 13:16:02 -0800702 ... ENABLED ACTIVE REACHABLE
703 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
Suchitra Vemuri8078b972020-02-06 19:07:41 -0800704 # Perform Authentication
Gayathri.Selvan283a63c2020-01-23 04:09:18 +0000705 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
706 ... Validate Authentication After Reassociate
707 ... True ${src['dp_iface_name']} ${src['ip']} ${src['user']} ${src['pass']}
708 ... ${src['container_type']} ${src['container_name']}
709 Wait Until Keyword Succeeds ${timeout} 2s
David K. Bainbridgec0617c92020-03-05 21:17:19 -0800710 ... Verify ONU in AAA-Users ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Gayathri.Selvan283a63c2020-01-23 04:09:18 +0000711 Wait Until Keyword Succeeds ${timeout} 2s
David K. Bainbridgec0617c92020-03-05 21:17:19 -0800712 ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
Gayathri.Selvan283a63c2020-01-23 04:09:18 +0000713 ... volt-add-subscriber-access ${of_id} ${onu_port}
714 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
715 ... Validate DHCP and Ping True True
716 ... ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
717 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
718 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
719 ... ${dst['container_name']}
720 Wait Until Keyword Succeeds ${timeout} 2s Run Keyword And Continue On Failure
David K. Bainbridgec0617c92020-03-05 21:17:19 -0800721 ... Validate Subscriber DHCP Allocation ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Gayathri.Selvan283a63c2020-01-23 04:09:18 +0000722 Run Keyword and Ignore Error Get Device Output from Voltha ${onu_device_id}
723 Run Keyword and Ignore Error Collect Logs
724 END
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000725
Hardik Windlass16cdf962020-04-29 15:26:50 +0530726Validate ONUs for PON OLT Disable
727 [Arguments] ${olt_peer_list}
728 [Documentation] This keyword validates that Ping fails for ONUs connected to Disabled OLT PON port
729 ... And Pings succeed for other Active OLT PON port ONUs
730 ... Also it removes subscriber for Disabled OLT PON port ONUs to replicate ATT workflow
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800731 FOR ${I} IN RANGE 0 ${num_all_nus}
Hardik Windlass16cdf962020-04-29 15:26:50 +0530732 ${src}= Set Variable ${hosts.src[${I}]}
733 ${dst}= Set Variable ${hosts.dst[${I}]}
734 ${onu_device_id}= Get Device ID From SN ${src['onu']}
735 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
736 ... ${of_id}
737 ${matched}= Match ONU in PON OLT Peer List ${olt_peer_list} ${onu_device_id}
738 Run Keyword If ${matched}
739 ... Run Keywords
740 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
741 ... Validate Device ENABLED DISCOVERED
742 ... UNREACHABLE ${src['onu']} onu=True onu_reason=stopping-openomci
743 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
744 ... Verify ONU Port Is Disabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
745 ... AND Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
746 ... Wait Until Keyword Succeeds 60s 2s
747 ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
748 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']}
749 ... ${src['container_name']}
750 # Remove Subscriber Access (To replicate ATT workflow)
751 ... AND Wait Until Keyword Succeeds ${timeout} 2s Execute ONOS CLI Command ${ONOS_SSH_IP}
752 ... ${ONOS_SSH_PORT} volt-remove-subscriber-access ${of_id} ${onu_port}
753 ... ELSE
754 ... Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
755 ... Wait Until Keyword Succeeds 60s 2s
756 ... Check Ping True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
757 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']}
758 ... ${src['container_name']}
759 Run Keyword and Ignore Error Collect Logs
760 END
761
762Validate ONUs for PON OLT Enable
763 [Arguments] ${olt_peer_list}
764 [Documentation] This keyword validates Ping succeeds for all Enabled/Acitve OLT PON ports
765 ... Also performs Auth/subscriberAdd/DHCP/Ping for the ONUs on Re-Enabled OLT PON port
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800766 FOR ${I} IN RANGE 0 ${num_all_onus}
Hardik Windlass16cdf962020-04-29 15:26:50 +0530767 ${src}= Set Variable ${hosts.src[${I}]}
768 ${dst}= Set Variable ${hosts.dst[${I}]}
769 ${onu_device_id}= Get Device ID From SN ${src['onu']}
770 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
771 ... ${of_id}
772 ${matched}= Match ONU in PON OLT Peer List ${olt_peer_list} ${onu_device_id}
773 ${wpa_log}= Run Keyword If ${has_dataplane} and ${matched} Catenate SEPARATOR=.
774 ... /tmp/wpa ${src['dp_iface_name']} log
775 Run Keyword If ${matched}
776 ... Run Keywords
777 # Perform Cleanup
778 ... Run Keyword If ${has_dataplane} Clean Up Linux ${onu_device_id}
779 # Verify ONU port status
780 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
781 ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
782 # Verify EAPOL flows are added for the ONU port
783 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
784 ... Verify Eapol Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
785 # Verify ONU state in voltha
786 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
787 ... Validate Device ENABLED ACTIVE REACHABLE
788 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
789 # Perform Authentication
790 ... AND Run Keyword If ${has_dataplane}
791 ... Run Keyword And Continue On Failure Validate Authentication True
792 ... ${src['dp_iface_name']} wpa_supplicant.conf ${src['ip']} ${src['user']} ${src['pass']}
793 ... ${src['container_type']} ${src['container_name']} ${wpa_log}
794 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
795 ... Verify ONU in AAA-Users ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
796 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
797 ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
798 ... volt-add-subscriber-access ${of_id} ${onu_port}
799 # Verify that no pending flows exist for the ONU port
800 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
801 ... Verify No Pending Flows For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
802 # Verify subscriber access flows are added for the ONU port
803 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
804 ... Verify Subscriber Access Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
805 ... ${onu_port} ${nni_port} ${src['c_tag']} ${src['s_tag']}
806 ... AND Run Keyword If ${has_dataplane}
807 ... Run Keyword And Continue On Failure Validate DHCP and Ping True
808 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
809 ... ${src['ip']} ${src['user']} ${src['pass']}
810 ... ${src['container_type']} ${src['container_name']}
811 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']}
812 ... ${dst['container_type']} ${dst['container_name']}
813 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
814 ... Validate Subscriber DHCP Allocation ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
815 ... AND Run Keyword and Ignore Error Get Device Output from Voltha ${onu_device_id}
816 ... ELSE
817 ... Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
818 ... Wait Until Keyword Succeeds 60s 2s
819 ... Check Ping True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
820 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']}
821 ... ${src['container_name']}
822 Run Keyword and Ignore Error Collect Logs
823 END
824
825Validate ONUs for PON OLT Disable DT
826 [Arguments] ${olt_peer_list}
827 [Documentation] This keyword validates that Ping fails for ONUs connected to Disabled OLT PON port
828 ... And Pings succeed for other Active OLT PON port ONUs
829 ... Also it removes subscriber and deletes ONUs for Disabled OLT PON port to replicate DT workflow
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800830 FOR ${I} IN RANGE 0 ${num_all_onus}
Hardik Windlass16cdf962020-04-29 15:26:50 +0530831 ${src}= Set Variable ${hosts.src[${I}]}
832 ${dst}= Set Variable ${hosts.dst[${I}]}
833 ${onu_device_id}= Get Device ID From SN ${src['onu']}
834 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
835 ... ${of_id}
836 ${matched}= Match ONU in PON OLT Peer List ${olt_peer_list} ${onu_device_id}
837 Run Keyword If ${matched}
838 ... Run Keywords
839 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
840 ... Validate Device ENABLED DISCOVERED
841 ... UNREACHABLE ${src['onu']} onu=True onu_reason=stopping-openomci
842 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
843 ... Verify ONU Port Is Disabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
844 ... AND Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
845 ... Wait Until Keyword Succeeds 60s 2s
846 ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
847 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']}
848 ... ${src['container_name']}
849 # Remove Subscriber Access (To replicate DT workflow)
850 ... AND Wait Until Keyword Succeeds ${timeout} 2s Execute ONOS CLI Command ${ONOS_SSH_IP}
851 ... ${ONOS_SSH_PORT} volt-remove-subscriber-access ${of_id} ${onu_port}
852 ... AND Sleep 10s
853 # Delete ONU Device (To replicate DT workflow)
854 ... AND Delete Device ${onu_device_id}
855 ... AND Sleep 5s
856 ... ELSE
857 ... Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
858 ... Wait Until Keyword Succeeds 60s 2s
859 ... Check Ping True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
860 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']}
861 ... ${src['container_name']}
862 Run Keyword and Ignore Error Collect Logs
863 END
864
865Validate ONUs for PON OLT Enable DT
866 [Arguments] ${olt_peer_list}
867 [Documentation] This keyword validates Ping succeeds for all Enabled/Acitve OLT PON ports
868 ... Also performs subscriberAdd/DHCP/Ping for the ONUs on Re-Enabled OLT PON port
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800869 FOR ${I} IN RANGE 0 ${num_all_onus}
Hardik Windlass16cdf962020-04-29 15:26:50 +0530870 ${src}= Set Variable ${hosts.src[${I}]}
871 ${dst}= Set Variable ${hosts.dst[${I}]}
872 ${onu_device_id}= Get Device ID From SN ${src['onu']}
873 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
874 ... ${of_id}
875 ${matched}= Match ONU in PON OLT Peer List ${olt_peer_list} ${onu_device_id}
876 Run Keyword If ${matched}
877 ... Run Keywords
878 # Perform Cleanup
879 ... Run Keyword If ${has_dataplane} Clean Up Linux ${onu_device_id}
880 # Verify ONU port status
881 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
882 ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
883 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
884 ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
885 ... volt-add-subscriber-access ${of_id} ${onu_port}
886 # Verify ONU state in voltha
887 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
888 ... Validate Device ENABLED ACTIVE REACHABLE
889 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
890 # Verify subscriber access flows are added for the ONU port
891 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
892 ... Verify Subscriber Access Flows Added For ONU DT ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
893 ... ${onu_port} ${nni_port} ${src['s_tag']}
894 ... AND Run Keyword If ${has_dataplane}
895 ... Run Keyword And Continue On Failure Validate DHCP and Ping True
896 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
897 ... ${src['ip']} ${src['user']} ${src['pass']}
898 ... ${src['container_type']} ${src['container_name']}
899 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']}
900 ... ${dst['container_type']} ${dst['container_name']}
901 ... ELSE
902 ... Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
903 ... Wait Until Keyword Succeeds 60s 2s
904 ... Check Ping True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
905 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']}
906 ... ${src['container_name']}
907 Run Keyword and Ignore Error Collect Logs
908 END
909
910Match ONU in PON OLT Peer List
911 [Arguments] ${olt_peer_list} ${onu_device_id}
912 [Documentation] This keyword matches if ONU device is present in OLT PON port peer list
913 ${matched}= Set Variable False
914 FOR ${olt_peer} IN @{olt_peer_list}
915 ${matched}= Set Variable If '${onu_device_id}' == '${olt_peer}' True False
916 Exit For Loop If ${matched}
917 END
918 [Return] ${matched}
919
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000920Collect Logs
921 [Documentation] Collect Logs from voltha and onos cli for various commands
922 Run Keyword and Ignore Error Get Device List from Voltha
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800923 FOR ${I} IN RANGE 0 ${num_olts}
924 Run Keyword and Ignore Error Get Logical Device Output from Voltha ${logical_id}
925 Run Keyword and Ignore Error Get Device Output from Voltha ${olt_ids}[${I}][device_id]
926 Run Keyword and Ignore Error Get Logical Device Output from Voltha ${olt_ids}[${I}][logical_id]
927 END
928 #Run Keyword and Ignore Error Get Device Output from Voltha ${olt_device_id}
929 #Run Keyword and Ignore Error Get Logical Device Output from Voltha ${logical_id}
ubuntu6b6e7d42020-03-02 12:35:42 -0800930 Get ONOS Status ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
Gayathri.Selvanf68ea4b2020-02-03 07:36:39 +0000931
932Verify ping is succesful except for given device
933 [Arguments] ${num_onus} ${exceptional_onu_id}
934 [Documentation] Checks that ping for all the devices are successful except the given ONU.
935 ${pingStatus} Set Variable True
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800936 FOR ${I} IN RANGE 0 ${num_all_onus}
Gayathri.Selvanf68ea4b2020-02-03 07:36:39 +0000937 ${src}= Set Variable ${hosts.src[${I}]}
938 ${dst}= Set Variable ${hosts.dst[${I}]}
939 ${onu_device_id}= Get Device ID From SN ${src['onu']}
940 ${pingStatus} Run Keyword If '${onu_device_id}' == '${exceptional_onu_id}' Set Variable False
Suchitra Vemuri69bcad22020-12-09 11:11:14 -0800941 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
942 ... Wait Until Keyword Succeeds 60s 2s
Gayathri.Selvanf68ea4b2020-02-03 07:36:39 +0000943 ... Check Ping ${pingStatus} ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
944 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
945 END
Andy Bavier4a8450e2020-02-04 08:58:37 -0700946
Suchitra Vemurife309412020-12-01 19:19:52 -0800947Verify ping is successful for ONUs not on this OLT
948 [Arguments] ${num_all_onus} ${exceptional_olt_id}
949 [Documentation] Checks that pings work for all the ONUs except for the ONUs on the given OLT.
950 #${pingStatus} Set Variable True
951 FOR ${I} IN RANGE 0 ${num_all_onus}
952 ${src}= Set Variable ${hosts.src[${I}]}
953 ${dst}= Set Variable ${hosts.dst[${I}]}
954 ${olt_device_id}= Get Device ID From SN ${src['olt']}
955 Continue For Loop If "${olt_device_id}"=="${exceptional_olt_id}"
956 #${pingStatus} Run Keyword If '${olt_device_id}' == '${exceptional_olt_id}' Set Variable False
Suchitra Vemuri69bcad22020-12-09 11:11:14 -0800957 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
958 ... Wait Until Keyword Succeeds 60s 2s
Suchitra Vemurife309412020-12-01 19:19:52 -0800959 ... Check Ping True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
960 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
961 END
962
Andy Bavier1923ecc2020-06-18 14:06:40 -0700963Echo Message to OLT Logs
964 [Arguments] ${message}
965 [Documentation] Echoes ${message} into the OLT logs
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800966 FOR ${I} IN RANGE 0 ${num_olts}
967 ${olt_user} Evaluate ${olts}[${I}].get("user")
968 ${olt_pass} Evaluate ${olts}[${I}].get("pass")
969 ${olt_ssh_ip} Evaluate ${olts}[${I}].get("sship")
Andrea Campanella366ed462021-01-12 13:10:29 +0100970 Continue For Loop If "${olt_user}" == "${None}"
971 Continue For Loop If "${olt_pass}" == "${None}"
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800972 Wait Until Keyword Succeeds 180s 10s Execute Remote Command
973 ... printf '%s\n' '' '' '${message}' '' >> /var/log/openolt.log
974 ... ${olt_ssh_ip} ${olt_user} ${olt_pass}
975 Wait Until Keyword Succeeds 180s 10s Execute Remote Command
976 ... printf '%s\n' '' '' '${message}' '' >> /var/log/dev_mgmt_daemon.log
977 ... ${olt_ssh_ip} ${olt_user} ${olt_pass}
978 Wait Until Keyword Succeeds 180s 10s Execute Remote Command
979 ... printf '%s\n' '' '' '${message}' '' >> /var/log/openolt_process_watchdog.log
980 ... ${olt_ssh_ip} ${olt_user} ${olt_pass}
981 END
Andy Bavier1923ecc2020-06-18 14:06:40 -0700982
Andy Bavierabeba262020-02-07 16:22:16 -0700983Start Logging
984 [Arguments] ${label}
985 [Documentation] Start logging for test ${label}
986 ${kail_process}= Run Keyword If "${container_log_dir}" != "${None}" Start Process kail -n default
987 ... -n voltha cwd=${container_log_dir} stdout=${label}-combined.log
988 Set Test Variable ${kail_process}
Andy Bavier1923ecc2020-06-18 14:06:40 -0700989 Run Keyword If ${has_dataplane} Echo Message to OLT Logs START ${label}
Andy Bavierabeba262020-02-07 16:22:16 -0700990
991Stop Logging
992 [Arguments] ${label}
993 [Documentation] End logging for test; remove logfile if test passed
994 Run sync
995 Run Keyword If ${kail_process} Terminate Process ${kail_process}
996 ${test_logfile}= Run Keyword If "${container_log_dir}" != "${None}"
997 ... Join Path ${container_log_dir} ${label}-combined.log
998 Run Keyword If Test Passed Run Keyword If "${test_logfile}" != "${None}" Remove File ${test_logfile}
Andy Bavier1923ecc2020-06-18 14:06:40 -0700999 Run Keyword If ${has_dataplane} Echo Message to OLT Logs END ${label}
Andy Bavierabeba262020-02-07 16:22:16 -07001000
Suchitra Vemuria5fa3dd2020-02-04 14:38:49 -08001001Clean Up Linux
1002 [Documentation] Kill processes and clean up interfaces on src+dst servers
Hardik Windlass16cdf962020-04-29 15:26:50 +05301003 [Arguments] ${onu_id}=${EMPTY}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -08001004 FOR ${I} IN RANGE 0 ${num_all_onus}
Suchitra Vemuria5fa3dd2020-02-04 14:38:49 -08001005 ${src}= Set Variable ${hosts.src[${I}]}
1006 ${dst}= Set Variable ${hosts.dst[${I}]}
Hardik Windlass16cdf962020-04-29 15:26:50 +05301007 ${onu_device_id}= Get Device ID From SN ${src['onu']}
1008 Continue For Loop If '${onu_id}' != '${EMPTY}' and '${onu_id}' != '${onu_device_id}'
Andy Bavier84b83282020-06-30 05:47:49 -07001009 Execute Remote Command sudo pkill wpa_supplicant ${src['ip']}
Suchitra Vemuria5fa3dd2020-02-04 14:38:49 -08001010 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
Andy Bavier84b83282020-06-30 05:47:49 -07001011 Execute Remote Command sudo pkill dhclient ${src['ip']}
Suchitra Vemuria5fa3dd2020-02-04 14:38:49 -08001012 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
Andy Baviereff938d2020-06-29 18:27:49 -07001013 Execute Remote Command sudo pkill mausezahn ${src['ip']}
1014 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
1015 Run Keyword If '${dst['ip']}' != '${None}' Execute Remote Command pkill dhcpd
1016 ... ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']} ${dst['container_name']}
Suchitra Vemuria5fa3dd2020-02-04 14:38:49 -08001017 Delete IP Addresses from Interface on Remote Host ${src['dp_iface_name']} ${src['ip']}
1018 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
1019 Run Keyword If '${dst['ip']}' != '${None}' Delete Interface on Remote Host
1020 ... ${dst['dp_iface_name']}.${src['s_tag']} ${dst['ip']} ${dst['user']} ${dst['pass']}
1021 ... ${dst['container_type']} ${dst['container_name']}
Andy Bavier84b83282020-06-30 05:47:49 -07001022 ${bng_ip}= Get Variable Value ${dst['noroot_ip']}
1023 ${bng_user}= Get Variable Value ${dst['noroot_user']}
1024 ${bng_pass}= Get Variable Value ${dst['noroot_pass']}
Andy Bavierf4b7d1d2020-06-30 11:14:04 -07001025 Run Keyword If "${bng_ip}" != "${NONE}" and "${bng_user}" != "${NONE}" and "${bng_pass}" != "${NONE}"
1026 ... Execute Remote Command sudo pkill mausezahn ${bng_ip} ${bng_user} ${bng_pass}
Andy Baviereff938d2020-06-29 18:27:49 -07001027 ... ${dst['container_type']} ${dst['container_name']}
Suchitra Vemuria5fa3dd2020-02-04 14:38:49 -08001028 END
Scott Baker60e570d2020-02-02 22:10:13 -08001029
Suchitra Vemuria6879aa2020-11-03 11:03:11 -08001030Clean Up Linux Per OLT
1031 [Documentation] Kill processes and clean up interfaces on src+dst servers
1032 [Arguments] ${olt_serial_number}
1033 FOR ${I} IN RANGE 0 ${num_all_onus}
1034 ${src}= Set Variable ${hosts.src[${I}]}
1035 ${dst}= Set Variable ${hosts.dst[${I}]}
1036 ${onu_device_id}= Get Device ID From SN ${src['onu']}
1037 ${sn}= Get Device ID From SN ${src['olt']}
1038 #Continue For Loop If '${onu_id}' != '${EMPTY}' and '${onu_id}' != '${onu_device_id}'
1039 Continue For Loop If '${olt_serial_number}' == '${sn}'
1040 Execute Remote Command sudo pkill wpa_supplicant ${src['ip']}
1041 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
1042 Execute Remote Command sudo pkill dhclient ${src['ip']}
1043 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
1044 Execute Remote Command sudo pkill mausezahn ${src['ip']}
1045 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
1046 Run Keyword If '${dst['ip']}' != '${None}' Execute Remote Command pkill dhcpd
1047 ... ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']} ${dst['container_name']}
1048 Delete IP Addresses from Interface on Remote Host ${src['dp_iface_name']} ${src['ip']}
1049 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
1050 Run Keyword If '${dst['ip']}' != '${None}' Delete Interface on Remote Host
1051 ... ${dst['dp_iface_name']}.${src['s_tag']} ${dst['ip']} ${dst['user']} ${dst['pass']}
1052 ... ${dst['container_type']} ${dst['container_name']}
1053 ${bng_ip}= Get Variable Value ${dst['noroot_ip']}
1054 ${bng_user}= Get Variable Value ${dst['noroot_user']}
1055 ${bng_pass}= Get Variable Value ${dst['noroot_pass']}
1056 Run Keyword If "${bng_ip}" != "${NONE}" and "${bng_user}" != "${NONE}" and "${bng_pass}" != "${NONE}"
1057 ... Execute Remote Command sudo pkill mausezahn ${bng_ip} ${bng_user} ${bng_pass}
1058 ... ${dst['container_type']} ${dst['container_name']}
1059 END
1060
Suchitra Vemuri8d3b0032020-09-11 17:49:08 -07001061Clean dhclient
1062 [Documentation] Kills dhclient processes only for all RGs
Suchitra Vemuria6879aa2020-11-03 11:03:11 -08001063 FOR ${I} IN RANGE 0 ${num_all_nus}
Suchitra Vemuri8d3b0032020-09-11 17:49:08 -07001064 ${src}= Set Variable ${hosts.src[${I}]}
1065 ${dst}= Set Variable ${hosts.dst[${I}]}
1066 Execute Remote Command sudo pkill dhclient ${src['ip']}
1067 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
1068 END
1069
Suchitra Vemurif7a033c2020-02-26 17:22:41 -08001070Clean WPA Process
1071 [Documentation] Kills wpa_supplicant processes only for all RGs
Suchitra Vemuria6879aa2020-11-03 11:03:11 -08001072 FOR ${I} IN RANGE 0 ${num_all_onus}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -08001073 ${src}= Set Variable ${hosts.src[${I}]}
1074 ${dst}= Set Variable ${hosts.dst[${I}]}
1075 Run Keyword And Ignore Error Kill Linux Process [w]pa_supplicant ${src['ip']}
1076 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
1077 END
1078
Scott Baker60e570d2020-02-02 22:10:13 -08001079Should Be Larger Than
1080 [Documentation] Verify that value_1 is > value_2
1081 [Arguments] ${value_1} ${value_2}
1082 Run Keyword If ${value_1} <= ${value_2}
1083 ... Fail The value ${value_1} is not larger than ${value_2}
1084
Scott Bakeree675552020-02-11 10:43:34 -08001085Should Be Larger Than Or Equal To
1086 [Documentation] Verify that value_1 is >= value_2
1087 [Arguments] ${value_1} ${value_2}
1088 Run Keyword If ${value_1} < ${value_2}
1089 ... Fail The value ${value_1} is not larger than or equal to ${value_2}
1090
Scott Baker60e570d2020-02-02 22:10:13 -08001091Should Be Float
1092 [Documentation] Verify that value is a floating point number type
1093 [Arguments] ${value}
1094 ${type} Evaluate type(${value}).__name__
1095 Should Be Equal ${type} float
1096
Scott Bakeree675552020-02-11 10:43:34 -08001097Should Be Newer Than Or Equal To
1098 [Documentation] Compare two RFC3339 dates
1099 [Arguments] ${value_1} ${value_2}
1100 ${unix_v1} Parse RFC3339 ${value_1}
1101 ${unix_v2} Parse RFC3339 ${value_2}
1102 Run Keyword If ${unix_v1} < ${unix_v2}
1103 ... Fail The value ${value_1} is not newer than or equal to ${value_2}
1104
Scott Baker60e570d2020-02-02 22:10:13 -08001105Get Current Time
1106 [Documentation] Return the current time in RFC3339 format
1107 ${output}= Run date -u +"%FT%T%:z"
1108 [return] ${output}
Scott Bakeree675552020-02-11 10:43:34 -08001109
1110Parse RFC3339
1111 [Documentation] Parse an RFC3339 timestamp
1112 [Arguments] ${dateStr}
1113 ${rc} ${output}= Run and Return Rc and Output date --date="${dateStr}" "+%s"
1114 Should Be Equal As Numbers ${rc} 0
1115 [return] ${output}
Matteo Scandolo142e6272020-04-29 17:36:59 -07001116
Gayathri.Selvan92d16862020-03-19 14:47:58 +00001117Get Bandwidth Profile Name For Given Subscriber
1118 [Arguments] ${subscriber_id} ${stream_type}=upstreamBandwidthProfile
1119 [Documentation] Keyword to get the bandwidth details of the given subscriber
1120 ${bandwidth_profile_output}= Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
1121 ... volt-programmed-subscribers | grep ${subscriber_id}
1122 @{bandwidth_profile_array}= Split String ${bandwidth_profile_output} ,
1123 Log ${bandwidth_profile_array}
1124 FOR ${value} IN @{bandwidth_profile_array}
1125 @{row_value}= Split String ${value} =
1126 ${bandwidth_profile_name}= Set Variable If '${row_value[0]}' == ' ${stream_type}'
1127 ... ${row_value[1]}
1128 ${bandwidth_profile_name}= Convert To String ${bandwidth_profile_name}
1129 Run Keyword If "${bandwidth_profile_name}" != "None" Exit For Loop
1130 END
1131 Log ${bandwidth_profile_name}
1132 [Return] ${bandwidth_profile_name}
1133
1134Execute Remote Command
1135 [Documentation] SSH into a remote host and execute a command on the bare host or in a container.
1136 ... This replaces and simplifies the Login And Run Command On Remote System keyword in CORDRobot.
1137 [Arguments] ${cmd} ${ip} ${user} ${pass}=${None}
Andy Baviereff938d2020-06-29 18:27:49 -07001138 ... ${container_type}=${None} ${container_name}=${None} ${timeout}=${None}
Gayathri.Selvan92d16862020-03-19 14:47:58 +00001139 ${conn_id}= SSHLibrary.Open Connection ${ip}
1140 Run Keyword If '${pass}' != '${None}'
1141 ... SSHLibrary.Login ${user} ${pass}
1142 ... ELSE
1143 ... SSHLibrary.Login With Public Key ${user} %{HOME}/.ssh/id_rsa
1144 ${namespace}= Run Keyword If '${container_type}' == 'K8S' SSHLibrary.Execute Command
1145 ... kubectl get pods --all-namespaces | grep ${container_name} | awk '{print $1}'
Andy Bavierf6ab19c2020-05-14 10:34:47 -07001146 ${stdout} ${stderr} ${rc}= Run Keyword If '${container_type}' == 'LXC'
1147 ... SSHLibrary.Execute Command lxc exec ${container_name} -- ${cmd}
Andy Baviereff938d2020-06-29 18:27:49 -07001148 ... return_stderr=True return_rc=True timeout=${timeout}
Gayathri.Selvan92d16862020-03-19 14:47:58 +00001149 ... ELSE IF '${container_type}' == 'K8S'
Andy Bavierf6ab19c2020-05-14 10:34:47 -07001150 ... SSHLibrary.Execute Command kubectl -n ${namespace} exec ${container_name} -- ${cmd}
Andy Baviereff938d2020-06-29 18:27:49 -07001151 ... return_stderr=True return_rc=True timeout=${timeout}
Gayathri.Selvan92d16862020-03-19 14:47:58 +00001152 ... ELSE
Andy Baviereff938d2020-06-29 18:27:49 -07001153 ... SSHLibrary.Execute Command ${cmd} return_stderr=True return_rc=True timeout=${timeout}
Andy Bavierf6ab19c2020-05-14 10:34:47 -07001154
1155 Log ${stdout}
1156 Log ${stderr}
1157 Log ${rc}
Gayathri.Selvan92d16862020-03-19 14:47:58 +00001158 SSHLibrary.Close Connection
Andy Bavierf6ab19c2020-05-14 10:34:47 -07001159 [Return] ${stdout} ${stderr} ${rc}
Gayathri.Selvan92d16862020-03-19 14:47:58 +00001160
Suraj Gour33651272020-05-04 10:10:16 +05301161Start Remote Command
1162 [Documentation] SSH into a remote host and execute a command on the bare host or in a container.
1163 ... This replaces and simplifies the Login And Run Command On Remote System keyword in CORDRobot.
1164 [Arguments] ${cmd} ${ip} ${user} ${pass}=${None}
1165 ... ${container_type}=${None} ${container_name}=${None}
1166 ${conn_id}= SSHLibrary.Open Connection ${ip}
1167 Run Keyword If '${pass}' != '${None}'
1168 ... SSHLibrary.Login ${user} ${pass}
1169 ... ELSE
1170 ... SSHLibrary.Login With Public Key ${user} %{HOME}/.ssh/id_rsa
1171 ${namespace}= Run Keyword If '${container_type}' == 'K8S' SSHLibrary.Execute Command
1172 ... kubectl get pods --all-namespaces | grep ${container_name} | awk '{print $1}'
1173 Run Keyword If '${container_type}' == 'LXC'
1174 ... SSHLibrary.Start Command lxc exec ${container_name} -- ${cmd}
1175 ... ELSE IF '${container_type}' == 'K8S'
1176 ... SSHLibrary.Start Command kubectl -n ${namespace} exec ${container_name} -- ${cmd}
1177 ... ELSE
1178 ... SSHLibrary.Start Command ${cmd}
Andy Bavier9fb23232020-06-30 15:12:20 -07001179 # It seems that closing the connection immediately will sometimes kill the command
1180 Sleep 1s
Suraj Gour33651272020-05-04 10:10:16 +05301181 SSHLibrary.Close Connection
1182
Gayathri.Selvan92d16862020-03-19 14:47:58 +00001183Run Iperf3 Test Client
1184 [Arguments] ${src} ${server} ${args}
1185 [Documentation] Login to ${src} and run the iperf3 client against ${server} using ${args}.
1186 ... Return a Dictionary containing the results of the test.
Andy Bavierf6ab19c2020-05-14 10:34:47 -07001187 ${output} ${stderr} ${rc}= Execute Remote Command iperf3 -J -c ${server} ${args} | jq -M -c '.'
Gayathri.Selvan92d16862020-03-19 14:47:58 +00001188 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
Andy Bavierf6ab19c2020-05-14 10:34:47 -07001189 Should Be Equal As Integers ${rc} 0
Gayathri.Selvan92d16862020-03-19 14:47:58 +00001190 ${object}= Evaluate json.loads(r'''${output}''') json
1191 [Return] ${object}
Hung-Wei Chiue0bec7c2020-05-29 22:16:56 +00001192
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -07001193Run Iperf Test Client for MCAST
1194 [Arguments] ${src} ${server} ${args}
1195 [Documentation] Login to ${src} and run the iperf client against ${server} using ${args}.
1196 ... Return a Dictionary containing the results of the test.
1197 ${output} ${stderr} ${rc}= Execute Remote Command sudo iperf -c ${server} ${args} | jq -M -c '.'
1198 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
1199 Should Be Equal As Integers ${rc} 0
1200 ${object}= Evaluate json.loads(r'''${output}''') json
1201 [Return] ${object}
1202
Hung-Wei Chiue0bec7c2020-05-29 22:16:56 +00001203RestoreONUs
1204 [Documentation] Restore all connected ONUs
Suchitra Vemuria6879aa2020-11-03 11:03:11 -08001205 [Arguments] ${num_all_onus}
1206 FOR ${I} IN RANGE 0 ${num_all_onus}
Hung-Wei Chiue0bec7c2020-05-29 22:16:56 +00001207 ${src}= Set Variable ${hosts.src[${I}]}
Hung-Wei Chiucc6e6552020-06-04 12:57:38 -07001208 ${container_type}= Get Variable Value ${src['container_type']} "null"
1209 ${container_name}= Get Variable Value ${src['container_name']} "null"
Hung-Wei Chiue0bec7c2020-05-29 22:16:56 +00001210 ${onu_type}= Get Variable Value ${src['onu_type']} "null"
Hung-Wei Chiucc6e6552020-06-04 12:57:38 -07001211 #Get ens6f0 from ens6f0.22
1212 ${if_name}= Replace String Using Regexp ${src['dp_iface_name']} \\..* \
Hung-Wei Chiue0bec7c2020-05-29 22:16:56 +00001213 Run Keyword IF '${onu_type}' == 'alpha' AlphaONURestoreDefault ${src['ip']} ${src['user']}
Hung-Wei Chiucc6e6552020-06-04 12:57:38 -07001214 ... ${src['pass']} ${if_name} admin admin ${container_type} ${container_name}
Hung-Wei Chiue0bec7c2020-05-29 22:16:56 +00001215 END
1216
1217AlphaONURestoreDefault
1218 [Documentation] Restore the Alpha ONU to factory setting
1219 [Arguments] ${rg_ip} ${rg_user} ${rg_pass} ${onu_ifname}
Hung-Wei Chiucc6e6552020-06-04 12:57:38 -07001220 ... ${onu_user} ${onu_pass} ${container_type}=${None} ${container_name}=${None}
Hung-Wei Chiue0bec7c2020-05-29 22:16:56 +00001221 ${output}= Login And Run Command On Remote System sudo ifconfig ${onu_ifname} 192.168.1.3/24
Hung-Wei Chiucc6e6552020-06-04 12:57:38 -07001222 ... ${rg_ip} ${rg_user} ${rg_pass} ${container_type} ${container_name}
Hung-Wei Chiue0bec7c2020-05-29 22:16:56 +00001223 ${cmd} Catenate
1224 ... (echo open "192.168.1.1"; sleep 1;
1225 ... echo "${onu_user}"; sleep 1;
1226 ... echo "${onu_pass}"; sleep 1;
1227 ... echo "restoredefault"; sleep 1) | telnet
1228 ${output}= Login And Run Command On Remote System ${cmd}
Hung-Wei Chiucc6e6552020-06-04 12:57:38 -07001229 ... ${rg_ip} ${rg_user} ${rg_pass} ${container_type} ${container_name}
Hung-Wei Chiue0bec7c2020-05-29 22:16:56 +00001230 Log To Console ${output}
1231 ${output}= Login And Run Command On Remote System sudo ifconfig ${onu_ifname} 0
Hung-Wei Chiucc6e6552020-06-04 12:57:38 -07001232 ... ${rg_ip} ${rg_user} ${rg_pass} ${container_type} ${container_name}
Suraj Gour33651272020-05-04 10:10:16 +05301233
1234Create traffic with each pbit and capture at other end
1235 [Documentation] Generates upstream traffic using Mausezahn tool
1236 ... with each pbit and validates reception at other end using tcpdump
1237 [Arguments] ${target_ip} ${target_iface} ${src_iface}
1238 ... ${packet_count} ${packet_type} ${target_port} ${vlan} ${tcpdump_filter}
1239 ... ${dst_ip} ${dst_user} ${dst_pass} ${dst_container_type} ${dst_container_name}
1240 ... ${src_ip} ${src_user} ${src_pass} ${src_container_type} ${src_container_name}
1241 FOR ${pbit} IN RANGE 8
Andy Baviereff938d2020-06-29 18:27:49 -07001242 Execute Remote Command sudo pkill mausezahn
Suraj Gour33651272020-05-04 10:10:16 +05301243 ... ${src_ip} ${src_user} ${src_pass} ${src_container_type} ${src_container_name}
Andy Baviereff938d2020-06-29 18:27:49 -07001244 ${var1}= Set Variable sudo mausezahn ${src_iface} -B ${target_ip} -c ${packet_count} -d 100m
Suraj Gour33651272020-05-04 10:10:16 +05301245 ${var2}= Set Variable -t ${packet_type} "dp=${target_port}" -p 1472 -Q ${pbit}:${vlan}
1246 ${cmd}= Set Variable ${var1} ${var2}
1247 Start Remote Command ${cmd} ${src_ip} ${src_user} ${src_pass}
1248 ... ${src_container_type} ${src_container_name}
1249 ${output} ${stderr} ${rc}= Execute Remote Command
Andy Baviereff938d2020-06-29 18:27:49 -07001250 ... sudo tcpdump -l -U -c 30 -i ${target_iface} -e ${tcpdump_filter}
Suraj Gour33651272020-05-04 10:10:16 +05301251 ... ${dst_ip} ${dst_user} ${dst_pass} ${dst_container_type} ${dst_container_name}
Andy Baviereff938d2020-06-29 18:27:49 -07001252 ... timeout=30 seconds
1253 Execute Remote Command sudo pkill mausezahn
Suraj Gour33651272020-05-04 10:10:16 +05301254 ... ${src_ip} ${src_user} ${src_pass} ${src_container_type} ${src_container_name}
1255 # VOL-3262: I'm seeing untagged downstream traffic at RG for pbit 0. According to Girish this is
1256 # incorrect behavior. Simplify the following check when VOL-3262 is resolved.
1257 Run Keyword If ${pbit}==0 and "${tcpdump_filter}"=="udp"
1258 ... Should Match Regexp ${output} \\.${target_port}: UDP,
1259 ... ELSE Should Match Regexp ${output} , p ${pbit},.*\\.${target_port}: UDP,
1260 END