blob: f9f8df07e61eea8d3ad476cbe1505d372d8aeb82 [file] [log] [blame]
Kailash92764922019-07-25 08:21:39 -07001# Copyright 2017-present Open Networking Foundation
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
Kailash92764922019-07-25 08:21:39 -070014# robot test functions
15
16*** Settings ***
17Documentation Library for various utilities
18Library SSHLibrary
Kailash92764922019-07-25 08:21:39 -070019Library String
20Library DateTime
21Library Process
22Library Collections
23Library RequestsLibrary
24Library OperatingSystem
Andy Bavier63460da2020-02-20 14:35:12 -070025Library CORDRobot
26Library ImportResource resources=CORDRobot
TorstenThiemed4f48962020-12-08 12:17:19 +000027Resource ./voltctl.robot
Kailash92764922019-07-25 08:21:39 -070028
29*** Keywords ***
Kailash528f7c02019-07-31 10:55:49 -070030Check CLI Tools Configured
31 [Documentation] Tests that use 'voltctl' and 'kubectl' should execute this keyword in suite setup
32 # check voltctl and kubectl configured
Zack Williamsa8fe75a2020-01-10 14:25:27 -070033 ${voltctl_rc}= Run And Return RC voltctl device list
34 ${kubectl_rc}= Run And Return RC kubectl get pods
Gilles Depatie675a2062019-10-22 12:44:42 -040035 Run Keyword If ${voltctl_rc} != 0 or ${kubectl_rc} != 0 FATAL ERROR
36 ... VOLTCTL and KUBECTL not configured. Please configure before executing tests.
Gilles Depatieb5682f82019-10-31 10:39:45 -040037
38Send File To Onos
Zack Williamsa8fe75a2020-01-10 14:25:27 -070039 [Documentation] Send the content of the file to Onos to selected section of configuration
40 ... using Post Request
41 [Arguments] ${CONFIG_FILE} ${section}
42 ${Headers}= Create Dictionary Content-Type application/json
43 ${File_Data}= OperatingSystem.Get File ${CONFIG_FILE}
44 Log ${Headers}
45 Log ${File_Data}
46 ${resp}= Post Request ONOS
47 ... /onos/v1/network/configuration/${section} headers=${Headers} data=${File_Data}
48 Should Be Equal As Strings ${resp.status_code} 200
Andy Bavier88cd9f62019-11-26 16:22:33 -070049
50Common Test Suite Setup
51 [Documentation] Setup the test suite
Andy Bavier88cd9f62019-11-26 16:22:33 -070052 Set Global Variable ${KUBECTL_CONFIG} export KUBECONFIG=%{KUBECONFIG}
Matteo Scandolo5899be12020-11-11 15:38:07 -080053 Set Global Variable ${VOLTCTL_CONFIG} %{VOLTCONFIG}
Andy Bavier88cd9f62019-11-26 16:22:33 -070054 ${k8s_node_ip}= Evaluate ${nodes}[0].get("ip")
ubuntu6b6e7d42020-03-02 12:35:42 -080055 ${ONOS_REST_IP}= Get Environment Variable ONOS_REST_IP ${k8s_node_ip}
56 ${ONOS_SSH_IP}= Get Environment Variable ONOS_SSH_IP ${k8s_node_ip}
57 Set Global Variable ${ONOS_REST_IP}
58 Set Global Variable ${ONOS_SSH_IP}
Andy Bavier88cd9f62019-11-26 16:22:33 -070059 ${k8s_node_user}= Evaluate ${nodes}[0].get("user")
60 ${k8s_node_pass}= Evaluate ${nodes}[0].get("pass")
61 Check CLI Tools Configured
62 ${onos_auth}= Create List karaf karaf
63 ${HEADERS} Create Dictionary Content-Type=application/json
ubuntu6b6e7d42020-03-02 12:35:42 -080064 Create Session ONOS http://${ONOS_REST_IP}:${ONOS_REST_PORT} auth=${ONOS_AUTH}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -080065 ${num_olts} Get Length ${olts}
66 ${list_olts} Create List
Suchitra Vemuriac9785e2021-01-07 16:50:18 -080067 # Create olt list from the configuration file
Suchitra Vemuria6879aa2020-11-03 11:03:11 -080068 FOR ${I} IN RANGE 0 ${num_olts}
69 ${ip} Evaluate ${olts}[${I}].get("ip")
70 ${user} Evaluate ${olts}[${I}].get("user")
71 ${pass} Evaluate ${olts}[${I}].get("pass")
72 ${serial_number} Evaluate ${olts}[${I}].get("serial")
73 ${olt_ssh_ip} Evaluate ${olts}[${I}].get("sship")
Andrea Campanella3dcce272021-01-15 16:04:47 +010074 ${type} Evaluate ${olts}[${I}].get("type")
Suchitra Vemuri09f878d2021-02-10 18:19:04 -080075 ${orig_olt_port} Evaluate ${olts}[${I}].get("oltPort")
76 ${port}= Set Variable If "${orig_olt_port}" == "None" ${OLT_PORT} ${orig_olt_port}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -080077 ${onu_count}= Get ONU Count For OLT ${hosts.src} ${serial_number}
Suchitra Vemurife309412020-12-01 19:19:52 -080078 ${onu_list}= Get ONU List For OLT ${hosts.src} ${serial_number}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -080079 ${olt} Create Dictionary ip ${ip} user ${user} pass
Andrea Campanella3dcce272021-01-15 16:04:47 +010080 ... ${pass} sn ${serial_number} onucount ${onu_count} type ${type}
Suchitra Vemuri09f878d2021-02-10 18:19:04 -080081 ... sship ${olt_ssh_ip} oltport ${port} onus ${onu_list}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -080082 Append To List ${list_olts} ${olt}
83 END
84 ${num_all_onus}= Get Length ${hosts.src}
85 ${num_all_onus}= Convert to String ${num_all_onus}
Andy Bavier88cd9f62019-11-26 16:22:33 -070086 #send sadis file to onos
Andy Baviera2691752019-11-27 12:18:38 -070087 ${sadis_file}= Get Variable Value ${sadis.file}
Zack Williamsa8fe75a2020-01-10 14:25:27 -070088 Log To Console \nSadis File:${sadis_file}
Andy Bavier88cd9f62019-11-26 16:22:33 -070089 Run Keyword Unless '${sadis_file}' is '${None}' Send File To Onos ${sadis_file} apps/
Suchitra Vemuria6879aa2020-11-03 11:03:11 -080090 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}
Andrea Campanella3dcce272021-01-15 16:04:47 +010095 @{container_list}= Create List ${OLT_ADAPTER_APP_LABEL} adapter-open-onu voltha-api-server
Andy Bavier88cd9f62019-11-26 16:22:33 -070096 ... voltha-ro-core voltha-rw-core-11 voltha-rw-core-12 voltha-ofagent
97 Set Suite Variable ${container_list}
98 ${datetime}= Get Current Date
suraj gour7f6d5fe2019-11-29 10:56:35 +000099 Set Suite Variable ${datetime}
100
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800101Get 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")
TorstenThiemed4f48962020-12-08 12:17:19 +0000108 ${count}= Run Keyword If '${serial_number}' == '${sn}' Evaluate ${count} + 1
109 ... ELSE Set Variable ${count}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800110 END
111 [Return] ${count}
112
Suchitra Vemurife309412020-12-01 19:19:52 -0800113Get 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}].get("onu")
121 ... ELSE Set Variable ${onu_list}
122 END
123 [Return] ${onu_list}
124
suraj gour7f6d5fe2019-11-29 10:56:35 +0000125WPA Reassociate
suraj gour7f6d5fe2019-11-29 10:56:35 +0000126 [Documentation] Executes a particular wpa_cli reassociate, which performs force reassociation
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700127 [Arguments] ${iface} ${ip} ${user} ${pass}=${None}
128 ... ${container_type}=${None} ${container_name}=${None}
suraj gour7f6d5fe2019-11-29 10:56:35 +0000129 #Below for loops are used instead of sleep time, to execute reassociate command and check status
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700130 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
Andy Bavierb63f6d22020-03-12 15:34:37 -0700135 Exit For Loop If ${passed}
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700136 END
Andy Bavierb63f6d22020-03-12 15:34:37 -0700137 Should Be True ${passed} Status does not contain 'SUCCESS'
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700138 FOR ${i} IN RANGE 70
139 ${output}= Login And Run Command On Remote System
Andy Bavierae4a17e2020-02-25 14:54:36 -0700140 ... wpa_cli -i ${iface} status | grep SUCCESS ${ip} ${user}
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700141 ... ${pass} ${container_type} ${container_name}
142 ${passed}= Run Keyword And Return Status Should Contain ${output} SUCCESS
Andy Bavierb63f6d22020-03-12 15:34:37 -0700143 Exit For Loop If ${passed}
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700144 END
Andy Bavierb63f6d22020-03-12 15:34:37 -0700145 Should Be True ${passed} Status does not contain 'SUCCESS'
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700146
suraj gour7f6d5fe2019-11-29 10:56:35 +0000147Validate Authentication After Reassociate
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700148 [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
Andy Bavier84834d42020-02-25 13:49:50 -0700153 ${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
suraj gour7f6d5fe2019-11-29 10:56:35 +0000158 WPA Reassociate ${iface} ${ip} ${user} ${pass} ${container_type} ${container_name}
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700159 Run Keyword If '${auth_pass}' == 'True' Wait Until Keyword Succeeds ${timeout} 2s
Andy Bavier84834d42020-02-25 13:49:50 -0700160 ... Check Remote File Contents True ${wpa_log} ${iface}.*authentication completed successfully
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700161 ... ${ip} ${user} ${pass} ${container_type} ${container_name}
suraj gour7f6d5fe2019-11-29 10:56:35 +0000162 Run Keyword If '${auth_pass}' == 'False' Sleep 20s
Suchitra Vemuri3cb29f82020-02-25 13:59:58 -0800163 Run Keyword If '${auth_pass}' == 'False' Check Remote File Contents False /tmp/wpa.log
Andy Bavier84834d42020-02-25 13:49:50 -0700164 ... ${iface}.*authentication completed successfully ${ip} ${user} ${pass}
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700165 ... ${container_type} ${container_name}
suraj gourd5cfdbb2019-12-13 12:44:55 +0000166
167Send Dhclient Request To Release Assigned IP
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700168 [Arguments] ${iface} ${ip} ${user} ${path_dhcpleasefile} ${pass}=${None}
169 ... ${container_type}=${None} ${container_name}=${None}
suraj gourd5cfdbb2019-12-13 12:44:55 +0000170 [Documentation] Executes a dhclient with option to release ip against a particular interface on the RG (src)
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700171 ${result}= Login And Run Command On Remote System
172 ... dhclient -nw -r ${iface} && rm ${path_dhcpleasefile}/dhclient.* ${ip} ${user}
suraj gourd5cfdbb2019-12-13 12:44:55 +0000173 ... ${pass} ${container_type} ${container_name}
174 Log ${result}
175 #Should Contain ${result} DHCPRELEASE
176 [Return] ${result}
suraj gour1ecfae92019-12-20 15:11:40 +0000177
178Check Remote File Contents For WPA Logs
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700179 [Arguments] ${file_should_exist} ${file} ${pattern} ${ip} ${user} ${pass}=${None}
180 ... ${container_type}=${None} ${container_name}=${None} ${prompt}=~$
suraj gour1ecfae92019-12-20 15:11:40 +0000181 [Documentation] Checks for particular pattern count in a file
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700182 ${result}= Login And Run Command On Remote System
183 ... cat ${file} | grep '${pattern}' | wc -l ${ip} ${user} ${pass}
suraj gour1ecfae92019-12-20 15:11:40 +0000184 ... ${container_type} ${container_name} ${prompt}
185 [Return] ${result}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000186
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800187
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000188Perform Sanity Test
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800189 [Documentation] This keyword iterate all OLTs and performs Sanity Test Procedure
190 ... for all the ONUs connected to each OLT - ATT workflow
TorstenThiemec3c23232021-01-13 13:06:31 +0000191 ... For repeating sanity test without subscriber changes set flag supress_add_subscriber=True.
192 ... In all other (common) cases flag has to be set False (default).
193 [Arguments] ${supress_add_subscriber}=False
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800194 FOR ${J} IN RANGE 0 ${num_olts}
195 ${olt_serial_number}= Set Variable ${list_olts}[${J}][sn]
196 ${onu_count}= Set Variable ${list_olts}[${J}][onucount]
197 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS
198 ... ${olt_serial_number}
199 Set Global Variable ${of_id}
200 ${nni_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
201 ... Get NNI Port in ONOS ${of_id}
202 Set Global Variable ${nni_port}
203 # Verify Default Meter in ONOS (valid only for ATT)
204 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
205 ... Verify Default Meter Present in ONOS ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
206 Perform Sanity Test Per OLT ${of_id} ${nni_port} ${olt_serial_number} ${onu_count}
TorstenThiemec3c23232021-01-13 13:06:31 +0000207 ... ${supress_add_subscriber}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800208 END
209
210Perform Sanity Test Per OLT
TorstenThiemec3c23232021-01-13 13:06:31 +0000211 [Arguments] ${of_id} ${nni_port} ${olt_serial_number} ${num_onus} ${supress_add_subscriber}=False
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000212 [Documentation] This keyword performs Sanity Test Procedure
213 ... Sanity test performs authentication, dhcp and pings for all the ONUs given for the POD
214 ... This keyword can be used to call in any other tests where sanity check is required
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800215 ... and avoids duplication of code. - ATT workflow
TorstenThiemec3c23232021-01-13 13:06:31 +0000216 ... For repeating sanity test without subscriber changes set flag supress_add_subscriber=True.
217 ... In all other (common) cases flag has to be set False (default).
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800218 FOR ${I} IN RANGE 0 ${num_all_onus}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000219 ${src}= Set Variable ${hosts.src[${I}]}
220 ${dst}= Set Variable ${hosts.dst[${I}]}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800221 Continue For Loop If "${olt_serial_number}"!="${src['olt']}"
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000222 ${onu_device_id}= Get Device ID From SN ${src['onu']}
223 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
224 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
Suchitra Vemuri8078b972020-02-06 19:07:41 -0800225 # Check ONU port is Enabled in ONOS
226 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
Suchitra Vemuri760bdd32020-06-17 12:34:48 -0700227 ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
Suchitra Vemuri8078b972020-02-06 19:07:41 -0800228 # Verify EAPOL flows are added for the ONU port
TorstenThiemec3c23232021-01-13 13:06:31 +0000229 Run Keyword Unless ${supress_add_subscriber}
230 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
ubuntu6b6e7d42020-03-02 12:35:42 -0800231 ... Verify Eapol Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Suchitra Vemuri8078b972020-02-06 19:07:41 -0800232 # Verify ONU state in voltha
233 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
234 ... ENABLED ACTIVE REACHABLE
235 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
236 # Perform Authentication
Andy Bavier84834d42020-02-25 13:49:50 -0700237 ${wpa_log}= Run Keyword If ${has_dataplane} Catenate SEPARATOR=.
238 ... /tmp/wpa ${src['dp_iface_name']} log
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000239 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate Authentication True
240 ... ${src['dp_iface_name']} wpa_supplicant.conf ${src['ip']} ${src['user']} ${src['pass']}
Andy Bavier84834d42020-02-25 13:49:50 -0700241 ... ${src['container_type']} ${src['container_name']} ${wpa_log}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000242 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
ubuntu6b6e7d42020-03-02 12:35:42 -0800243 ... Verify ONU in AAA-Users ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
TorstenThiemec3c23232021-01-13 13:06:31 +0000244 Run Keyword Unless ${supress_add_subscriber}
245 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
ubuntu6b6e7d42020-03-02 12:35:42 -0800246 ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000247 ... volt-add-subscriber-access ${of_id} ${onu_port}
Suchitra Vemuri9da44302020-03-04 14:24:49 -0800248 # Verify that no pending flows exist for the ONU port
249 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
250 ... Verify No Pending Flows For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Hardik Windlass21807632020-04-14 16:24:55 +0530251 # Verify subscriber access flows are added for the ONU port
252 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
253 ... Verify Subscriber Access Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
254 ... ${onu_port} ${nni_port} ${src['c_tag']} ${src['s_tag']}
Hardik Windlass2a9b1592020-07-23 18:28:13 +0530255 # Verify Meters in ONOS
256 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
257 ... Verify Meters in ONOS ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id} ${onu_port}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000258 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate DHCP and Ping True
259 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
260 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
261 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
262 ... ${dst['container_name']}
263 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
ubuntu6b6e7d42020-03-02 12:35:42 -0800264 ... Validate Subscriber DHCP Allocation ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000265 END
266
Hardik Windlassa3d04b92020-02-17 15:06:05 +0000267Perform Sanity Test DT
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800268 [Documentation] This keyword iterate all OLTs and performs Sanity Test Procedure for DT workflow
TorstenThiemec3c23232021-01-13 13:06:31 +0000269 ... 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
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800272 FOR ${J} IN RANGE 0 ${num_olts}
273 ${olt_serial_number}= Set Variable ${list_olts}[${J}][sn]
274 ${num_onus}= Set Variable ${list_olts}[${J}][onucount]
275 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
276 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS
277 ... ${olt_serial_number}
278 Set Global Variable ${of_id}
279 ${nni_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
280 ... Get NNI Port in ONOS ${of_id}
281 Set Global Variable ${nni_port}
282 Perform Sanity Test DT Per OLT ${of_id} ${nni_port} ${olt_serial_number} ${num_onus}
TorstenThiemec3c23232021-01-13 13:06:31 +0000283 ... ${supress_add_subscriber}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800284 # Verify ONOS Flows
285 # Number of Access Flows on ONOS equals 4 * the Number of Active ONUs (2 for each downstream and upstream)
286 ${onos_flows_count}= Evaluate 4 * ${num_onus}
287 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
288 ... Verify Subscriber Access Flows Added Count DT ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
289 ... ${onos_flows_count}
290 # Verify VOLTHA Flows
291 # Number of per OLT Flows equals Twice the Number of Active ONUs (each for downstream and upstream) + 1 for LLDP
292 ${olt_flows}= Evaluate 2 * ${num_onus} + 1
293 # Number of per ONU Flows equals 2 (one each for downstream and upstream)
294 ${onu_flows}= Set Variable 2
295 Run Keyword Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Flows ${olt_flows}
296 ... ${olt_device_id}
297 ${List_ONU_Serial} Create List
298 Set Suite Variable ${List_ONU_Serial}
Suchitra Vemuri21a47fd2020-11-16 18:39:09 -0800299 Build ONU SN List ${List_ONU_Serial} ${olt_serial_number}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800300 Log ${List_ONU_Serial}
301 Run Keyword Wait Until Keyword Succeeds ${timeout} 5s Validate ONU Flows
302 ... ${List_ONU_Serial} ${onu_flows}
303 END
304
305
306Perform Sanity Test DT Per OLT
TorstenThiemec3c23232021-01-13 13:06:31 +0000307 [Arguments] ${of_id} ${nni_port} ${olt_serial_number} ${num_onus} ${supress_add_subscriber}=False
Hardik Windlassa3d04b92020-02-17 15:06:05 +0000308 [Documentation] This keyword performs Sanity Test Procedure for DT Workflow
309 ... Sanity test performs dhcp and pings (without EAPOL and DHCP flows) for all the ONUs given for the POD
310 ... This keyword can be used to call in any other tests where sanity check is required
311 ... and avoids duplication of code.
TorstenThiemec3c23232021-01-13 13:06:31 +0000312 ... For repeating sanity test without subscriber changes set flag supress_add_subscriber=True.
313 ... In all other (common) cases flag has to be set False (default).
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800314 FOR ${I} IN RANGE 0 ${num_all_onus}
Hardik Windlassa3d04b92020-02-17 15:06:05 +0000315 ${src}= Set Variable ${hosts.src[${I}]}
316 ${dst}= Set Variable ${hosts.dst[${I}]}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800317 Continue For Loop If "${olt_serial_number}"!="${src['olt']}"
Hardik Windlassa3d04b92020-02-17 15:06:05 +0000318 ${onu_device_id}= Get Device ID From SN ${src['onu']}
319 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
320 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
321 # Check ONU port is Enabled in ONOS
322 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
Suchitra Vemuri760bdd32020-06-17 12:34:48 -0700323 ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
TorstenThiemec3c23232021-01-13 13:06:31 +0000324 Run Keyword Unless ${supress_add_subscriber}
325 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
ubuntu6b6e7d42020-03-02 12:35:42 -0800326 ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
Hardik Windlassa3d04b92020-02-17 15:06:05 +0000327 ... volt-add-subscriber-access ${of_id} ${onu_port}
Hardik Windlassfb5eace2020-03-26 14:49:01 +0530328 # Verify subscriber access flows are added for the ONU port
329 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
Hardik Windlass25e11702020-03-30 20:05:19 +0530330 ... Verify Subscriber Access Flows Added For ONU DT ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
331 ... ${onu_port} ${nni_port} ${src['s_tag']}
TorstenThiemea36068c2021-02-19 09:57:32 +0000332 # Verify ONU state in voltha
333 ${onu_reasons}= Create List omci-flows-pushed
334 # In case of previous dis- and enable of ONU and no further subscriber add actions state will be onu-reenabled
335 Run Keyword If ${supress_add_subscriber} Append To List ${onu_reasons} onu-reenabled
Hardik Windlassa3d04b92020-02-17 15:06:05 +0000336 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
337 ... ENABLED ACTIVE REACHABLE
TorstenThiemec3c23232021-01-13 13:06:31 +0000338 ... ${src['onu']} onu=True onu_reason=${onu_reasons}
Hardik Windlass2a9b1592020-07-23 18:28:13 +0530339 # Verify Meters in ONOS
340 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
341 ... Verify Meters in ONOS ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id} ${onu_port}
Hardik Windlassfb5eace2020-03-26 14:49:01 +0530342 # TODO: Yet to Verify on the GPON based Physical POD (VOL-2652)
Hardik Windlassa3d04b92020-02-17 15:06:05 +0000343 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate DHCP and Ping True
344 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
345 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
346 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
347 ... ${dst['container_name']}
Hardik Windlassa3d04b92020-02-17 15:06:05 +0000348 END
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800349
350Validate All OLT Flows
351 [Documentation] This keyword iterate all OLTs and performs Sanity Test Procedure for DT workflow
352 FOR ${J} IN RANGE 0 ${num_olts}
353 ${olt_serial_number}= Set Variable ${list_olts}[${J}][sn]
354 ${num_onus}= Set Variable ${list_olts}[${J}][onucount]
355 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
356 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS
357 ... ${olt_serial_number}
358 Set Global Variable ${of_id}
359 # Verify ONOS Flows
360 # Number of Access Flows on ONOS equals 4 * the Number of Active ONUs (2 for each downstream and upstream)
361 ${onos_flows_count}= Evaluate 4 * ${num_onus}
362 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
363 ... Verify Subscriber Access Flows Added Count DT ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
364 ... ${onos_flows_count}
365 # Verify VOLTHA Flows
366 # Number of per OLT Flows equals Twice the Number of Active ONUs (each for downstream and upstream) + 1 for LLDP
367 ${olt_flows}= Evaluate 2 * ${num_onus} + 1
368 # Number of per ONU Flows equals 2 (one each for downstream and upstream)
369 ${onu_flows}= Set Variable 2
370 Run Keyword Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Flows ${olt_flows}
371 ... ${olt_device_id}
372 ${List_ONU_Serial} Create List
373 Set Suite Variable ${List_ONU_Serial}
Andrea Campanella6391f842020-11-16 10:01:18 +0100374 Build ONU SN List ${List_ONU_Serial} ${olt_serial_number}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800375 Log ${List_ONU_Serial}
376 Run Keyword Wait Until Keyword Succeeds ${timeout} 5s Validate ONU Flows
377 ... ${List_ONU_Serial} ${onu_flows}
378 END
Hardik Windlassa3d04b92020-02-17 15:06:05 +0000379
TorstenThieme70bc5262021-01-19 12:12:55 +0000380Perform Sanity Tests TT
381 [Documentation] This keyword performs both Sanity Test Procedure for TT Workflow
382 ... Sanity Test TT for HSIA, VoD, VoIP services and Sanity Test TT for MCAST
383 ... For repeating sanity tests without subscriber changes set flag supress_add_subscriber=True.
384 ... In all other (common) cases flag has to be set False (default).
385 [Arguments] ${supress_add_subscriber}=False
386 Perform Sanity Test TT ${supress_add_subscriber}
387 Perform Sanity Test TT MCAST ${supress_add_subscriber}
388
Suchitra Vemuri2f1e07d2020-06-26 19:18:01 -0700389Perform Sanity Test TT
390 [Documentation] This keyword performs Sanity Test Procedure for TT Workflow
391 ... Sanity test performs dhcp and pings (without EAPOL and DHCP flows) for all the ONUs given for the POD
392 ... This keyword can be used to call in any other tests where sanity check is required
393 ... and avoids duplication of code.
TorstenThieme70bc5262021-01-19 12:12:55 +0000394 ... For repeating sanity test without subscriber changes set flag supress_add_subscriber=True.
395 ... In all other (common) cases flag has to be set False (default).
396 [Arguments] ${supress_add_subscriber}=False
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800397 FOR ${I} IN RANGE 0 ${num_all_onus}
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -0700398 ${src}= Set Variable ${hosts.src[${I}]}
399 ${dst}= Set Variable ${hosts.dst[${I}]}
400 ${service_type}= Get Variable Value ${src['service_type']} "null"
TorstenThiemea36068c2021-02-19 09:57:32 +0000401 Run Keyword IF '${service_type}' != 'mcast' Sanity Test TT one ONU ${src} ${dst} ${supress_add_subscriber}
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -0700402 END
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -0700403
404Sanity Test TT one ONU
405 [Documentation] This keyword performs sanity test for a single ONU for TT workflow
406 ... Tests for one ONU
407 ... Assertions apply to HSIA, VoD, VoIP services
TorstenThieme70bc5262021-01-19 12:12:55 +0000408 ... For repeating sanity test without subscriber changes set flag supress_add_subscriber=True.
409 ... In all other (common) cases flag has to be set False (default).
410 [Arguments] ${src} ${dst} ${supress_add_subscriber}=False
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800411 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${src['olt']}
Suchitra Vemuri2f1e07d2020-06-26 19:18:01 -0700412 Set Global Variable ${of_id}
413 ${nni_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
414 ... Get NNI Port in ONOS ${of_id}
415 Set Global Variable ${nni_port}
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -0700416 ${onu_device_id}= Get Device ID From SN ${src['onu']}
417 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
418 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
419 # Check ONU port is Enabled in ONOS
420 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
421 ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
TorstenThiemea36068c2021-02-19 09:57:32 +0000422 Run Keyword Unless ${supress_add_subscriber}
423 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -0700424 ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
425 ... volt-add-subscriber-access ${of_id} ${onu_port}
426 Sleep 30s
TorstenThiemea36068c2021-02-19 09:57:32 +0000427 # Verify ONU state in voltha
428 ${onu_reasons}= Create List omci-flows-pushed
429 # In case of previous dis- and enable of ONU and no further subscriber add actions state will be onu-reenabled
430 Run Keyword If ${supress_add_subscriber} Append To List ${onu_reasons} onu-reenabled
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -0700431 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
432 ... ENABLED ACTIVE REACHABLE
Matteo Scandolo74bd5c32020-12-08 09:52:19 -0800433 ... ${src['onu']} onu=True onu_reason=${onu_reasons}
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -0700434 # TODO: Yet to Verify on the GPON based Physical POD (VOL-2652)
435 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate DHCP and Ping True
436 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
437 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
438 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
439 ... ${dst['container_name']}
Matteo Scandolo37a6cb72021-01-08 13:55:59 -0800440 Run Keyword IF '${src['service_type']}'!='hsia'
Suchitra Vemuri42819412020-10-01 17:45:43 -0700441 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
Suchitra Vemuri8d3b0032020-09-11 17:49:08 -0700442 ... Validate Subscriber DHCP Allocation ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Suchitra Vemuri42819412020-10-01 17:45:43 -0700443 ... ${src['c_tag']}
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -0700444
445Perform Sanity Test TT MCAST
446 [Documentation] This keyword performs Sanity Test Procedure for TT Workflow
447 ... Adds subscribers
448 ... Validates for MCAST
TorstenThieme70bc5262021-01-19 12:12:55 +0000449 ... For repeating sanity test without subscriber changes set flag supress_add_subscriber=True.
450 ... In all other (common) cases flag has to be set False (default).
451 [Arguments] ${supress_add_subscriber}=False
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800452 FOR ${I} IN RANGE 0 ${num_all_onus}
Suchitra Vemuri2f1e07d2020-06-26 19:18:01 -0700453 ${src}= Set Variable ${hosts.src[${I}]}
454 ${dst}= Set Variable ${hosts.dst[${I}]}
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -0700455 ${service_type}= Get Variable Value ${src['service_type']} "null"
456 Run Keyword IF '${service_type}' == 'mcast' Sanity Test TT MCAST one ONU ${src}
TorstenThiemea36068c2021-02-19 09:57:32 +0000457 ... ${dst} ${supress_add_subscriber}
Suchitra Vemuri2f1e07d2020-06-26 19:18:01 -0700458 END
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -0700459
460Sanity Test TT MCAST one ONU
461 [Documentation] This keyword performs sanity test for a single ONU for TT workflow
462 ... Tests for one ONU
463 ... Assertions apply to MCAST services
TorstenThieme70bc5262021-01-19 12:12:55 +0000464 ... For repeating sanity test without subscriber changes set flag supress_add_subscriber=True.
465 ... In all other (common) cases flag has to be set False (default).
466 [Arguments] ${src} ${dst} ${supress_add_subscriber}=False
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -0700467 # Check for iperf and jq tools
468 ${stdout} ${stderr} ${rc}= Execute Remote Command which iperf jq
469 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']}
470 ... ${src['container_name']}
471 Pass Execution If ${rc} != 0 Skipping test: iperf / jq not found on the RG
472
473 #Reset the IP on the interface
474 ${output}= Login And Run Command On Remote System sudo ifconfig ${src['dp_iface_name']} 0
475 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
476 # Kill iperf on BNG
477 ${rg_output}= Run Keyword and Continue On Failure Login And Run Command On Remote System
478 ... sudo kill -9 `pidof iperf`
479 ... ${dst['bng_ip']} ${dst['bng_user']} ${dst['bng_pass']} ${dst['container_type']}
480 ... ${dst['container_name']}
481
482 # Setup RG for Multi-cast test
483 ${output}= Login And Run Command On Remote System
484 ... sudo ifconfig ${src['dp_iface_name']} ${src['mcast_rg']} up ; sudo kill -9 `pidof iperf`
485 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
486 ${output}= Login And Run Command On Remote System
487 ... sudo ip route add ${src['mcast_grp_subnet_mask']} dev ${src['dp_iface_name']} scope link
488 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
489
490 # Perform operations for adding subscriber
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800491 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${src['olt']}
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -0700492 Set Global Variable ${of_id}
493 ${nni_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
494 ... Get NNI Port in ONOS ${of_id}
495 Set Global Variable ${nni_port}
496 ${onu_device_id}= Get Device ID From SN ${src['onu']}
497 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
498 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
499 # Check ONU port is Enabled in ONOS
500 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
501 ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
TorstenThiemea36068c2021-02-19 09:57:32 +0000502 Run Keyword Unless ${supress_add_subscriber}
503 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -0700504 ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
505 ... volt-add-subscriber-access ${of_id} ${onu_port}
506 Sleep 30s
TorstenThiemea36068c2021-02-19 09:57:32 +0000507 # Verify ONU state in voltha
508 ${onu_reasons}= Create List omci-flows-pushed
509 # In case of previous dis- and enable of ONU and no further subscriber add actions state will be onu-reenabled
510 Run Keyword If ${supress_add_subscriber} Append To List ${onu_reasons} onu-reenabled
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -0700511 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
512 ... ENABLED ACTIVE REACHABLE
Matteo Scandolo74bd5c32020-12-08 09:52:19 -0800513 ... ${src['onu']} onu=True onu_reason=${onu_reasons}
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -0700514
515 # Setup iperf on the BNG
516 ${server_output}= Login And Run Command On Remote System
517 ... sudo iperf -c ${dst['dp_iface_ip_qinq']} -u -T 32 -t 60 -i 1 &
518 ... ${dst['bng_ip']} ${dst['bng_user']} ${dst['bng_pass']} ${dst['container_type']}
519 ... ${dst['container_name']}
520
521 # Setup iperf on the RG
522 ${rg_output}= Run Keyword and Continue On Failure Wait Until Keyword Succeeds 90s 5s
523 ... Login And Run Command On Remote System
524 ... rm -rf /tmp/rg_output ; sudo iperf -s -u -B ${dst['dp_iface_ip_qinq']} -i 1 -D >> /tmp/rg_output
525 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
526 Log ${rg_output}
527 Sleep 60s
528 ${output}= Run Keyword and Continue On Failure Wait Until Keyword Succeeds 90s 5s
529 ... Login And Run Command On Remote System
530 ... cat /tmp/rg_output | grep KBytes
531 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
532 Log ${output}
533 Should Contain ${output} KBytes
534
535 # Kill iperf on BNG
536 ${rg_output}= Run Keyword and Continue On Failure Login And Run Command On Remote System
537 ... sudo kill -9 `pidof iperf`
538 ... ${dst['bng_ip']} ${dst['bng_user']} ${dst['bng_pass']} ${dst['container_type']}
539 ... ${dst['container_name']}
540
541 # Kill iperf on the RG
542 ${output}= Run Keyword and Continue On Failure Login And Run Command On Remote System
543 ... sudo kill -9 `pidof iperf`
544 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
545
Suchitra Vemuri2f1e07d2020-06-26 19:18:01 -0700546
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000547Setup
548 [Documentation] Pre-test Setup
549 #test for empty device list
550 Test Empty Device List
Suchitra Vemuri1d8e8172020-06-17 17:43:56 -0700551 Run Keyword If ${has_dataplane} Sleep 230s
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800552 # Create a list of olt ids (logical and device_id)
553 ${olt_ids} Create List
554 FOR ${I} IN RANGE 0 ${num_olts}
555 #create/preprovision device
Andrea Campanella3dcce272021-01-15 16:04:47 +0100556 ${olt_device_id}= Run Keyword If "${list_olts}[${I}][type]" == "${None}"
Suchitra Vemuri09f878d2021-02-10 18:19:04 -0800557 ... Create Device ${list_olts}[${I}][ip] ${list_olts}[${I}][oltport]
558 ... ELSE Create Device ${list_olts}[${I}][ip] ${list_olts}[${I}][oltport] ${list_olts}[${I}][type]
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800559 ${olt_serial_number}= Set Variable ${list_olts}[${I}][sn]
560 #Set Suite Variable ${olt_device_id}
561 #validate olt states
562 Wait Until Keyword Succeeds ${timeout} 5s
563 ... Validate OLT Device PREPROVISIONED UNKNOWN UNKNOWN ${olt_device_id}
564 Sleep 5s
565 Enable Device ${olt_device_id}
566 Wait Until Keyword Succeeds 380s 5s
567 ... Validate OLT Device ENABLED ACTIVE REACHABLE ${olt_serial_number}
568 ${logical_id}= Get Logical Device ID From SN ${olt_serial_number}
569 # Set Suite Variable ${logical_id}
570 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS
571 ... ${olt_serial_number}
572 ${olt} Create Dictionary device_id ${olt_device_id} logical_id ${logical_id}
573 ... of_id ${of_id} sn ${olt_serial_number}
574 Append To List ${olt_ids} ${olt}
575 END
576 Set Global Variable ${olt_ids}
577
578Get ofID From OLT List
579 [Documentation] Retrieves the corresponding of_id for the OLT serial number specified
580 [Arguments] ${serial_number}
581 FOR ${I} IN RANGE 0 ${olt_count}
582 ${sn}= Get From Dictionary ${olt_ids}[${I}] sn
Andrea Campanella317a94c2020-11-13 10:38:19 +0100583 ${of_id}= Run Keyword IF "${serial_number}"=="${sn}"
584 ... Get From Dictionary ${olt_ids}[${I}] of_id ELSE Set Variable ${of_id}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800585 END
586 [Return] ${of_id}
587
588Get OLTDeviceID From OLT List
589 [Documentation] Retrieves the corresponding olt_device_id for the OLT serial number specified
590 [Arguments] ${serial_number}
Suchitra Vemuri4b8f4f52020-11-17 19:12:50 -0800591 ${olt_device_id}= Set Variable 0
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800592 FOR ${I} IN RANGE 0 ${olt_count}
593 ${sn}= Get From Dictionary ${olt_ids}[${I}] sn
Andrea Campanella317a94c2020-11-13 10:38:19 +0100594 ${olt_device_id}= Run Keyword IF "${serial_number}"=="${sn}"
595 ... Get From Dictionary ${olt_ids}[${I}] device_id ELSE Set Variable ${olt_device_id}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800596 END
597 [Return] ${olt_device_id}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000598
Andrea Campanellad848de02020-11-24 10:23:41 +0100599Get Num of Onus From OLT SN
600 [Documentation] Retrieves the corresponding number of ONUs for a given OLT based on serial number specified
601 [Arguments] ${serial_number}
602 ${num_of_olt_onus}= Set Variable 0
603 FOR ${I} IN RANGE 0 ${olt_count}
604 ${sn}= Get From Dictionary ${olt_ids}[${I}] sn
605 ${num_of_olt_onus}= Run Keyword IF "${serial_number}"=="${sn}"
606 ... Get From Dictionary ${list_olts}[${I}] onucount ELSE Set Variable ${num_of_olt_onus}
607 END
608 [Return] ${num_of_olt_onus}
609
Hardik Windlassaaea3402020-03-10 19:45:45 +0530610Validate ONUs After OLT Disable
611 [Documentation] Validates the ONUs state in Voltha, ONUs port state in ONOS
612 ... and that pings do not succeed After corresponding OLT is Disabled
Andrea Campanella4e507882020-11-26 11:33:11 +0100613 [Arguments] ${num_onus} ${olt_serial_number}
Hardik Windlassaaea3402020-03-10 19:45:45 +0530614 FOR ${I} IN RANGE 0 ${num_onus}
615 ${src}= Set Variable ${hosts.src[${I}]}
616 ${dst}= Set Variable ${hosts.dst[${I}]}
Andrea Campanella4e507882020-11-26 11:33:11 +0100617 Continue For Loop If "${olt_serial_number}"!="${src['olt']}"
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800618 ${of_id}= Get ofID From OLT List ${src['olt']}
Hardik Windlassaaea3402020-03-10 19:45:45 +0530619 ${onu_device_id}= Get Device ID From SN ${src['onu']}
620 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
621 ... ${of_id}
622 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
623 ... Validate Device ENABLED DISCOVERED
624 ... UNREACHABLE ${src['onu']} onu=True onu_reason=stopping-openomci
625 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
Suchitra Vemuri760bdd32020-06-17 12:34:48 -0700626 ... Verify ONU Port Is Disabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
Hardik Windlassaaea3402020-03-10 19:45:45 +0530627 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
628 ... Wait Until Keyword Succeeds 60s 2s
629 ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
630 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
Hardik Windlassaaea3402020-03-10 19:45:45 +0530631 END
632
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000633Delete All Devices and Verify
634 [Documentation] Remove any devices from VOLTHA and ONOS
635 # Clear devices from VOLTHA
636 Disable Devices In Voltha Root=true
Suchitra Vemuri970747f2020-03-30 17:31:34 -0700637 Sleep 5s
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000638 Wait Until Keyword Succeeds ${timeout} 2s Test Devices Disabled In Voltha Root=true
639 Delete Devices In Voltha Root=true
Hardik Windlassdf5035e2021-01-27 08:34:59 +0000640 Sleep 30s
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000641 Wait Until Keyword Succeeds ${timeout} 2s Test Empty Device List
Hardik Windlasse8b99222021-01-25 10:03:14 +0000642 FOR ${I} IN RANGE 0 ${num_olts}
643 ${olt_serial_number}= Set Variable ${list_olts}[${I}][sn]
644 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 15s
645 ... Validate Deleted Device Cleanup In ONOS ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${olt_serial_number}
646 END
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000647 # Clear devices from ONOS
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800648 #Remove All Devices From ONOS
ubuntu6b6e7d42020-03-02 12:35:42 -0800649 #... http://karaf:karaf@${ONOS_REST_IP}:${ONOS_REST_PORT}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000650
651Teardown
652 [Documentation] kills processes and cleans up interfaces on src+dst servers
653 Run Keyword If ${has_dataplane} Clean Up Linux
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000654
655Teardown Suite
656 [Documentation] Clean up device if desired
657 Run Keyword If ${teardown_device} Delete All Devices and Verify
658
659Delete Device and Verify
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800660 [Arguments] ${olt_serial_number}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000661 [Documentation] Disable -> Delete devices via voltctl and verify its removed
Suchitra Vemuri2fa9bba2020-01-22 17:38:48 -0800662 ${olt_device_id}= Get Device ID From SN ${olt_serial_number}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000663 ${rc} ${output}= Run and Return Rc and Output
Matteo Scandolo5899be12020-11-11 15:38:07 -0800664 ... voltctl -c ${VOLTCTL_CONFIG} device disable ${olt_device_id}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000665 Should Be Equal As Integers ${rc} 0
666 Sleep 5s
667 Wait Until Keyword Succeeds ${timeout} 5s
668 ... Validate OLT Device DISABLED UNKNOWN REACHABLE ${olt_serial_number}
669 ${rc} ${output}= Run and Return Rc and Output
Matteo Scandolo5899be12020-11-11 15:38:07 -0800670 ... voltctl -c ${VOLTCTL_CONFIG} device delete ${olt_device_id}
Hardik Windlassdf5035e2021-01-27 08:34:59 +0000671 Sleep 50s
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000672 Should Be Equal As Integers ${rc} 0
673 Wait Until Keyword Succeeds ${timeout} 5s Validate Device Removed ${olt_device_id}
Hardik Windlasse8b99222021-01-25 10:03:14 +0000674 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 15s
675 ... Validate Deleted Device Cleanup In ONOS ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${olt_serial_number}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000676
Gayathri.Selvan283a63c2020-01-23 04:09:18 +0000677Repeat Sanity Test
678 [Documentation] This keyword performs Sanity Test Procedure
679 ... Sanity test performs authentication, dhcp and pings for all the ONUs given for the POD
680 ... This keyword can be used to call in any other tests where sanity check is required
681 ... with wpa reassociation
682 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${olt_serial_number}
683 Set Global Variable ${of_id}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800684 FOR ${I} IN RANGE 0 ${num_all_onus}
Gayathri.Selvan283a63c2020-01-23 04:09:18 +0000685 ${src}= Set Variable ${hosts.src[${I}]}
686 ${dst}= Set Variable ${hosts.dst[${I}]}
Suchitra Vemuri8078b972020-02-06 19:07:41 -0800687 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
688 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
689 # Check ONU port is Enabled in ONOD
690 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
Suchitra Vemuri760bdd32020-06-17 12:34:48 -0700691 ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
Suchitra Vemuri8078b972020-02-06 19:07:41 -0800692 # Verify EAPOL flows are added for the ONU port
693 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
David K. Bainbridgec0617c92020-03-05 21:17:19 -0800694 ... Verify Eapol Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Suchitra Vemuri8078b972020-02-06 19:07:41 -0800695 # Verify ONU state in voltha
Suchitra Vemurid1e27fb2020-02-01 16:34:37 -0800696 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
Suchitra Vemuri81e4f022020-02-01 13:16:02 -0800697 ... ENABLED ACTIVE REACHABLE
698 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
Suchitra Vemuri8078b972020-02-06 19:07:41 -0800699 # Perform Authentication
Gayathri.Selvan283a63c2020-01-23 04:09:18 +0000700 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
701 ... Validate Authentication After Reassociate
702 ... True ${src['dp_iface_name']} ${src['ip']} ${src['user']} ${src['pass']}
703 ... ${src['container_type']} ${src['container_name']}
704 Wait Until Keyword Succeeds ${timeout} 2s
David K. Bainbridgec0617c92020-03-05 21:17:19 -0800705 ... Verify ONU in AAA-Users ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Gayathri.Selvan283a63c2020-01-23 04:09:18 +0000706 Wait Until Keyword Succeeds ${timeout} 2s
David K. Bainbridgec0617c92020-03-05 21:17:19 -0800707 ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
Gayathri.Selvan283a63c2020-01-23 04:09:18 +0000708 ... volt-add-subscriber-access ${of_id} ${onu_port}
709 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
710 ... Validate DHCP and Ping True True
711 ... ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
712 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
713 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
714 ... ${dst['container_name']}
715 Wait Until Keyword Succeeds ${timeout} 2s Run Keyword And Continue On Failure
David K. Bainbridgec0617c92020-03-05 21:17:19 -0800716 ... Validate Subscriber DHCP Allocation ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Gayathri.Selvan283a63c2020-01-23 04:09:18 +0000717 END
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000718
Hardik Windlass41701e82021-01-12 17:44:44 +0000719Disable Enable PON Port Per OLT
720 [Arguments] ${olt_serial_number}
721 [Documentation] This keyword disables and then enables OLT PON port and
722 ... also validate ONUs for each corresponding case
723 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
724 ${olt_pon_port_list}= Retrieve OLT PON Ports ${olt_device_id}
725 ${olt_pon_port_list_len}= Get Length ${olt_pon_port_list}
726 FOR ${INDEX0} IN RANGE 0 ${olt_pon_port_list_len}
727 ${olt_pon_port}= Get From List ${olt_pon_port_list} ${INDEX0}
728 ${olt_peer_list}= Retrieve Peer List From OLT PON Port ${olt_device_id} ${olt_pon_port}
729 # Disable the OLT PON Port and Validate OLT Device
730 DisableOrEnable OLT PON Port disable ${olt_device_id} ${olt_pon_port}
731 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
732 ... Validate OLT PON Port Status ${olt_device_id} ${olt_pon_port}
733 ... DISABLED DISCOVERED
734 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
735 ... Validate OLT Device ENABLED ACTIVE REACHABLE
736 ... ${olt_serial_number}
737 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
738 ... Validate ONUs for PON OLT Disable ${olt_serial_number} ${olt_peer_list}
739 # Enable the OLT PON Port back, and check ONU status are back to "ACTIVE"
740 DisableOrEnable OLT PON Port enable ${olt_device_id} ${olt_pon_port}
741 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
742 ... Validate OLT PON Port Status ${olt_device_id} ${olt_pon_port}
743 ... ENABLED ACTIVE
744 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
745 ... Validate ONUs for PON OLT Enable ${olt_serial_number} ${olt_peer_list}
746 END
747
Hardik Windlass16cdf962020-04-29 15:26:50 +0530748Validate ONUs for PON OLT Disable
Hardik Windlass41701e82021-01-12 17:44:44 +0000749 [Arguments] ${olt_sn} ${olt_peer_list}
Hardik Windlass16cdf962020-04-29 15:26:50 +0530750 [Documentation] This keyword validates that Ping fails for ONUs connected to Disabled OLT PON port
751 ... And Pings succeed for other Active OLT PON port ONUs
752 ... Also it removes subscriber for Disabled OLT PON port ONUs to replicate ATT workflow
Hardik Windlass41701e82021-01-12 17:44:44 +0000753 FOR ${I} IN RANGE 0 ${num_all_onus}
Hardik Windlass16cdf962020-04-29 15:26:50 +0530754 ${src}= Set Variable ${hosts.src[${I}]}
755 ${dst}= Set Variable ${hosts.dst[${I}]}
Hardik Windlass41701e82021-01-12 17:44:44 +0000756 Continue For Loop If "${olt_sn}"!="${src['olt']}"
Hardik Windlass16cdf962020-04-29 15:26:50 +0530757 ${onu_device_id}= Get Device ID From SN ${src['onu']}
Hardik Windlass41701e82021-01-12 17:44:44 +0000758 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${src['olt']}
Hardik Windlass16cdf962020-04-29 15:26:50 +0530759 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
760 ... ${of_id}
761 ${matched}= Match ONU in PON OLT Peer List ${olt_peer_list} ${onu_device_id}
762 Run Keyword If ${matched}
763 ... Run Keywords
764 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
765 ... Validate Device ENABLED DISCOVERED
Hardik Windlass41701e82021-01-12 17:44:44 +0000766 ... UNREACHABLE ${src['onu']} onu=True onu_reason=omci-flows-deleted
Hardik Windlass16cdf962020-04-29 15:26:50 +0530767 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
768 ... Verify ONU Port Is Disabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
769 ... AND Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
770 ... Wait Until Keyword Succeeds 60s 2s
771 ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
772 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']}
773 ... ${src['container_name']}
774 # Remove Subscriber Access (To replicate ATT workflow)
775 ... AND Wait Until Keyword Succeeds ${timeout} 2s Execute ONOS CLI Command ${ONOS_SSH_IP}
776 ... ${ONOS_SSH_PORT} volt-remove-subscriber-access ${of_id} ${onu_port}
777 ... ELSE
778 ... Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
779 ... Wait Until Keyword Succeeds 60s 2s
780 ... Check Ping True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
781 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']}
782 ... ${src['container_name']}
Hardik Windlass16cdf962020-04-29 15:26:50 +0530783 END
784
785Validate ONUs for PON OLT Enable
Hardik Windlass41701e82021-01-12 17:44:44 +0000786 [Arguments] ${olt_sn} ${olt_peer_list}
Hardik Windlass16cdf962020-04-29 15:26:50 +0530787 [Documentation] This keyword validates Ping succeeds for all Enabled/Acitve OLT PON ports
788 ... Also performs Auth/subscriberAdd/DHCP/Ping for the ONUs on Re-Enabled OLT PON port
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800789 FOR ${I} IN RANGE 0 ${num_all_onus}
Hardik Windlass16cdf962020-04-29 15:26:50 +0530790 ${src}= Set Variable ${hosts.src[${I}]}
791 ${dst}= Set Variable ${hosts.dst[${I}]}
Hardik Windlass41701e82021-01-12 17:44:44 +0000792 Continue For Loop If "${olt_sn}"!="${src['olt']}"
Hardik Windlass16cdf962020-04-29 15:26:50 +0530793 ${onu_device_id}= Get Device ID From SN ${src['onu']}
Hardik Windlass41701e82021-01-12 17:44:44 +0000794 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${src['olt']}
Hardik Windlass16cdf962020-04-29 15:26:50 +0530795 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
796 ... ${of_id}
797 ${matched}= Match ONU in PON OLT Peer List ${olt_peer_list} ${onu_device_id}
798 ${wpa_log}= Run Keyword If ${has_dataplane} and ${matched} Catenate SEPARATOR=.
799 ... /tmp/wpa ${src['dp_iface_name']} log
800 Run Keyword If ${matched}
801 ... Run Keywords
802 # Perform Cleanup
803 ... Run Keyword If ${has_dataplane} Clean Up Linux ${onu_device_id}
804 # Verify ONU port status
805 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
806 ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
807 # Verify EAPOL flows are added for the ONU port
808 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
809 ... Verify Eapol Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
810 # Verify ONU state in voltha
811 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
812 ... Validate Device ENABLED ACTIVE REACHABLE
813 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
814 # Perform Authentication
815 ... AND Run Keyword If ${has_dataplane}
816 ... Run Keyword And Continue On Failure Validate Authentication True
817 ... ${src['dp_iface_name']} wpa_supplicant.conf ${src['ip']} ${src['user']} ${src['pass']}
818 ... ${src['container_type']} ${src['container_name']} ${wpa_log}
819 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
820 ... Verify ONU in AAA-Users ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
821 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
822 ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
823 ... volt-add-subscriber-access ${of_id} ${onu_port}
824 # Verify that no pending flows exist for the ONU port
825 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
826 ... Verify No Pending Flows For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
827 # Verify subscriber access flows are added for the ONU port
828 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
829 ... Verify Subscriber Access Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
830 ... ${onu_port} ${nni_port} ${src['c_tag']} ${src['s_tag']}
831 ... AND Run Keyword If ${has_dataplane}
832 ... Run Keyword And Continue On Failure Validate DHCP and Ping True
833 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
834 ... ${src['ip']} ${src['user']} ${src['pass']}
835 ... ${src['container_type']} ${src['container_name']}
836 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']}
837 ... ${dst['container_type']} ${dst['container_name']}
838 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
839 ... Validate Subscriber DHCP Allocation ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
840 ... AND Run Keyword and Ignore Error Get Device Output from Voltha ${onu_device_id}
841 ... ELSE
842 ... Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
843 ... Wait Until Keyword Succeeds 60s 2s
844 ... Check Ping True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
845 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']}
846 ... ${src['container_name']}
Hardik Windlass16cdf962020-04-29 15:26:50 +0530847 END
848
Hardik Windlass41701e82021-01-12 17:44:44 +0000849Disable Enable PON Port Per OLT DT
850 [Arguments] ${olt_serial_number}
851 [Documentation] This keyword disables and then enables OLT PON port and
852 ... also validate ONUs for each corresponding case
853 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
854 ${olt_pon_port_list}= Retrieve OLT PON Ports ${olt_device_id}
855 ${olt_pon_port_list_len}= Get Length ${olt_pon_port_list}
856 FOR ${INDEX0} IN RANGE 0 ${olt_pon_port_list_len}
857 ${olt_pon_port}= Get From List ${olt_pon_port_list} ${INDEX0}
858 ${olt_peer_list}= Retrieve Peer List From OLT PON Port ${olt_device_id} ${olt_pon_port}
859 # Disable the OLT PON Port and Validate OLT Device
860 DisableOrEnable OLT PON Port disable ${olt_device_id} ${olt_pon_port}
861 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
862 ... Validate OLT PON Port Status ${olt_device_id} ${olt_pon_port}
863 ... DISABLED DISCOVERED
864 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
865 ... Validate OLT Device ENABLED ACTIVE REACHABLE
866 ... ${olt_serial_number}
867 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
868 ... Validate ONUs for PON OLT Disable DT ${olt_serial_number} ${olt_peer_list}
869 Sleep 15s
870 # Enable the OLT PON Port back, and check ONU status are back to "ACTIVE"
871 DisableOrEnable OLT PON Port enable ${olt_device_id} ${olt_pon_port}
872 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
873 ... Validate OLT PON Port Status ${olt_device_id} ${olt_pon_port}
874 ... ENABLED ACTIVE
875 # Waiting extra time for the ONUs to come up
876 Sleep 60s
877 ${olt_peer_list_new}= Retrieve Peer List From OLT PON Port ${olt_device_id} ${olt_pon_port}
878 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
879 ... Validate ONUs for PON OLT Enable DT ${olt_serial_number} ${olt_peer_list_new}
880 END
881
Hardik Windlass16cdf962020-04-29 15:26:50 +0530882Validate ONUs for PON OLT Disable DT
Hardik Windlass41701e82021-01-12 17:44:44 +0000883 [Arguments] ${olt_sn} ${olt_peer_list}
Hardik Windlass16cdf962020-04-29 15:26:50 +0530884 [Documentation] This keyword validates that Ping fails for ONUs connected to Disabled OLT PON port
885 ... And Pings succeed for other Active OLT PON port ONUs
886 ... Also it removes subscriber and deletes ONUs for Disabled OLT PON port to replicate DT workflow
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800887 FOR ${I} IN RANGE 0 ${num_all_onus}
Hardik Windlass16cdf962020-04-29 15:26:50 +0530888 ${src}= Set Variable ${hosts.src[${I}]}
889 ${dst}= Set Variable ${hosts.dst[${I}]}
Hardik Windlass41701e82021-01-12 17:44:44 +0000890 Continue For Loop If "${olt_sn}"!="${src['olt']}"
Hardik Windlass16cdf962020-04-29 15:26:50 +0530891 ${onu_device_id}= Get Device ID From SN ${src['onu']}
Hardik Windlass41701e82021-01-12 17:44:44 +0000892 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${src['olt']}
Hardik Windlass16cdf962020-04-29 15:26:50 +0530893 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
894 ... ${of_id}
895 ${matched}= Match ONU in PON OLT Peer List ${olt_peer_list} ${onu_device_id}
896 Run Keyword If ${matched}
897 ... Run Keywords
898 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
899 ... Validate Device ENABLED DISCOVERED
900 ... UNREACHABLE ${src['onu']} onu=True onu_reason=stopping-openomci
901 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
902 ... Verify ONU Port Is Disabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
903 ... AND Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
904 ... Wait Until Keyword Succeeds 60s 2s
905 ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
906 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']}
907 ... ${src['container_name']}
908 # Remove Subscriber Access (To replicate DT workflow)
909 ... AND Wait Until Keyword Succeeds ${timeout} 2s Execute ONOS CLI Command ${ONOS_SSH_IP}
910 ... ${ONOS_SSH_PORT} volt-remove-subscriber-access ${of_id} ${onu_port}
911 ... AND Sleep 10s
912 # Delete ONU Device (To replicate DT workflow)
913 ... AND Delete Device ${onu_device_id}
914 ... AND Sleep 5s
915 ... ELSE
916 ... Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
917 ... Wait Until Keyword Succeeds 60s 2s
918 ... Check Ping True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
919 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']}
920 ... ${src['container_name']}
Hardik Windlass16cdf962020-04-29 15:26:50 +0530921 END
922
923Validate ONUs for PON OLT Enable DT
Hardik Windlass41701e82021-01-12 17:44:44 +0000924 [Arguments] ${olt_sn} ${olt_peer_list}
Hardik Windlass16cdf962020-04-29 15:26:50 +0530925 [Documentation] This keyword validates Ping succeeds for all Enabled/Acitve OLT PON ports
926 ... Also performs subscriberAdd/DHCP/Ping for the ONUs on Re-Enabled OLT PON port
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800927 FOR ${I} IN RANGE 0 ${num_all_onus}
Hardik Windlass16cdf962020-04-29 15:26:50 +0530928 ${src}= Set Variable ${hosts.src[${I}]}
929 ${dst}= Set Variable ${hosts.dst[${I}]}
Hardik Windlass41701e82021-01-12 17:44:44 +0000930 Continue For Loop If "${olt_sn}"!="${src['olt']}"
Hardik Windlass16cdf962020-04-29 15:26:50 +0530931 ${onu_device_id}= Get Device ID From SN ${src['onu']}
Hardik Windlass41701e82021-01-12 17:44:44 +0000932 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${src['olt']}
Hardik Windlass16cdf962020-04-29 15:26:50 +0530933 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
934 ... ${of_id}
935 ${matched}= Match ONU in PON OLT Peer List ${olt_peer_list} ${onu_device_id}
936 Run Keyword If ${matched}
937 ... Run Keywords
938 # Perform Cleanup
939 ... Run Keyword If ${has_dataplane} Clean Up Linux ${onu_device_id}
940 # Verify ONU port status
941 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
942 ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
943 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
944 ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
945 ... volt-add-subscriber-access ${of_id} ${onu_port}
946 # Verify ONU state in voltha
947 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
948 ... Validate Device ENABLED ACTIVE REACHABLE
949 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
950 # Verify subscriber access flows are added for the ONU port
951 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
952 ... Verify Subscriber Access Flows Added For ONU DT ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
953 ... ${onu_port} ${nni_port} ${src['s_tag']}
954 ... AND Run Keyword If ${has_dataplane}
955 ... Run Keyword And Continue On Failure Validate DHCP and Ping True
956 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
957 ... ${src['ip']} ${src['user']} ${src['pass']}
958 ... ${src['container_type']} ${src['container_name']}
959 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']}
960 ... ${dst['container_type']} ${dst['container_name']}
961 ... ELSE
962 ... Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
963 ... Wait Until Keyword Succeeds 60s 2s
964 ... Check Ping True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
965 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']}
966 ... ${src['container_name']}
Hardik Windlass16cdf962020-04-29 15:26:50 +0530967 END
968
969Match ONU in PON OLT Peer List
970 [Arguments] ${olt_peer_list} ${onu_device_id}
971 [Documentation] This keyword matches if ONU device is present in OLT PON port peer list
972 ${matched}= Set Variable False
973 FOR ${olt_peer} IN @{olt_peer_list}
974 ${matched}= Set Variable If '${onu_device_id}' == '${olt_peer}' True False
975 Exit For Loop If ${matched}
976 END
977 [Return] ${matched}
978
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000979Collect Logs
980 [Documentation] Collect Logs from voltha and onos cli for various commands
981 Run Keyword and Ignore Error Get Device List from Voltha
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800982 FOR ${I} IN RANGE 0 ${num_olts}
983 Run Keyword and Ignore Error Get Logical Device Output from Voltha ${logical_id}
984 Run Keyword and Ignore Error Get Device Output from Voltha ${olt_ids}[${I}][device_id]
985 Run Keyword and Ignore Error Get Logical Device Output from Voltha ${olt_ids}[${I}][logical_id]
986 END
987 #Run Keyword and Ignore Error Get Device Output from Voltha ${olt_device_id}
988 #Run Keyword and Ignore Error Get Logical Device Output from Voltha ${logical_id}
ubuntu6b6e7d42020-03-02 12:35:42 -0800989 Get ONOS Status ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
Gayathri.Selvanf68ea4b2020-02-03 07:36:39 +0000990
991Verify ping is succesful except for given device
992 [Arguments] ${num_onus} ${exceptional_onu_id}
993 [Documentation] Checks that ping for all the devices are successful except the given ONU.
994 ${pingStatus} Set Variable True
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800995 FOR ${I} IN RANGE 0 ${num_all_onus}
Gayathri.Selvanf68ea4b2020-02-03 07:36:39 +0000996 ${src}= Set Variable ${hosts.src[${I}]}
997 ${dst}= Set Variable ${hosts.dst[${I}]}
998 ${onu_device_id}= Get Device ID From SN ${src['onu']}
999 ${pingStatus} Run Keyword If '${onu_device_id}' == '${exceptional_onu_id}' Set Variable False
Suchitra Vemuri69bcad22020-12-09 11:11:14 -08001000 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
1001 ... Wait Until Keyword Succeeds 60s 2s
Gayathri.Selvanf68ea4b2020-02-03 07:36:39 +00001002 ... Check Ping ${pingStatus} ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
1003 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
1004 END
Andy Bavier4a8450e2020-02-04 08:58:37 -07001005
Suchitra Vemurife309412020-12-01 19:19:52 -08001006Verify ping is successful for ONUs not on this OLT
1007 [Arguments] ${num_all_onus} ${exceptional_olt_id}
1008 [Documentation] Checks that pings work for all the ONUs except for the ONUs on the given OLT.
1009 #${pingStatus} Set Variable True
1010 FOR ${I} IN RANGE 0 ${num_all_onus}
1011 ${src}= Set Variable ${hosts.src[${I}]}
1012 ${dst}= Set Variable ${hosts.dst[${I}]}
1013 ${olt_device_id}= Get Device ID From SN ${src['olt']}
1014 Continue For Loop If "${olt_device_id}"=="${exceptional_olt_id}"
1015 #${pingStatus} Run Keyword If '${olt_device_id}' == '${exceptional_olt_id}' Set Variable False
Suchitra Vemuri69bcad22020-12-09 11:11:14 -08001016 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
1017 ... Wait Until Keyword Succeeds 60s 2s
Suchitra Vemurife309412020-12-01 19:19:52 -08001018 ... Check Ping True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
1019 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
1020 END
1021
Andy Bavier1923ecc2020-06-18 14:06:40 -07001022Echo Message to OLT Logs
1023 [Arguments] ${message}
1024 [Documentation] Echoes ${message} into the OLT logs
Suchitra Vemuria6879aa2020-11-03 11:03:11 -08001025 FOR ${I} IN RANGE 0 ${num_olts}
1026 ${olt_user} Evaluate ${olts}[${I}].get("user")
1027 ${olt_pass} Evaluate ${olts}[${I}].get("pass")
1028 ${olt_ssh_ip} Evaluate ${olts}[${I}].get("sship")
Andrea Campanellaebf6f0d2021-01-12 13:10:29 +01001029 Continue For Loop If "${olt_user}" == "${None}"
1030 Continue For Loop If "${olt_pass}" == "${None}"
Suchitra Vemuria6879aa2020-11-03 11:03:11 -08001031 Wait Until Keyword Succeeds 180s 10s Execute Remote Command
1032 ... printf '%s\n' '' '' '${message}' '' >> /var/log/openolt.log
1033 ... ${olt_ssh_ip} ${olt_user} ${olt_pass}
1034 Wait Until Keyword Succeeds 180s 10s Execute Remote Command
1035 ... printf '%s\n' '' '' '${message}' '' >> /var/log/dev_mgmt_daemon.log
1036 ... ${olt_ssh_ip} ${olt_user} ${olt_pass}
1037 Wait Until Keyword Succeeds 180s 10s Execute Remote Command
1038 ... printf '%s\n' '' '' '${message}' '' >> /var/log/openolt_process_watchdog.log
1039 ... ${olt_ssh_ip} ${olt_user} ${olt_pass}
1040 END
Andy Bavier1923ecc2020-06-18 14:06:40 -07001041
Andy Bavierabeba262020-02-07 16:22:16 -07001042Start Logging
1043 [Arguments] ${label}
1044 [Documentation] Start logging for test ${label}
1045 ${kail_process}= Run Keyword If "${container_log_dir}" != "${None}" Start Process kail -n default
1046 ... -n voltha cwd=${container_log_dir} stdout=${label}-combined.log
1047 Set Test Variable ${kail_process}
Andy Bavier1923ecc2020-06-18 14:06:40 -07001048 Run Keyword If ${has_dataplane} Echo Message to OLT Logs START ${label}
Andy Bavierabeba262020-02-07 16:22:16 -07001049
1050Stop Logging
1051 [Arguments] ${label}
1052 [Documentation] End logging for test; remove logfile if test passed
1053 Run sync
1054 Run Keyword If ${kail_process} Terminate Process ${kail_process}
1055 ${test_logfile}= Run Keyword If "${container_log_dir}" != "${None}"
1056 ... Join Path ${container_log_dir} ${label}-combined.log
1057 Run Keyword If Test Passed Run Keyword If "${test_logfile}" != "${None}" Remove File ${test_logfile}
Andy Bavier1923ecc2020-06-18 14:06:40 -07001058 Run Keyword If ${has_dataplane} Echo Message to OLT Logs END ${label}
Andy Bavierabeba262020-02-07 16:22:16 -07001059
Suchitra Vemuria5fa3dd2020-02-04 14:38:49 -08001060Clean Up Linux
1061 [Documentation] Kill processes and clean up interfaces on src+dst servers
Hardik Windlass16cdf962020-04-29 15:26:50 +05301062 [Arguments] ${onu_id}=${EMPTY}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -08001063 FOR ${I} IN RANGE 0 ${num_all_onus}
Suchitra Vemuria5fa3dd2020-02-04 14:38:49 -08001064 ${src}= Set Variable ${hosts.src[${I}]}
1065 ${dst}= Set Variable ${hosts.dst[${I}]}
Hardik Windlass16cdf962020-04-29 15:26:50 +05301066 ${onu_device_id}= Get Device ID From SN ${src['onu']}
1067 Continue For Loop If '${onu_id}' != '${EMPTY}' and '${onu_id}' != '${onu_device_id}'
Andy Bavier84b83282020-06-30 05:47:49 -07001068 Execute Remote Command sudo pkill wpa_supplicant ${src['ip']}
Suchitra Vemuria5fa3dd2020-02-04 14:38:49 -08001069 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
Andy Bavier84b83282020-06-30 05:47:49 -07001070 Execute Remote Command sudo pkill dhclient ${src['ip']}
Suchitra Vemuria5fa3dd2020-02-04 14:38:49 -08001071 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
Andy Baviereff938d2020-06-29 18:27:49 -07001072 Execute Remote Command sudo pkill mausezahn ${src['ip']}
1073 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
1074 Run Keyword If '${dst['ip']}' != '${None}' Execute Remote Command pkill dhcpd
1075 ... ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']} ${dst['container_name']}
Suchitra Vemuria5fa3dd2020-02-04 14:38:49 -08001076 Delete IP Addresses from Interface on Remote Host ${src['dp_iface_name']} ${src['ip']}
1077 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
1078 Run Keyword If '${dst['ip']}' != '${None}' Delete Interface on Remote Host
1079 ... ${dst['dp_iface_name']}.${src['s_tag']} ${dst['ip']} ${dst['user']} ${dst['pass']}
1080 ... ${dst['container_type']} ${dst['container_name']}
Andy Bavier84b83282020-06-30 05:47:49 -07001081 ${bng_ip}= Get Variable Value ${dst['noroot_ip']}
1082 ${bng_user}= Get Variable Value ${dst['noroot_user']}
1083 ${bng_pass}= Get Variable Value ${dst['noroot_pass']}
Andy Bavierf4b7d1d2020-06-30 11:14:04 -07001084 Run Keyword If "${bng_ip}" != "${NONE}" and "${bng_user}" != "${NONE}" and "${bng_pass}" != "${NONE}"
1085 ... Execute Remote Command sudo pkill mausezahn ${bng_ip} ${bng_user} ${bng_pass}
Andy Baviereff938d2020-06-29 18:27:49 -07001086 ... ${dst['container_type']} ${dst['container_name']}
Suchitra Vemuria5fa3dd2020-02-04 14:38:49 -08001087 END
Scott Baker60e570d2020-02-02 22:10:13 -08001088
Suchitra Vemuria6879aa2020-11-03 11:03:11 -08001089Clean Up Linux Per OLT
1090 [Documentation] Kill processes and clean up interfaces on src+dst servers
1091 [Arguments] ${olt_serial_number}
1092 FOR ${I} IN RANGE 0 ${num_all_onus}
1093 ${src}= Set Variable ${hosts.src[${I}]}
1094 ${dst}= Set Variable ${hosts.dst[${I}]}
1095 ${onu_device_id}= Get Device ID From SN ${src['onu']}
1096 ${sn}= Get Device ID From SN ${src['olt']}
1097 #Continue For Loop If '${onu_id}' != '${EMPTY}' and '${onu_id}' != '${onu_device_id}'
1098 Continue For Loop If '${olt_serial_number}' == '${sn}'
1099 Execute Remote Command sudo pkill wpa_supplicant ${src['ip']}
1100 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
1101 Execute Remote Command sudo pkill dhclient ${src['ip']}
1102 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
1103 Execute Remote Command sudo pkill mausezahn ${src['ip']}
1104 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
1105 Run Keyword If '${dst['ip']}' != '${None}' Execute Remote Command pkill dhcpd
1106 ... ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']} ${dst['container_name']}
1107 Delete IP Addresses from Interface on Remote Host ${src['dp_iface_name']} ${src['ip']}
1108 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
1109 Run Keyword If '${dst['ip']}' != '${None}' Delete Interface on Remote Host
1110 ... ${dst['dp_iface_name']}.${src['s_tag']} ${dst['ip']} ${dst['user']} ${dst['pass']}
1111 ... ${dst['container_type']} ${dst['container_name']}
1112 ${bng_ip}= Get Variable Value ${dst['noroot_ip']}
1113 ${bng_user}= Get Variable Value ${dst['noroot_user']}
1114 ${bng_pass}= Get Variable Value ${dst['noroot_pass']}
1115 Run Keyword If "${bng_ip}" != "${NONE}" and "${bng_user}" != "${NONE}" and "${bng_pass}" != "${NONE}"
1116 ... Execute Remote Command sudo pkill mausezahn ${bng_ip} ${bng_user} ${bng_pass}
1117 ... ${dst['container_type']} ${dst['container_name']}
1118 END
1119
Suchitra Vemuri8d3b0032020-09-11 17:49:08 -07001120Clean dhclient
1121 [Documentation] Kills dhclient processes only for all RGs
Hardik Windlass41701e82021-01-12 17:44:44 +00001122 FOR ${I} IN RANGE 0 ${num_all_onus}
Suchitra Vemuri8d3b0032020-09-11 17:49:08 -07001123 ${src}= Set Variable ${hosts.src[${I}]}
1124 ${dst}= Set Variable ${hosts.dst[${I}]}
1125 Execute Remote Command sudo pkill dhclient ${src['ip']}
1126 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
1127 END
1128
Suchitra Vemurif7a033c2020-02-26 17:22:41 -08001129Clean WPA Process
1130 [Documentation] Kills wpa_supplicant processes only for all RGs
Suchitra Vemuria6879aa2020-11-03 11:03:11 -08001131 FOR ${I} IN RANGE 0 ${num_all_onus}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -08001132 ${src}= Set Variable ${hosts.src[${I}]}
1133 ${dst}= Set Variable ${hosts.dst[${I}]}
1134 Run Keyword And Ignore Error Kill Linux Process [w]pa_supplicant ${src['ip']}
1135 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
1136 END
1137
Scott Baker60e570d2020-02-02 22:10:13 -08001138Should Be Larger Than
1139 [Documentation] Verify that value_1 is > value_2
1140 [Arguments] ${value_1} ${value_2}
1141 Run Keyword If ${value_1} <= ${value_2}
1142 ... Fail The value ${value_1} is not larger than ${value_2}
1143
Scott Bakeree675552020-02-11 10:43:34 -08001144Should Be Larger Than Or Equal To
1145 [Documentation] Verify that value_1 is >= value_2
1146 [Arguments] ${value_1} ${value_2}
1147 Run Keyword If ${value_1} < ${value_2}
1148 ... Fail The value ${value_1} is not larger than or equal to ${value_2}
1149
Scott Baker60e570d2020-02-02 22:10:13 -08001150Should Be Float
1151 [Documentation] Verify that value is a floating point number type
1152 [Arguments] ${value}
1153 ${type} Evaluate type(${value}).__name__
1154 Should Be Equal ${type} float
1155
Scott Bakeree675552020-02-11 10:43:34 -08001156Should Be Newer Than Or Equal To
1157 [Documentation] Compare two RFC3339 dates
1158 [Arguments] ${value_1} ${value_2}
1159 ${unix_v1} Parse RFC3339 ${value_1}
1160 ${unix_v2} Parse RFC3339 ${value_2}
1161 Run Keyword If ${unix_v1} < ${unix_v2}
1162 ... Fail The value ${value_1} is not newer than or equal to ${value_2}
1163
Scott Baker60e570d2020-02-02 22:10:13 -08001164Get Current Time
1165 [Documentation] Return the current time in RFC3339 format
1166 ${output}= Run date -u +"%FT%T%:z"
1167 [return] ${output}
Scott Bakeree675552020-02-11 10:43:34 -08001168
1169Parse RFC3339
1170 [Documentation] Parse an RFC3339 timestamp
1171 [Arguments] ${dateStr}
1172 ${rc} ${output}= Run and Return Rc and Output date --date="${dateStr}" "+%s"
1173 Should Be Equal As Numbers ${rc} 0
1174 [return] ${output}
Matteo Scandolo142e6272020-04-29 17:36:59 -07001175
Gayathri.Selvan92d16862020-03-19 14:47:58 +00001176Get Bandwidth Profile Name For Given Subscriber
1177 [Arguments] ${subscriber_id} ${stream_type}=upstreamBandwidthProfile
1178 [Documentation] Keyword to get the bandwidth details of the given subscriber
1179 ${bandwidth_profile_output}= Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
1180 ... volt-programmed-subscribers | grep ${subscriber_id}
1181 @{bandwidth_profile_array}= Split String ${bandwidth_profile_output} ,
1182 Log ${bandwidth_profile_array}
1183 FOR ${value} IN @{bandwidth_profile_array}
1184 @{row_value}= Split String ${value} =
1185 ${bandwidth_profile_name}= Set Variable If '${row_value[0]}' == ' ${stream_type}'
1186 ... ${row_value[1]}
1187 ${bandwidth_profile_name}= Convert To String ${bandwidth_profile_name}
1188 Run Keyword If "${bandwidth_profile_name}" != "None" Exit For Loop
1189 END
1190 Log ${bandwidth_profile_name}
1191 [Return] ${bandwidth_profile_name}
1192
1193Execute Remote Command
1194 [Documentation] SSH into a remote host and execute a command on the bare host or in a container.
1195 ... This replaces and simplifies the Login And Run Command On Remote System keyword in CORDRobot.
1196 [Arguments] ${cmd} ${ip} ${user} ${pass}=${None}
Andy Baviereff938d2020-06-29 18:27:49 -07001197 ... ${container_type}=${None} ${container_name}=${None} ${timeout}=${None}
Gayathri.Selvan92d16862020-03-19 14:47:58 +00001198 ${conn_id}= SSHLibrary.Open Connection ${ip}
1199 Run Keyword If '${pass}' != '${None}'
1200 ... SSHLibrary.Login ${user} ${pass}
1201 ... ELSE
1202 ... SSHLibrary.Login With Public Key ${user} %{HOME}/.ssh/id_rsa
1203 ${namespace}= Run Keyword If '${container_type}' == 'K8S' SSHLibrary.Execute Command
1204 ... kubectl get pods --all-namespaces | grep ${container_name} | awk '{print $1}'
Andy Bavierf6ab19c2020-05-14 10:34:47 -07001205 ${stdout} ${stderr} ${rc}= Run Keyword If '${container_type}' == 'LXC'
1206 ... SSHLibrary.Execute Command lxc exec ${container_name} -- ${cmd}
Andy Baviereff938d2020-06-29 18:27:49 -07001207 ... return_stderr=True return_rc=True timeout=${timeout}
Gayathri.Selvan92d16862020-03-19 14:47:58 +00001208 ... ELSE IF '${container_type}' == 'K8S'
Andy Bavierf6ab19c2020-05-14 10:34:47 -07001209 ... SSHLibrary.Execute Command kubectl -n ${namespace} exec ${container_name} -- ${cmd}
Andy Baviereff938d2020-06-29 18:27:49 -07001210 ... return_stderr=True return_rc=True timeout=${timeout}
Gayathri.Selvan92d16862020-03-19 14:47:58 +00001211 ... ELSE
Andy Baviereff938d2020-06-29 18:27:49 -07001212 ... SSHLibrary.Execute Command ${cmd} return_stderr=True return_rc=True timeout=${timeout}
Andy Bavierf6ab19c2020-05-14 10:34:47 -07001213
1214 Log ${stdout}
1215 Log ${stderr}
1216 Log ${rc}
Gayathri.Selvan92d16862020-03-19 14:47:58 +00001217 SSHLibrary.Close Connection
Andy Bavierf6ab19c2020-05-14 10:34:47 -07001218 [Return] ${stdout} ${stderr} ${rc}
Gayathri.Selvan92d16862020-03-19 14:47:58 +00001219
Suraj Gour33651272020-05-04 10:10:16 +05301220Start Remote Command
1221 [Documentation] SSH into a remote host and execute a command on the bare host or in a container.
1222 ... This replaces and simplifies the Login And Run Command On Remote System keyword in CORDRobot.
1223 [Arguments] ${cmd} ${ip} ${user} ${pass}=${None}
1224 ... ${container_type}=${None} ${container_name}=${None}
1225 ${conn_id}= SSHLibrary.Open Connection ${ip}
1226 Run Keyword If '${pass}' != '${None}'
1227 ... SSHLibrary.Login ${user} ${pass}
1228 ... ELSE
1229 ... SSHLibrary.Login With Public Key ${user} %{HOME}/.ssh/id_rsa
1230 ${namespace}= Run Keyword If '${container_type}' == 'K8S' SSHLibrary.Execute Command
1231 ... kubectl get pods --all-namespaces | grep ${container_name} | awk '{print $1}'
1232 Run Keyword If '${container_type}' == 'LXC'
1233 ... SSHLibrary.Start Command lxc exec ${container_name} -- ${cmd}
1234 ... ELSE IF '${container_type}' == 'K8S'
1235 ... SSHLibrary.Start Command kubectl -n ${namespace} exec ${container_name} -- ${cmd}
1236 ... ELSE
1237 ... SSHLibrary.Start Command ${cmd}
Andy Bavier9fb23232020-06-30 15:12:20 -07001238 # It seems that closing the connection immediately will sometimes kill the command
1239 Sleep 1s
Suraj Gour33651272020-05-04 10:10:16 +05301240 SSHLibrary.Close Connection
1241
Gayathri.Selvan92d16862020-03-19 14:47:58 +00001242Run Iperf3 Test Client
1243 [Arguments] ${src} ${server} ${args}
1244 [Documentation] Login to ${src} and run the iperf3 client against ${server} using ${args}.
1245 ... Return a Dictionary containing the results of the test.
Andy Bavierf6ab19c2020-05-14 10:34:47 -07001246 ${output} ${stderr} ${rc}= Execute Remote Command iperf3 -J -c ${server} ${args} | jq -M -c '.'
Gayathri.Selvan92d16862020-03-19 14:47:58 +00001247 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
Andy Bavierf6ab19c2020-05-14 10:34:47 -07001248 Should Be Equal As Integers ${rc} 0
Gayathri.Selvan92d16862020-03-19 14:47:58 +00001249 ${object}= Evaluate json.loads(r'''${output}''') json
1250 [Return] ${object}
Hung-Wei Chiue0bec7c2020-05-29 22:16:56 +00001251
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -07001252Run Iperf Test Client for MCAST
1253 [Arguments] ${src} ${server} ${args}
1254 [Documentation] Login to ${src} and run the iperf client against ${server} using ${args}.
1255 ... Return a Dictionary containing the results of the test.
1256 ${output} ${stderr} ${rc}= Execute Remote Command sudo iperf -c ${server} ${args} | jq -M -c '.'
1257 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
1258 Should Be Equal As Integers ${rc} 0
1259 ${object}= Evaluate json.loads(r'''${output}''') json
1260 [Return] ${object}
1261
Hung-Wei Chiue0bec7c2020-05-29 22:16:56 +00001262RestoreONUs
1263 [Documentation] Restore all connected ONUs
Suchitra Vemuria6879aa2020-11-03 11:03:11 -08001264 [Arguments] ${num_all_onus}
1265 FOR ${I} IN RANGE 0 ${num_all_onus}
Hung-Wei Chiue0bec7c2020-05-29 22:16:56 +00001266 ${src}= Set Variable ${hosts.src[${I}]}
Hung-Wei Chiucc6e6552020-06-04 12:57:38 -07001267 ${container_type}= Get Variable Value ${src['container_type']} "null"
1268 ${container_name}= Get Variable Value ${src['container_name']} "null"
Hung-Wei Chiue0bec7c2020-05-29 22:16:56 +00001269 ${onu_type}= Get Variable Value ${src['onu_type']} "null"
Hung-Wei Chiucc6e6552020-06-04 12:57:38 -07001270 #Get ens6f0 from ens6f0.22
1271 ${if_name}= Replace String Using Regexp ${src['dp_iface_name']} \\..* \
Hung-Wei Chiue0bec7c2020-05-29 22:16:56 +00001272 Run Keyword IF '${onu_type}' == 'alpha' AlphaONURestoreDefault ${src['ip']} ${src['user']}
Hung-Wei Chiucc6e6552020-06-04 12:57:38 -07001273 ... ${src['pass']} ${if_name} admin admin ${container_type} ${container_name}
Hung-Wei Chiue0bec7c2020-05-29 22:16:56 +00001274 END
1275
1276AlphaONURestoreDefault
1277 [Documentation] Restore the Alpha ONU to factory setting
1278 [Arguments] ${rg_ip} ${rg_user} ${rg_pass} ${onu_ifname}
Hung-Wei Chiucc6e6552020-06-04 12:57:38 -07001279 ... ${onu_user} ${onu_pass} ${container_type}=${None} ${container_name}=${None}
Hung-Wei Chiue0bec7c2020-05-29 22:16:56 +00001280 ${output}= Login And Run Command On Remote System sudo ifconfig ${onu_ifname} 192.168.1.3/24
Hung-Wei Chiucc6e6552020-06-04 12:57:38 -07001281 ... ${rg_ip} ${rg_user} ${rg_pass} ${container_type} ${container_name}
TorstenThieme70bc5262021-01-19 12:12:55 +00001282 ${cmd} Catenate
Hung-Wei Chiue0bec7c2020-05-29 22:16:56 +00001283 ... (echo open "192.168.1.1"; sleep 1;
1284 ... echo "${onu_user}"; sleep 1;
1285 ... echo "${onu_pass}"; sleep 1;
1286 ... echo "restoredefault"; sleep 1) | telnet
1287 ${output}= Login And Run Command On Remote System ${cmd}
Hung-Wei Chiucc6e6552020-06-04 12:57:38 -07001288 ... ${rg_ip} ${rg_user} ${rg_pass} ${container_type} ${container_name}
Hung-Wei Chiue0bec7c2020-05-29 22:16:56 +00001289 Log To Console ${output}
1290 ${output}= Login And Run Command On Remote System sudo ifconfig ${onu_ifname} 0
Hung-Wei Chiucc6e6552020-06-04 12:57:38 -07001291 ... ${rg_ip} ${rg_user} ${rg_pass} ${container_type} ${container_name}
Suraj Gour33651272020-05-04 10:10:16 +05301292
1293Create traffic with each pbit and capture at other end
1294 [Documentation] Generates upstream traffic using Mausezahn tool
1295 ... with each pbit and validates reception at other end using tcpdump
1296 [Arguments] ${target_ip} ${target_iface} ${src_iface}
1297 ... ${packet_count} ${packet_type} ${target_port} ${vlan} ${tcpdump_filter}
1298 ... ${dst_ip} ${dst_user} ${dst_pass} ${dst_container_type} ${dst_container_name}
1299 ... ${src_ip} ${src_user} ${src_pass} ${src_container_type} ${src_container_name}
1300 FOR ${pbit} IN RANGE 8
Andy Baviereff938d2020-06-29 18:27:49 -07001301 Execute Remote Command sudo pkill mausezahn
Suraj Gour33651272020-05-04 10:10:16 +05301302 ... ${src_ip} ${src_user} ${src_pass} ${src_container_type} ${src_container_name}
Andy Baviereff938d2020-06-29 18:27:49 -07001303 ${var1}= Set Variable sudo mausezahn ${src_iface} -B ${target_ip} -c ${packet_count} -d 100m
Suraj Gour33651272020-05-04 10:10:16 +05301304 ${var2}= Set Variable -t ${packet_type} "dp=${target_port}" -p 1472 -Q ${pbit}:${vlan}
1305 ${cmd}= Set Variable ${var1} ${var2}
1306 Start Remote Command ${cmd} ${src_ip} ${src_user} ${src_pass}
1307 ... ${src_container_type} ${src_container_name}
1308 ${output} ${stderr} ${rc}= Execute Remote Command
Andy Baviereff938d2020-06-29 18:27:49 -07001309 ... sudo tcpdump -l -U -c 30 -i ${target_iface} -e ${tcpdump_filter}
Suraj Gour33651272020-05-04 10:10:16 +05301310 ... ${dst_ip} ${dst_user} ${dst_pass} ${dst_container_type} ${dst_container_name}
Andy Baviereff938d2020-06-29 18:27:49 -07001311 ... timeout=30 seconds
1312 Execute Remote Command sudo pkill mausezahn
Suraj Gour33651272020-05-04 10:10:16 +05301313 ... ${src_ip} ${src_user} ${src_pass} ${src_container_type} ${src_container_name}
1314 # VOL-3262: I'm seeing untagged downstream traffic at RG for pbit 0. According to Girish this is
1315 # incorrect behavior. Simplify the following check when VOL-3262 is resolved.
1316 Run Keyword If ${pbit}==0 and "${tcpdump_filter}"=="udp"
1317 ... Should Match Regexp ${output} \\.${target_port}: UDP,
1318 ... ELSE Should Match Regexp ${output} , p ${pbit},.*\\.${target_port}: UDP,
1319 END
TorstenThieme70bc5262021-01-19 12:12:55 +00001320
1321Determine Number Of ONU
1322 [Arguments] ${olt_serial_number}=${EMPTY} ${num_onus}=${num_all_onus}
1323 [Documentation] Determine the number of different ONUs for the given OLT taken from host.src
1324 ${onu_list} Create List
1325 FOR ${INDEX} IN RANGE 0 ${num_onus}
1326 Continue For Loop If "${olt_serial_number}"!="${hosts.src[${INDEX}].olt}" and "${olt_serial_number}"!="${EMPTY}"
1327 ${onu_id}= Get Index From List ${onu_list} ${hosts.src[${INDEX}].onu}
1328 Run Keyword If -1 == ${onu_id} Append To List ${onu_list} ${hosts.src[${INDEX}].onu}
1329 END
1330 ${real_num_onus}= Get Length ${onu_list}
1331 [Return] ${real_num_onus}