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