blob: a40d482c168e3879be1b3a1a4de11344be0f69c3 [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 Vemuria6879aa2020-11-03 11:03:11 -080075 ${onu_count}= Get ONU Count For OLT ${hosts.src} ${serial_number}
Suchitra Vemurife309412020-12-01 19:19:52 -080076 ${onu_list}= Get ONU List For OLT ${hosts.src} ${serial_number}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -080077 ${olt} Create Dictionary ip ${ip} user ${user} pass
Andrea Campanella3dcce272021-01-15 16:04:47 +010078 ... ${pass} sn ${serial_number} onucount ${onu_count} type ${type}
Suchitra Vemurife309412020-12-01 19:19:52 -080079 ... sship ${olt_ssh_ip} onus ${onu_list}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -080080 Append To List ${list_olts} ${olt}
81 END
82 ${num_all_onus}= Get Length ${hosts.src}
83 ${num_all_onus}= Convert to String ${num_all_onus}
Andy Bavier88cd9f62019-11-26 16:22:33 -070084 #send sadis file to onos
Andy Baviera2691752019-11-27 12:18:38 -070085 ${sadis_file}= Get Variable Value ${sadis.file}
Zack Williamsa8fe75a2020-01-10 14:25:27 -070086 Log To Console \nSadis File:${sadis_file}
Andy Bavier88cd9f62019-11-26 16:22:33 -070087 Run Keyword Unless '${sadis_file}' is '${None}' Send File To Onos ${sadis_file} apps/
Suchitra Vemuria6879aa2020-11-03 11:03:11 -080088 Set Suite Variable ${num_all_onus}
89 Set Suite Variable ${num_olts}
90 Set Suite Variable ${list_olts}
91 ${olt_count}= Get Length ${list_olts}
92 Set Suite Variable ${olt_count}
Andrea Campanella3dcce272021-01-15 16:04:47 +010093 @{container_list}= Create List ${OLT_ADAPTER_APP_LABEL} adapter-open-onu voltha-api-server
Andy Bavier88cd9f62019-11-26 16:22:33 -070094 ... voltha-ro-core voltha-rw-core-11 voltha-rw-core-12 voltha-ofagent
95 Set Suite Variable ${container_list}
96 ${datetime}= Get Current Date
suraj gour7f6d5fe2019-11-29 10:56:35 +000097 Set Suite Variable ${datetime}
98
Suchitra Vemuria6879aa2020-11-03 11:03:11 -080099Get ONU Count For OLT
100 [Arguments] ${src} ${serial_number}
101 [Documentation] Gets ONU Count for the specified OLT
102 ${src_length}= Get Length ${src}
103 ${count}= Set Variable 0
104 FOR ${I} IN RANGE 0 ${src_length}
105 ${sn} Evaluate ${src}[${I}].get("olt")
TorstenThiemed4f48962020-12-08 12:17:19 +0000106 ${count}= Run Keyword If '${serial_number}' == '${sn}' Evaluate ${count} + 1
107 ... ELSE Set Variable ${count}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800108 END
109 [Return] ${count}
110
Suchitra Vemurife309412020-12-01 19:19:52 -0800111Get ONU List For OLT
112 [Arguments] ${src} ${serial_number}
113 [Documentation] Gets ONU List for the specified OLT
114 ${src_length}= Get Length ${src}
115 ${onu_list}= Create List
116 FOR ${I} IN RANGE 0 ${src_length}
117 ${sn} Evaluate ${src}[${I}].get("olt")
118 Run Keyword If '${serial_number}' == '${sn}' Append To List ${onu_list} ${src}[${I}].get("onu")
119 ... ELSE Set Variable ${onu_list}
120 END
121 [Return] ${onu_list}
122
suraj gour7f6d5fe2019-11-29 10:56:35 +0000123WPA Reassociate
suraj gour7f6d5fe2019-11-29 10:56:35 +0000124 [Documentation] Executes a particular wpa_cli reassociate, which performs force reassociation
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700125 [Arguments] ${iface} ${ip} ${user} ${pass}=${None}
126 ... ${container_type}=${None} ${container_name}=${None}
suraj gour7f6d5fe2019-11-29 10:56:35 +0000127 #Below for loops are used instead of sleep time, to execute reassociate command and check status
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700128 FOR ${i} IN RANGE 70
129 ${output}= Login And Run Command On Remote System
130 ... wpa_cli -i ${iface} reassociate ${ip} ${user}
131 ... ${pass} ${container_type} ${container_name}
132 ${passed}= Run Keyword And Return Status Should Contain ${output} OK
Andy Bavierb63f6d22020-03-12 15:34:37 -0700133 Exit For Loop If ${passed}
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700134 END
Andy Bavierb63f6d22020-03-12 15:34:37 -0700135 Should Be True ${passed} Status does not contain 'SUCCESS'
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700136 FOR ${i} IN RANGE 70
137 ${output}= Login And Run Command On Remote System
Andy Bavierae4a17e2020-02-25 14:54:36 -0700138 ... wpa_cli -i ${iface} status | grep SUCCESS ${ip} ${user}
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700139 ... ${pass} ${container_type} ${container_name}
140 ${passed}= Run Keyword And Return Status Should Contain ${output} SUCCESS
Andy Bavierb63f6d22020-03-12 15:34:37 -0700141 Exit For Loop If ${passed}
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700142 END
Andy Bavierb63f6d22020-03-12 15:34:37 -0700143 Should Be True ${passed} Status does not contain 'SUCCESS'
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700144
suraj gour7f6d5fe2019-11-29 10:56:35 +0000145Validate Authentication After Reassociate
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700146 [Arguments] ${auth_pass} ${iface} ${ip} ${user} ${pass}=${None}
147 ... ${container_type}=${None} ${container_name}=${None}
148 [Documentation]
149 ... Executes a particular reassociate request on the RG using wpa_cli.
150 ... auth_pass determines if authentication should pass
Andy Bavier84834d42020-02-25 13:49:50 -0700151 ${wpa_log}= Catenate SEPARATOR=. /tmp/wpa ${iface} log
152 ${output}= Login And Run Command On Remote System truncate -s 0 ${wpa_log}; cat ${wpa_log}
153 ... ${ip} ${user} ${pass} ${container_type} ${container_name}
154 Log ${output}
155 Should Not Contain ${output} authentication completed successfully
suraj gour7f6d5fe2019-11-29 10:56:35 +0000156 WPA Reassociate ${iface} ${ip} ${user} ${pass} ${container_type} ${container_name}
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700157 Run Keyword If '${auth_pass}' == 'True' Wait Until Keyword Succeeds ${timeout} 2s
Andy Bavier84834d42020-02-25 13:49:50 -0700158 ... Check Remote File Contents True ${wpa_log} ${iface}.*authentication completed successfully
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700159 ... ${ip} ${user} ${pass} ${container_type} ${container_name}
suraj gour7f6d5fe2019-11-29 10:56:35 +0000160 Run Keyword If '${auth_pass}' == 'False' Sleep 20s
Suchitra Vemuri3cb29f82020-02-25 13:59:58 -0800161 Run Keyword If '${auth_pass}' == 'False' Check Remote File Contents False /tmp/wpa.log
Andy Bavier84834d42020-02-25 13:49:50 -0700162 ... ${iface}.*authentication completed successfully ${ip} ${user} ${pass}
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700163 ... ${container_type} ${container_name}
suraj gourd5cfdbb2019-12-13 12:44:55 +0000164
165Send Dhclient Request To Release Assigned IP
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700166 [Arguments] ${iface} ${ip} ${user} ${path_dhcpleasefile} ${pass}=${None}
167 ... ${container_type}=${None} ${container_name}=${None}
suraj gourd5cfdbb2019-12-13 12:44:55 +0000168 [Documentation] Executes a dhclient with option to release ip against a particular interface on the RG (src)
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700169 ${result}= Login And Run Command On Remote System
170 ... dhclient -nw -r ${iface} && rm ${path_dhcpleasefile}/dhclient.* ${ip} ${user}
suraj gourd5cfdbb2019-12-13 12:44:55 +0000171 ... ${pass} ${container_type} ${container_name}
172 Log ${result}
173 #Should Contain ${result} DHCPRELEASE
174 [Return] ${result}
suraj gour1ecfae92019-12-20 15:11:40 +0000175
176Check Remote File Contents For WPA Logs
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700177 [Arguments] ${file_should_exist} ${file} ${pattern} ${ip} ${user} ${pass}=${None}
178 ... ${container_type}=${None} ${container_name}=${None} ${prompt}=~$
suraj gour1ecfae92019-12-20 15:11:40 +0000179 [Documentation] Checks for particular pattern count in a file
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700180 ${result}= Login And Run Command On Remote System
181 ... cat ${file} | grep '${pattern}' | wc -l ${ip} ${user} ${pass}
suraj gour1ecfae92019-12-20 15:11:40 +0000182 ... ${container_type} ${container_name} ${prompt}
183 [Return] ${result}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000184
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800185
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000186Perform Sanity Test
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800187 [Documentation] This keyword iterate all OLTs and performs Sanity Test Procedure
188 ... for all the ONUs connected to each OLT - ATT workflow
TorstenThiemec3c23232021-01-13 13:06:31 +0000189 ... 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
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800192 FOR ${J} IN RANGE 0 ${num_olts}
193 ${olt_serial_number}= Set Variable ${list_olts}[${J}][sn]
194 ${onu_count}= Set Variable ${list_olts}[${J}][onucount]
195 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS
196 ... ${olt_serial_number}
197 Set Global Variable ${of_id}
198 ${nni_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
199 ... Get NNI Port in ONOS ${of_id}
200 Set Global Variable ${nni_port}
201 # Verify Default Meter in ONOS (valid only for ATT)
202 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
203 ... Verify Default Meter Present in ONOS ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
204 Perform Sanity Test Per OLT ${of_id} ${nni_port} ${olt_serial_number} ${onu_count}
TorstenThiemec3c23232021-01-13 13:06:31 +0000205 ... ${supress_add_subscriber}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800206 END
207
208Perform Sanity Test Per OLT
TorstenThiemec3c23232021-01-13 13:06:31 +0000209 [Arguments] ${of_id} ${nni_port} ${olt_serial_number} ${num_onus} ${supress_add_subscriber}=False
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000210 [Documentation] This keyword performs Sanity Test Procedure
211 ... Sanity test performs authentication, dhcp and pings for all the ONUs given for the POD
212 ... This keyword can be used to call in any other tests where sanity check is required
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800213 ... and avoids duplication of code. - ATT workflow
TorstenThiemec3c23232021-01-13 13:06:31 +0000214 ... For repeating sanity test without subscriber changes set flag supress_add_subscriber=True.
215 ... In all other (common) cases flag has to be set False (default).
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800216 FOR ${I} IN RANGE 0 ${num_all_onus}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000217 ${src}= Set Variable ${hosts.src[${I}]}
218 ${dst}= Set Variable ${hosts.dst[${I}]}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800219 Continue For Loop If "${olt_serial_number}"!="${src['olt']}"
Suchitra Vemuri03005912020-02-20 18:59:46 -0800220 Run Keyword and Ignore Error Collect Logs
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000221 ${onu_device_id}= Get Device ID From SN ${src['onu']}
222 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
223 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
Suchitra Vemuri8078b972020-02-06 19:07:41 -0800224 # Check ONU port is Enabled in ONOS
225 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
Suchitra Vemuri760bdd32020-06-17 12:34:48 -0700226 ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
Suchitra Vemuri8078b972020-02-06 19:07:41 -0800227 # Verify EAPOL flows are added for the ONU port
TorstenThiemec3c23232021-01-13 13:06:31 +0000228 Run Keyword Unless ${supress_add_subscriber}
229 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
ubuntu6b6e7d42020-03-02 12:35:42 -0800230 ... Verify Eapol Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Suchitra Vemuri8078b972020-02-06 19:07:41 -0800231 # Verify ONU state in voltha
232 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
233 ... ENABLED ACTIVE REACHABLE
234 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
235 # Perform Authentication
Andy Bavier84834d42020-02-25 13:49:50 -0700236 ${wpa_log}= Run Keyword If ${has_dataplane} Catenate SEPARATOR=.
237 ... /tmp/wpa ${src['dp_iface_name']} log
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000238 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate Authentication True
239 ... ${src['dp_iface_name']} wpa_supplicant.conf ${src['ip']} ${src['user']} ${src['pass']}
Andy Bavier84834d42020-02-25 13:49:50 -0700240 ... ${src['container_type']} ${src['container_name']} ${wpa_log}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000241 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
ubuntu6b6e7d42020-03-02 12:35:42 -0800242 ... Verify ONU in AAA-Users ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
TorstenThiemec3c23232021-01-13 13:06:31 +0000243 Run Keyword Unless ${supress_add_subscriber}
244 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
ubuntu6b6e7d42020-03-02 12:35:42 -0800245 ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000246 ... volt-add-subscriber-access ${of_id} ${onu_port}
Suchitra Vemuri9da44302020-03-04 14:24:49 -0800247 # Verify that no pending flows exist for the ONU port
248 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
249 ... Verify No Pending Flows For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Hardik Windlass21807632020-04-14 16:24:55 +0530250 # Verify subscriber access flows are added for the ONU port
251 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
252 ... Verify Subscriber Access Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
253 ... ${onu_port} ${nni_port} ${src['c_tag']} ${src['s_tag']}
Hardik Windlass2a9b1592020-07-23 18:28:13 +0530254 # Verify Meters in ONOS
255 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
256 ... Verify Meters in ONOS ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id} ${onu_port}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000257 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate DHCP and Ping True
258 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
259 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
260 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
261 ... ${dst['container_name']}
262 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
ubuntu6b6e7d42020-03-02 12:35:42 -0800263 ... Validate Subscriber DHCP Allocation ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000264 Run Keyword and Ignore Error Get Device Output from Voltha ${onu_device_id}
265 Run Keyword and Ignore Error Collect Logs
266 END
267
Hardik Windlassa3d04b92020-02-17 15:06:05 +0000268Perform Sanity Test DT
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800269 [Documentation] This keyword iterate all OLTs and performs Sanity Test Procedure for DT workflow
TorstenThiemec3c23232021-01-13 13:06:31 +0000270 ... For repeating sanity test without subscriber changes set flag supress_add_subscriber=True.
271 ... In all other (common) cases flag has to be set False (default).
272 [Arguments] ${supress_add_subscriber}=False
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800273 FOR ${J} IN RANGE 0 ${num_olts}
274 ${olt_serial_number}= Set Variable ${list_olts}[${J}][sn]
275 ${num_onus}= Set Variable ${list_olts}[${J}][onucount]
276 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
Suchitra Vemuri4b8f4f52020-11-17 19:12:50 -0800277 Run Keyword and Ignore Error Collect Logs
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800278 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS
279 ... ${olt_serial_number}
280 Set Global Variable ${of_id}
281 ${nni_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
282 ... Get NNI Port in ONOS ${of_id}
283 Set Global Variable ${nni_port}
284 Perform Sanity Test DT Per OLT ${of_id} ${nni_port} ${olt_serial_number} ${num_onus}
TorstenThiemec3c23232021-01-13 13:06:31 +0000285 ... ${supress_add_subscriber}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800286 # Verify ONOS Flows
287 # Number of Access Flows on ONOS equals 4 * the Number of Active ONUs (2 for each downstream and upstream)
288 ${onos_flows_count}= Evaluate 4 * ${num_onus}
289 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
290 ... Verify Subscriber Access Flows Added Count DT ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
291 ... ${onos_flows_count}
292 # Verify VOLTHA Flows
293 # Number of per OLT Flows equals Twice the Number of Active ONUs (each for downstream and upstream) + 1 for LLDP
294 ${olt_flows}= Evaluate 2 * ${num_onus} + 1
295 # Number of per ONU Flows equals 2 (one each for downstream and upstream)
296 ${onu_flows}= Set Variable 2
297 Run Keyword Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Flows ${olt_flows}
298 ... ${olt_device_id}
299 ${List_ONU_Serial} Create List
300 Set Suite Variable ${List_ONU_Serial}
Suchitra Vemuri21a47fd2020-11-16 18:39:09 -0800301 Build ONU SN List ${List_ONU_Serial} ${olt_serial_number}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800302 Log ${List_ONU_Serial}
303 Run Keyword Wait Until Keyword Succeeds ${timeout} 5s Validate ONU Flows
304 ... ${List_ONU_Serial} ${onu_flows}
305 END
306
307
308Perform Sanity Test DT Per OLT
TorstenThiemec3c23232021-01-13 13:06:31 +0000309 [Arguments] ${of_id} ${nni_port} ${olt_serial_number} ${num_onus} ${supress_add_subscriber}=False
Hardik Windlassa3d04b92020-02-17 15:06:05 +0000310 [Documentation] This keyword performs Sanity Test Procedure for DT Workflow
311 ... Sanity test performs dhcp and pings (without EAPOL and DHCP flows) for all the ONUs given for the POD
312 ... This keyword can be used to call in any other tests where sanity check is required
313 ... and avoids duplication of code.
TorstenThiemec3c23232021-01-13 13:06:31 +0000314 ... For repeating sanity test without subscriber changes set flag supress_add_subscriber=True.
315 ... In all other (common) cases flag has to be set False (default).
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800316 FOR ${I} IN RANGE 0 ${num_all_onus}
Hardik Windlassa3d04b92020-02-17 15:06:05 +0000317 ${src}= Set Variable ${hosts.src[${I}]}
318 ${dst}= Set Variable ${hosts.dst[${I}]}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800319 Continue For Loop If "${olt_serial_number}"!="${src['olt']}"
Suchitra Vemuri4b8f4f52020-11-17 19:12:50 -0800320 Run Keyword and Ignore Error Collect Logs
Hardik Windlassa3d04b92020-02-17 15:06:05 +0000321 ${onu_device_id}= Get Device ID From SN ${src['onu']}
322 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
323 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
324 # Check ONU port is Enabled in ONOS
325 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
Suchitra Vemuri760bdd32020-06-17 12:34:48 -0700326 ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
TorstenThiemec3c23232021-01-13 13:06:31 +0000327 Run Keyword Unless ${supress_add_subscriber}
328 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
ubuntu6b6e7d42020-03-02 12:35:42 -0800329 ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
Hardik Windlassa3d04b92020-02-17 15:06:05 +0000330 ... volt-add-subscriber-access ${of_id} ${onu_port}
Hardik Windlassfb5eace2020-03-26 14:49:01 +0530331 # Verify subscriber access flows are added for the ONU port
332 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
Hardik Windlass25e11702020-03-30 20:05:19 +0530333 ... Verify Subscriber Access Flows Added For ONU DT ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
334 ... ${onu_port} ${nni_port} ${src['s_tag']}
TorstenThiemec3c23232021-01-13 13:06:31 +0000335 # Verify ONU state in voltha, in case of previous dis- and enable of ONU state will be onu-reenabled
336 ${onu_reasons}= Create List omci-flows-pushed onu-reenabled
Hardik Windlassa3d04b92020-02-17 15:06:05 +0000337 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
338 ... ENABLED ACTIVE REACHABLE
TorstenThiemec3c23232021-01-13 13:06:31 +0000339 ... ${src['onu']} onu=True onu_reason=${onu_reasons}
Hardik Windlass2a9b1592020-07-23 18:28:13 +0530340 # Verify Meters in ONOS
341 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
342 ... Verify Meters in ONOS ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id} ${onu_port}
Hardik Windlassfb5eace2020-03-26 14:49:01 +0530343 # TODO: Yet to Verify on the GPON based Physical POD (VOL-2652)
Hardik Windlassa3d04b92020-02-17 15:06:05 +0000344 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate DHCP and Ping True
345 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
346 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
347 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
348 ... ${dst['container_name']}
349 Run Keyword and Ignore Error Get Device Output from Voltha ${onu_device_id}
350 Run Keyword and Ignore Error Collect Logs
351 END
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800352
353Validate All OLT Flows
354 [Documentation] This keyword iterate all OLTs and performs Sanity Test Procedure for DT workflow
355 FOR ${J} IN RANGE 0 ${num_olts}
356 ${olt_serial_number}= Set Variable ${list_olts}[${J}][sn]
357 ${num_onus}= Set Variable ${list_olts}[${J}][onucount]
358 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
359 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS
360 ... ${olt_serial_number}
361 Set Global Variable ${of_id}
362 # Verify ONOS Flows
363 # Number of Access Flows on ONOS equals 4 * the Number of Active ONUs (2 for each downstream and upstream)
364 ${onos_flows_count}= Evaluate 4 * ${num_onus}
365 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
366 ... Verify Subscriber Access Flows Added Count DT ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
367 ... ${onos_flows_count}
368 # Verify VOLTHA Flows
369 # Number of per OLT Flows equals Twice the Number of Active ONUs (each for downstream and upstream) + 1 for LLDP
370 ${olt_flows}= Evaluate 2 * ${num_onus} + 1
371 # Number of per ONU Flows equals 2 (one each for downstream and upstream)
372 ${onu_flows}= Set Variable 2
373 Run Keyword Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Flows ${olt_flows}
374 ... ${olt_device_id}
375 ${List_ONU_Serial} Create List
376 Set Suite Variable ${List_ONU_Serial}
Andrea Campanella6391f842020-11-16 10:01:18 +0100377 Build ONU SN List ${List_ONU_Serial} ${olt_serial_number}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800378 Log ${List_ONU_Serial}
379 Run Keyword Wait Until Keyword Succeeds ${timeout} 5s Validate ONU Flows
380 ... ${List_ONU_Serial} ${onu_flows}
381 END
Hardik Windlassa3d04b92020-02-17 15:06:05 +0000382
TorstenThieme70bc5262021-01-19 12:12:55 +0000383Perform Sanity Tests TT
384 [Documentation] This keyword performs both Sanity Test Procedure for TT Workflow
385 ... Sanity Test TT for HSIA, VoD, VoIP services and Sanity Test TT for MCAST
386 ... For repeating sanity tests without subscriber changes set flag supress_add_subscriber=True.
387 ... In all other (common) cases flag has to be set False (default).
388 [Arguments] ${supress_add_subscriber}=False
389 Perform Sanity Test TT ${supress_add_subscriber}
390 Perform Sanity Test TT MCAST ${supress_add_subscriber}
391
Suchitra Vemuri2f1e07d2020-06-26 19:18:01 -0700392Perform Sanity Test TT
393 [Documentation] This keyword performs Sanity Test Procedure for TT Workflow
394 ... Sanity test performs dhcp and pings (without EAPOL and DHCP flows) for all the ONUs given for the POD
395 ... This keyword can be used to call in any other tests where sanity check is required
396 ... and avoids duplication of code.
TorstenThieme70bc5262021-01-19 12:12:55 +0000397 ... For repeating sanity test without subscriber changes set flag supress_add_subscriber=True.
398 ... In all other (common) cases flag has to be set False (default).
399 [Arguments] ${supress_add_subscriber}=False
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800400 FOR ${I} IN RANGE 0 ${num_all_onus}
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -0700401 ${src}= Set Variable ${hosts.src[${I}]}
402 ${dst}= Set Variable ${hosts.dst[${I}]}
403 ${service_type}= Get Variable Value ${src['service_type']} "null"
404 Run Keyword IF '${service_type}' != 'mcast' Sanity Test TT one ONU ${src} ${dst}
405 Run Keyword and Ignore Error Collect Logs
406 END
407 Run Keyword and Ignore Error Collect Logs
408
409Sanity Test TT one ONU
410 [Documentation] This keyword performs sanity test for a single ONU for TT workflow
411 ... Tests for one ONU
412 ... Assertions apply to HSIA, VoD, VoIP services
TorstenThieme70bc5262021-01-19 12:12:55 +0000413 ... For repeating sanity test without subscriber changes set flag supress_add_subscriber=True.
414 ... In all other (common) cases flag has to be set False (default).
415 [Arguments] ${src} ${dst} ${supress_add_subscriber}=False
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800416 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${src['olt']}
Suchitra Vemuri2f1e07d2020-06-26 19:18:01 -0700417 Set Global Variable ${of_id}
418 ${nni_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
419 ... Get NNI Port in ONOS ${of_id}
420 Set Global Variable ${nni_port}
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -0700421 ${onu_device_id}= Get Device ID From SN ${src['onu']}
422 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
423 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
424 # Check ONU port is Enabled in ONOS
425 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
426 ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
427 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
428 ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
429 ... volt-add-subscriber-access ${of_id} ${onu_port}
430 Sleep 30s
TorstenThieme70bc5262021-01-19 12:12:55 +0000431 # Verify ONU state in voltha, in case of previous dis- and enable of ONU state will be onu-reenabled
432 ${onu_reasons}= Create List tech-profile-config-download-success omci-flows-pushed onu-reenabled
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -0700433 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
434 ... ENABLED ACTIVE REACHABLE
Matteo Scandolo74bd5c32020-12-08 09:52:19 -0800435 ... ${src['onu']} onu=True onu_reason=${onu_reasons}
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -0700436 # TODO: Yet to Verify on the GPON based Physical POD (VOL-2652)
437 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate DHCP and Ping True
438 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
439 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
440 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
441 ... ${dst['container_name']}
Matteo Scandolo37a6cb72021-01-08 13:55:59 -0800442 Run Keyword IF '${src['service_type']}'!='hsia'
Suchitra Vemuri42819412020-10-01 17:45:43 -0700443 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
Suchitra Vemuri8d3b0032020-09-11 17:49:08 -0700444 ... Validate Subscriber DHCP Allocation ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Suchitra Vemuri42819412020-10-01 17:45:43 -0700445 ... ${src['c_tag']}
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -0700446 Run Keyword and Ignore Error Get Device Output from Voltha ${onu_device_id}
447 Run Keyword and Ignore Error Collect Logs
448
449Perform Sanity Test TT MCAST
450 [Documentation] This keyword performs Sanity Test Procedure for TT Workflow
451 ... Adds subscribers
452 ... Validates for MCAST
TorstenThieme70bc5262021-01-19 12:12:55 +0000453 ... For repeating sanity test without subscriber changes set flag supress_add_subscriber=True.
454 ... In all other (common) cases flag has to be set False (default).
455 [Arguments] ${supress_add_subscriber}=False
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800456 FOR ${I} IN RANGE 0 ${num_all_onus}
Suchitra Vemuri2f1e07d2020-06-26 19:18:01 -0700457 ${src}= Set Variable ${hosts.src[${I}]}
458 ${dst}= Set Variable ${hosts.dst[${I}]}
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -0700459 ${service_type}= Get Variable Value ${src['service_type']} "null"
460 Run Keyword IF '${service_type}' == 'mcast' Sanity Test TT MCAST one ONU ${src}
461 ... ${dst}
Suchitra Vemuri2f1e07d2020-06-26 19:18:01 -0700462 Run Keyword and Ignore Error Collect Logs
463 END
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -0700464 Run Keyword and Ignore Error Collect Logs
465
466Sanity Test TT MCAST one ONU
467 [Documentation] This keyword performs sanity test for a single ONU for TT workflow
468 ... Tests for one ONU
469 ... Assertions apply to MCAST services
TorstenThieme70bc5262021-01-19 12:12:55 +0000470 ... For repeating sanity test without subscriber changes set flag supress_add_subscriber=True.
471 ... In all other (common) cases flag has to be set False (default).
472 [Arguments] ${src} ${dst} ${supress_add_subscriber}=False
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -0700473 # Check for iperf and jq tools
474 ${stdout} ${stderr} ${rc}= Execute Remote Command which iperf jq
475 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']}
476 ... ${src['container_name']}
477 Pass Execution If ${rc} != 0 Skipping test: iperf / jq not found on the RG
478
479 #Reset the IP on the interface
480 ${output}= Login And Run Command On Remote System sudo ifconfig ${src['dp_iface_name']} 0
481 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
482 # Kill iperf on BNG
483 ${rg_output}= Run Keyword and Continue On Failure Login And Run Command On Remote System
484 ... sudo kill -9 `pidof iperf`
485 ... ${dst['bng_ip']} ${dst['bng_user']} ${dst['bng_pass']} ${dst['container_type']}
486 ... ${dst['container_name']}
487
488 # Setup RG for Multi-cast test
489 ${output}= Login And Run Command On Remote System
490 ... sudo ifconfig ${src['dp_iface_name']} ${src['mcast_rg']} up ; sudo kill -9 `pidof iperf`
491 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
492 ${output}= Login And Run Command On Remote System
493 ... sudo ip route add ${src['mcast_grp_subnet_mask']} dev ${src['dp_iface_name']} scope link
494 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
495
496 # Perform operations for adding subscriber
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800497 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${src['olt']}
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -0700498 Set Global Variable ${of_id}
499 ${nni_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
500 ... Get NNI Port in ONOS ${of_id}
501 Set Global Variable ${nni_port}
502 ${onu_device_id}= Get Device ID From SN ${src['onu']}
503 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
504 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
505 # Check ONU port is Enabled in ONOS
506 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
507 ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
508 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
509 ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
510 ... volt-add-subscriber-access ${of_id} ${onu_port}
511 Sleep 30s
TorstenThieme70bc5262021-01-19 12:12:55 +0000512 # Verify ONU state in voltha, in case of previous dis- and enable of ONU state will be onu-reenabled
513 ${onu_reasons}= Create List tech-profile-config-download-success omci-flows-pushed onu-reenabled
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -0700514 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
515 ... ENABLED ACTIVE REACHABLE
Matteo Scandolo74bd5c32020-12-08 09:52:19 -0800516 ... ${src['onu']} onu=True onu_reason=${onu_reasons}
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -0700517
518 # Setup iperf on the BNG
519 ${server_output}= Login And Run Command On Remote System
520 ... sudo iperf -c ${dst['dp_iface_ip_qinq']} -u -T 32 -t 60 -i 1 &
521 ... ${dst['bng_ip']} ${dst['bng_user']} ${dst['bng_pass']} ${dst['container_type']}
522 ... ${dst['container_name']}
523
524 # Setup iperf on the RG
525 ${rg_output}= Run Keyword and Continue On Failure Wait Until Keyword Succeeds 90s 5s
526 ... Login And Run Command On Remote System
527 ... rm -rf /tmp/rg_output ; sudo iperf -s -u -B ${dst['dp_iface_ip_qinq']} -i 1 -D >> /tmp/rg_output
528 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
529 Log ${rg_output}
530 Sleep 60s
531 ${output}= Run Keyword and Continue On Failure Wait Until Keyword Succeeds 90s 5s
532 ... Login And Run Command On Remote System
533 ... cat /tmp/rg_output | grep KBytes
534 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
535 Log ${output}
536 Should Contain ${output} KBytes
537
538 # Kill iperf on BNG
539 ${rg_output}= Run Keyword and Continue On Failure Login And Run Command On Remote System
540 ... sudo kill -9 `pidof iperf`
541 ... ${dst['bng_ip']} ${dst['bng_user']} ${dst['bng_pass']} ${dst['container_type']}
542 ... ${dst['container_name']}
543
544 # Kill iperf on the RG
545 ${output}= Run Keyword and Continue On Failure Login And Run Command On Remote System
546 ... sudo kill -9 `pidof iperf`
547 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
548
Suchitra Vemuri2f1e07d2020-06-26 19:18:01 -0700549
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000550Setup
551 [Documentation] Pre-test Setup
552 #test for empty device list
553 Test Empty Device List
Suchitra Vemuri1d8e8172020-06-17 17:43:56 -0700554 Run Keyword If ${has_dataplane} Sleep 230s
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800555 # Create a list of olt ids (logical and device_id)
556 ${olt_ids} Create List
557 FOR ${I} IN RANGE 0 ${num_olts}
558 #create/preprovision device
Andrea Campanella3dcce272021-01-15 16:04:47 +0100559 ${olt_device_id}= Run Keyword If "${list_olts}[${I}][type]" == "${None}"
560 ... Create Device ${list_olts}[${I}][ip] ${OLT_PORT}
561 ... ELSE Create Device ${list_olts}[${I}][ip] ${OLT_PORT} ${list_olts}[${I}][type]
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800562 ${olt_serial_number}= Set Variable ${list_olts}[${I}][sn]
563 #Set Suite Variable ${olt_device_id}
564 #validate olt states
565 Wait Until Keyword Succeeds ${timeout} 5s
566 ... Validate OLT Device PREPROVISIONED UNKNOWN UNKNOWN ${olt_device_id}
567 Sleep 5s
568 Enable Device ${olt_device_id}
569 Wait Until Keyword Succeeds 380s 5s
570 ... Validate OLT Device ENABLED ACTIVE REACHABLE ${olt_serial_number}
571 ${logical_id}= Get Logical Device ID From SN ${olt_serial_number}
572 # Set Suite Variable ${logical_id}
573 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS
574 ... ${olt_serial_number}
575 ${olt} Create Dictionary device_id ${olt_device_id} logical_id ${logical_id}
576 ... of_id ${of_id} sn ${olt_serial_number}
577 Append To List ${olt_ids} ${olt}
578 END
579 Set Global Variable ${olt_ids}
580
581Get ofID From OLT List
582 [Documentation] Retrieves the corresponding of_id for the OLT serial number specified
583 [Arguments] ${serial_number}
584 FOR ${I} IN RANGE 0 ${olt_count}
585 ${sn}= Get From Dictionary ${olt_ids}[${I}] sn
Andrea Campanella317a94c2020-11-13 10:38:19 +0100586 ${of_id}= Run Keyword IF "${serial_number}"=="${sn}"
587 ... Get From Dictionary ${olt_ids}[${I}] of_id ELSE Set Variable ${of_id}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800588 END
589 [Return] ${of_id}
590
591Get OLTDeviceID From OLT List
592 [Documentation] Retrieves the corresponding olt_device_id for the OLT serial number specified
593 [Arguments] ${serial_number}
Suchitra Vemuri4b8f4f52020-11-17 19:12:50 -0800594 ${olt_device_id}= Set Variable 0
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800595 FOR ${I} IN RANGE 0 ${olt_count}
596 ${sn}= Get From Dictionary ${olt_ids}[${I}] sn
Andrea Campanella317a94c2020-11-13 10:38:19 +0100597 ${olt_device_id}= Run Keyword IF "${serial_number}"=="${sn}"
598 ... Get From Dictionary ${olt_ids}[${I}] device_id ELSE Set Variable ${olt_device_id}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800599 END
600 [Return] ${olt_device_id}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000601
Andrea Campanellad848de02020-11-24 10:23:41 +0100602Get Num of Onus From OLT SN
603 [Documentation] Retrieves the corresponding number of ONUs for a given OLT based on serial number specified
604 [Arguments] ${serial_number}
605 ${num_of_olt_onus}= Set Variable 0
606 FOR ${I} IN RANGE 0 ${olt_count}
607 ${sn}= Get From Dictionary ${olt_ids}[${I}] sn
608 ${num_of_olt_onus}= Run Keyword IF "${serial_number}"=="${sn}"
609 ... Get From Dictionary ${list_olts}[${I}] onucount ELSE Set Variable ${num_of_olt_onus}
610 END
611 [Return] ${num_of_olt_onus}
612
Hardik Windlassaaea3402020-03-10 19:45:45 +0530613Validate ONUs After OLT Disable
614 [Documentation] Validates the ONUs state in Voltha, ONUs port state in ONOS
615 ... and that pings do not succeed After corresponding OLT is Disabled
Andrea Campanella4e507882020-11-26 11:33:11 +0100616 [Arguments] ${num_onus} ${olt_serial_number}
Hardik Windlassaaea3402020-03-10 19:45:45 +0530617 FOR ${I} IN RANGE 0 ${num_onus}
618 ${src}= Set Variable ${hosts.src[${I}]}
619 ${dst}= Set Variable ${hosts.dst[${I}]}
Andrea Campanella4e507882020-11-26 11:33:11 +0100620 Continue For Loop If "${olt_serial_number}"!="${src['olt']}"
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800621 ${of_id}= Get ofID From OLT List ${src['olt']}
Hardik Windlassaaea3402020-03-10 19:45:45 +0530622 ${onu_device_id}= Get Device ID From SN ${src['onu']}
623 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
624 ... ${of_id}
625 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
626 ... Validate Device ENABLED DISCOVERED
627 ... UNREACHABLE ${src['onu']} onu=True onu_reason=stopping-openomci
628 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
Suchitra Vemuri760bdd32020-06-17 12:34:48 -0700629 ... Verify ONU Port Is Disabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
Hardik Windlassaaea3402020-03-10 19:45:45 +0530630 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
631 ... Wait Until Keyword Succeeds 60s 2s
632 ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
633 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
634 Run Keyword and Ignore Error Get Device Output from Voltha ${onu_device_id}
635 Run Keyword and Ignore Error Collect Logs
636 END
637
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000638Delete All Devices and Verify
639 [Documentation] Remove any devices from VOLTHA and ONOS
640 # Clear devices from VOLTHA
641 Disable Devices In Voltha Root=true
Suchitra Vemuri970747f2020-03-30 17:31:34 -0700642 Sleep 5s
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000643 Wait Until Keyword Succeeds ${timeout} 2s Test Devices Disabled In Voltha Root=true
644 Delete Devices In Voltha Root=true
Hardik Windlassdf5035e2021-01-27 08:34:59 +0000645 Sleep 30s
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000646 Wait Until Keyword Succeeds ${timeout} 2s Test Empty Device List
Hardik Windlasse8b99222021-01-25 10:03:14 +0000647 FOR ${I} IN RANGE 0 ${num_olts}
648 ${olt_serial_number}= Set Variable ${list_olts}[${I}][sn]
649 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 15s
650 ... Validate Deleted Device Cleanup In ONOS ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${olt_serial_number}
651 END
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000652 # Clear devices from ONOS
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800653 #Remove All Devices From ONOS
ubuntu6b6e7d42020-03-02 12:35:42 -0800654 #... http://karaf:karaf@${ONOS_REST_IP}:${ONOS_REST_PORT}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000655
656Teardown
657 [Documentation] kills processes and cleans up interfaces on src+dst servers
658 Run Keyword If ${has_dataplane} Clean Up Linux
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000659
660Teardown Suite
661 [Documentation] Clean up device if desired
662 Run Keyword If ${teardown_device} Delete All Devices and Verify
663
664Delete Device and Verify
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800665 [Arguments] ${olt_serial_number}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000666 [Documentation] Disable -> Delete devices via voltctl and verify its removed
Suchitra Vemuri2fa9bba2020-01-22 17:38:48 -0800667 ${olt_device_id}= Get Device ID From SN ${olt_serial_number}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000668 ${rc} ${output}= Run and Return Rc and Output
Matteo Scandolo5899be12020-11-11 15:38:07 -0800669 ... voltctl -c ${VOLTCTL_CONFIG} device disable ${olt_device_id}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000670 Should Be Equal As Integers ${rc} 0
671 Sleep 5s
672 Wait Until Keyword Succeeds ${timeout} 5s
673 ... Validate OLT Device DISABLED UNKNOWN REACHABLE ${olt_serial_number}
674 ${rc} ${output}= Run and Return Rc and Output
Matteo Scandolo5899be12020-11-11 15:38:07 -0800675 ... voltctl -c ${VOLTCTL_CONFIG} device delete ${olt_device_id}
Hardik Windlassdf5035e2021-01-27 08:34:59 +0000676 Sleep 50s
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000677 Should Be Equal As Integers ${rc} 0
678 Wait Until Keyword Succeeds ${timeout} 5s Validate Device Removed ${olt_device_id}
Hardik Windlasse8b99222021-01-25 10:03:14 +0000679 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 15s
680 ... Validate Deleted Device Cleanup In ONOS ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${olt_serial_number}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000681
Gayathri.Selvan283a63c2020-01-23 04:09:18 +0000682Repeat Sanity Test
683 [Documentation] This keyword performs Sanity Test Procedure
684 ... Sanity test performs authentication, dhcp and pings for all the ONUs given for the POD
685 ... This keyword can be used to call in any other tests where sanity check is required
686 ... with wpa reassociation
687 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${olt_serial_number}
688 Set Global Variable ${of_id}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800689 FOR ${I} IN RANGE 0 ${num_all_onus}
Suchitra Vemuri03005912020-02-20 18:59:46 -0800690 Run Keyword and Ignore Error Collect Logs
Gayathri.Selvan283a63c2020-01-23 04:09:18 +0000691 ${src}= Set Variable ${hosts.src[${I}]}
692 ${dst}= Set Variable ${hosts.dst[${I}]}
Suchitra Vemuri8078b972020-02-06 19:07:41 -0800693 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
694 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
695 # Check ONU port is Enabled in ONOD
696 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
Suchitra Vemuri760bdd32020-06-17 12:34:48 -0700697 ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
Suchitra Vemuri8078b972020-02-06 19:07:41 -0800698 # Verify EAPOL flows are added for the ONU port
699 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
David K. Bainbridgec0617c92020-03-05 21:17:19 -0800700 ... Verify Eapol Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Suchitra Vemuri8078b972020-02-06 19:07:41 -0800701 # Verify ONU state in voltha
Suchitra Vemurid1e27fb2020-02-01 16:34:37 -0800702 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
Suchitra Vemuri81e4f022020-02-01 13:16:02 -0800703 ... ENABLED ACTIVE REACHABLE
704 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
Suchitra Vemuri8078b972020-02-06 19:07:41 -0800705 # Perform Authentication
Gayathri.Selvan283a63c2020-01-23 04:09:18 +0000706 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
707 ... Validate Authentication After Reassociate
708 ... True ${src['dp_iface_name']} ${src['ip']} ${src['user']} ${src['pass']}
709 ... ${src['container_type']} ${src['container_name']}
710 Wait Until Keyword Succeeds ${timeout} 2s
David K. Bainbridgec0617c92020-03-05 21:17:19 -0800711 ... Verify ONU in AAA-Users ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Gayathri.Selvan283a63c2020-01-23 04:09:18 +0000712 Wait Until Keyword Succeeds ${timeout} 2s
David K. Bainbridgec0617c92020-03-05 21:17:19 -0800713 ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
Gayathri.Selvan283a63c2020-01-23 04:09:18 +0000714 ... volt-add-subscriber-access ${of_id} ${onu_port}
715 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
716 ... Validate DHCP and Ping True True
717 ... ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
718 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
719 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
720 ... ${dst['container_name']}
721 Wait Until Keyword Succeeds ${timeout} 2s Run Keyword And Continue On Failure
David K. Bainbridgec0617c92020-03-05 21:17:19 -0800722 ... Validate Subscriber DHCP Allocation ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Gayathri.Selvan283a63c2020-01-23 04:09:18 +0000723 Run Keyword and Ignore Error Get Device Output from Voltha ${onu_device_id}
724 Run Keyword and Ignore Error Collect Logs
725 END
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000726
Hardik Windlass41701e82021-01-12 17:44:44 +0000727Disable Enable PON Port Per OLT
728 [Arguments] ${olt_serial_number}
729 [Documentation] This keyword disables and then enables OLT PON port and
730 ... also validate ONUs for each corresponding case
731 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
732 ${olt_pon_port_list}= Retrieve OLT PON Ports ${olt_device_id}
733 ${olt_pon_port_list_len}= Get Length ${olt_pon_port_list}
734 FOR ${INDEX0} IN RANGE 0 ${olt_pon_port_list_len}
735 ${olt_pon_port}= Get From List ${olt_pon_port_list} ${INDEX0}
736 ${olt_peer_list}= Retrieve Peer List From OLT PON Port ${olt_device_id} ${olt_pon_port}
737 # Disable the OLT PON Port and Validate OLT Device
738 DisableOrEnable OLT PON Port disable ${olt_device_id} ${olt_pon_port}
739 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
740 ... Validate OLT PON Port Status ${olt_device_id} ${olt_pon_port}
741 ... DISABLED DISCOVERED
742 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
743 ... Validate OLT Device ENABLED ACTIVE REACHABLE
744 ... ${olt_serial_number}
745 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
746 ... Validate ONUs for PON OLT Disable ${olt_serial_number} ${olt_peer_list}
747 # Enable the OLT PON Port back, and check ONU status are back to "ACTIVE"
748 DisableOrEnable OLT PON Port enable ${olt_device_id} ${olt_pon_port}
749 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
750 ... Validate OLT PON Port Status ${olt_device_id} ${olt_pon_port}
751 ... ENABLED ACTIVE
752 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
753 ... Validate ONUs for PON OLT Enable ${olt_serial_number} ${olt_peer_list}
754 END
755
Hardik Windlass16cdf962020-04-29 15:26:50 +0530756Validate ONUs for PON OLT Disable
Hardik Windlass41701e82021-01-12 17:44:44 +0000757 [Arguments] ${olt_sn} ${olt_peer_list}
Hardik Windlass16cdf962020-04-29 15:26:50 +0530758 [Documentation] This keyword validates that Ping fails for ONUs connected to Disabled OLT PON port
759 ... And Pings succeed for other Active OLT PON port ONUs
760 ... Also it removes subscriber for Disabled OLT PON port ONUs to replicate ATT workflow
Hardik Windlass41701e82021-01-12 17:44:44 +0000761 FOR ${I} IN RANGE 0 ${num_all_onus}
Hardik Windlass16cdf962020-04-29 15:26:50 +0530762 ${src}= Set Variable ${hosts.src[${I}]}
763 ${dst}= Set Variable ${hosts.dst[${I}]}
Hardik Windlass41701e82021-01-12 17:44:44 +0000764 Continue For Loop If "${olt_sn}"!="${src['olt']}"
Hardik Windlass16cdf962020-04-29 15:26:50 +0530765 ${onu_device_id}= Get Device ID From SN ${src['onu']}
Hardik Windlass41701e82021-01-12 17:44:44 +0000766 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${src['olt']}
Hardik Windlass16cdf962020-04-29 15:26:50 +0530767 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
768 ... ${of_id}
769 ${matched}= Match ONU in PON OLT Peer List ${olt_peer_list} ${onu_device_id}
770 Run Keyword If ${matched}
771 ... Run Keywords
772 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
773 ... Validate Device ENABLED DISCOVERED
Hardik Windlass41701e82021-01-12 17:44:44 +0000774 ... UNREACHABLE ${src['onu']} onu=True onu_reason=omci-flows-deleted
Hardik Windlass16cdf962020-04-29 15:26:50 +0530775 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
776 ... Verify ONU Port Is Disabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
777 ... AND Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
778 ... Wait Until Keyword Succeeds 60s 2s
779 ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
780 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']}
781 ... ${src['container_name']}
782 # Remove Subscriber Access (To replicate ATT workflow)
783 ... AND Wait Until Keyword Succeeds ${timeout} 2s Execute ONOS CLI Command ${ONOS_SSH_IP}
784 ... ${ONOS_SSH_PORT} volt-remove-subscriber-access ${of_id} ${onu_port}
785 ... ELSE
786 ... Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
787 ... Wait Until Keyword Succeeds 60s 2s
788 ... Check Ping True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
789 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']}
790 ... ${src['container_name']}
791 Run Keyword and Ignore Error Collect Logs
792 END
793
794Validate ONUs for PON OLT Enable
Hardik Windlass41701e82021-01-12 17:44:44 +0000795 [Arguments] ${olt_sn} ${olt_peer_list}
Hardik Windlass16cdf962020-04-29 15:26:50 +0530796 [Documentation] This keyword validates Ping succeeds for all Enabled/Acitve OLT PON ports
797 ... Also performs Auth/subscriberAdd/DHCP/Ping for the ONUs on Re-Enabled OLT PON port
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800798 FOR ${I} IN RANGE 0 ${num_all_onus}
Hardik Windlass16cdf962020-04-29 15:26:50 +0530799 ${src}= Set Variable ${hosts.src[${I}]}
800 ${dst}= Set Variable ${hosts.dst[${I}]}
Hardik Windlass41701e82021-01-12 17:44:44 +0000801 Continue For Loop If "${olt_sn}"!="${src['olt']}"
Hardik Windlass16cdf962020-04-29 15:26:50 +0530802 ${onu_device_id}= Get Device ID From SN ${src['onu']}
Hardik Windlass41701e82021-01-12 17:44:44 +0000803 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${src['olt']}
Hardik Windlass16cdf962020-04-29 15:26:50 +0530804 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
805 ... ${of_id}
806 ${matched}= Match ONU in PON OLT Peer List ${olt_peer_list} ${onu_device_id}
807 ${wpa_log}= Run Keyword If ${has_dataplane} and ${matched} Catenate SEPARATOR=.
808 ... /tmp/wpa ${src['dp_iface_name']} log
809 Run Keyword If ${matched}
810 ... Run Keywords
811 # Perform Cleanup
812 ... Run Keyword If ${has_dataplane} Clean Up Linux ${onu_device_id}
813 # Verify ONU port status
814 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
815 ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
816 # Verify EAPOL flows are added for the ONU port
817 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
818 ... Verify Eapol Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
819 # Verify ONU state in voltha
820 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
821 ... Validate Device ENABLED ACTIVE REACHABLE
822 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
823 # Perform Authentication
824 ... AND Run Keyword If ${has_dataplane}
825 ... Run Keyword And Continue On Failure Validate Authentication True
826 ... ${src['dp_iface_name']} wpa_supplicant.conf ${src['ip']} ${src['user']} ${src['pass']}
827 ... ${src['container_type']} ${src['container_name']} ${wpa_log}
828 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
829 ... Verify ONU in AAA-Users ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
830 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
831 ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
832 ... volt-add-subscriber-access ${of_id} ${onu_port}
833 # Verify that no pending flows exist for the ONU port
834 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
835 ... Verify No Pending Flows For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
836 # Verify subscriber access flows are added for the ONU port
837 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
838 ... Verify Subscriber Access Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
839 ... ${onu_port} ${nni_port} ${src['c_tag']} ${src['s_tag']}
840 ... AND Run Keyword If ${has_dataplane}
841 ... Run Keyword And Continue On Failure Validate DHCP and Ping True
842 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
843 ... ${src['ip']} ${src['user']} ${src['pass']}
844 ... ${src['container_type']} ${src['container_name']}
845 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']}
846 ... ${dst['container_type']} ${dst['container_name']}
847 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
848 ... Validate Subscriber DHCP Allocation ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
849 ... AND Run Keyword and Ignore Error Get Device Output from Voltha ${onu_device_id}
850 ... ELSE
851 ... Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
852 ... Wait Until Keyword Succeeds 60s 2s
853 ... Check Ping True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
854 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']}
855 ... ${src['container_name']}
856 Run Keyword and Ignore Error Collect Logs
857 END
858
Hardik Windlass41701e82021-01-12 17:44:44 +0000859Disable Enable PON Port Per OLT DT
860 [Arguments] ${olt_serial_number}
861 [Documentation] This keyword disables and then enables OLT PON port and
862 ... also validate ONUs for each corresponding case
863 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
864 ${olt_pon_port_list}= Retrieve OLT PON Ports ${olt_device_id}
865 ${olt_pon_port_list_len}= Get Length ${olt_pon_port_list}
866 FOR ${INDEX0} IN RANGE 0 ${olt_pon_port_list_len}
867 ${olt_pon_port}= Get From List ${olt_pon_port_list} ${INDEX0}
868 ${olt_peer_list}= Retrieve Peer List From OLT PON Port ${olt_device_id} ${olt_pon_port}
869 # Disable the OLT PON Port and Validate OLT Device
870 DisableOrEnable OLT PON Port disable ${olt_device_id} ${olt_pon_port}
871 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
872 ... Validate OLT PON Port Status ${olt_device_id} ${olt_pon_port}
873 ... DISABLED DISCOVERED
874 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
875 ... Validate OLT Device ENABLED ACTIVE REACHABLE
876 ... ${olt_serial_number}
877 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
878 ... Validate ONUs for PON OLT Disable DT ${olt_serial_number} ${olt_peer_list}
879 Sleep 15s
880 # Enable the OLT PON Port back, and check ONU status are back to "ACTIVE"
881 DisableOrEnable OLT PON Port enable ${olt_device_id} ${olt_pon_port}
882 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
883 ... Validate OLT PON Port Status ${olt_device_id} ${olt_pon_port}
884 ... ENABLED ACTIVE
885 # Waiting extra time for the ONUs to come up
886 Sleep 60s
887 ${olt_peer_list_new}= Retrieve Peer List From OLT PON Port ${olt_device_id} ${olt_pon_port}
888 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
889 ... Validate ONUs for PON OLT Enable DT ${olt_serial_number} ${olt_peer_list_new}
890 END
891
Hardik Windlass16cdf962020-04-29 15:26:50 +0530892Validate ONUs for PON OLT Disable DT
Hardik Windlass41701e82021-01-12 17:44:44 +0000893 [Arguments] ${olt_sn} ${olt_peer_list}
Hardik Windlass16cdf962020-04-29 15:26:50 +0530894 [Documentation] This keyword validates that Ping fails for ONUs connected to Disabled OLT PON port
895 ... And Pings succeed for other Active OLT PON port ONUs
896 ... Also it removes subscriber and deletes ONUs for Disabled OLT PON port to replicate DT workflow
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800897 FOR ${I} IN RANGE 0 ${num_all_onus}
Hardik Windlass16cdf962020-04-29 15:26:50 +0530898 ${src}= Set Variable ${hosts.src[${I}]}
899 ${dst}= Set Variable ${hosts.dst[${I}]}
Hardik Windlass41701e82021-01-12 17:44:44 +0000900 Continue For Loop If "${olt_sn}"!="${src['olt']}"
Hardik Windlass16cdf962020-04-29 15:26:50 +0530901 ${onu_device_id}= Get Device ID From SN ${src['onu']}
Hardik Windlass41701e82021-01-12 17:44:44 +0000902 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${src['olt']}
Hardik Windlass16cdf962020-04-29 15:26:50 +0530903 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
904 ... ${of_id}
905 ${matched}= Match ONU in PON OLT Peer List ${olt_peer_list} ${onu_device_id}
906 Run Keyword If ${matched}
907 ... Run Keywords
908 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
909 ... Validate Device ENABLED DISCOVERED
910 ... UNREACHABLE ${src['onu']} onu=True onu_reason=stopping-openomci
911 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
912 ... Verify ONU Port Is Disabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
913 ... AND Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
914 ... Wait Until Keyword Succeeds 60s 2s
915 ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
916 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']}
917 ... ${src['container_name']}
918 # Remove Subscriber Access (To replicate DT workflow)
919 ... AND Wait Until Keyword Succeeds ${timeout} 2s Execute ONOS CLI Command ${ONOS_SSH_IP}
920 ... ${ONOS_SSH_PORT} volt-remove-subscriber-access ${of_id} ${onu_port}
921 ... AND Sleep 10s
922 # Delete ONU Device (To replicate DT workflow)
923 ... AND Delete Device ${onu_device_id}
924 ... AND Sleep 5s
925 ... ELSE
926 ... Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
927 ... Wait Until Keyword Succeeds 60s 2s
928 ... Check Ping True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
929 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']}
930 ... ${src['container_name']}
931 Run Keyword and Ignore Error Collect Logs
932 END
933
934Validate ONUs for PON OLT Enable DT
Hardik Windlass41701e82021-01-12 17:44:44 +0000935 [Arguments] ${olt_sn} ${olt_peer_list}
Hardik Windlass16cdf962020-04-29 15:26:50 +0530936 [Documentation] This keyword validates Ping succeeds for all Enabled/Acitve OLT PON ports
937 ... Also performs subscriberAdd/DHCP/Ping for the ONUs on Re-Enabled OLT PON port
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800938 FOR ${I} IN RANGE 0 ${num_all_onus}
Hardik Windlass16cdf962020-04-29 15:26:50 +0530939 ${src}= Set Variable ${hosts.src[${I}]}
940 ${dst}= Set Variable ${hosts.dst[${I}]}
Hardik Windlass41701e82021-01-12 17:44:44 +0000941 Continue For Loop If "${olt_sn}"!="${src['olt']}"
Hardik Windlass16cdf962020-04-29 15:26:50 +0530942 ${onu_device_id}= Get Device ID From SN ${src['onu']}
Hardik Windlass41701e82021-01-12 17:44:44 +0000943 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${src['olt']}
Hardik Windlass16cdf962020-04-29 15:26:50 +0530944 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
945 ... ${of_id}
946 ${matched}= Match ONU in PON OLT Peer List ${olt_peer_list} ${onu_device_id}
947 Run Keyword If ${matched}
948 ... Run Keywords
949 # Perform Cleanup
950 ... Run Keyword If ${has_dataplane} Clean Up Linux ${onu_device_id}
951 # Verify ONU port status
952 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
953 ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
954 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
955 ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
956 ... volt-add-subscriber-access ${of_id} ${onu_port}
957 # Verify ONU state in voltha
958 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
959 ... Validate Device ENABLED ACTIVE REACHABLE
960 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
961 # Verify subscriber access flows are added for the ONU port
962 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
963 ... Verify Subscriber Access Flows Added For ONU DT ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
964 ... ${onu_port} ${nni_port} ${src['s_tag']}
965 ... AND Run Keyword If ${has_dataplane}
966 ... Run Keyword And Continue On Failure Validate DHCP and Ping True
967 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
968 ... ${src['ip']} ${src['user']} ${src['pass']}
969 ... ${src['container_type']} ${src['container_name']}
970 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']}
971 ... ${dst['container_type']} ${dst['container_name']}
972 ... ELSE
973 ... Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
974 ... Wait Until Keyword Succeeds 60s 2s
975 ... Check Ping True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
976 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']}
977 ... ${src['container_name']}
978 Run Keyword and Ignore Error Collect Logs
979 END
980
981Match ONU in PON OLT Peer List
982 [Arguments] ${olt_peer_list} ${onu_device_id}
983 [Documentation] This keyword matches if ONU device is present in OLT PON port peer list
984 ${matched}= Set Variable False
985 FOR ${olt_peer} IN @{olt_peer_list}
986 ${matched}= Set Variable If '${onu_device_id}' == '${olt_peer}' True False
987 Exit For Loop If ${matched}
988 END
989 [Return] ${matched}
990
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000991Collect Logs
992 [Documentation] Collect Logs from voltha and onos cli for various commands
993 Run Keyword and Ignore Error Get Device List from Voltha
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800994 FOR ${I} IN RANGE 0 ${num_olts}
995 Run Keyword and Ignore Error Get Logical Device Output from Voltha ${logical_id}
996 Run Keyword and Ignore Error Get Device Output from Voltha ${olt_ids}[${I}][device_id]
997 Run Keyword and Ignore Error Get Logical Device Output from Voltha ${olt_ids}[${I}][logical_id]
998 END
999 #Run Keyword and Ignore Error Get Device Output from Voltha ${olt_device_id}
1000 #Run Keyword and Ignore Error Get Logical Device Output from Voltha ${logical_id}
ubuntu6b6e7d42020-03-02 12:35:42 -08001001 Get ONOS Status ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
Gayathri.Selvanf68ea4b2020-02-03 07:36:39 +00001002
1003Verify ping is succesful except for given device
1004 [Arguments] ${num_onus} ${exceptional_onu_id}
1005 [Documentation] Checks that ping for all the devices are successful except the given ONU.
1006 ${pingStatus} Set Variable True
Suchitra Vemuria6879aa2020-11-03 11:03:11 -08001007 FOR ${I} IN RANGE 0 ${num_all_onus}
Gayathri.Selvanf68ea4b2020-02-03 07:36:39 +00001008 ${src}= Set Variable ${hosts.src[${I}]}
1009 ${dst}= Set Variable ${hosts.dst[${I}]}
1010 ${onu_device_id}= Get Device ID From SN ${src['onu']}
1011 ${pingStatus} Run Keyword If '${onu_device_id}' == '${exceptional_onu_id}' Set Variable False
Suchitra Vemuri69bcad22020-12-09 11:11:14 -08001012 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
1013 ... Wait Until Keyword Succeeds 60s 2s
Gayathri.Selvanf68ea4b2020-02-03 07:36:39 +00001014 ... Check Ping ${pingStatus} ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
1015 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
1016 END
Andy Bavier4a8450e2020-02-04 08:58:37 -07001017
Suchitra Vemurife309412020-12-01 19:19:52 -08001018Verify ping is successful for ONUs not on this OLT
1019 [Arguments] ${num_all_onus} ${exceptional_olt_id}
1020 [Documentation] Checks that pings work for all the ONUs except for the ONUs on the given OLT.
1021 #${pingStatus} Set Variable True
1022 FOR ${I} IN RANGE 0 ${num_all_onus}
1023 ${src}= Set Variable ${hosts.src[${I}]}
1024 ${dst}= Set Variable ${hosts.dst[${I}]}
1025 ${olt_device_id}= Get Device ID From SN ${src['olt']}
1026 Continue For Loop If "${olt_device_id}"=="${exceptional_olt_id}"
1027 #${pingStatus} Run Keyword If '${olt_device_id}' == '${exceptional_olt_id}' Set Variable False
Suchitra Vemuri69bcad22020-12-09 11:11:14 -08001028 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
1029 ... Wait Until Keyword Succeeds 60s 2s
Suchitra Vemurife309412020-12-01 19:19:52 -08001030 ... Check Ping True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
1031 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
1032 END
1033
Andy Bavier1923ecc2020-06-18 14:06:40 -07001034Echo Message to OLT Logs
1035 [Arguments] ${message}
1036 [Documentation] Echoes ${message} into the OLT logs
Suchitra Vemuria6879aa2020-11-03 11:03:11 -08001037 FOR ${I} IN RANGE 0 ${num_olts}
1038 ${olt_user} Evaluate ${olts}[${I}].get("user")
1039 ${olt_pass} Evaluate ${olts}[${I}].get("pass")
1040 ${olt_ssh_ip} Evaluate ${olts}[${I}].get("sship")
Andrea Campanellaebf6f0d2021-01-12 13:10:29 +01001041 Continue For Loop If "${olt_user}" == "${None}"
1042 Continue For Loop If "${olt_pass}" == "${None}"
Suchitra Vemuria6879aa2020-11-03 11:03:11 -08001043 Wait Until Keyword Succeeds 180s 10s Execute Remote Command
1044 ... printf '%s\n' '' '' '${message}' '' >> /var/log/openolt.log
1045 ... ${olt_ssh_ip} ${olt_user} ${olt_pass}
1046 Wait Until Keyword Succeeds 180s 10s Execute Remote Command
1047 ... printf '%s\n' '' '' '${message}' '' >> /var/log/dev_mgmt_daemon.log
1048 ... ${olt_ssh_ip} ${olt_user} ${olt_pass}
1049 Wait Until Keyword Succeeds 180s 10s Execute Remote Command
1050 ... printf '%s\n' '' '' '${message}' '' >> /var/log/openolt_process_watchdog.log
1051 ... ${olt_ssh_ip} ${olt_user} ${olt_pass}
1052 END
Andy Bavier1923ecc2020-06-18 14:06:40 -07001053
Andy Bavierabeba262020-02-07 16:22:16 -07001054Start Logging
1055 [Arguments] ${label}
1056 [Documentation] Start logging for test ${label}
1057 ${kail_process}= Run Keyword If "${container_log_dir}" != "${None}" Start Process kail -n default
1058 ... -n voltha cwd=${container_log_dir} stdout=${label}-combined.log
1059 Set Test Variable ${kail_process}
Andy Bavier1923ecc2020-06-18 14:06:40 -07001060 Run Keyword If ${has_dataplane} Echo Message to OLT Logs START ${label}
Andy Bavierabeba262020-02-07 16:22:16 -07001061
1062Stop Logging
1063 [Arguments] ${label}
1064 [Documentation] End logging for test; remove logfile if test passed
1065 Run sync
1066 Run Keyword If ${kail_process} Terminate Process ${kail_process}
1067 ${test_logfile}= Run Keyword If "${container_log_dir}" != "${None}"
1068 ... Join Path ${container_log_dir} ${label}-combined.log
1069 Run Keyword If Test Passed Run Keyword If "${test_logfile}" != "${None}" Remove File ${test_logfile}
Andy Bavier1923ecc2020-06-18 14:06:40 -07001070 Run Keyword If ${has_dataplane} Echo Message to OLT Logs END ${label}
Andy Bavierabeba262020-02-07 16:22:16 -07001071
Suchitra Vemuria5fa3dd2020-02-04 14:38:49 -08001072Clean Up Linux
1073 [Documentation] Kill processes and clean up interfaces on src+dst servers
Hardik Windlass16cdf962020-04-29 15:26:50 +05301074 [Arguments] ${onu_id}=${EMPTY}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -08001075 FOR ${I} IN RANGE 0 ${num_all_onus}
Suchitra Vemuria5fa3dd2020-02-04 14:38:49 -08001076 ${src}= Set Variable ${hosts.src[${I}]}
1077 ${dst}= Set Variable ${hosts.dst[${I}]}
Hardik Windlass16cdf962020-04-29 15:26:50 +05301078 ${onu_device_id}= Get Device ID From SN ${src['onu']}
1079 Continue For Loop If '${onu_id}' != '${EMPTY}' and '${onu_id}' != '${onu_device_id}'
Andy Bavier84b83282020-06-30 05:47:49 -07001080 Execute Remote Command sudo pkill wpa_supplicant ${src['ip']}
Suchitra Vemuria5fa3dd2020-02-04 14:38:49 -08001081 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
Andy Bavier84b83282020-06-30 05:47:49 -07001082 Execute Remote Command sudo pkill dhclient ${src['ip']}
Suchitra Vemuria5fa3dd2020-02-04 14:38:49 -08001083 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
Andy Baviereff938d2020-06-29 18:27:49 -07001084 Execute Remote Command sudo pkill mausezahn ${src['ip']}
1085 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
1086 Run Keyword If '${dst['ip']}' != '${None}' Execute Remote Command pkill dhcpd
1087 ... ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']} ${dst['container_name']}
Suchitra Vemuria5fa3dd2020-02-04 14:38:49 -08001088 Delete IP Addresses from Interface on Remote Host ${src['dp_iface_name']} ${src['ip']}
1089 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
1090 Run Keyword If '${dst['ip']}' != '${None}' Delete Interface on Remote Host
1091 ... ${dst['dp_iface_name']}.${src['s_tag']} ${dst['ip']} ${dst['user']} ${dst['pass']}
1092 ... ${dst['container_type']} ${dst['container_name']}
Andy Bavier84b83282020-06-30 05:47:49 -07001093 ${bng_ip}= Get Variable Value ${dst['noroot_ip']}
1094 ${bng_user}= Get Variable Value ${dst['noroot_user']}
1095 ${bng_pass}= Get Variable Value ${dst['noroot_pass']}
Andy Bavierf4b7d1d2020-06-30 11:14:04 -07001096 Run Keyword If "${bng_ip}" != "${NONE}" and "${bng_user}" != "${NONE}" and "${bng_pass}" != "${NONE}"
1097 ... Execute Remote Command sudo pkill mausezahn ${bng_ip} ${bng_user} ${bng_pass}
Andy Baviereff938d2020-06-29 18:27:49 -07001098 ... ${dst['container_type']} ${dst['container_name']}
Suchitra Vemuria5fa3dd2020-02-04 14:38:49 -08001099 END
Scott Baker60e570d2020-02-02 22:10:13 -08001100
Suchitra Vemuria6879aa2020-11-03 11:03:11 -08001101Clean Up Linux Per OLT
1102 [Documentation] Kill processes and clean up interfaces on src+dst servers
1103 [Arguments] ${olt_serial_number}
1104 FOR ${I} IN RANGE 0 ${num_all_onus}
1105 ${src}= Set Variable ${hosts.src[${I}]}
1106 ${dst}= Set Variable ${hosts.dst[${I}]}
1107 ${onu_device_id}= Get Device ID From SN ${src['onu']}
1108 ${sn}= Get Device ID From SN ${src['olt']}
1109 #Continue For Loop If '${onu_id}' != '${EMPTY}' and '${onu_id}' != '${onu_device_id}'
1110 Continue For Loop If '${olt_serial_number}' == '${sn}'
1111 Execute Remote Command sudo pkill wpa_supplicant ${src['ip']}
1112 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
1113 Execute Remote Command sudo pkill dhclient ${src['ip']}
1114 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
1115 Execute Remote Command sudo pkill mausezahn ${src['ip']}
1116 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
1117 Run Keyword If '${dst['ip']}' != '${None}' Execute Remote Command pkill dhcpd
1118 ... ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']} ${dst['container_name']}
1119 Delete IP Addresses from Interface on Remote Host ${src['dp_iface_name']} ${src['ip']}
1120 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
1121 Run Keyword If '${dst['ip']}' != '${None}' Delete Interface on Remote Host
1122 ... ${dst['dp_iface_name']}.${src['s_tag']} ${dst['ip']} ${dst['user']} ${dst['pass']}
1123 ... ${dst['container_type']} ${dst['container_name']}
1124 ${bng_ip}= Get Variable Value ${dst['noroot_ip']}
1125 ${bng_user}= Get Variable Value ${dst['noroot_user']}
1126 ${bng_pass}= Get Variable Value ${dst['noroot_pass']}
1127 Run Keyword If "${bng_ip}" != "${NONE}" and "${bng_user}" != "${NONE}" and "${bng_pass}" != "${NONE}"
1128 ... Execute Remote Command sudo pkill mausezahn ${bng_ip} ${bng_user} ${bng_pass}
1129 ... ${dst['container_type']} ${dst['container_name']}
1130 END
1131
Suchitra Vemuri8d3b0032020-09-11 17:49:08 -07001132Clean dhclient
1133 [Documentation] Kills dhclient processes only for all RGs
Hardik Windlass41701e82021-01-12 17:44:44 +00001134 FOR ${I} IN RANGE 0 ${num_all_onus}
Suchitra Vemuri8d3b0032020-09-11 17:49:08 -07001135 ${src}= Set Variable ${hosts.src[${I}]}
1136 ${dst}= Set Variable ${hosts.dst[${I}]}
1137 Execute Remote Command sudo pkill dhclient ${src['ip']}
1138 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
1139 END
1140
Suchitra Vemurif7a033c2020-02-26 17:22:41 -08001141Clean WPA Process
1142 [Documentation] Kills wpa_supplicant processes only for all RGs
Suchitra Vemuria6879aa2020-11-03 11:03:11 -08001143 FOR ${I} IN RANGE 0 ${num_all_onus}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -08001144 ${src}= Set Variable ${hosts.src[${I}]}
1145 ${dst}= Set Variable ${hosts.dst[${I}]}
1146 Run Keyword And Ignore Error Kill Linux Process [w]pa_supplicant ${src['ip']}
1147 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
1148 END
1149
Scott Baker60e570d2020-02-02 22:10:13 -08001150Should Be Larger Than
1151 [Documentation] Verify that value_1 is > value_2
1152 [Arguments] ${value_1} ${value_2}
1153 Run Keyword If ${value_1} <= ${value_2}
1154 ... Fail The value ${value_1} is not larger than ${value_2}
1155
Scott Bakeree675552020-02-11 10:43:34 -08001156Should Be Larger Than Or Equal To
1157 [Documentation] Verify that value_1 is >= value_2
1158 [Arguments] ${value_1} ${value_2}
1159 Run Keyword If ${value_1} < ${value_2}
1160 ... Fail The value ${value_1} is not larger than or equal to ${value_2}
1161
Scott Baker60e570d2020-02-02 22:10:13 -08001162Should Be Float
1163 [Documentation] Verify that value is a floating point number type
1164 [Arguments] ${value}
1165 ${type} Evaluate type(${value}).__name__
1166 Should Be Equal ${type} float
1167
Scott Bakeree675552020-02-11 10:43:34 -08001168Should Be Newer Than Or Equal To
1169 [Documentation] Compare two RFC3339 dates
1170 [Arguments] ${value_1} ${value_2}
1171 ${unix_v1} Parse RFC3339 ${value_1}
1172 ${unix_v2} Parse RFC3339 ${value_2}
1173 Run Keyword If ${unix_v1} < ${unix_v2}
1174 ... Fail The value ${value_1} is not newer than or equal to ${value_2}
1175
Scott Baker60e570d2020-02-02 22:10:13 -08001176Get Current Time
1177 [Documentation] Return the current time in RFC3339 format
1178 ${output}= Run date -u +"%FT%T%:z"
1179 [return] ${output}
Scott Bakeree675552020-02-11 10:43:34 -08001180
1181Parse RFC3339
1182 [Documentation] Parse an RFC3339 timestamp
1183 [Arguments] ${dateStr}
1184 ${rc} ${output}= Run and Return Rc and Output date --date="${dateStr}" "+%s"
1185 Should Be Equal As Numbers ${rc} 0
1186 [return] ${output}
Matteo Scandolo142e6272020-04-29 17:36:59 -07001187
Gayathri.Selvan92d16862020-03-19 14:47:58 +00001188Get Bandwidth Profile Name For Given Subscriber
1189 [Arguments] ${subscriber_id} ${stream_type}=upstreamBandwidthProfile
1190 [Documentation] Keyword to get the bandwidth details of the given subscriber
1191 ${bandwidth_profile_output}= Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
1192 ... volt-programmed-subscribers | grep ${subscriber_id}
1193 @{bandwidth_profile_array}= Split String ${bandwidth_profile_output} ,
1194 Log ${bandwidth_profile_array}
1195 FOR ${value} IN @{bandwidth_profile_array}
1196 @{row_value}= Split String ${value} =
1197 ${bandwidth_profile_name}= Set Variable If '${row_value[0]}' == ' ${stream_type}'
1198 ... ${row_value[1]}
1199 ${bandwidth_profile_name}= Convert To String ${bandwidth_profile_name}
1200 Run Keyword If "${bandwidth_profile_name}" != "None" Exit For Loop
1201 END
1202 Log ${bandwidth_profile_name}
1203 [Return] ${bandwidth_profile_name}
1204
1205Execute Remote Command
1206 [Documentation] SSH into a remote host and execute a command on the bare host or in a container.
1207 ... This replaces and simplifies the Login And Run Command On Remote System keyword in CORDRobot.
1208 [Arguments] ${cmd} ${ip} ${user} ${pass}=${None}
Andy Baviereff938d2020-06-29 18:27:49 -07001209 ... ${container_type}=${None} ${container_name}=${None} ${timeout}=${None}
Gayathri.Selvan92d16862020-03-19 14:47:58 +00001210 ${conn_id}= SSHLibrary.Open Connection ${ip}
1211 Run Keyword If '${pass}' != '${None}'
1212 ... SSHLibrary.Login ${user} ${pass}
1213 ... ELSE
1214 ... SSHLibrary.Login With Public Key ${user} %{HOME}/.ssh/id_rsa
1215 ${namespace}= Run Keyword If '${container_type}' == 'K8S' SSHLibrary.Execute Command
1216 ... kubectl get pods --all-namespaces | grep ${container_name} | awk '{print $1}'
Andy Bavierf6ab19c2020-05-14 10:34:47 -07001217 ${stdout} ${stderr} ${rc}= Run Keyword If '${container_type}' == 'LXC'
1218 ... SSHLibrary.Execute Command lxc exec ${container_name} -- ${cmd}
Andy Baviereff938d2020-06-29 18:27:49 -07001219 ... return_stderr=True return_rc=True timeout=${timeout}
Gayathri.Selvan92d16862020-03-19 14:47:58 +00001220 ... ELSE IF '${container_type}' == 'K8S'
Andy Bavierf6ab19c2020-05-14 10:34:47 -07001221 ... SSHLibrary.Execute Command kubectl -n ${namespace} exec ${container_name} -- ${cmd}
Andy Baviereff938d2020-06-29 18:27:49 -07001222 ... return_stderr=True return_rc=True timeout=${timeout}
Gayathri.Selvan92d16862020-03-19 14:47:58 +00001223 ... ELSE
Andy Baviereff938d2020-06-29 18:27:49 -07001224 ... SSHLibrary.Execute Command ${cmd} return_stderr=True return_rc=True timeout=${timeout}
Andy Bavierf6ab19c2020-05-14 10:34:47 -07001225
1226 Log ${stdout}
1227 Log ${stderr}
1228 Log ${rc}
Gayathri.Selvan92d16862020-03-19 14:47:58 +00001229 SSHLibrary.Close Connection
Andy Bavierf6ab19c2020-05-14 10:34:47 -07001230 [Return] ${stdout} ${stderr} ${rc}
Gayathri.Selvan92d16862020-03-19 14:47:58 +00001231
Suraj Gour33651272020-05-04 10:10:16 +05301232Start Remote Command
1233 [Documentation] SSH into a remote host and execute a command on the bare host or in a container.
1234 ... This replaces and simplifies the Login And Run Command On Remote System keyword in CORDRobot.
1235 [Arguments] ${cmd} ${ip} ${user} ${pass}=${None}
1236 ... ${container_type}=${None} ${container_name}=${None}
1237 ${conn_id}= SSHLibrary.Open Connection ${ip}
1238 Run Keyword If '${pass}' != '${None}'
1239 ... SSHLibrary.Login ${user} ${pass}
1240 ... ELSE
1241 ... SSHLibrary.Login With Public Key ${user} %{HOME}/.ssh/id_rsa
1242 ${namespace}= Run Keyword If '${container_type}' == 'K8S' SSHLibrary.Execute Command
1243 ... kubectl get pods --all-namespaces | grep ${container_name} | awk '{print $1}'
1244 Run Keyword If '${container_type}' == 'LXC'
1245 ... SSHLibrary.Start Command lxc exec ${container_name} -- ${cmd}
1246 ... ELSE IF '${container_type}' == 'K8S'
1247 ... SSHLibrary.Start Command kubectl -n ${namespace} exec ${container_name} -- ${cmd}
1248 ... ELSE
1249 ... SSHLibrary.Start Command ${cmd}
Andy Bavier9fb23232020-06-30 15:12:20 -07001250 # It seems that closing the connection immediately will sometimes kill the command
1251 Sleep 1s
Suraj Gour33651272020-05-04 10:10:16 +05301252 SSHLibrary.Close Connection
1253
Gayathri.Selvan92d16862020-03-19 14:47:58 +00001254Run Iperf3 Test Client
1255 [Arguments] ${src} ${server} ${args}
1256 [Documentation] Login to ${src} and run the iperf3 client against ${server} using ${args}.
1257 ... Return a Dictionary containing the results of the test.
Andy Bavierf6ab19c2020-05-14 10:34:47 -07001258 ${output} ${stderr} ${rc}= Execute Remote Command iperf3 -J -c ${server} ${args} | jq -M -c '.'
Gayathri.Selvan92d16862020-03-19 14:47:58 +00001259 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
Andy Bavierf6ab19c2020-05-14 10:34:47 -07001260 Should Be Equal As Integers ${rc} 0
Gayathri.Selvan92d16862020-03-19 14:47:58 +00001261 ${object}= Evaluate json.loads(r'''${output}''') json
1262 [Return] ${object}
Hung-Wei Chiue0bec7c2020-05-29 22:16:56 +00001263
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -07001264Run Iperf Test Client for MCAST
1265 [Arguments] ${src} ${server} ${args}
1266 [Documentation] Login to ${src} and run the iperf client against ${server} using ${args}.
1267 ... Return a Dictionary containing the results of the test.
1268 ${output} ${stderr} ${rc}= Execute Remote Command sudo iperf -c ${server} ${args} | jq -M -c '.'
1269 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
1270 Should Be Equal As Integers ${rc} 0
1271 ${object}= Evaluate json.loads(r'''${output}''') json
1272 [Return] ${object}
1273
Hung-Wei Chiue0bec7c2020-05-29 22:16:56 +00001274RestoreONUs
1275 [Documentation] Restore all connected ONUs
Suchitra Vemuria6879aa2020-11-03 11:03:11 -08001276 [Arguments] ${num_all_onus}
1277 FOR ${I} IN RANGE 0 ${num_all_onus}
Hung-Wei Chiue0bec7c2020-05-29 22:16:56 +00001278 ${src}= Set Variable ${hosts.src[${I}]}
Hung-Wei Chiucc6e6552020-06-04 12:57:38 -07001279 ${container_type}= Get Variable Value ${src['container_type']} "null"
1280 ${container_name}= Get Variable Value ${src['container_name']} "null"
Hung-Wei Chiue0bec7c2020-05-29 22:16:56 +00001281 ${onu_type}= Get Variable Value ${src['onu_type']} "null"
Hung-Wei Chiucc6e6552020-06-04 12:57:38 -07001282 #Get ens6f0 from ens6f0.22
1283 ${if_name}= Replace String Using Regexp ${src['dp_iface_name']} \\..* \
Hung-Wei Chiue0bec7c2020-05-29 22:16:56 +00001284 Run Keyword IF '${onu_type}' == 'alpha' AlphaONURestoreDefault ${src['ip']} ${src['user']}
Hung-Wei Chiucc6e6552020-06-04 12:57:38 -07001285 ... ${src['pass']} ${if_name} admin admin ${container_type} ${container_name}
Hung-Wei Chiue0bec7c2020-05-29 22:16:56 +00001286 END
1287
1288AlphaONURestoreDefault
1289 [Documentation] Restore the Alpha ONU to factory setting
1290 [Arguments] ${rg_ip} ${rg_user} ${rg_pass} ${onu_ifname}
Hung-Wei Chiucc6e6552020-06-04 12:57:38 -07001291 ... ${onu_user} ${onu_pass} ${container_type}=${None} ${container_name}=${None}
Hung-Wei Chiue0bec7c2020-05-29 22:16:56 +00001292 ${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 -07001293 ... ${rg_ip} ${rg_user} ${rg_pass} ${container_type} ${container_name}
TorstenThieme70bc5262021-01-19 12:12:55 +00001294 ${cmd} Catenate
Hung-Wei Chiue0bec7c2020-05-29 22:16:56 +00001295 ... (echo open "192.168.1.1"; sleep 1;
1296 ... echo "${onu_user}"; sleep 1;
1297 ... echo "${onu_pass}"; sleep 1;
1298 ... echo "restoredefault"; sleep 1) | telnet
1299 ${output}= Login And Run Command On Remote System ${cmd}
Hung-Wei Chiucc6e6552020-06-04 12:57:38 -07001300 ... ${rg_ip} ${rg_user} ${rg_pass} ${container_type} ${container_name}
Hung-Wei Chiue0bec7c2020-05-29 22:16:56 +00001301 Log To Console ${output}
1302 ${output}= Login And Run Command On Remote System sudo ifconfig ${onu_ifname} 0
Hung-Wei Chiucc6e6552020-06-04 12:57:38 -07001303 ... ${rg_ip} ${rg_user} ${rg_pass} ${container_type} ${container_name}
Suraj Gour33651272020-05-04 10:10:16 +05301304
1305Create traffic with each pbit and capture at other end
1306 [Documentation] Generates upstream traffic using Mausezahn tool
1307 ... with each pbit and validates reception at other end using tcpdump
1308 [Arguments] ${target_ip} ${target_iface} ${src_iface}
1309 ... ${packet_count} ${packet_type} ${target_port} ${vlan} ${tcpdump_filter}
1310 ... ${dst_ip} ${dst_user} ${dst_pass} ${dst_container_type} ${dst_container_name}
1311 ... ${src_ip} ${src_user} ${src_pass} ${src_container_type} ${src_container_name}
1312 FOR ${pbit} IN RANGE 8
Andy Baviereff938d2020-06-29 18:27:49 -07001313 Execute Remote Command sudo pkill mausezahn
Suraj Gour33651272020-05-04 10:10:16 +05301314 ... ${src_ip} ${src_user} ${src_pass} ${src_container_type} ${src_container_name}
Andy Baviereff938d2020-06-29 18:27:49 -07001315 ${var1}= Set Variable sudo mausezahn ${src_iface} -B ${target_ip} -c ${packet_count} -d 100m
Suraj Gour33651272020-05-04 10:10:16 +05301316 ${var2}= Set Variable -t ${packet_type} "dp=${target_port}" -p 1472 -Q ${pbit}:${vlan}
1317 ${cmd}= Set Variable ${var1} ${var2}
1318 Start Remote Command ${cmd} ${src_ip} ${src_user} ${src_pass}
1319 ... ${src_container_type} ${src_container_name}
1320 ${output} ${stderr} ${rc}= Execute Remote Command
Andy Baviereff938d2020-06-29 18:27:49 -07001321 ... sudo tcpdump -l -U -c 30 -i ${target_iface} -e ${tcpdump_filter}
Suraj Gour33651272020-05-04 10:10:16 +05301322 ... ${dst_ip} ${dst_user} ${dst_pass} ${dst_container_type} ${dst_container_name}
Andy Baviereff938d2020-06-29 18:27:49 -07001323 ... timeout=30 seconds
1324 Execute Remote Command sudo pkill mausezahn
Suraj Gour33651272020-05-04 10:10:16 +05301325 ... ${src_ip} ${src_user} ${src_pass} ${src_container_type} ${src_container_name}
1326 # VOL-3262: I'm seeing untagged downstream traffic at RG for pbit 0. According to Girish this is
1327 # incorrect behavior. Simplify the following check when VOL-3262 is resolved.
1328 Run Keyword If ${pbit}==0 and "${tcpdump_filter}"=="udp"
1329 ... Should Match Regexp ${output} \\.${target_port}: UDP,
1330 ... ELSE Should Match Regexp ${output} , p ${pbit},.*\\.${target_port}: UDP,
1331 END
TorstenThieme70bc5262021-01-19 12:12:55 +00001332
1333Determine Number Of ONU
1334 [Arguments] ${olt_serial_number}=${EMPTY} ${num_onus}=${num_all_onus}
1335 [Documentation] Determine the number of different ONUs for the given OLT taken from host.src
1336 ${onu_list} Create List
1337 FOR ${INDEX} IN RANGE 0 ${num_onus}
1338 Continue For Loop If "${olt_serial_number}"!="${hosts.src[${INDEX}].olt}" and "${olt_serial_number}"!="${EMPTY}"
1339 ${onu_id}= Get Index From List ${onu_list} ${hosts.src[${INDEX}].onu}
1340 Run Keyword If -1 == ${onu_id} Append To List ${onu_list} ${hosts.src[${INDEX}].onu}
1341 END
1342 ${real_num_onus}= Get Length ${onu_list}
1343 [Return] ${real_num_onus}