blob: 1857563e14a12163f899bc9ce1d78cd3f092c46e [file] [log] [blame]
Joey Armstrong9fadcbe2024-01-17 19:00:37 -05001# Copyright 2017-2024 Open Networking Foundation (ONF) and the ONF Contributors
bharat raj58488b32023-05-11 22:46:18 +05302#
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.
14# robot test functions
15
16*** Settings ***
17Documentation Library for various utilities
18Library SSHLibrary
19Library String
20Library DateTime
21Library Process
22Library Collections
23Library RequestsLibrary
24Library OperatingSystem
25Library CORDRobot
26Library ImportResource resources=CORDRobot
27Resource ./voltctl.robot
28Resource ./vgc.robot
29
30*** Keywords ***
31Check CLI Tools Configured
32 [Documentation] Tests that use 'voltctl' and 'kubectl' should execute this keyword in suite setup
33 # check voltctl and kubectl configured
34 ${voltctl_rc} ${voltctl_output}= Run And Return Rc And Output voltctl -c ${VOLTCTL_CONFIG} device list
35 Log ${voltctl_output}
36 ${kubectl_rc} ${kubectl_output}= Run And Return Rc And Output kubectl get pods
37 Log ${kubectl_output}
38 Run Keyword If ${voltctl_rc} != 0 or ${kubectl_rc} != 0 FATAL ERROR
39 ... VOLTCTL and KUBECTL not configured. Please configure before executing tests.
40
41Common Test Suite Setup
42 [Documentation] Setup the test suite
Cristina de Franciscoc4cfd7e2023-10-09 10:55:08 +020043 Set Global Variable ${KUBECTL_CONFIG} %{KUBECONFIG}
bharat raj58488b32023-05-11 22:46:18 +053044 Set Global Variable ${VOLTCTL_CONFIG} %{VOLTCONFIG}
45 ${k8s_node_ip}= Evaluate ${nodes}[0].get("ip")
46 ${VGC_REST_IP}= Get Environment Variable VGC_REST_IP ${k8s_node_ip}
47 ${VGC_SSH_IP}= Get Environment Variable VGC_SSH_IP ${k8s_node_ip}
48 Set Global Variable ${VGC_REST_IP}
49 Set Global Variable ${VGC_SSH_IP}
50 ${k8s_node_user}= Evaluate ${nodes}[0].get("user")
51 ${k8s_node_pass}= Evaluate ${nodes}[0].get("pass")
52 Check CLI Tools Configured
53 ${HEADERS} Create Dictionary Content-Type=application/json
54 Create VGC Session
55 ${num_olts} Get Length ${olts}
56 ${list_olts} Create List
57 # Create olt list from the configuration file
58 FOR ${I} IN RANGE 0 ${num_olts}
59 ${ip} Evaluate ${olts}[${I}].get("ip")
60 ${user} Evaluate ${olts}[${I}].get("user")
61 ${pass} Evaluate ${olts}[${I}].get("pass")
62 ${serial_number} Evaluate ${olts}[${I}].get("serial")
63 ${olt_ssh_ip} Evaluate ${olts}[${I}].get("sship")
64 ${type} Evaluate ${olts}[${I}].get("type")
65 ${power_switch_port} Evaluate ${olts}[${I}].get("power_switch_port")
66 ${orig_olt_port} Evaluate ${olts}[${I}].get("oltPort")
67 ${port}= Set Variable If "${orig_olt_port}" == "None" ${OLT_PORT} ${orig_olt_port}
68 ${onu_count}= Get ONU Count For OLT ${hosts.src} ${serial_number}
Guru Prasanna6dcd8a22025-05-08 01:28:20 +053069 Log ${hosts.src}
70 Log ${hosts}
bharat raj58488b32023-05-11 22:46:18 +053071 ${onu_list}= Get ONU List For OLT ${hosts.src} ${serial_number}
72 ${olt} Create Dictionary ip ${ip} user ${user} pass
73 ... ${pass} sn ${serial_number} onucount ${onu_count} type ${type}
74 ... sship ${olt_ssh_ip} oltport ${port} powerswitchport ${power_switch_port}
75 ... onus ${onu_list}
76 Append To List ${list_olts} ${olt}
77 END
78 ${num_all_onus}= Get Length ${hosts.src}
79 ${num_all_onus}= Convert to String ${num_all_onus}
80 #send sadis file to vgc
81 ${sadis_file}= Get Variable Value ${sadis.file}
82 Log To Console \nSadis File:${sadis_file}
Cristina de Franciscoc4cfd7e2023-10-09 10:55:08 +020083 Run Keyword Unless '${sadis_file}' == '${None}' Send File To VGC ${sadis_file} # apps/
bharat raj58488b32023-05-11 22:46:18 +053084 Set Suite Variable ${num_all_onus}
85 Set Suite Variable ${num_olts}
86 Set Suite Variable ${list_olts}
87 ${olt_count}= Get Length ${list_olts}
88 Set Suite Variable ${olt_count}
89 @{container_list}= Create List ${OLT_ADAPTER_APP_LABEL} adapter-open-onu voltha-api-server
90 ... voltha-ro-core voltha-rw-core-11 voltha-rw-core-12 voltha-ofagent
91 Set Suite Variable ${container_list}
92 ${datetime}= Get Current Date
93 Set Suite Variable ${datetime}
94
95Get ONU Count For OLT
96 [Arguments] ${src} ${serial_number}
97 [Documentation] Gets ONU Count for the specified OLT
98 ${src_length}= Get Length ${src}
99 ${count}= Set Variable 0
100 FOR ${I} IN RANGE 0 ${src_length}
101 ${sn} Evaluate ${src}[${I}].get("olt")
102 ${count}= Run Keyword If '${serial_number}' == '${sn}' Evaluate ${count} + 1
103 ... ELSE Set Variable ${count}
104 END
105 [Return] ${count}
106
107Get ONU List For OLT
108 [Arguments] ${src} ${serial_number}
109 [Documentation] Gets ONU List for the specified OLT
110 ${src_length}= Get Length ${src}
111 ${onu_list}= Create List
112 FOR ${I} IN RANGE 0 ${src_length}
113 ${sn} Evaluate ${src}[${I}].get("olt")
114 Run Keyword If '${serial_number}' == '${sn}' Append To List ${onu_list} ${src}[${I}][onu]
115 ... ELSE Set Variable ${onu_list}
116 END
117 [Return] ${onu_list}
118
119WPA Reassociate
120 [Documentation] Executes a particular wpa_cli reassociate, which performs force reassociation
121 [Arguments] ${iface} ${ip} ${user} ${pass}=${None}
122 ... ${container_type}=${None} ${container_name}=${None}
123 #Below for loops are used instead of sleep time, to execute reassociate command and check status
124 FOR ${i} IN RANGE 70
125 ${output}= Login And Run Command On Remote System
126 ... wpa_cli -i ${iface} reassociate ${ip} ${user}
127 ... ${pass} ${container_type} ${container_name}
128 ${passed}= Run Keyword And Return Status Should Contain ${output} OK
129 Exit For Loop If ${passed}
130 END
131 Should Be True ${passed} Status does not contain 'SUCCESS'
132 FOR ${i} IN RANGE 70
133 ${output}= Login And Run Command On Remote System
134 ... wpa_cli -i ${iface} status | grep SUCCESS ${ip} ${user}
135 ... ${pass} ${container_type} ${container_name}
136 ${passed}= Run Keyword And Return Status Should Contain ${output} SUCCESS
137 Exit For Loop If ${passed}
138 END
139 Should Be True ${passed} Status does not contain 'SUCCESS'
140
141Validate Authentication After Reassociate
142 [Arguments] ${auth_pass} ${iface} ${ip} ${user} ${pass}=${None}
143 ... ${container_type}=${None} ${container_name}=${None}
144 [Documentation]
145 ... Executes a particular reassociate request on the RG using wpa_cli.
146 ... auth_pass determines if authentication should pass
147 ${wpa_log}= Catenate SEPARATOR=. /tmp/wpa ${iface} log
148 ${output}= Login And Run Command On Remote System truncate -s 0 ${wpa_log}; cat ${wpa_log}
149 ... ${ip} ${user} ${pass} ${container_type} ${container_name}
150 Log ${output}
151 Should Not Contain ${output} authentication completed successfully
152 WPA Reassociate ${iface} ${ip} ${user} ${pass} ${container_type} ${container_name}
153 Run Keyword If '${auth_pass}' == 'True' Wait Until Keyword Succeeds ${timeout} 2s
154 ... Check Remote File Contents True ${wpa_log} ${iface}.*authentication completed successfully
155 ... ${ip} ${user} ${pass} ${container_type} ${container_name}
156 Run Keyword If '${auth_pass}' == 'False' Sleep 20s
157 Run Keyword If '${auth_pass}' == 'False' Check Remote File Contents False /tmp/wpa.log
158 ... ${iface}.*authentication completed successfully ${ip} ${user} ${pass}
159 ... ${container_type} ${container_name}
160
161Send Dhclient Request To Release Assigned IP
162 [Arguments] ${iface} ${ip} ${user} ${path_dhcpleasefile} ${pass}=${None}
163 ... ${container_type}=${None} ${container_name}=${None}
164 [Documentation] Executes a dhclient with option to release ip against a particular interface on the RG (src)
165 ${result}= Login And Run Command On Remote System
166 ... dhclient -nw -r ${iface} && rm ${path_dhcpleasefile}/dhclient.* ${ip} ${user}
167 ... ${pass} ${container_type} ${container_name}
168 Log ${result}
169 #Should Contain ${result} DHCPRELEASE
170 [Return] ${result}
171
172Check Remote File Contents For WPA Logs
173 [Arguments] ${file_should_exist} ${file} ${pattern} ${ip} ${user} ${pass}=${None}
174 ... ${container_type}=${None} ${container_name}=${None} ${prompt}=~$
175 [Documentation] Checks for particular pattern count in a file
176 ${result}= Login And Run Command On Remote System
177 ... cat ${file} | grep '${pattern}' | wc -l ${ip} ${user} ${pass}
178 ... ${container_type} ${container_name} ${prompt}
179 [Return] ${result}
180
181Perform Sanity Test DT
182 [Documentation] This keyword iterate all OLTs and performs Sanity Test Procedure for DT workflow
183 ... For repeating sanity test without subscriber changes set flag supress_add_subscriber=True.
184 ... In all other (common) cases flag has to be set False (default).
185 [Arguments] ${supress_add_subscriber}=False
186 FOR ${J} IN RANGE 0 ${num_olts}
187 ${olt_serial_number}= Set Variable ${list_olts}[${J}][sn]
188 ${num_onus}= Set Variable ${list_olts}[${J}][onucount]
189 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
190 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in VGC
191 ... ${olt_serial_number}
192 Set Global Variable ${of_id}
193 ${nni_port}= Wait Until Keyword Succeeds ${timeout} 2s Get NNI Port in VGC ${of_id}
194 Perform Sanity Test DT Per OLT ${of_id} ${nni_port} ${olt_serial_number} ${num_onus}
195 ... ${supress_add_subscriber}
196 # Verify VGC Flows
197 # Number of Access Flows on VGC equals 4 * the Number of Active ONUs (2 for each downstream and upstream)
198 ${vgc_flows_count}= Evaluate 4 * ${num_onus}
199 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
200 ... Verify Subscriber Access Flows Added Count DT ${VGC_SSH_IP} ${VGC_SSH_PORT} ${of_id}
201 ... ${vgc_flows_count}
202 # Verify LLDP flow in VGC
203 #Wait Until Keyword Succeeds ${timeout} 5s
204 #... Verify LLDP Flow Added ${VGC_SSH_IP} ${VGC_SSH_PORT} ${of_id} 1
205 # Verify VOLTHA Flows
206 # Number of per OLT Flows equals Twice the Number of Active ONUs (each for downstream and upstream) + 1 for LLDP
207 ${olt_flows}= Evaluate 2 * ${num_onus}
208 # Number of per ONU Flows equals 2 (one each for downstream and upstream)
209 ${onu_flows}= Set Variable 2
210 Run Keyword Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Flows
211 ... ${olt_flows} ${olt_device_id}
212 ${List_ONU_Serial} Create List
213 Set Suite Variable ${List_ONU_Serial}
214 Build ONU SN List ${List_ONU_Serial} ${olt_serial_number}
215 Log ${List_ONU_Serial}
216 Wait Until Keyword Succeeds ${timeout} 5s Validate ONU Flows
217 ... ${List_ONU_Serial} ${onu_flows}
218 END
219
220
221Perform Sanity Test DT Per OLT
222 [Arguments] ${of_id} ${nni_port} ${olt_serial_number} ${num_onus} ${supress_add_subscriber}=False
223 [Documentation] This keyword performs Sanity Test Procedure for DT Workflow
224 ... Sanity test performs dhcp and pings (without EAPOL and DHCP flows) for all the ONUs given for the POD
225 ... This keyword can be used to call in any other tests where sanity check is required
226 ... and avoids duplication of code.
227 ... For repeating sanity test without subscriber changes set flag supress_add_subscriber=True.
228 ... In all other (common) cases flag has to be set False (default).
229 FOR ${I} IN RANGE 0 ${num_all_onus}
230 ${src}= Set Variable ${hosts.src[${I}]}
231 ${dst}= Set Variable ${hosts.dst[${I}]}
232 Continue For Loop If "${olt_serial_number}"!="${src['olt']}"
233 ${onu_device_id}= Get Device ID From SN ${src['onu']}
234 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s
235 ... Get ONU Port in VGC ${src['onu']} ${of_id} ${src['uni_id']}
236 # Check ONU port is Enabled in VGC
237 Wait Until Keyword Succeeds 120s 2s
238 ... Verify UNI Port Is Enabled ${src['onu']} ${src['uni_id']}
239 Run Keyword Unless ${supress_add_subscriber}
240 ... Add Subscriber Details ${of_id} ${onu_port}
241 Wait Until Keyword Succeeds ${timeout} 5s
242 ... Verify Subscriber Access Flows Added For ONU DT in VGC ${VGC_SSH_IP} ${VGC_SSH_PORT} ${of_id}
243 ... ${onu_port} ${nni_port} ${src['s_tag']}
244 # Verify ONU state in voltha
245 ${onu_reasons}= Create List omci-flows-pushed
246 Run Keyword If ${supress_add_subscriber} Append To List ${onu_reasons} onu-reenabled
247 Wait Until Keyword Succeeds ${timeout} 5s Validate Device
248 ... ENABLED ACTIVE REACHABLE
249 ... ${src['onu']} onu=True onu_reason=${onu_reasons}
250 # Verify Meters in VGC
251 Wait Until Keyword Succeeds ${timeout} 5s
252 ... Verify Meters in VGC Ietf ${VGC_SSH_IP} ${VGC_SSH_PORT} ${of_id} ${onu_port}
253 # TODO: Yet to Verify on the GPON based Physical POD (VOL-2652)
254 Run Keyword If ${has_dataplane} Validate DHCP and Ping True
255 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
256 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
257 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
258 ... ${dst['container_name']}
259 END
260
261Perform Sanity Test DT FTTB
262 [Documentation] This keyword iterate all OLTs and performs Sanity Test Procedure for DT-FTTB workflow
263 ... For repeating sanity test without subscriber changes set flag supress_add_subscriber=True.
264 ... In all other (common) cases flag has to be set False (default).
265 [Arguments] ${supress_add_subscriber}=False
266 FOR ${J} IN RANGE 0 ${num_olts}
267 ${olt_serial_number}= Set Variable ${list_olts}[${J}][sn]
268 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
269 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in VGC
270 ... ${olt_serial_number}
271 ${nni_port}= Wait Until Keyword Succeeds ${timeout} 2s Get NNI Port in VGC ${of_id}
272 Perform Sanity Test DT FTTB Per OLT ${of_id} ${nni_port} ${olt_serial_number}
273 ... ${supress_add_subscriber}
274 END
275
276Perform Sanity Test DT FTTB Per OLT
277 [Arguments] ${of_id} ${nni_port} ${olt_serial_number} ${supress_add_subscriber}=False
278 [Documentation] This keyword performs Sanity Test Procedure for DT-FTTB Workflow
279 ... Sanity test performs dhcp and pings (without EAPOL and DHCP flows) for all the ONUs given for the POD
280 ... This keyword can be used to call in any other tests where sanity check is required
281 ... and avoids duplication of code.
282 ... For repeating sanity test without subscriber changes set flag supress_add_subscriber=True.
283 ... In all other (common) cases flag has to be set False (default).
284 FOR ${I} IN RANGE 0 ${num_all_onus}
285 ${src}= Set Variable ${hosts.src[${I}]}
Guru Prasanna6dcd8a22025-05-08 01:28:20 +0530286 Log ${src}
bharat raj58488b32023-05-11 22:46:18 +0530287 ${dst}= Set Variable ${hosts.dst[${I}]}
Guru Prasanna6dcd8a22025-05-08 01:28:20 +0530288 Log ${dst}
bharat raj58488b32023-05-11 22:46:18 +0530289 Continue For Loop If "${olt_serial_number}"!="${src['olt']}"
290 ${onu_device_id}= Get Device ID From SN ${src['onu']}
291 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s
292 ... Get ONU Port in VGC ${src['onu']} ${of_id} ${src['uni_id']}
293 # Check ONU port is Enabled in VGC
Guru Prasanna6dcd8a22025-05-08 01:28:20 +0530294 Wait Until Keyword Succeeds 120s 2s
bharat raj58488b32023-05-11 22:46:18 +0530295 ... Verify UNI Port Is Enabled ${src['onu']} ${src['uni_id']}
296 Run Keyword Unless ${supress_add_subscriber}
297 ... Add Subscriber Details ${of_id} ${onu_port}
298 Wait Until Keyword Succeeds ${timeout} 5s
299 ... Verify VGC Flows Added For DT FTTB ${of_id}
300 ... ${onu_port} ${nni_port} ${src['service']}
301 # Verify that the Subscriber is present at the given location
302 Wait Until Keyword Succeeds ${timeout} 5s
303 ... Verify Programmed Subscribers DT FTTB ${of_id}
304 ... ${onu_port} ${src['service']}
305 # Verify ONU state in voltha
306 ${onu_reasons}= Create List omci-flows-pushed
307 Run Keyword If ${supress_add_subscriber} Append To List ${onu_reasons} onu-reenabled
308 Wait Until Keyword Succeeds ${timeout} 5s Validate Device
309 ... ENABLED ACTIVE REACHABLE
310 ... ${src['onu']} onu=True onu_reason=${onu_reasons}
311 # Verify Meters in VGC
312 Wait Until Keyword Succeeds ${timeout} 5s
313 ... Verify Meters in VGC Ietf ${VGC_SSH_IP} ${VGC_SSH_PORT} ${of_id} ${onu_port}
314 ... FTTB_SUBSCRIBER_TRAFFIC
315 Run Keyword If ${has_dataplane} Validate DHCP and Ping True
316 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
317 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
318 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
319 ... ${dst['container_name']}
320 END
321
322Validate All OLT Flows
323 [Documentation] This keyword iterate all OLTs and performs Sanity Test Procedure for DT workflow
324 FOR ${J} IN RANGE 0 ${num_olts}
325 ${olt_serial_number}= Set Variable ${list_olts}[${J}][sn]
326 ${num_onus}= Set Variable ${list_olts}[${J}][onucount]
327 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
328 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in VGC
329 ... ${olt_serial_number}
330 Set Global Variable ${of_id}
331 # Verify VGC Flows
332 # Number of Access Flows on VGC equals 4 * the Number of Active ONUs (2 for each downstream and upstream)
333 ${vgc_flows_count}= Evaluate 4 * ${num_onus}
334 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
335 ... Verify Subscriber Access Flows Added Count DT ${VGC_SSH_IP} ${VGC_SSH_PORT} ${of_id}
336 ... ${vgc_flows_count}
337 # Verify VOLTHA Flows
338 # Number of per OLT Flows equals Twice the Number of Active ONUs (each for downstream and upstream) + 1 for LLDP
339 ${olt_flows}= Evaluate 2 * ${num_onus}
340 # Number of per ONU Flows equals 2 (one each for downstream and upstream)
341 ${onu_flows}= Set Variable 2
342 Run Keyword Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Flows ${olt_flows}
343 ... ${olt_device_id}
344 ${List_ONU_Serial} Create List
345 Set Suite Variable ${List_ONU_Serial}
346 Build ONU SN List ${List_ONU_Serial} ${olt_serial_number}
347 Log ${List_ONU_Serial}
348 Run Keyword Wait Until Keyword Succeeds ${timeout} 5s Validate ONU Flows
349 ... ${List_ONU_Serial} ${onu_flows}
350 END
351
352Setup Soak
353 [Documentation] Pre-test Setup for Soak Job
354 ${olt_ids} Create List
355 FOR ${I} IN RANGE 0 ${num_olts}
356 ${olt_serial_number}= Set Variable ${list_olts}[${I}][sn]
357 ${olt_device_id}= Get Device ID From SN ${olt_serial_number}
358 ${logical_id}= Get Logical Device ID From SN ${olt_serial_number}
359 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in VGC
360 ... ${olt_serial_number}
361 ${nni_port}= Wait Until Keyword Succeeds ${timeout} 2s Get NNI Port in VGC ${of_id}
362 ${olt} Create Dictionary device_id ${olt_device_id} logical_id ${logical_id}
363 ... of_id ${of_id} sn ${olt_serial_number}
364 Append To List ${olt_ids} ${olt}
365 END
366 Set Global Variable ${olt_ids}
367
368Setup
369 [Documentation] Pre-test Setup
370 [Arguments] ${skip_empty_device_list_test}=False
371 #test for empty device list
372 Run Keyword If '${skip_empty_device_list_test}'=='False' Test Empty Device List
373 # TBD: Need for this Sleep
374 Run Keyword If ${has_dataplane} Sleep 180s
375 # Create a list of olt ids (logical and device_id)
376 ${olt_ids} Create List
377 FOR ${I} IN RANGE 0 ${num_olts}
378 #create/preprovision device
379 ${olt_device_id}= Run Keyword If "${list_olts}[${I}][type]" == "${None}"
380 ... Create Device ${list_olts}[${I}][ip] ${list_olts}[${I}][oltport]
381 ... ELSE Create Device ${list_olts}[${I}][ip] ${list_olts}[${I}][oltport] ${list_olts}[${I}][type]
382 ${olt_serial_number}= Set Variable ${list_olts}[${I}][sn]
383 #Set Suite Variable ${olt_device_id}
384 #validate olt states
385 Wait Until Keyword Succeeds ${timeout} 5s
386 ... Validate OLT Device PREPROVISIONED UNKNOWN UNKNOWN ${olt_device_id} by_dev_id=True
387 Sleep 5s
388 Enable Device ${olt_device_id}
389 # Increasing the timer to incorporate wait time for in-band
390 Wait Until Keyword Succeeds 540s 5s
391 ... Validate OLT Device ENABLED ACTIVE REACHABLE ${olt_serial_number}
392 ${logical_id}= Get Logical Device ID From SN ${olt_serial_number}
393 # Set Suite Variable ${logical_id}
394 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in VGC
395 ... ${olt_serial_number}
396 ${olt} Create Dictionary device_id ${olt_device_id} logical_id ${logical_id}
397 ... of_id ${of_id} sn ${olt_serial_number}
398 Append To List ${olt_ids} ${olt}
399 END
400 Set Global Variable ${olt_ids}
401
402Get ofID From OLT List
403 [Documentation] Retrieves the corresponding of_id for the OLT serial number specified
404 [Arguments] ${serial_number}
405 FOR ${I} IN RANGE 0 ${olt_count}
406 ${sn}= Get From Dictionary ${olt_ids}[${I}] sn
407 ${of_id}= Run Keyword IF "${serial_number}"=="${sn}"
408 ... Get From Dictionary ${olt_ids}[${I}] of_id ELSE Set Variable ${of_id}
409 END
410 [Return] ${of_id}
411
412Get OLTDeviceID From OLT List
413 [Documentation] Retrieves the corresponding olt_device_id for the OLT serial number specified
414 [Arguments] ${serial_number}
415 ${olt_device_id}= Set Variable 0
416 FOR ${I} IN RANGE 0 ${olt_count}
417 ${sn}= Get From Dictionary ${olt_ids}[${I}] sn
418 ${olt_device_id}= Run Keyword IF "${serial_number}"=="${sn}"
419 ... Get From Dictionary ${olt_ids}[${I}] device_id ELSE Set Variable ${olt_device_id}
420 END
421 [Return] ${olt_device_id}
422
423Get Num of Onus From OLT SN
424 [Documentation] Retrieves the corresponding number of ONUs for a given OLT based on serial number specified
425 [Arguments] ${serial_number}
426 ${num_of_olt_onus}= Set Variable 0
427 FOR ${I} IN RANGE 0 ${olt_count}
428 ${sn}= Get From Dictionary ${olt_ids}[${I}] sn
429 ${num_of_olt_onus}= Run Keyword IF "${serial_number}"=="${sn}"
430 ... Get From Dictionary ${list_olts}[${I}] onucount ELSE Set Variable ${num_of_olt_onus}
431 END
432 [Return] ${num_of_olt_onus}
433
434Validate ONUs After OLT Disable
435 [Documentation] Validates the ONUs state in Voltha, ONUs port state in VGC
436 ... and that pings do not succeed After corresponding OLT is Disabled
437 [Arguments] ${num_onus} ${olt_serial_number}
438 FOR ${I} IN RANGE 0 ${num_onus}
439 ${src}= Set Variable ${hosts.src[${I}]}
440 ${dst}= Set Variable ${hosts.dst[${I}]}
441 Continue For Loop If "${olt_serial_number}"!="${src['olt']}"
442 ${of_id}= Get ofID From OLT List ${src['olt']}
443 ${onu_device_id}= Get Device ID From SN ${src['onu']}
444 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in VGC ${src['onu']}
445 ... ${of_id}
446 ${valid_onu_states}= Create List stopping-openomci omci-flows-deleted
447 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
448 ... Validate Device ENABLED DISCOVERED
449 ... UNREACHABLE ${src['onu']} onu=True onu_reason=${valid_onu_states}
450 Wait Until Keyword Succeeds ${timeout} 2s
451 ... Verify UNI Port Is Disabled ${VGC_SSH_IP} ${VGC_SSH_PORT} ${src['onu']} ${src['uni_id']}
452 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
453 ... Wait Until Keyword Succeeds ${timeout} 2s
454 ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
455 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
456 END
457
458Delete All Devices and Verify
459 [Documentation] Remove any devices from VOLTHA and VGC
460 [Arguments] ${maclearning_enabled}=False
461 # Clear devices from VOLTHA
462 ${resp}= Get Request VGC devices
463 ${jsondata}= To Json ${resp.content}
464 ${length}= Get Length ${jsondata['devices']}
465 ${matched}= Set Variable False
466 ${matched}= Set Variable If '${length}' == '${num_olts}' True False
467 Run Keyword If ${matched} Disable Devices In Voltha Root=true
468 Wait Until Keyword Succeeds ${timeout} 2s Test Devices Disabled In Voltha Root=true
469 Delete Devices In Voltha Root=true
470 Wait Until Keyword Succeeds ${timeout} 2s Test Empty Device List
471 FOR ${I} IN RANGE 0 ${length}
472 ${value}= Get From List ${jsondata['devices']} ${I}
473 ${device_id}= Get From Dictionary ${value} id
474 ${olt_serial_number}= Get From Dictionary ${value} serial
475 #${olt_serial_number}= Set Variable ${list_olts}[${I}][sn]
476 Wait Until Keyword Succeeds ${timeout} 5s
477 ... Validate Deleted Device Cleanup In VGC ${VGC_SSH_IP} ${VGC_SSH_PORT} ${olt_serial_number} ${device_id}
478 ... ${maclearning_enabled}
479 END
480 Wait Until Keyword Succeeds ${timeout} 5s Validate Cleanup In ETCD ${INFRA_NAMESPACE}
481
482Teardown
483 [Documentation] kills processes and cleans up interfaces on src+dst servers
484 Run Keyword If ${has_dataplane} Clean Up Linux
485
486Teardown Suite
487 [Documentation] Clean up device if desired
488 Start Logging Setup or Teardown Teardown-${SUITE NAME}
489 Run Keyword If ${has_dataplane} Clean Up Linux
490 Run Keyword If ${teardown_device} Deactivate Subscribers In VGC
491 Run Keyword If ${teardown_device} Delete All Devices and Verify
492 Run Keyword And Continue On Failure Collect Logs
493 #Close All VGC SSH Connections
494 Run Keyword If ${has_dataplane} Clean Up All Nodes
495 Stop Logging Setup or Teardown Teardown-${SUITE NAME}
496
497Delete Device and Verify
498 [Arguments] ${olt_serial_number}
499 [Documentation] Disable -> Delete devices via voltctl and verify its removed
500 ${olt_device_id}= Get Device ID From SN ${olt_serial_number}
501 ${rc} ${output}= Run and Return Rc and Output
502 ... voltctl -c ${VOLTCTL_CONFIG} device disable ${olt_device_id}
503 Should Be Equal As Integers ${rc} 0
504 Sleep 5s
505 Wait Until Keyword Succeeds ${timeout} 5s
506 ... Validate OLT Device DISABLED UNKNOWN REACHABLE ${olt_serial_number}
507 ${rc} ${output}= Run and Return Rc and Output
508 ... voltctl -c ${VOLTCTL_CONFIG} device delete ${olt_device_id}
509 Sleep 50s
510 Should Be Equal As Integers ${rc} 0
511 Wait Until Keyword Succeeds ${timeout} 5s Validate Device Removed ${olt_device_id}
512 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 15s
513 ... Validate Deleted Device Cleanup In VGC ${VGC_SSH_IP} ${VGC_SSH_PORT} ${olt_serial_number} ${olt_device_id}
514
515Disable Enable PON Port Per OLT DT
516 [Arguments] ${olt_serial_number}
517 [Documentation] This keyword disables and then enables OLT PON port and
518 ... also validate ONUs for each corresponding case
519 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
520 ${olt_pon_port_list}= Retrieve OLT PON Ports ${olt_device_id}
521 ${olt_pon_port_list_len}= Get Length ${olt_pon_port_list}
522 FOR ${INDEX0} IN RANGE 0 ${olt_pon_port_list_len}
523 ${olt_pon_port}= Get From List ${olt_pon_port_list} ${INDEX0}
524 ${olt_peer_list}= Retrieve Peer List From OLT PON Port ${olt_device_id} ${olt_pon_port}
525 ${olt_peer_list_len}= Get Length ${olt_peer_list}
526 # Disable the OLT PON Port and Validate OLT Device
527 DisableOrEnable OLT PON Port disable ${olt_device_id} ${olt_pon_port}
528 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
529 ... Validate OLT PON Port Status ${olt_device_id} ${olt_pon_port}
530 ... DISABLED DISCOVERED
531 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
532 ... Validate OLT Device ENABLED ACTIVE REACHABLE
533 ... ${olt_serial_number}
534 Wait Until Keyword Succeeds ${timeout} 5s
535 ... Validate ONUs for PON OLT Disable DT ${olt_serial_number} ${olt_peer_list}
536 # Enable the OLT PON Port back, and check ONU status are back to "ACTIVE"
537 DisableOrEnable OLT PON Port enable ${olt_device_id} ${olt_pon_port}
538 Wait Until Keyword Succeeds ${timeout} 5s
539 ... Validate OLT PON Port Status ${olt_device_id} ${olt_pon_port}
540 ... ENABLED ACTIVE
541 ${olt_peer_list_new}= Wait Until Keyword Succeeds ${timeout} 5s
542 ... Retrieve Peer List From OLT PON Port ${olt_device_id} ${olt_pon_port} ${olt_peer_list_len}
543 Wait Until Keyword Succeeds ${timeout} 5s
544 ... Validate ONUs for PON OLT Enable DT ${olt_serial_number} ${olt_peer_list_new}
545 END
546
547Validate ONUs for PON OLT Disable DT
548 [Arguments] ${olt_sn} ${olt_peer_list}
549 [Documentation] This keyword validates that Ping fails for ONUs connected to Disabled OLT PON port
550 ... And Pings succeed for other Active OLT PON port ONUs
551 ... Also it removes subscriber and deletes ONUs for Disabled OLT PON port to replicate DT workflow
552 FOR ${I} IN RANGE 0 ${num_all_onus}
553 ${src}= Set Variable ${hosts.src[${I}]}
554 ${dst}= Set Variable ${hosts.dst[${I}]}
555 Continue For Loop If "${olt_sn}"!="${src['olt']}"
556 ${onu_device_id}= Get Device ID From SN ${src['onu']}
557 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in VGC ${src['olt']}
558 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in VGC ${src['onu']}
559 ... ${of_id} ${src['uni_id']}
560 ${matched}= Match ONU in PON OLT Peer List ${olt_peer_list} ${onu_device_id}
561 ${valid_onu_states}= Create List stopping-openomci omci-flows-deleted
562 Run Keyword If ${matched}
563 ... Run Keywords
564 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
565 ... Validate Device ENABLED DISCOVERED
566 ... UNREACHABLE ${src['onu']} onu=True onu_reason=${valid_onu_states}
567 ... AND Wait Until Keyword Succeeds ${timeout} 2s
568 ... Verify UNI Port Is Disabled ${VGC_SSH_IP} ${VGC_SSH_PORT} ${src['onu']} ${src['uni_id']}
569 ... AND Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
570 ... Wait Until Keyword Succeeds ${timeout} 2s
571 ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
572 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']}
573 ... ${src['container_name']}
574 # Remove Subscriber Access (To replicate DT workflow)
575 ... AND Wait Until Keyword Succeeds ${timeout} 2s Remove Subscriber Access ${of_id} ${onu_port}
576 #Execute VGC CLI Command use single connection
577 #... ${VGC_SSH_IP} ${VGC_SSH_PORT} volt-remove-subscriber-access ${of_id} ${onu_port}
578 # Delete ONU Device (To replicate DT workflow)
579 ... AND Delete Device ${onu_device_id}
580 # Additional Sleep to let subscriber and ONU delete process
581 ... AND Sleep 10s
582 ... ELSE
583 ... Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
584 ... Wait Until Keyword Succeeds ${timeout} 2s
585 ... Check Ping True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
586 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']}
587 ... ${src['container_name']}
588 END
589
590Validate ONUs for PON OLT Enable DT
591 [Arguments] ${olt_sn} ${olt_peer_list}
592 [Documentation] This keyword validates Ping succeeds for all Enabled/Acitve OLT PON ports
593 ... Also performs subscriberAdd/DHCP/Ping for the ONUs on Re-Enabled OLT PON port
594 FOR ${I} IN RANGE 0 ${num_all_onus}
595 ${src}= Set Variable ${hosts.src[${I}]}
596 ${dst}= Set Variable ${hosts.dst[${I}]}
597 Continue For Loop If "${olt_sn}"!="${src['olt']}"
598 ${onu_device_id}= Get Device ID From SN ${src['onu']}
599 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in VGC ${src['olt']}
600 ${nni_port}= Wait Until Keyword Succeeds ${timeout} 2s Get NNI Port in VGC ${of_id}
601 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in VGC ${src['onu']}
602 ... ${of_id} ${src['uni_id']}
603 ${matched}= Match ONU in PON OLT Peer List ${olt_peer_list} ${onu_device_id}
604 Run Keyword If ${matched}
605 ... Run Keywords
606 # Perform Cleanup
607 ... Run Keyword If ${has_dataplane} Clean Up Linux ${onu_device_id}
608 # Verify ONU port status
609 ... AND Wait Until Keyword Succeeds 120s 2s
610 ... Verify UNI Port Is Enabled ${src['onu']} ${src['uni_id']}
611 ... AND Wait Until Keyword Succeeds ${timeout} 2
612 # ... Execute VGC CLI Command use single connection ${VGC_SSH_IP} ${VGC_SSH_PORT}
613 # ... volt-add-subscriber-access ${of_id} ${onu_port}
614 ... Add Subscriber Details ${of_id} ${onu_port}
615 # Verify ONU state in voltha
616 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
617 ... Validate Device ENABLED ACTIVE REACHABLE
618 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
619 # Verify subscriber access flows are added for the ONU port
620 ... AND Wait Until Keyword Succeeds ${timeout} 5s
621 ... Verify Subscriber Access Flows Added For ONU DT In VGC ${VGC_SSH_IP} ${VGC_SSH_PORT} ${of_id}
622 ... ${onu_port} ${nni_port} ${src['s_tag']}
623 ... AND Run Keyword If ${has_dataplane}
624 ... Run Keyword And Continue On Failure Validate DHCP and Ping True
625 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
626 ... ${src['ip']} ${src['user']} ${src['pass']}
627 ... ${src['container_type']} ${src['container_name']}
628 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']}
629 ... ${dst['container_type']} ${dst['container_name']}
630 ... ELSE
631 ... Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
632 ... Wait Until Keyword Succeeds ${timeout} 2s
633 ... Check Ping True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
634 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']}
635 ... ${src['container_name']}
636 END
637
638Match ONU in PON OLT Peer List
639 [Arguments] ${olt_peer_list} ${onu_device_id}
640 [Documentation] This keyword matches if ONU device is present in OLT PON port peer list
641 ${matched}= Set Variable False
642 FOR ${olt_peer} IN @{olt_peer_list}
643 ${matched}= Set Variable If '${onu_device_id}' == '${olt_peer}' True False
644 Exit For Loop If ${matched}
645 END
646 [Return] ${matched}
647
648Collect Logs
649 [Documentation] Collect Logs from voltha for various commands
650 Run Keyword and Ignore Error Get Device List from Voltha
651 FOR ${I} IN RANGE 0 ${num_olts}
652 Run Keyword and Ignore Error Get Device Output from Voltha ${olt_ids}[${I}][device_id]
653 Run Keyword and Ignore Error Get Logical Device Output from Voltha ${olt_ids}[${I}][logical_id]
654 END
655
656Verify ping is successful except for given device
657 [Arguments] ${num_onus} ${exceptional_onu}
658 [Documentation] Checks that ping for all the devices are successful except the given ONU.
659 ${pingStatus} Set Variable True
660 FOR ${I} IN RANGE 0 ${num_all_onus}
661 ${src}= Set Variable ${hosts.src[${I}]}
662 ${dst}= Set Variable ${hosts.dst[${I}]}
663 ${pingStatus} Run Keyword If '${src['onu']}' == '${exceptional_onu}' Set Variable False
664 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
665 ... Wait Until Keyword Succeeds 60s 2s
666 ... Check Ping ${pingStatus} ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
667 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
668 END
669
670Verify ping is successful for ONUs not on this OLT
671 [Arguments] ${num_all_onus} ${exceptional_olt_id}
672 [Documentation] Checks that pings work for all the ONUs except for the ONUs on the given OLT.
673 #${pingStatus} Set Variable True
674 FOR ${I} IN RANGE 0 ${num_all_onus}
675 ${src}= Set Variable ${hosts.src[${I}]}
676 ${dst}= Set Variable ${hosts.dst[${I}]}
677 ${olt_device_id}= Get Device ID From SN ${src['olt']}
678 Continue For Loop If "${olt_device_id}"=="${exceptional_olt_id}"
679 #${pingStatus} Run Keyword If '${olt_device_id}' == '${exceptional_olt_id}' Set Variable False
680 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
681 ... Wait Until Keyword Succeeds 60s 2s
682 ... Check Ping True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
683 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
684 END
685
686Echo Message to OLT Logs
687 [Arguments] ${message}
688 [Documentation] Echoes ${message} into the OLT logs
689 FOR ${I} IN RANGE 0 ${num_olts}
690 ${olt_user} Evaluate ${olts}[${I}].get("user")
691 ${olt_pass} Evaluate ${olts}[${I}].get("pass")
692 ${olt_ssh_ip} Evaluate ${olts}[${I}].get("sship")
693 ${olt_type} Evaluate ${olts}[${I}].get("type")
694 Continue For Loop If "${olt_user}" == "${None}"
695 Continue For Loop If "${olt_pass}" == "${None}"
696 ${command_timeout}= Set Variable If "${olt_type}"=="adtranolt" 300s 180s
697 Wait Until Keyword Succeeds ${command_timeout} 10s Execute Remote Command
698 ... printf '%s\n' '' '' '${message}' '' >> /var/log/openolt.log
699 ... ${olt_ssh_ip} ${olt_user} ${olt_pass}
700 Wait Until Keyword Succeeds ${command_timeout} 10s Execute Remote Command
701 ... printf '%s\n' '' '' '${message}' '' >> /var/log/dev_mgmt_daemon.log
702 ... ${olt_ssh_ip} ${olt_user} ${olt_pass}
703 Wait Until Keyword Succeeds ${command_timeout} 10s Execute Remote Command
704 ... printf '%s\n' '' '' '${message}' '' >> /var/log/openolt_process_watchdog.log
705 ... ${olt_ssh_ip} ${olt_user} ${olt_pass}
706 END
707
708Start Logging
709 [Arguments] ${label}
710 [Documentation] Start logging for test ${label}
711 ${kail_process}= Run Keyword If "${container_log_dir}" != "${None}" Start Process kail -n ${NAMESPACE}
712 ... -n ${INFRA_NAMESPACE} cwd=${container_log_dir} stdout=${label}-combined.log
713 Set Test Variable ${kail_process}
714 Run Keyword If ${has_dataplane} Echo Message to OLT Logs START ${label}
715
716Start Logging Setup or Teardown
717 [Arguments] ${label}
718 [Documentation] Start logging for suite ${label}
719 ${file}= Replace String ${label} ${SPACE} -
720 ${kail_process}= Run Keyword If "${container_log_dir}" != "${None}" Start Process kail -n ${NAMESPACE}
721 ... -n ${INFRA_NAMESPACE} cwd=${container_log_dir} stdout=${file}-combined.log
722 Set Suite Variable ${kail_process}
723 Run Keyword If ${has_dataplane} Echo Message to OLT Logs START ${label}
724
725Stop Logging Setup or Teardown
726 [Arguments] ${label}
727 [Documentation] End logging for suite;
728 Run sync
729 Run Keyword If ${kail_process} Terminate Process ${kail_process}
730 ${test_logfile}= Run Keyword If "${container_log_dir}" != "${None}"
731 ... Join Path ${container_log_dir} ${label}-combined.log
732 Run Keyword If ${has_dataplane} Echo Message to OLT Logs END ${label}
733
734Stop Logging
735 [Arguments] ${label}
736 [Documentation] End logging for test; remove logfile if test passed and ${logging} is set to False
737 Run sync
738 Run Keyword If ${kail_process} Terminate Process ${kail_process}
739 ${test_logfile}= Run Keyword If "${container_log_dir}" != "${None}"
740 ... Join Path ${container_log_dir} ${label}-combined.log
741 Run Keyword If Test Passed
742 ... Run Keyword If "${logging}" == "False"
743 ... Run Keyword If "${test_logfile}" != "${None}"
744 ... Remove File ${test_logfile}
745 Run Keyword If ${has_dataplane} Echo Message to OLT Logs END ${label}
746
747Clean Up Linux
748 [Documentation] Kill processes and clean up interfaces on src+dst servers
749 [Arguments] ${onu_id}=${EMPTY}
750 FOR ${I} IN RANGE 0 ${num_all_onus}
751 ${src}= Set Variable ${hosts.src[${I}]}
752 ${dst}= Set Variable ${hosts.dst[${I}]}
753 ${onu_device_id}= Get Device ID From SN ${src['onu']}
754 Continue For Loop If '${onu_id}' != '${EMPTY}' and '${onu_id}' != '${onu_device_id}'
755 Execute Remote Command sudo pkill wpa_supplicant ${src['ip']}
756 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
757 Execute Remote Command sudo pkill dhclient ${src['ip']}
758 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
759 Execute Remote Command sudo pkill mausezahn ${src['ip']}
760 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
761 Run Keyword If '${dst['ip']}' != '${None}' Execute Remote Command pkill dhcpd
762 ... ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']} ${dst['container_name']}
763 Delete IP Addresses from Interface on Remote Host ${src['dp_iface_name']} ${src['ip']}
764 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
765 Run Keyword If '${dst['ip']}' != '${None}' Delete Interface on Remote Host
766 ... ${dst['dp_iface_name']}.${src['s_tag']} ${dst['ip']} ${dst['user']} ${dst['pass']}
767 ... ${dst['container_type']} ${dst['container_name']}
768 ${bng_ip}= Get Variable Value ${dst['noroot_ip']}
769 ${bng_user}= Get Variable Value ${dst['noroot_user']}
770 ${bng_pass}= Get Variable Value ${dst['noroot_pass']}
771 Run Keyword If "${bng_ip}" != "${NONE}" and "${bng_user}" != "${NONE}" and "${bng_pass}" != "${NONE}"
772 ... Execute Remote Command sudo pkill mausezahn ${bng_ip} ${bng_user} ${bng_pass}
773 ... ${dst['container_type']} ${dst['container_name']}
774 END
775
776Clean Up Linux Per OLT
777 [Documentation] Kill processes and clean up interfaces on src+dst servers
778 [Arguments] ${olt_serial_number}
779 FOR ${I} IN RANGE 0 ${num_all_onus}
780 ${src}= Set Variable ${hosts.src[${I}]}
781 ${dst}= Set Variable ${hosts.dst[${I}]}
782 ${onu_device_id}= Get Device ID From SN ${src['onu']}
783 ${sn}= Get Device ID From SN ${src['olt']}
784 #Continue For Loop If '${onu_id}' != '${EMPTY}' and '${onu_id}' != '${onu_device_id}'
785 Continue For Loop If '${olt_serial_number}' == '${sn}'
786 Execute Remote Command sudo pkill wpa_supplicant ${src['ip']}
787 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
788 Execute Remote Command sudo pkill dhclient ${src['ip']}
789 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
790 Execute Remote Command sudo pkill mausezahn ${src['ip']}
791 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
792 Run Keyword If '${dst['ip']}' != '${None}' Execute Remote Command pkill dhcpd
793 ... ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']} ${dst['container_name']}
794 Delete IP Addresses from Interface on Remote Host ${src['dp_iface_name']} ${src['ip']}
795 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
796 Run Keyword If '${dst['ip']}' != '${None}' Delete Interface on Remote Host
797 ... ${dst['dp_iface_name']}.${src['s_tag']} ${dst['ip']} ${dst['user']} ${dst['pass']}
798 ... ${dst['container_type']} ${dst['container_name']}
799 ${bng_ip}= Get Variable Value ${dst['noroot_ip']}
800 ${bng_user}= Get Variable Value ${dst['noroot_user']}
801 ${bng_pass}= Get Variable Value ${dst['noroot_pass']}
802 Run Keyword If "${bng_ip}" != "${NONE}" and "${bng_user}" != "${NONE}" and "${bng_pass}" != "${NONE}"
803 ... Execute Remote Command sudo pkill mausezahn ${bng_ip} ${bng_user} ${bng_pass}
804 ... ${dst['container_type']} ${dst['container_name']}
805 END
806
807Clean dhclient
808 [Documentation] Kills dhclient processes only for all RGs
809 FOR ${I} IN RANGE 0 ${num_all_onus}
810 ${src}= Set Variable ${hosts.src[${I}]}
811 ${dst}= Set Variable ${hosts.dst[${I}]}
812 Execute Remote Command sudo pkill dhclient ${src['ip']}
813 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
814 END
815
816Clean WPA Process
817 [Documentation] Kills wpa_supplicant processes only for all RGs
818 FOR ${I} IN RANGE 0 ${num_all_onus}
819 ${src}= Set Variable ${hosts.src[${I}]}
820 ${dst}= Set Variable ${hosts.dst[${I}]}
821 Run Keyword And Ignore Error Kill Linux Process [w]pa_supplicant ${src['ip']}
822 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
823 END
824
825Should Be Larger Than
826 [Documentation] Verify that value_1 is > value_2
827 [Arguments] ${value_1} ${value_2}
828 Run Keyword If ${value_1} <= ${value_2}
829 ... Fail The value ${value_1} is not larger than ${value_2}
830
831Should Be Larger Than Or Equal To
832 [Documentation] Verify that value_1 is >= value_2
833 [Arguments] ${value_1} ${value_2}
834 Run Keyword If ${value_1} < ${value_2}
835 ... Fail The value ${value_1} is not larger than or equal to ${value_2}
836
837Should Be Lower Than
838 [Documentation] Verify that value_1 is < value_2
839 [Arguments] ${value_1} ${value_2}
840 Run Keyword If ${value_1} >= ${value_2}
841 ... Fail The value ${value_1} is not lower than ${value_2}
842
843Should Be Float
844 [Documentation] Verify that value is a floating point number type
845 [Arguments] ${value}
846 ${type} Evaluate type(${value}).__name__
847 Should Be Equal ${type} float
848
849Should Be Newer Than Or Equal To
850 [Documentation] Compare two RFC3339 dates
851 [Arguments] ${value_1} ${value_2}
852 ${unix_v1} Parse RFC3339 ${value_1}
853 ${unix_v2} Parse RFC3339 ${value_2}
854 Run Keyword If ${unix_v1} < ${unix_v2}
855 ... Fail The value ${value_1} is not newer than or equal to ${value_2}
856
857Get Current Time
858 [Documentation] Return the current time in RFC3339 format
859 ${output}= Run date -u +"%FT%T%:z"
860 [return] ${output}
861
862Parse RFC3339
863 [Documentation] Parse an RFC3339 timestamp
864 [Arguments] ${dateStr}
865 ${rc} ${output}= Run and Return Rc and Output date --date="${dateStr}" "+%s"
866 Should Be Equal As Numbers ${rc} 0
867 [return] ${output}
868
869Execute Remote Command
870 [Documentation] SSH into a remote host and execute a command on the bare host or in a container.
871 ... This replaces and simplifies the Login And Run Command On Remote System keyword in CORDRobot.
872 [Arguments] ${cmd} ${ip} ${user} ${pass}=${None}
873 ... ${container_type}=${None} ${container_name}=${None} ${timeout}=${None}
874 ${conn_id}= SSHLibrary.Open Connection ${ip}
875 Run Keyword If '${pass}' != '${None}'
876 ... SSHLibrary.Login ${user} ${pass}
877 ... ELSE
878 ... SSHLibrary.Login With Public Key ${user} %{HOME}/.ssh/id_rsa
879 ${namespace}= Run Keyword If '${container_type}' == 'K8S' SSHLibrary.Execute Command
880 ... kubectl get pods --all-namespaces | grep ${container_name} | awk '{print $1}'
881 ${stdout} ${stderr} ${rc}= Run Keyword If '${container_type}' == 'LXC'
882 ... SSHLibrary.Execute Command lxc exec ${container_name} -- ${cmd}
883 ... return_stderr=True return_rc=True timeout=${timeout}
884 ... ELSE IF '${container_type}' == 'K8S'
885 ... SSHLibrary.Execute Command kubectl -n ${namespace} exec ${container_name} -- ${cmd}
886 ... return_stderr=True return_rc=True timeout=${timeout}
887 ... ELSE
888 ... SSHLibrary.Execute Command ${cmd} return_stderr=True return_rc=True timeout=${timeout}
889
890 Log ${stdout}
891 Log ${stderr}
892 Log ${rc}
893 SSHLibrary.Close Connection
894 [Return] ${stdout} ${stderr} ${rc}
895
896Start Remote Command
897 [Documentation] SSH into a remote host and execute a command on the bare host or in a container.
898 ... This replaces and simplifies the Login And Run Command On Remote System keyword in CORDRobot.
899 [Arguments] ${cmd} ${ip} ${user} ${pass}=${None}
900 ... ${container_type}=${None} ${container_name}=${None}
901 ${conn_id}= SSHLibrary.Open Connection ${ip}
902 Run Keyword If '${pass}' != '${None}'
903 ... SSHLibrary.Login ${user} ${pass}
904 ... ELSE
905 ... SSHLibrary.Login With Public Key ${user} %{HOME}/.ssh/id_rsa
906 ${namespace}= Run Keyword If '${container_type}' == 'K8S' SSHLibrary.Execute Command
907 ... kubectl get pods --all-namespaces | grep ${container_name} | awk '{print $1}'
908 Run Keyword If '${container_type}' == 'LXC'
909 ... SSHLibrary.Start Command lxc exec ${container_name} -- ${cmd}
910 ... ELSE IF '${container_type}' == 'K8S'
911 ... SSHLibrary.Start Command kubectl -n ${namespace} exec ${container_name} -- ${cmd}
912 ... ELSE
913 ... SSHLibrary.Start Command ${cmd}
914 # It seems that closing the connection immediately will sometimes kill the command
915 Sleep 1s
916 SSHLibrary.Close Connection
917
918Run Iperf3 Test Client
919 [Arguments] ${src} ${server} ${args}
920 [Documentation] Login to ${src} and run the iperf3 client against ${server} using ${args}.
921 ... Return a Dictionary containing the results of the test.
922 ${output} ${stderr} ${rc}= Execute Remote Command iperf3 -J -c ${server} ${args} -l 1024 -M 1350 | jq -M -c '.'
923 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
924 Should Be Equal As Integers ${rc} 0
925 ${object}= Evaluate json.loads(r'''${output}''') json
926 [Return] ${object}
927
928Run Iperf Test Client for MCAST
929 [Arguments] ${src} ${server} ${args}
930 [Documentation] Login to ${src} and run the iperf client against ${server} using ${args}.
931 ... Return a Dictionary containing the results of the test.
932 ${output} ${stderr} ${rc}= Execute Remote Command sudo iperf -c ${server} ${args} | jq -M -c '.'
933 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
934 Should Be Equal As Integers ${rc} 0
935 ${object}= Evaluate json.loads(r'''${output}''') json
936 [Return] ${object}
937
938Run Ping In Background
939 [Arguments] ${output_file} ${dst_ip} ${iface} ${ip} ${user} ${pass}=${None}
940 ... ${container_type}=${None} ${container_name}=${None}
941 [Documentation] Runs the 'ping' on remote system in background and stores the result in a file
942 ${result}= Login And Run Command On Remote System
943 ... echo "ping -I ${iface} ${dst_ip} > ${output_file} &" > ping.sh; chmod +x ping.sh; ./ping.sh
944 ... ${ip} ${user} ${pass} ${container_type} ${container_name}
945 Log ${result}
946
947Stop Ping Running In Background
948 [Arguments] ${ip} ${user} ${pass}=${None}
949 ... ${container_type}=${None} ${container_name}=${None}
950 [Documentation] Stops the 'ping' running in background on remote system
951 ${cmd}= Run Keyword If '${container_type}' == 'LXC' or '${container_type}' == 'K8S'
952 ... Set Variable kill -SIGINT `pgrep ping`
953 ... ELSE
954 ... Set Variable sudo kill -SIGINT `pgrep ping`
955 ${result}= Login And Run Command On Remote System
956 ... ${cmd} ${ip} ${user} ${pass} ${container_type} ${container_name}
957 Log ${result}
958
959Retrieve Remote File Contents
960 [Documentation] Retrieves the contents of the file on remote system
961 [Arguments] ${file} ${ip} ${user} ${pass}=${None}
962 ... ${container_type}=${None} ${container_name}=${None} ${prompt}=~$
963 ${output}= Login And Run Command On Remote System
964 ... cat ${file}
965 ... ${ip} ${user} ${pass} ${container_type} ${container_name} ${prompt}
966 [Return] ${output}
967
968RestoreONUs
969 [Documentation] Restore all connected ONUs
970 [Arguments] ${num_all_onus}
971 FOR ${I} IN RANGE 0 ${num_all_onus}
972 ${src}= Set Variable ${hosts.src[${I}]}
973 ${container_type}= Get Variable Value ${src['container_type']} "null"
974 ${container_name}= Get Variable Value ${src['container_name']} "null"
975 ${onu_type}= Get Variable Value ${src['onu_type']} "null"
976 #Get ens6f0 from ens6f0.22
977 ${if_name}= Replace String Using Regexp ${src['dp_iface_name']} \\..* \
978 Run Keyword IF '${onu_type}' == 'alpha' AlphaONURestoreDefault ${src['ip']} ${src['user']}
979 ... ${src['pass']} ${if_name} admin admin ${container_type} ${container_name}
980 END
981
982AlphaONURestoreDefault
983 [Documentation] Restore the Alpha ONU to factory setting
984 [Arguments] ${rg_ip} ${rg_user} ${rg_pass} ${onu_ifname}
985 ... ${onu_user} ${onu_pass} ${container_type}=${None} ${container_name}=${None}
986 ${output}= Login And Run Command On Remote System sudo ifconfig ${onu_ifname} 192.168.1.3/24
987 ... ${rg_ip} ${rg_user} ${rg_pass} ${container_type} ${container_name}
988 ${cmd} Catenate
989 ... (echo open "192.168.1.1"; sleep 1;
990 ... echo "${onu_user}"; sleep 1;
991 ... echo "${onu_pass}"; sleep 1;
992 ... echo "restoredefault"; sleep 1) | telnet
993 ${output}= Login And Run Command On Remote System ${cmd}
994 ... ${rg_ip} ${rg_user} ${rg_pass} ${container_type} ${container_name}
995 Log To Console ${output}
996 ${output}= Login And Run Command On Remote System sudo ifconfig ${onu_ifname} 0
997 ... ${rg_ip} ${rg_user} ${rg_pass} ${container_type} ${container_name}
998
999Create traffic with each pbit and capture at other end
1000 [Documentation] Generates upstream traffic using Mausezahn tool
1001 ... with each pbit and validates reception at other end using tcpdump
1002 [Arguments] ${target_ip} ${target_iface} ${src_iface}
1003 ... ${packet_count} ${packet_type} ${c_vlan} ${s_vlan} ${direction} ${tcpdump_filter}
1004 ... ${dst_ip} ${dst_user} ${dst_pass} ${dst_container_type} ${dst_container_name}
1005 ... ${src_ip} ${src_user} ${src_pass} ${src_container_type} ${src_container_name}
1006 FOR ${pbit} IN RANGE 8
1007 Execute Remote Command sudo pkill mausezahn
1008 ... ${src_ip} ${src_user} ${src_pass} ${src_container_type} ${src_container_name}
1009 ${var1}= Set Variable sudo mausezahn ${src_iface} -B ${target_ip} -c ${packet_count}
1010 ${var2}= Run Keyword If "${direction}"=="downstream"
1011 ... Set Variable -t ${packet_type} "dp=80, flags=rst, p=aa:aa:aa" -Q ${pbit}:${s_vlan},${pbit}:${c_vlan}
1012 ... ELSE
1013 ... Set Variable -t ${packet_type} "dp=80, flags=rst, p=aa:aa:aa" -Q ${pbit}:${c_vlan}
1014 ${cmd}= Set Variable ${var1} ${var2}
1015 Start Remote Command ${cmd} ${src_ip} ${src_user} ${src_pass}
1016 ... ${src_container_type} ${src_container_name}
1017 ${output} ${stderr} ${rc}= Execute Remote Command
1018 ... sudo tcpdump -l -U -c 30 -i ${target_iface} -e ${tcpdump_filter}
1019 ... ${dst_ip} ${dst_user} ${dst_pass} ${dst_container_type} ${dst_container_name}
1020 ... timeout=30 seconds
1021 Execute Remote Command sudo pkill mausezahn
1022 ... ${src_ip} ${src_user} ${src_pass} ${src_container_type} ${src_container_name}
1023 Run Keyword If "${tcpdump_filter}"=="tcp"
1024 ... Should Match Regexp ${output} , p ${pbit},
1025 END
1026
1027Determine Number Of ONU
1028 [Arguments] ${olt_serial_number}=${EMPTY} ${num_onus}=${num_all_onus}
1029 [Documentation] Determine the number of different ONUs for the given OLT taken from host.src
1030 ${onu_list} Create List
1031 FOR ${INDEX} IN RANGE 0 ${num_onus}
1032 Continue For Loop If "${olt_serial_number}"!="${hosts.src[${INDEX}].olt}" and "${olt_serial_number}"!="${EMPTY}"
1033 ${onu_id}= Get Index From List ${onu_list} ${hosts.src[${INDEX}].onu}
1034 Run Keyword If -1 == ${onu_id} Append To List ${onu_list} ${hosts.src[${INDEX}].onu}
1035 END
1036 ${real_num_onus}= Get Length ${onu_list}
1037 [Return] ${real_num_onus}
1038
1039Validate Cleanup In ETCD
1040 [Documentation] The keyword verifies that device, ports, flows, meters are all cleared in ETCD
1041 [Arguments] ${namespace}=default ${defaultkvstoreprefix}=voltha/voltha_voltha
1042 ${podname}= Set Variable etcd
1043 ${kvstoreprefix}= Get Kv Store Prefix ${defaultkvstoreprefix}
1044 # Log Devices Output and Verify Output Should be Empty
1045 ${commandget}= Catenate
1046 ... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/${kvstoreprefix}/devices --keys-only'
1047 ${result}= Exec Pod In Kube ${namespace} ${podname} ${commandget}
1048 Log ${result}
1049 Should Be Empty ${result} Stale Devices Data in Etcd!
1050 # Log Flows Output and Verify Output Should be Empty
1051 ${commandget}= Catenate
1052 ... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/${kvstoreprefix}/flows --keys-only'
1053 ${result}= Exec Pod In Kube ${namespace} ${podname} ${commandget}
1054 Log ${result}
1055 Should Be Empty ${result} Stale Flows Data in Etcd!
1056 # Log LogicalDevices Output and Verify Output Should be Empty
1057 ${commandget}= Catenate
1058 ... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/${kvstoreprefix}/logical_devices --keys-only'
1059 ${result}= Exec Pod In Kube ${namespace} ${podname} ${commandget}
1060 Log ${result}
1061 Should Be Empty ${result} Stale Logical Devices Data in Etcd!
1062 # Log LogicalFlows Output and Verify Output Should be Empty
1063 ${commandget}= Catenate
1064 ... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/${kvstoreprefix}/logical_flows --keys-only'
1065 ${result}= Exec Pod In Kube ${namespace} ${podname} ${commandget}
1066 Log ${result}
1067 Should Be Empty ${result} Stale Logical Flows Data in Etcd!
1068 # Log LogicalMeters Output and Verify Output Should be Empty
1069 ${commandget}= Catenate
1070 ... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/${kvstoreprefix}/logical_meters --keys-only'
1071 ${result}= Exec Pod In Kube ${namespace} ${podname} ${commandget}
1072 Log ${result}
1073 Should Be Empty ${result} Stale Logical Meters Data in Etcd!
1074 # Log LogicalPorts Output and Verify Output Should be Empty
1075 ${commandget}= Catenate
1076 ... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/${kvstoreprefix}/logical_ports --keys-only'
1077 ${result}= Exec Pod In Kube ${namespace} ${podname} ${commandget}
1078 Log ${result}
1079 Should Be Empty ${result} Stale Logical Ports Data in Etcd!
1080 # Log Openolt Output and Verify Output Should be Empty
1081 ${commandget}= Catenate
1082 ... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/${kvstoreprefix}/openolt --keys-only'
1083 ${result}= Exec Pod In Kube ${namespace} ${podname} ${commandget}
1084 Log ${result}
1085 Should Be Empty ${result} Stale Openolt Data in Etcd!
1086 # Log Openonu Output and Verify Output Should be Empty
1087 ${commandget}= Catenate
1088 ... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/${kvstoreprefix}/openonu --keys-only'
1089 ${result}= Exec Pod In Kube ${namespace} ${podname} ${commandget}
1090 Log ${result}
1091 Should Be Empty ${result} Stale Openonu Data in Etcd!
1092 # Log Ports Output and Verify Output Should be Empty
1093 ${commandget}= Catenate
1094 ... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/${kvstoreprefix}/ports --keys-only'
1095 ${result}= Exec Pod In Kube ${namespace} ${podname} ${commandget}
1096 Log ${result}
1097 Should Be Empty ${result} Stale Ports Data in Etcd!
1098 # Log ResourceInstances Output and Verify Output Should be Empty
1099 ${commandget}= Catenate
1100 ... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/${kvstoreprefix}/resource_instances --keys-only'
1101 ${result}= Exec Pod In Kube ${namespace} ${podname} ${commandget}
1102 Log ${result}
1103 Should Be Empty ${result} Stale Resource Instances Data in Etcd!
1104 # Log ResourceManager Output and Verify Output Should be Empty
1105 ${commandget}= Catenate
1106 ... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/${kvstoreprefix}/resource_manager --keys-only'
1107 ${result}= Exec Pod In Kube ${namespace} ${podname} ${commandget}
1108 Log ${result}
1109 Should Be Empty ${result} Stale Resource Manager Data in Etcd!
1110
1111Clean Up All Nodes
1112 [Documentation] Login to each node and kill all stale lxc prcoesses
1113 ${num_nodes}= Get Length ${nodes}
1114 FOR ${I} IN RANGE 0 ${num_nodes}
1115 ${node_ip}= Evaluate ${nodes}[${I}].get("ip")
1116 ${node_user}= Evaluate ${nodes}[${I}].get("user")
1117 ${node_pass}= Evaluate ${nodes}[${I}].get("pass")
1118 Run Keyword And Continue On Failure Start Remote Command kill -9 `pidof lxc`
1119 ... ${node_ip} ${node_user} ${node_pass}
1120 END
1121
1122Reboot XGSPON ONU
1123 [Documentation] Reboots the XGSPON ONU and verifies the ONU state after the reboot
1124 [Arguments] ${olt_sn} ${onu_sn} ${reason}
1125 FOR ${I} IN RANGE 0 ${num_olts}
1126 ${serial_number} Evaluate ${olts}[${I}].get("serial")
1127 Continue For Loop If "${serial_number}"!="${olt_sn}"
1128 ${board_tech} Evaluate ${olts}[${I}].get("board_technology")
1129 ${onu_device_id}= Get Device ID From SN ${onu_sn}
1130 Run Keyword If "${board_tech}"=="XGS-PON" Run Keywords
1131 ... Reboot Device ${onu_device_id}
1132 ... AND Wait Until Keyword Succeeds 120s 5s
1133 ... Validate Device ENABLED ACTIVE
1134 ... REACHABLE ${onu_sn} onu=True onu_reason=${reason}
1135 END
1136
1137Set Non-Critical Tag for XGSPON Tech
1138 [Documentation] Dynamically sets the test tag for xgs-pon based to non-critical
1139 FOR ${I} IN RANGE 0 ${num_olts}
1140 ${board_tech} Evaluate ${olts}[${I}].get("board_technology")
1141 Run Keyword If "${board_tech}"=="XGS-PON" Run Keywords
1142 ... Set Tags non-critical
1143 ... AND Exit For Loop
1144 END
1145
1146Perform Reboot ONUs and OLTs Physically
1147 [Documentation] This keyword reboots ONUs and OLTs physically
1148 ... It runs only on the PODs that are configured with PowerSwitch that
1149 ... controls the power off/on ONUs/OLT remotely (simulating a physical reboot)
1150 [Arguments] ${power_cycle_olt}=False
1151 Power Switch Connection Suite ${web_power_switch.ip} ${web_power_switch.user} ${web_power_switch.password}
1152 @{onu_list}= Create List
1153 FOR ${I} IN RANGE 0 ${num_all_onus}
1154 ${src}= Set Variable ${hosts.src[${I}]}
1155 ${dst}= Set Variable ${hosts.dst[${I}]}
1156 # If the power switch port is not specified, continue
1157 Continue For Loop If '${src["power_switch_port"]}' == '${None}'
1158 # Skip if we have already handled this ONU
1159 ${sn}= Set Variable ${src['onu']}
1160 ${onu_id}= Get Index From List ${onu_list} ${sn}
1161 Continue For Loop If -1 != ${onu_id}
1162 Append To List ${onu_list} ${sn}
1163 Disable Switch Outlet ${src['power_switch_port']}
1164 Sleep 10s
1165 Enable Switch Outlet ${src['power_switch_port']}
1166 END
1167 Pass Execution If '${power_cycle_olt}'=='False' Skipping OLT(s) Power Switch Reboot
1168 # Waiting extra time for the ONUs to come up
1169 Sleep 30s
1170 FOR ${I} IN RANGE 0 ${olt_count}
1171 ${olt_serial_number}= Get From Dictionary ${list_olts}[${I}] sn
1172 ${power_switch_port}= Get From Dictionary ${list_olts}[${I}] powerswitchport
1173 ${olt_ssh_ip}= Get From Dictionary ${list_olts}[${I}] sship
1174 # If the power switch port is not specified, continue
1175 Continue For Loop If '${power_switch_port}' == '${None}'
1176 Disable Switch Outlet ${power_switch_port}
1177 Sleep 10s
1178 Enable Switch Outlet ${power_switch_port}
1179 Run Keyword If ${has_dataplane} Wait Until Keyword Succeeds 120s 10s
1180 ... Check Remote System Reachability True ${olt_ssh_ip}
1181 END
1182 # Waiting extra time for the ONUs to come up
1183 Sleep 60s
1184
1185Count Number of UNI ports for OLT
1186 [Documentation] Count Provisioned UNI ports, for ONUs connected with specified OLT
1187 [Arguments] ${olt_serial_number} ${type_of_service}
1188 ${num_of_provisioned_onus_ports}= Evaluate 0
1189 FOR ${I} IN RANGE 0 ${num_all_onus}
1190 ${src}= Set Variable ${hosts.src[${I}]}
1191 Continue For Loop If "${olt_serial_number}"!="${src['olt']}"
1192 Continue For Loop If "${type_of_service}"!="${src['service_type']}"
1193 ${num_of_provisioned_onus_ports}= Evaluate ${num_of_provisioned_onus_ports} + 1
1194 END
1195 [Return] ${num_of_provisioned_onus_ports}