blob: 682e9b5ad5b16a8293ca55c1e5a18da57fec1f8c [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
Kailash92764922019-07-25 08:21:39 -070027
28*** Keywords ***
Kailash528f7c02019-07-31 10:55:49 -070029Check CLI Tools Configured
30 [Documentation] Tests that use 'voltctl' and 'kubectl' should execute this keyword in suite setup
31 # check voltctl and kubectl configured
Zack Williamsa8fe75a2020-01-10 14:25:27 -070032 ${voltctl_rc}= Run And Return RC voltctl device list
33 ${kubectl_rc}= Run And Return RC kubectl get pods
Gilles Depatie675a2062019-10-22 12:44:42 -040034 Run Keyword If ${voltctl_rc} != 0 or ${kubectl_rc} != 0 FATAL ERROR
35 ... VOLTCTL and KUBECTL not configured. Please configure before executing tests.
Gilles Depatieb5682f82019-10-31 10:39:45 -040036
37Send File To Onos
Zack Williamsa8fe75a2020-01-10 14:25:27 -070038 [Documentation] Send the content of the file to Onos to selected section of configuration
39 ... using Post Request
40 [Arguments] ${CONFIG_FILE} ${section}
41 ${Headers}= Create Dictionary Content-Type application/json
42 ${File_Data}= OperatingSystem.Get File ${CONFIG_FILE}
43 Log ${Headers}
44 Log ${File_Data}
45 ${resp}= Post Request ONOS
46 ... /onos/v1/network/configuration/${section} headers=${Headers} data=${File_Data}
47 Should Be Equal As Strings ${resp.status_code} 200
Andy Bavier88cd9f62019-11-26 16:22:33 -070048
49Common Test Suite Setup
50 [Documentation] Setup the test suite
Andy Bavier88cd9f62019-11-26 16:22:33 -070051 Set Global Variable ${KUBECTL_CONFIG} export KUBECONFIG=%{KUBECONFIG}
Matteo Scandolo5899be12020-11-11 15:38:07 -080052 Set Global Variable ${VOLTCTL_CONFIG} %{VOLTCONFIG}
Andy Bavier88cd9f62019-11-26 16:22:33 -070053 ${k8s_node_ip}= Evaluate ${nodes}[0].get("ip")
ubuntu6b6e7d42020-03-02 12:35:42 -080054 ${ONOS_REST_IP}= Get Environment Variable ONOS_REST_IP ${k8s_node_ip}
55 ${ONOS_SSH_IP}= Get Environment Variable ONOS_SSH_IP ${k8s_node_ip}
56 Set Global Variable ${ONOS_REST_IP}
57 Set Global Variable ${ONOS_SSH_IP}
Andy Bavier88cd9f62019-11-26 16:22:33 -070058 ${k8s_node_user}= Evaluate ${nodes}[0].get("user")
59 ${k8s_node_pass}= Evaluate ${nodes}[0].get("pass")
60 Check CLI Tools Configured
61 ${onos_auth}= Create List karaf karaf
62 ${HEADERS} Create Dictionary Content-Type=application/json
ubuntu6b6e7d42020-03-02 12:35:42 -080063 Create Session ONOS http://${ONOS_REST_IP}:${ONOS_REST_PORT} auth=${ONOS_AUTH}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -080064 #${olt_ip}= Evaluate ${olts}[0].get("ip")
65 #${olt_ssh_ip}= Evaluate ${olts}[0].get("sship")
66 #${olt_user}= Evaluate ${olts}[0].get("user")
67 #${olt_pass}= Evaluate ${olts}[0].get("pass")
68 #${olt_serial_number}= Evaluate ${olts}[0].get("serial")
69 ${num_olts} Get Length ${olts}
70 ${list_olts} Create List
71 FOR ${I} IN RANGE 0 ${num_olts}
72 ${ip} Evaluate ${olts}[${I}].get("ip")
73 ${user} Evaluate ${olts}[${I}].get("user")
74 ${pass} Evaluate ${olts}[${I}].get("pass")
75 ${serial_number} Evaluate ${olts}[${I}].get("serial")
76 ${olt_ssh_ip} Evaluate ${olts}[${I}].get("sship")
77 ${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
80 ... ${pass} sn ${serial_number} onucount ${onu_count}
Suchitra Vemurife309412020-12-01 19:19:52 -080081 ... sship ${olt_ssh_ip} 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}
95 #Set Suite Variable ${olt_serial_number}
96 #Set Suite Variable ${olt_ip}
97 #Set Suite Variable ${olt_ssh_ip}
98 #Set Suite Variable ${olt_user}
99 #Set Suite Variable ${olt_pass}
Andy Bavier88cd9f62019-11-26 16:22:33 -0700100 @{container_list}= Create List adapter-open-olt adapter-open-onu voltha-api-server
101 ... voltha-ro-core voltha-rw-core-11 voltha-rw-core-12 voltha-ofagent
102 Set Suite Variable ${container_list}
103 ${datetime}= Get Current Date
suraj gour7f6d5fe2019-11-29 10:56:35 +0000104 Set Suite Variable ${datetime}
105
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800106Get ONU Count For OLT
107 [Arguments] ${src} ${serial_number}
108 [Documentation] Gets ONU Count for the specified OLT
109 ${src_length}= Get Length ${src}
110 ${count}= Set Variable 0
111 FOR ${I} IN RANGE 0 ${src_length}
112 ${sn} Evaluate ${src}[${I}].get("olt")
Andrea Campanella155c2aa2020-11-12 18:41:34 +0100113 ${count}= Run Keyword If '${serial_number}' == '${sn}' Evaluate ${count} + 1 ELSE Set Variable ${count}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800114 END
115 [Return] ${count}
116
Suchitra Vemurife309412020-12-01 19:19:52 -0800117Get ONU List For OLT
118 [Arguments] ${src} ${serial_number}
119 [Documentation] Gets ONU List for the specified OLT
120 ${src_length}= Get Length ${src}
121 ${onu_list}= Create List
122 FOR ${I} IN RANGE 0 ${src_length}
123 ${sn} Evaluate ${src}[${I}].get("olt")
124 Run Keyword If '${serial_number}' == '${sn}' Append To List ${onu_list} ${src}[${I}].get("onu")
125 ... ELSE Set Variable ${onu_list}
126 END
127 [Return] ${onu_list}
128
suraj gour7f6d5fe2019-11-29 10:56:35 +0000129WPA Reassociate
suraj gour7f6d5fe2019-11-29 10:56:35 +0000130 [Documentation] Executes a particular wpa_cli reassociate, which performs force reassociation
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700131 [Arguments] ${iface} ${ip} ${user} ${pass}=${None}
132 ... ${container_type}=${None} ${container_name}=${None}
suraj gour7f6d5fe2019-11-29 10:56:35 +0000133 #Below for loops are used instead of sleep time, to execute reassociate command and check status
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700134 FOR ${i} IN RANGE 70
135 ${output}= Login And Run Command On Remote System
136 ... wpa_cli -i ${iface} reassociate ${ip} ${user}
137 ... ${pass} ${container_type} ${container_name}
138 ${passed}= Run Keyword And Return Status Should Contain ${output} OK
Andy Bavierb63f6d22020-03-12 15:34:37 -0700139 Exit For Loop If ${passed}
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700140 END
Andy Bavierb63f6d22020-03-12 15:34:37 -0700141 Should Be True ${passed} Status does not contain 'SUCCESS'
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700142 FOR ${i} IN RANGE 70
143 ${output}= Login And Run Command On Remote System
Andy Bavierae4a17e2020-02-25 14:54:36 -0700144 ... wpa_cli -i ${iface} status | grep SUCCESS ${ip} ${user}
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700145 ... ${pass} ${container_type} ${container_name}
146 ${passed}= Run Keyword And Return Status Should Contain ${output} SUCCESS
Andy Bavierb63f6d22020-03-12 15:34:37 -0700147 Exit For Loop If ${passed}
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700148 END
Andy Bavierb63f6d22020-03-12 15:34:37 -0700149 Should Be True ${passed} Status does not contain 'SUCCESS'
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700150
suraj gour7f6d5fe2019-11-29 10:56:35 +0000151Validate Authentication After Reassociate
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700152 [Arguments] ${auth_pass} ${iface} ${ip} ${user} ${pass}=${None}
153 ... ${container_type}=${None} ${container_name}=${None}
154 [Documentation]
155 ... Executes a particular reassociate request on the RG using wpa_cli.
156 ... auth_pass determines if authentication should pass
Andy Bavier84834d42020-02-25 13:49:50 -0700157 ${wpa_log}= Catenate SEPARATOR=. /tmp/wpa ${iface} log
158 ${output}= Login And Run Command On Remote System truncate -s 0 ${wpa_log}; cat ${wpa_log}
159 ... ${ip} ${user} ${pass} ${container_type} ${container_name}
160 Log ${output}
161 Should Not Contain ${output} authentication completed successfully
suraj gour7f6d5fe2019-11-29 10:56:35 +0000162 WPA Reassociate ${iface} ${ip} ${user} ${pass} ${container_type} ${container_name}
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700163 Run Keyword If '${auth_pass}' == 'True' Wait Until Keyword Succeeds ${timeout} 2s
Andy Bavier84834d42020-02-25 13:49:50 -0700164 ... Check Remote File Contents True ${wpa_log} ${iface}.*authentication completed successfully
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700165 ... ${ip} ${user} ${pass} ${container_type} ${container_name}
suraj gour7f6d5fe2019-11-29 10:56:35 +0000166 Run Keyword If '${auth_pass}' == 'False' Sleep 20s
Suchitra Vemuri3cb29f82020-02-25 13:59:58 -0800167 Run Keyword If '${auth_pass}' == 'False' Check Remote File Contents False /tmp/wpa.log
Andy Bavier84834d42020-02-25 13:49:50 -0700168 ... ${iface}.*authentication completed successfully ${ip} ${user} ${pass}
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700169 ... ${container_type} ${container_name}
suraj gourd5cfdbb2019-12-13 12:44:55 +0000170
171Send Dhclient Request To Release Assigned IP
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700172 [Arguments] ${iface} ${ip} ${user} ${path_dhcpleasefile} ${pass}=${None}
173 ... ${container_type}=${None} ${container_name}=${None}
suraj gourd5cfdbb2019-12-13 12:44:55 +0000174 [Documentation] Executes a dhclient with option to release ip against a particular interface on the RG (src)
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700175 ${result}= Login And Run Command On Remote System
176 ... dhclient -nw -r ${iface} && rm ${path_dhcpleasefile}/dhclient.* ${ip} ${user}
suraj gourd5cfdbb2019-12-13 12:44:55 +0000177 ... ${pass} ${container_type} ${container_name}
178 Log ${result}
179 #Should Contain ${result} DHCPRELEASE
180 [Return] ${result}
suraj gour1ecfae92019-12-20 15:11:40 +0000181
182Check Remote File Contents For WPA Logs
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700183 [Arguments] ${file_should_exist} ${file} ${pattern} ${ip} ${user} ${pass}=${None}
184 ... ${container_type}=${None} ${container_name}=${None} ${prompt}=~$
suraj gour1ecfae92019-12-20 15:11:40 +0000185 [Documentation] Checks for particular pattern count in a file
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700186 ${result}= Login And Run Command On Remote System
187 ... cat ${file} | grep '${pattern}' | wc -l ${ip} ${user} ${pass}
suraj gour1ecfae92019-12-20 15:11:40 +0000188 ... ${container_type} ${container_name} ${prompt}
189 [Return] ${result}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000190
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800191
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000192Perform Sanity Test
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800193 [Documentation] This keyword iterate all OLTs and performs Sanity Test Procedure
194 ... for all the ONUs connected to each OLT - ATT workflow
195 FOR ${J} IN RANGE 0 ${num_olts}
196 ${olt_serial_number}= Set Variable ${list_olts}[${J}][sn]
197 ${onu_count}= Set Variable ${list_olts}[${J}][onucount]
198 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS
199 ... ${olt_serial_number}
200 Set Global Variable ${of_id}
201 ${nni_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
202 ... Get NNI Port in ONOS ${of_id}
203 Set Global Variable ${nni_port}
204 # Verify Default Meter in ONOS (valid only for ATT)
205 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
206 ... Verify Default Meter Present in ONOS ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
207 Perform Sanity Test Per OLT ${of_id} ${nni_port} ${olt_serial_number} ${onu_count}
208 END
209
210Perform Sanity Test Per OLT
211 [Arguments] ${of_id} ${nni_port} ${olt_serial_number} ${num_onus}
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
216 #${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${olt_serial_number}
217 #Set Global Variable ${of_id}
218 #${nni_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
219 #... Get NNI Port in ONOS ${of_id}
220 #Set Global Variable ${nni_port}
Hardik Windlass2a9b1592020-07-23 18:28:13 +0530221 # Verify Default Meter in ONOS (valid only for ATT)
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800222 #Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
223 #... Verify Default Meter Present in ONOS ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
224 FOR ${I} IN RANGE 0 ${num_all_onus}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000225 ${src}= Set Variable ${hosts.src[${I}]}
226 ${dst}= Set Variable ${hosts.dst[${I}]}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800227 Continue For Loop If "${olt_serial_number}"!="${src['olt']}"
Suchitra Vemuri03005912020-02-20 18:59:46 -0800228 Run Keyword and Ignore Error Collect Logs
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000229 ${onu_device_id}= Get Device ID From SN ${src['onu']}
230 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
231 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
Suchitra Vemuri8078b972020-02-06 19:07:41 -0800232 # Check ONU port is Enabled in ONOS
233 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
Suchitra Vemuri760bdd32020-06-17 12:34:48 -0700234 ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
Suchitra Vemuri8078b972020-02-06 19:07:41 -0800235 # Verify EAPOL flows are added for the ONU port
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000236 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
ubuntu6b6e7d42020-03-02 12:35:42 -0800237 ... Verify Eapol Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Suchitra Vemuri8078b972020-02-06 19:07:41 -0800238 # Verify ONU state in voltha
239 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
240 ... ENABLED ACTIVE REACHABLE
241 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
242 # Perform Authentication
Andy Bavier84834d42020-02-25 13:49:50 -0700243 ${wpa_log}= Run Keyword If ${has_dataplane} Catenate SEPARATOR=.
244 ... /tmp/wpa ${src['dp_iface_name']} log
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000245 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate Authentication True
246 ... ${src['dp_iface_name']} wpa_supplicant.conf ${src['ip']} ${src['user']} ${src['pass']}
Andy Bavier84834d42020-02-25 13:49:50 -0700247 ... ${src['container_type']} ${src['container_name']} ${wpa_log}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000248 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
ubuntu6b6e7d42020-03-02 12:35:42 -0800249 ... Verify ONU in AAA-Users ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000250 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
ubuntu6b6e7d42020-03-02 12:35:42 -0800251 ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000252 ... volt-add-subscriber-access ${of_id} ${onu_port}
Suchitra Vemuri9da44302020-03-04 14:24:49 -0800253 # Verify that no pending flows exist for the ONU port
254 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
255 ... Verify No Pending Flows For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Hardik Windlass21807632020-04-14 16:24:55 +0530256 # Verify subscriber access flows are added for the ONU port
257 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
258 ... Verify Subscriber Access Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
259 ... ${onu_port} ${nni_port} ${src['c_tag']} ${src['s_tag']}
Hardik Windlass2a9b1592020-07-23 18:28:13 +0530260 # Verify Meters in ONOS
261 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
262 ... Verify Meters in ONOS ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id} ${onu_port}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000263 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate DHCP and Ping True
264 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
265 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
266 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
267 ... ${dst['container_name']}
268 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
ubuntu6b6e7d42020-03-02 12:35:42 -0800269 ... Validate Subscriber DHCP Allocation ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000270 Run Keyword and Ignore Error Get Device Output from Voltha ${onu_device_id}
271 Run Keyword and Ignore Error Collect Logs
272 END
273
Hardik Windlassa3d04b92020-02-17 15:06:05 +0000274Perform Sanity Test DT
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800275 [Documentation] This keyword iterate all OLTs and performs Sanity Test Procedure for DT workflow
276 FOR ${J} IN RANGE 0 ${num_olts}
277 ${olt_serial_number}= Set Variable ${list_olts}[${J}][sn]
278 ${num_onus}= Set Variable ${list_olts}[${J}][onucount]
279 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
Suchitra Vemuri4b8f4f52020-11-17 19:12:50 -0800280 Run Keyword and Ignore Error Collect Logs
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800281 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS
282 ... ${olt_serial_number}
283 Set Global Variable ${of_id}
284 ${nni_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
285 ... Get NNI Port in ONOS ${of_id}
286 Set Global Variable ${nni_port}
287 Perform Sanity Test DT Per OLT ${of_id} ${nni_port} ${olt_serial_number} ${num_onus}
288 # Verify ONOS Flows
289 # Number of Access Flows on ONOS equals 4 * the Number of Active ONUs (2 for each downstream and upstream)
290 ${onos_flows_count}= Evaluate 4 * ${num_onus}
291 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
292 ... Verify Subscriber Access Flows Added Count DT ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
293 ... ${onos_flows_count}
294 # Verify VOLTHA Flows
295 # Number of per OLT Flows equals Twice the Number of Active ONUs (each for downstream and upstream) + 1 for LLDP
296 ${olt_flows}= Evaluate 2 * ${num_onus} + 1
297 # Number of per ONU Flows equals 2 (one each for downstream and upstream)
298 ${onu_flows}= Set Variable 2
299 Run Keyword Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Flows ${olt_flows}
300 ... ${olt_device_id}
301 ${List_ONU_Serial} Create List
302 Set Suite Variable ${List_ONU_Serial}
Suchitra Vemuri21a47fd2020-11-16 18:39:09 -0800303 Build ONU SN List ${List_ONU_Serial} ${olt_serial_number}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800304 Log ${List_ONU_Serial}
305 Run Keyword Wait Until Keyword Succeeds ${timeout} 5s Validate ONU Flows
306 ... ${List_ONU_Serial} ${onu_flows}
307 END
308
309
310Perform Sanity Test DT Per OLT
311 [Arguments] ${of_id} ${nni_port} ${olt_serial_number} ${num_onus}
Hardik Windlassa3d04b92020-02-17 15:06:05 +0000312 [Documentation] This keyword performs Sanity Test Procedure for DT Workflow
313 ... Sanity test performs dhcp and pings (without EAPOL and DHCP flows) for all the ONUs given for the POD
314 ... This keyword can be used to call in any other tests where sanity check is required
315 ... and avoids duplication of code.
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800316 #${of_id}= Wait Until Keyword Succeeds 360s 15s Validate OLT Device in ONOS ${olt_serial_number}
317 #Set Global Variable ${of_id}
318 #${nni_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
319 #... Get NNI Port in ONOS ${of_id}
320 #Set Global Variable ${nni_port}
321 FOR ${I} IN RANGE 0 ${num_all_onus}
Hardik Windlassa3d04b92020-02-17 15:06:05 +0000322 ${src}= Set Variable ${hosts.src[${I}]}
323 ${dst}= Set Variable ${hosts.dst[${I}]}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800324 Continue For Loop If "${olt_serial_number}"!="${src['olt']}"
Suchitra Vemuri4b8f4f52020-11-17 19:12:50 -0800325 Run Keyword and Ignore Error Collect Logs
Hardik Windlassa3d04b92020-02-17 15:06:05 +0000326 ${onu_device_id}= Get Device ID From SN ${src['onu']}
327 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
328 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
329 # Check ONU port is Enabled in ONOS
330 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
Suchitra Vemuri760bdd32020-06-17 12:34:48 -0700331 ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
Hardik Windlassa3d04b92020-02-17 15:06:05 +0000332 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
ubuntu6b6e7d42020-03-02 12:35:42 -0800333 ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
Hardik Windlassa3d04b92020-02-17 15:06:05 +0000334 ... volt-add-subscriber-access ${of_id} ${onu_port}
Hardik Windlassfb5eace2020-03-26 14:49:01 +0530335 # Verify subscriber access flows are added for the ONU port
336 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
Hardik Windlass25e11702020-03-30 20:05:19 +0530337 ... Verify Subscriber Access Flows Added For ONU DT ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
338 ... ${onu_port} ${nni_port} ${src['s_tag']}
Hardik Windlassa3d04b92020-02-17 15:06:05 +0000339 # Verify ONU state in voltha
340 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
341 ... ENABLED ACTIVE REACHABLE
342 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
Hardik Windlass2a9b1592020-07-23 18:28:13 +0530343 # Verify Meters in ONOS
344 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
345 ... Verify Meters in ONOS ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id} ${onu_port}
Hardik Windlassfb5eace2020-03-26 14:49:01 +0530346 # TODO: Yet to Verify on the GPON based Physical POD (VOL-2652)
Hardik Windlassa3d04b92020-02-17 15:06:05 +0000347 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate DHCP and Ping True
348 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
349 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
350 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
351 ... ${dst['container_name']}
352 Run Keyword and Ignore Error Get Device Output from Voltha ${onu_device_id}
353 Run Keyword and Ignore Error Collect Logs
354 END
Hardik Windlassfb5eace2020-03-26 14:49:01 +0530355 # Verify ONOS Flows
356 # Number of Access Flows on ONOS equals 4 * the Number of Active ONUs (2 for each downstream and upstream)
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800357 #${onos_flows_count}= Evaluate 4 * ${num_onus}
358 #Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
359 #... Verify Subscriber Access Flows Added Count DT ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
360 #... ${onos_flows_count}
Hardik Windlassfb5eace2020-03-26 14:49:01 +0530361 # Verify VOLTHA Flows
Hardik Windlassa3d04b92020-02-17 15:06:05 +0000362 # Number of per OLT Flows equals Twice the Number of Active ONUs (each for downstream and upstream) + 1 for LLDP
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800363 #${olt_flows}= Evaluate 2 * ${num_onus} + 1
Hardik Windlassa3d04b92020-02-17 15:06:05 +0000364 # Number of per ONU Flows equals 2 (one each for downstream and upstream)
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800365 #${onu_flows}= Set Variable 2
366 #Run Keyword Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Flows ${olt_flows}
367 #${List_ONU_Serial} Create List
368 #Set Suite Variable ${List_ONU_Serial}
Andrea Campanella6391f842020-11-16 10:01:18 +0100369 #Build ONU SN List ${List_ONU_Serial} ${olt_serial_number}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800370 #Log ${List_ONU_Serial}
371 #Run Keyword Wait Until Keyword Succeeds ${timeout} 5s Validate ONU Flows
372 #... ${List_ONU_Serial} ${onu_flows}
373
374Validate All OLT Flows
375 [Documentation] This keyword iterate all OLTs and performs Sanity Test Procedure for DT workflow
376 FOR ${J} IN RANGE 0 ${num_olts}
377 ${olt_serial_number}= Set Variable ${list_olts}[${J}][sn]
378 ${num_onus}= Set Variable ${list_olts}[${J}][onucount]
379 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
380 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS
381 ... ${olt_serial_number}
382 Set Global Variable ${of_id}
383 # Verify ONOS Flows
384 # Number of Access Flows on ONOS equals 4 * the Number of Active ONUs (2 for each downstream and upstream)
385 ${onos_flows_count}= Evaluate 4 * ${num_onus}
386 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
387 ... Verify Subscriber Access Flows Added Count DT ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
388 ... ${onos_flows_count}
389 # Verify VOLTHA Flows
390 # Number of per OLT Flows equals Twice the Number of Active ONUs (each for downstream and upstream) + 1 for LLDP
391 ${olt_flows}= Evaluate 2 * ${num_onus} + 1
392 # Number of per ONU Flows equals 2 (one each for downstream and upstream)
393 ${onu_flows}= Set Variable 2
394 Run Keyword Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Flows ${olt_flows}
395 ... ${olt_device_id}
396 ${List_ONU_Serial} Create List
397 Set Suite Variable ${List_ONU_Serial}
Andrea Campanella6391f842020-11-16 10:01:18 +0100398 Build ONU SN List ${List_ONU_Serial} ${olt_serial_number}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800399 Log ${List_ONU_Serial}
400 Run Keyword Wait Until Keyword Succeeds ${timeout} 5s Validate ONU Flows
401 ... ${List_ONU_Serial} ${onu_flows}
402 END
Hardik Windlassa3d04b92020-02-17 15:06:05 +0000403
Suchitra Vemuri2f1e07d2020-06-26 19:18:01 -0700404Perform Sanity Test TT
405 [Documentation] This keyword performs Sanity Test Procedure for TT Workflow
406 ... Sanity test performs dhcp and pings (without EAPOL and DHCP flows) for all the ONUs given for the POD
407 ... This keyword can be used to call in any other tests where sanity check is required
408 ... and avoids duplication of code.
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800409 FOR ${I} IN RANGE 0 ${num_all_onus}
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -0700410 ${src}= Set Variable ${hosts.src[${I}]}
411 ${dst}= Set Variable ${hosts.dst[${I}]}
412 ${service_type}= Get Variable Value ${src['service_type']} "null"
413 Run Keyword IF '${service_type}' != 'mcast' Sanity Test TT one ONU ${src} ${dst}
414 Run Keyword and Ignore Error Collect Logs
415 END
416 Run Keyword and Ignore Error Collect Logs
417
418Sanity Test TT one ONU
419 [Documentation] This keyword performs sanity test for a single ONU for TT workflow
420 ... Tests for one ONU
421 ... Assertions apply to HSIA, VoD, VoIP services
422 [Arguments] ${src} ${dst}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800423 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${src['olt']}
Suchitra Vemuri2f1e07d2020-06-26 19:18:01 -0700424 Set Global Variable ${of_id}
425 ${nni_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
426 ... Get NNI Port in ONOS ${of_id}
427 Set Global Variable ${nni_port}
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -0700428 ${onu_device_id}= Get Device ID From SN ${src['onu']}
429 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
430 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
431 # Check ONU port is Enabled in ONOS
432 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
433 ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
434 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
435 ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
436 ... volt-add-subscriber-access ${of_id} ${onu_port}
437 Sleep 30s
438 # Verify ONU state in voltha
439 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
440 ... ENABLED ACTIVE REACHABLE
441 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
442 # TODO: Yet to Verify on the GPON based Physical POD (VOL-2652)
443 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate DHCP and Ping True
444 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
445 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
446 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
447 ... ${dst['container_name']}
Suchitra Vemuri16644bd2020-10-03 14:06:12 -0700448 Run Keyword IF ${has_dataplane}
Suchitra Vemurib4d9e8d2020-10-05 20:49:21 -0700449 ... Run Keyword IF '${src['service_type']}'!='hsia'
Suchitra Vemuri42819412020-10-01 17:45:43 -0700450 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
Suchitra Vemuri8d3b0032020-09-11 17:49:08 -0700451 ... Validate Subscriber DHCP Allocation ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Suchitra Vemuri42819412020-10-01 17:45:43 -0700452 ... ${src['c_tag']}
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -0700453 Run Keyword and Ignore Error Get Device Output from Voltha ${onu_device_id}
454 Run Keyword and Ignore Error Collect Logs
455
456Perform Sanity Test TT MCAST
457 [Documentation] This keyword performs Sanity Test Procedure for TT Workflow
458 ... Adds subscribers
459 ... Validates for MCAST
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800460 FOR ${I} IN RANGE 0 ${num_all_onus}
Suchitra Vemuri2f1e07d2020-06-26 19:18:01 -0700461 ${src}= Set Variable ${hosts.src[${I}]}
462 ${dst}= Set Variable ${hosts.dst[${I}]}
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -0700463 ${service_type}= Get Variable Value ${src['service_type']} "null"
464 Run Keyword IF '${service_type}' == 'mcast' Sanity Test TT MCAST one ONU ${src}
465 ... ${dst}
Suchitra Vemuri2f1e07d2020-06-26 19:18:01 -0700466 Run Keyword and Ignore Error Collect Logs
467 END
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -0700468 Run Keyword and Ignore Error Collect Logs
469
470Sanity Test TT MCAST one ONU
471 [Documentation] This keyword performs sanity test for a single ONU for TT workflow
472 ... Tests for one ONU
473 ... Assertions apply to MCAST services
474 [Arguments] ${src} ${dst}
475 # Check for iperf and jq tools
476 ${stdout} ${stderr} ${rc}= Execute Remote Command which iperf jq
477 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']}
478 ... ${src['container_name']}
479 Pass Execution If ${rc} != 0 Skipping test: iperf / jq not found on the RG
480
481 #Reset the IP on the interface
482 ${output}= Login And Run Command On Remote System sudo ifconfig ${src['dp_iface_name']} 0
483 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
484 # Kill iperf on BNG
485 ${rg_output}= Run Keyword and Continue On Failure Login And Run Command On Remote System
486 ... sudo kill -9 `pidof iperf`
487 ... ${dst['bng_ip']} ${dst['bng_user']} ${dst['bng_pass']} ${dst['container_type']}
488 ... ${dst['container_name']}
489
490 # Setup RG for Multi-cast test
491 ${output}= Login And Run Command On Remote System
492 ... sudo ifconfig ${src['dp_iface_name']} ${src['mcast_rg']} up ; sudo kill -9 `pidof iperf`
493 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
494 ${output}= Login And Run Command On Remote System
495 ... sudo ip route add ${src['mcast_grp_subnet_mask']} dev ${src['dp_iface_name']} scope link
496 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
497
498 # Perform operations for adding subscriber
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800499 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${src['olt']}
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -0700500 Set Global Variable ${of_id}
501 ${nni_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
502 ... Get NNI Port in ONOS ${of_id}
503 Set Global Variable ${nni_port}
504 ${onu_device_id}= Get Device ID From SN ${src['onu']}
505 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
506 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
507 # Check ONU port is Enabled in ONOS
508 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
509 ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
510 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
511 ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
512 ... volt-add-subscriber-access ${of_id} ${onu_port}
513 Sleep 30s
514 # Verify ONU state in voltha
515 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
516 ... ENABLED ACTIVE REACHABLE
517 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
518
519 # Setup iperf on the BNG
520 ${server_output}= Login And Run Command On Remote System
521 ... sudo iperf -c ${dst['dp_iface_ip_qinq']} -u -T 32 -t 60 -i 1 &
522 ... ${dst['bng_ip']} ${dst['bng_user']} ${dst['bng_pass']} ${dst['container_type']}
523 ... ${dst['container_name']}
524
525 # Setup iperf on the RG
526 ${rg_output}= Run Keyword and Continue On Failure Wait Until Keyword Succeeds 90s 5s
527 ... Login And Run Command On Remote System
528 ... rm -rf /tmp/rg_output ; sudo iperf -s -u -B ${dst['dp_iface_ip_qinq']} -i 1 -D >> /tmp/rg_output
529 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
530 Log ${rg_output}
531 Sleep 60s
532 ${output}= Run Keyword and Continue On Failure Wait Until Keyword Succeeds 90s 5s
533 ... Login And Run Command On Remote System
534 ... cat /tmp/rg_output | grep KBytes
535 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
536 Log ${output}
537 Should Contain ${output} KBytes
538
539 # Kill iperf on BNG
540 ${rg_output}= Run Keyword and Continue On Failure Login And Run Command On Remote System
541 ... sudo kill -9 `pidof iperf`
542 ... ${dst['bng_ip']} ${dst['bng_user']} ${dst['bng_pass']} ${dst['container_type']}
543 ... ${dst['container_name']}
544
545 # Kill iperf on the RG
546 ${output}= Run Keyword and Continue On Failure Login And Run Command On Remote System
547 ... sudo kill -9 `pidof iperf`
548 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
549
Suchitra Vemuri2f1e07d2020-06-26 19:18:01 -0700550
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000551Setup
552 [Documentation] Pre-test Setup
553 #test for empty device list
554 Test Empty Device List
Suchitra Vemuri3158f3c2020-05-28 17:58:26 -0700555 #Run Keyword If ${has_dataplane} Wait Until Keyword Succeeds 120s 10s Openolt is Up
556 #... ${olt_ip} ${olt_user} ${olt_pass}
Suchitra Vemuri1d8e8172020-06-17 17:43:56 -0700557 Run Keyword If ${has_dataplane} Sleep 230s
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800558 # Create a list of olt ids (logical and device_id)
559 ${olt_ids} Create List
560 FOR ${I} IN RANGE 0 ${num_olts}
561 #create/preprovision device
562 ${olt_device_id}= Create Device ${list_olts}[${I}][ip] ${OLT_PORT}
563 ${olt_serial_number}= Set Variable ${list_olts}[${I}][sn]
564 #Set Suite Variable ${olt_device_id}
565 #validate olt states
566 Wait Until Keyword Succeeds ${timeout} 5s
567 ... Validate OLT Device PREPROVISIONED UNKNOWN UNKNOWN ${olt_device_id}
568 Sleep 5s
569 Enable Device ${olt_device_id}
570 Wait Until Keyword Succeeds 380s 5s
571 ... Validate OLT Device ENABLED ACTIVE REACHABLE ${olt_serial_number}
572 ${logical_id}= Get Logical Device ID From SN ${olt_serial_number}
573 # Set Suite Variable ${logical_id}
574 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS
575 ... ${olt_serial_number}
576 ${olt} Create Dictionary device_id ${olt_device_id} logical_id ${logical_id}
577 ... of_id ${of_id} sn ${olt_serial_number}
578 Append To List ${olt_ids} ${olt}
579 END
580 Set Global Variable ${olt_ids}
581
582Get ofID From OLT List
583 [Documentation] Retrieves the corresponding of_id for the OLT serial number specified
584 [Arguments] ${serial_number}
585 FOR ${I} IN RANGE 0 ${olt_count}
586 ${sn}= Get From Dictionary ${olt_ids}[${I}] sn
Andrea Campanella317a94c2020-11-13 10:38:19 +0100587 ${of_id}= Run Keyword IF "${serial_number}"=="${sn}"
588 ... Get From Dictionary ${olt_ids}[${I}] of_id ELSE Set Variable ${of_id}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800589 END
590 [Return] ${of_id}
591
592Get OLTDeviceID From OLT List
593 [Documentation] Retrieves the corresponding olt_device_id for the OLT serial number specified
594 [Arguments] ${serial_number}
Suchitra Vemuri4b8f4f52020-11-17 19:12:50 -0800595 ${olt_device_id}= Set Variable 0
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800596 FOR ${I} IN RANGE 0 ${olt_count}
597 ${sn}= Get From Dictionary ${olt_ids}[${I}] sn
Andrea Campanella317a94c2020-11-13 10:38:19 +0100598 ${olt_device_id}= Run Keyword IF "${serial_number}"=="${sn}"
599 ... Get From Dictionary ${olt_ids}[${I}] device_id ELSE Set Variable ${olt_device_id}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800600 END
601 [Return] ${olt_device_id}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000602
Andrea Campanellad848de02020-11-24 10:23:41 +0100603Get Num of Onus From OLT SN
604 [Documentation] Retrieves the corresponding number of ONUs for a given OLT based on serial number specified
605 [Arguments] ${serial_number}
606 ${num_of_olt_onus}= Set Variable 0
607 FOR ${I} IN RANGE 0 ${olt_count}
608 ${sn}= Get From Dictionary ${olt_ids}[${I}] sn
609 ${num_of_olt_onus}= Run Keyword IF "${serial_number}"=="${sn}"
610 ... Get From Dictionary ${list_olts}[${I}] onucount ELSE Set Variable ${num_of_olt_onus}
611 END
612 [Return] ${num_of_olt_onus}
613
Hardik Windlassaaea3402020-03-10 19:45:45 +0530614Validate ONUs After OLT Disable
615 [Documentation] Validates the ONUs state in Voltha, ONUs port state in ONOS
616 ... and that pings do not succeed After corresponding OLT is Disabled
Andrea Campanella4e507882020-11-26 11:33:11 +0100617 [Arguments] ${num_onus} ${olt_serial_number}
Hardik Windlassaaea3402020-03-10 19:45:45 +0530618 FOR ${I} IN RANGE 0 ${num_onus}
619 ${src}= Set Variable ${hosts.src[${I}]}
620 ${dst}= Set Variable ${hosts.dst[${I}]}
Andrea Campanella4e507882020-11-26 11:33:11 +0100621 Continue For Loop If "${olt_serial_number}"!="${src['olt']}"
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800622 ${of_id}= Get ofID From OLT List ${src['olt']}
Hardik Windlassaaea3402020-03-10 19:45:45 +0530623 ${onu_device_id}= Get Device ID From SN ${src['onu']}
624 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
625 ... ${of_id}
626 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
627 ... Validate Device ENABLED DISCOVERED
628 ... UNREACHABLE ${src['onu']} onu=True onu_reason=stopping-openomci
629 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
Suchitra Vemuri760bdd32020-06-17 12:34:48 -0700630 ... Verify ONU Port Is Disabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
Hardik Windlassaaea3402020-03-10 19:45:45 +0530631 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
632 ... Wait Until Keyword Succeeds 60s 2s
633 ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
634 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
635 Run Keyword and Ignore Error Get Device Output from Voltha ${onu_device_id}
636 Run Keyword and Ignore Error Collect Logs
637 END
638
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000639Delete All Devices and Verify
640 [Documentation] Remove any devices from VOLTHA and ONOS
641 # Clear devices from VOLTHA
642 Disable Devices In Voltha Root=true
Suchitra Vemuri970747f2020-03-30 17:31:34 -0700643 Sleep 5s
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000644 Wait Until Keyword Succeeds ${timeout} 2s Test Devices Disabled In Voltha Root=true
645 Delete Devices In Voltha Root=true
Matteo Scandolof6cea382020-04-20 14:32:00 -0700646 Run Keyword If ${has_dataplane} Sleep 30s
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000647 Wait Until Keyword Succeeds ${timeout} 2s Test Empty Device List
648 # Clear devices from ONOS
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800649 #Remove All Devices From ONOS
ubuntu6b6e7d42020-03-02 12:35:42 -0800650 #... http://karaf:karaf@${ONOS_REST_IP}:${ONOS_REST_PORT}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000651
652Teardown
653 [Documentation] kills processes and cleans up interfaces on src+dst servers
654 Run Keyword If ${has_dataplane} Clean Up Linux
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000655
656Teardown Suite
657 [Documentation] Clean up device if desired
658 Run Keyword If ${teardown_device} Delete All Devices and Verify
659
660Delete Device and Verify
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800661 [Arguments] ${olt_serial_number}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000662 [Documentation] Disable -> Delete devices via voltctl and verify its removed
Suchitra Vemuri2fa9bba2020-01-22 17:38:48 -0800663 ${olt_device_id}= Get Device ID From SN ${olt_serial_number}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000664 ${rc} ${output}= Run and Return Rc and Output
Matteo Scandolo5899be12020-11-11 15:38:07 -0800665 ... voltctl -c ${VOLTCTL_CONFIG} device disable ${olt_device_id}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000666 Should Be Equal As Integers ${rc} 0
667 Sleep 5s
668 Wait Until Keyword Succeeds ${timeout} 5s
669 ... Validate OLT Device DISABLED UNKNOWN REACHABLE ${olt_serial_number}
670 ${rc} ${output}= Run and Return Rc and Output
Matteo Scandolo5899be12020-11-11 15:38:07 -0800671 ... voltctl -c ${VOLTCTL_CONFIG} device delete ${olt_device_id}
Matteo Scandolof6cea382020-04-20 14:32:00 -0700672 Run Keyword If ${has_dataplane} Sleep 50s
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000673 Should Be Equal As Integers ${rc} 0
674 Wait Until Keyword Succeeds ${timeout} 5s Validate Device Removed ${olt_device_id}
675
Gayathri.Selvan283a63c2020-01-23 04:09:18 +0000676Repeat Sanity Test
677 [Documentation] This keyword performs Sanity Test Procedure
678 ... Sanity test performs authentication, dhcp and pings for all the ONUs given for the POD
679 ... This keyword can be used to call in any other tests where sanity check is required
680 ... with wpa reassociation
681 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${olt_serial_number}
682 Set Global Variable ${of_id}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800683 FOR ${I} IN RANGE 0 ${num_all_onus}
Suchitra Vemuri03005912020-02-20 18:59:46 -0800684 Run Keyword and Ignore Error Collect Logs
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 Run Keyword and Ignore Error Get Device Output from Voltha ${onu_device_id}
718 Run Keyword and Ignore Error Collect Logs
719 END
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000720
Hardik Windlass16cdf962020-04-29 15:26:50 +0530721Validate ONUs for PON OLT Disable
722 [Arguments] ${olt_peer_list}
723 [Documentation] This keyword validates that Ping fails for ONUs connected to Disabled OLT PON port
724 ... And Pings succeed for other Active OLT PON port ONUs
725 ... Also it removes subscriber for Disabled OLT PON port ONUs to replicate ATT workflow
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800726 FOR ${I} IN RANGE 0 ${num_all_nus}
Hardik Windlass16cdf962020-04-29 15:26:50 +0530727 ${src}= Set Variable ${hosts.src[${I}]}
728 ${dst}= Set Variable ${hosts.dst[${I}]}
729 ${onu_device_id}= Get Device ID From SN ${src['onu']}
730 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
731 ... ${of_id}
732 ${matched}= Match ONU in PON OLT Peer List ${olt_peer_list} ${onu_device_id}
733 Run Keyword If ${matched}
734 ... Run Keywords
735 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
736 ... Validate Device ENABLED DISCOVERED
737 ... UNREACHABLE ${src['onu']} onu=True onu_reason=stopping-openomci
738 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
739 ... Verify ONU Port Is Disabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
740 ... AND Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
741 ... Wait Until Keyword Succeeds 60s 2s
742 ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
743 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']}
744 ... ${src['container_name']}
745 # Remove Subscriber Access (To replicate ATT workflow)
746 ... AND Wait Until Keyword Succeeds ${timeout} 2s Execute ONOS CLI Command ${ONOS_SSH_IP}
747 ... ${ONOS_SSH_PORT} volt-remove-subscriber-access ${of_id} ${onu_port}
748 ... ELSE
749 ... Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
750 ... Wait Until Keyword Succeeds 60s 2s
751 ... Check Ping True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
752 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']}
753 ... ${src['container_name']}
754 Run Keyword and Ignore Error Collect Logs
755 END
756
757Validate ONUs for PON OLT Enable
758 [Arguments] ${olt_peer_list}
759 [Documentation] This keyword validates Ping succeeds for all Enabled/Acitve OLT PON ports
760 ... Also performs Auth/subscriberAdd/DHCP/Ping for the ONUs on Re-Enabled OLT PON port
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800761 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}]}
764 ${onu_device_id}= Get Device ID From SN ${src['onu']}
765 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
766 ... ${of_id}
767 ${matched}= Match ONU in PON OLT Peer List ${olt_peer_list} ${onu_device_id}
768 ${wpa_log}= Run Keyword If ${has_dataplane} and ${matched} Catenate SEPARATOR=.
769 ... /tmp/wpa ${src['dp_iface_name']} log
770 Run Keyword If ${matched}
771 ... Run Keywords
772 # Perform Cleanup
773 ... Run Keyword If ${has_dataplane} Clean Up Linux ${onu_device_id}
774 # Verify ONU port status
775 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
776 ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
777 # Verify EAPOL flows are added for the ONU port
778 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
779 ... Verify Eapol Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
780 # Verify ONU state in voltha
781 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
782 ... Validate Device ENABLED ACTIVE REACHABLE
783 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
784 # Perform Authentication
785 ... AND Run Keyword If ${has_dataplane}
786 ... Run Keyword And Continue On Failure Validate Authentication True
787 ... ${src['dp_iface_name']} wpa_supplicant.conf ${src['ip']} ${src['user']} ${src['pass']}
788 ... ${src['container_type']} ${src['container_name']} ${wpa_log}
789 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
790 ... Verify ONU in AAA-Users ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
791 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
792 ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
793 ... volt-add-subscriber-access ${of_id} ${onu_port}
794 # Verify that no pending flows exist for the ONU port
795 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
796 ... Verify No Pending Flows For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
797 # Verify subscriber access flows are added for the ONU port
798 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
799 ... Verify Subscriber Access Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
800 ... ${onu_port} ${nni_port} ${src['c_tag']} ${src['s_tag']}
801 ... AND Run Keyword If ${has_dataplane}
802 ... Run Keyword And Continue On Failure Validate DHCP and Ping True
803 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
804 ... ${src['ip']} ${src['user']} ${src['pass']}
805 ... ${src['container_type']} ${src['container_name']}
806 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']}
807 ... ${dst['container_type']} ${dst['container_name']}
808 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
809 ... Validate Subscriber DHCP Allocation ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
810 ... AND Run Keyword and Ignore Error Get Device Output from Voltha ${onu_device_id}
811 ... ELSE
812 ... Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
813 ... Wait Until Keyword Succeeds 60s 2s
814 ... Check Ping True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
815 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']}
816 ... ${src['container_name']}
817 Run Keyword and Ignore Error Collect Logs
818 END
819
820Validate ONUs for PON OLT Disable DT
821 [Arguments] ${olt_peer_list}
822 [Documentation] This keyword validates that Ping fails for ONUs connected to Disabled OLT PON port
823 ... And Pings succeed for other Active OLT PON port ONUs
824 ... Also it removes subscriber and deletes ONUs for Disabled OLT PON port to replicate DT workflow
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800825 FOR ${I} IN RANGE 0 ${num_all_onus}
Hardik Windlass16cdf962020-04-29 15:26:50 +0530826 ${src}= Set Variable ${hosts.src[${I}]}
827 ${dst}= Set Variable ${hosts.dst[${I}]}
828 ${onu_device_id}= Get Device ID From SN ${src['onu']}
829 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
830 ... ${of_id}
831 ${matched}= Match ONU in PON OLT Peer List ${olt_peer_list} ${onu_device_id}
832 Run Keyword If ${matched}
833 ... Run Keywords
834 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
835 ... Validate Device ENABLED DISCOVERED
836 ... UNREACHABLE ${src['onu']} onu=True onu_reason=stopping-openomci
837 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
838 ... Verify ONU Port Is Disabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
839 ... AND Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
840 ... Wait Until Keyword Succeeds 60s 2s
841 ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
842 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']}
843 ... ${src['container_name']}
844 # Remove Subscriber Access (To replicate DT workflow)
845 ... AND Wait Until Keyword Succeeds ${timeout} 2s Execute ONOS CLI Command ${ONOS_SSH_IP}
846 ... ${ONOS_SSH_PORT} volt-remove-subscriber-access ${of_id} ${onu_port}
847 ... AND Sleep 10s
848 # Delete ONU Device (To replicate DT workflow)
849 ... AND Delete Device ${onu_device_id}
850 ... AND Sleep 5s
851 ... ELSE
852 ... Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
853 ... Wait Until Keyword Succeeds 60s 2s
854 ... Check Ping True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
855 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']}
856 ... ${src['container_name']}
857 Run Keyword and Ignore Error Collect Logs
858 END
859
860Validate ONUs for PON OLT Enable DT
861 [Arguments] ${olt_peer_list}
862 [Documentation] This keyword validates Ping succeeds for all Enabled/Acitve OLT PON ports
863 ... Also performs subscriberAdd/DHCP/Ping for the ONUs on Re-Enabled OLT PON port
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800864 FOR ${I} IN RANGE 0 ${num_all_onus}
Hardik Windlass16cdf962020-04-29 15:26:50 +0530865 ${src}= Set Variable ${hosts.src[${I}]}
866 ${dst}= Set Variable ${hosts.dst[${I}]}
867 ${onu_device_id}= Get Device ID From SN ${src['onu']}
868 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
869 ... ${of_id}
870 ${matched}= Match ONU in PON OLT Peer List ${olt_peer_list} ${onu_device_id}
871 Run Keyword If ${matched}
872 ... Run Keywords
873 # Perform Cleanup
874 ... Run Keyword If ${has_dataplane} Clean Up Linux ${onu_device_id}
875 # Verify ONU port status
876 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
877 ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
878 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
879 ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
880 ... volt-add-subscriber-access ${of_id} ${onu_port}
881 # Verify ONU state in voltha
882 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
883 ... Validate Device ENABLED ACTIVE REACHABLE
884 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
885 # Verify subscriber access flows are added for the ONU port
886 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
887 ... Verify Subscriber Access Flows Added For ONU DT ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
888 ... ${onu_port} ${nni_port} ${src['s_tag']}
889 ... AND Run Keyword If ${has_dataplane}
890 ... Run Keyword And Continue On Failure Validate DHCP and Ping True
891 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
892 ... ${src['ip']} ${src['user']} ${src['pass']}
893 ... ${src['container_type']} ${src['container_name']}
894 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']}
895 ... ${dst['container_type']} ${dst['container_name']}
896 ... ELSE
897 ... Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
898 ... Wait Until Keyword Succeeds 60s 2s
899 ... Check Ping True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
900 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']}
901 ... ${src['container_name']}
902 Run Keyword and Ignore Error Collect Logs
903 END
904
905Match ONU in PON OLT Peer List
906 [Arguments] ${olt_peer_list} ${onu_device_id}
907 [Documentation] This keyword matches if ONU device is present in OLT PON port peer list
908 ${matched}= Set Variable False
909 FOR ${olt_peer} IN @{olt_peer_list}
910 ${matched}= Set Variable If '${onu_device_id}' == '${olt_peer}' True False
911 Exit For Loop If ${matched}
912 END
913 [Return] ${matched}
914
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000915Collect Logs
916 [Documentation] Collect Logs from voltha and onos cli for various commands
917 Run Keyword and Ignore Error Get Device List from Voltha
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800918 FOR ${I} IN RANGE 0 ${num_olts}
919 Run Keyword and Ignore Error Get Logical Device Output from Voltha ${logical_id}
920 Run Keyword and Ignore Error Get Device Output from Voltha ${olt_ids}[${I}][device_id]
921 Run Keyword and Ignore Error Get Logical Device Output from Voltha ${olt_ids}[${I}][logical_id]
922 END
923 #Run Keyword and Ignore Error Get Device Output from Voltha ${olt_device_id}
924 #Run Keyword and Ignore Error Get Logical Device Output from Voltha ${logical_id}
ubuntu6b6e7d42020-03-02 12:35:42 -0800925 Get ONOS Status ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
Gayathri.Selvanf68ea4b2020-02-03 07:36:39 +0000926
927Verify ping is succesful except for given device
928 [Arguments] ${num_onus} ${exceptional_onu_id}
929 [Documentation] Checks that ping for all the devices are successful except the given ONU.
930 ${pingStatus} Set Variable True
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800931 FOR ${I} IN RANGE 0 ${num_all_onus}
Gayathri.Selvanf68ea4b2020-02-03 07:36:39 +0000932 ${src}= Set Variable ${hosts.src[${I}]}
933 ${dst}= Set Variable ${hosts.dst[${I}]}
934 ${onu_device_id}= Get Device ID From SN ${src['onu']}
935 ${pingStatus} Run Keyword If '${onu_device_id}' == '${exceptional_onu_id}' Set Variable False
936 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 60s 2s
937 ... Check Ping ${pingStatus} ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
938 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
939 END
Andy Bavier4a8450e2020-02-04 08:58:37 -0700940
Suchitra Vemurife309412020-12-01 19:19:52 -0800941Verify ping is successful for ONUs not on this OLT
942 [Arguments] ${num_all_onus} ${exceptional_olt_id}
943 [Documentation] Checks that pings work for all the ONUs except for the ONUs on the given OLT.
944 #${pingStatus} Set Variable True
945 FOR ${I} IN RANGE 0 ${num_all_onus}
946 ${src}= Set Variable ${hosts.src[${I}]}
947 ${dst}= Set Variable ${hosts.dst[${I}]}
948 ${olt_device_id}= Get Device ID From SN ${src['olt']}
949 Continue For Loop If "${olt_device_id}"=="${exceptional_olt_id}"
950 #${pingStatus} Run Keyword If '${olt_device_id}' == '${exceptional_olt_id}' Set Variable False
951 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 60s 2s
952 ... Check Ping True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
953 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
954 END
955
Andy Bavier1923ecc2020-06-18 14:06:40 -0700956Echo Message to OLT Logs
957 [Arguments] ${message}
958 [Documentation] Echoes ${message} into the OLT logs
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800959 FOR ${I} IN RANGE 0 ${num_olts}
960 ${olt_user} Evaluate ${olts}[${I}].get("user")
961 ${olt_pass} Evaluate ${olts}[${I}].get("pass")
962 ${olt_ssh_ip} Evaluate ${olts}[${I}].get("sship")
963 Wait Until Keyword Succeeds 180s 10s Execute Remote Command
964 ... printf '%s\n' '' '' '${message}' '' >> /var/log/openolt.log
965 ... ${olt_ssh_ip} ${olt_user} ${olt_pass}
966 Wait Until Keyword Succeeds 180s 10s Execute Remote Command
967 ... printf '%s\n' '' '' '${message}' '' >> /var/log/dev_mgmt_daemon.log
968 ... ${olt_ssh_ip} ${olt_user} ${olt_pass}
969 Wait Until Keyword Succeeds 180s 10s Execute Remote Command
970 ... printf '%s\n' '' '' '${message}' '' >> /var/log/openolt_process_watchdog.log
971 ... ${olt_ssh_ip} ${olt_user} ${olt_pass}
972 END
Andy Bavier1923ecc2020-06-18 14:06:40 -0700973
Andy Bavierabeba262020-02-07 16:22:16 -0700974Start Logging
975 [Arguments] ${label}
976 [Documentation] Start logging for test ${label}
977 ${kail_process}= Run Keyword If "${container_log_dir}" != "${None}" Start Process kail -n default
978 ... -n voltha cwd=${container_log_dir} stdout=${label}-combined.log
979 Set Test Variable ${kail_process}
Andy Bavier1923ecc2020-06-18 14:06:40 -0700980 Run Keyword If ${has_dataplane} Echo Message to OLT Logs START ${label}
Andy Bavierabeba262020-02-07 16:22:16 -0700981
982Stop Logging
983 [Arguments] ${label}
984 [Documentation] End logging for test; remove logfile if test passed
985 Run sync
986 Run Keyword If ${kail_process} Terminate Process ${kail_process}
987 ${test_logfile}= Run Keyword If "${container_log_dir}" != "${None}"
988 ... Join Path ${container_log_dir} ${label}-combined.log
989 Run Keyword If Test Passed Run Keyword If "${test_logfile}" != "${None}" Remove File ${test_logfile}
Andy Bavier1923ecc2020-06-18 14:06:40 -0700990 Run Keyword If ${has_dataplane} Echo Message to OLT Logs END ${label}
Andy Bavierabeba262020-02-07 16:22:16 -0700991
Suchitra Vemuria5fa3dd2020-02-04 14:38:49 -0800992Clean Up Linux
993 [Documentation] Kill processes and clean up interfaces on src+dst servers
Hardik Windlass16cdf962020-04-29 15:26:50 +0530994 [Arguments] ${onu_id}=${EMPTY}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800995 FOR ${I} IN RANGE 0 ${num_all_onus}
Suchitra Vemuria5fa3dd2020-02-04 14:38:49 -0800996 ${src}= Set Variable ${hosts.src[${I}]}
997 ${dst}= Set Variable ${hosts.dst[${I}]}
Hardik Windlass16cdf962020-04-29 15:26:50 +0530998 ${onu_device_id}= Get Device ID From SN ${src['onu']}
999 Continue For Loop If '${onu_id}' != '${EMPTY}' and '${onu_id}' != '${onu_device_id}'
Andy Bavier84b83282020-06-30 05:47:49 -07001000 Execute Remote Command sudo pkill wpa_supplicant ${src['ip']}
Suchitra Vemuria5fa3dd2020-02-04 14:38:49 -08001001 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
Andy Bavier84b83282020-06-30 05:47:49 -07001002 Execute Remote Command sudo pkill dhclient ${src['ip']}
Suchitra Vemuria5fa3dd2020-02-04 14:38:49 -08001003 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
Andy Baviereff938d2020-06-29 18:27:49 -07001004 Execute Remote Command sudo pkill mausezahn ${src['ip']}
1005 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
1006 Run Keyword If '${dst['ip']}' != '${None}' Execute Remote Command pkill dhcpd
1007 ... ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']} ${dst['container_name']}
Suchitra Vemuria5fa3dd2020-02-04 14:38:49 -08001008 Delete IP Addresses from Interface on Remote Host ${src['dp_iface_name']} ${src['ip']}
1009 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
1010 Run Keyword If '${dst['ip']}' != '${None}' Delete Interface on Remote Host
1011 ... ${dst['dp_iface_name']}.${src['s_tag']} ${dst['ip']} ${dst['user']} ${dst['pass']}
1012 ... ${dst['container_type']} ${dst['container_name']}
Andy Bavier84b83282020-06-30 05:47:49 -07001013 ${bng_ip}= Get Variable Value ${dst['noroot_ip']}
1014 ${bng_user}= Get Variable Value ${dst['noroot_user']}
1015 ${bng_pass}= Get Variable Value ${dst['noroot_pass']}
Andy Bavierf4b7d1d2020-06-30 11:14:04 -07001016 Run Keyword If "${bng_ip}" != "${NONE}" and "${bng_user}" != "${NONE}" and "${bng_pass}" != "${NONE}"
1017 ... Execute Remote Command sudo pkill mausezahn ${bng_ip} ${bng_user} ${bng_pass}
Andy Baviereff938d2020-06-29 18:27:49 -07001018 ... ${dst['container_type']} ${dst['container_name']}
Suchitra Vemuria5fa3dd2020-02-04 14:38:49 -08001019 END
Scott Baker60e570d2020-02-02 22:10:13 -08001020
Suchitra Vemuria6879aa2020-11-03 11:03:11 -08001021Clean Up Linux Per OLT
1022 [Documentation] Kill processes and clean up interfaces on src+dst servers
1023 [Arguments] ${olt_serial_number}
1024 FOR ${I} IN RANGE 0 ${num_all_onus}
1025 ${src}= Set Variable ${hosts.src[${I}]}
1026 ${dst}= Set Variable ${hosts.dst[${I}]}
1027 ${onu_device_id}= Get Device ID From SN ${src['onu']}
1028 ${sn}= Get Device ID From SN ${src['olt']}
1029 #Continue For Loop If '${onu_id}' != '${EMPTY}' and '${onu_id}' != '${onu_device_id}'
1030 Continue For Loop If '${olt_serial_number}' == '${sn}'
1031 Execute Remote Command sudo pkill wpa_supplicant ${src['ip']}
1032 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
1033 Execute Remote Command sudo pkill dhclient ${src['ip']}
1034 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
1035 Execute Remote Command sudo pkill mausezahn ${src['ip']}
1036 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
1037 Run Keyword If '${dst['ip']}' != '${None}' Execute Remote Command pkill dhcpd
1038 ... ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']} ${dst['container_name']}
1039 Delete IP Addresses from Interface on Remote Host ${src['dp_iface_name']} ${src['ip']}
1040 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
1041 Run Keyword If '${dst['ip']}' != '${None}' Delete Interface on Remote Host
1042 ... ${dst['dp_iface_name']}.${src['s_tag']} ${dst['ip']} ${dst['user']} ${dst['pass']}
1043 ... ${dst['container_type']} ${dst['container_name']}
1044 ${bng_ip}= Get Variable Value ${dst['noroot_ip']}
1045 ${bng_user}= Get Variable Value ${dst['noroot_user']}
1046 ${bng_pass}= Get Variable Value ${dst['noroot_pass']}
1047 Run Keyword If "${bng_ip}" != "${NONE}" and "${bng_user}" != "${NONE}" and "${bng_pass}" != "${NONE}"
1048 ... Execute Remote Command sudo pkill mausezahn ${bng_ip} ${bng_user} ${bng_pass}
1049 ... ${dst['container_type']} ${dst['container_name']}
1050 END
1051
Suchitra Vemuri8d3b0032020-09-11 17:49:08 -07001052Clean dhclient
1053 [Documentation] Kills dhclient processes only for all RGs
Suchitra Vemuria6879aa2020-11-03 11:03:11 -08001054 FOR ${I} IN RANGE 0 ${num_all_nus}
Suchitra Vemuri8d3b0032020-09-11 17:49:08 -07001055 ${src}= Set Variable ${hosts.src[${I}]}
1056 ${dst}= Set Variable ${hosts.dst[${I}]}
1057 Execute Remote Command sudo pkill dhclient ${src['ip']}
1058 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
1059 END
1060
Suchitra Vemurif7a033c2020-02-26 17:22:41 -08001061Clean WPA Process
1062 [Documentation] Kills wpa_supplicant processes only for all RGs
Suchitra Vemuria6879aa2020-11-03 11:03:11 -08001063 FOR ${I} IN RANGE 0 ${num_all_onus}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -08001064 ${src}= Set Variable ${hosts.src[${I}]}
1065 ${dst}= Set Variable ${hosts.dst[${I}]}
1066 Run Keyword And Ignore Error Kill Linux Process [w]pa_supplicant ${src['ip']}
1067 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
1068 END
1069
Scott Baker60e570d2020-02-02 22:10:13 -08001070Should Be Larger Than
1071 [Documentation] Verify that value_1 is > value_2
1072 [Arguments] ${value_1} ${value_2}
1073 Run Keyword If ${value_1} <= ${value_2}
1074 ... Fail The value ${value_1} is not larger than ${value_2}
1075
Scott Bakeree675552020-02-11 10:43:34 -08001076Should Be Larger Than Or Equal To
1077 [Documentation] Verify that value_1 is >= value_2
1078 [Arguments] ${value_1} ${value_2}
1079 Run Keyword If ${value_1} < ${value_2}
1080 ... Fail The value ${value_1} is not larger than or equal to ${value_2}
1081
Scott Baker60e570d2020-02-02 22:10:13 -08001082Should Be Float
1083 [Documentation] Verify that value is a floating point number type
1084 [Arguments] ${value}
1085 ${type} Evaluate type(${value}).__name__
1086 Should Be Equal ${type} float
1087
Scott Bakeree675552020-02-11 10:43:34 -08001088Should Be Newer Than Or Equal To
1089 [Documentation] Compare two RFC3339 dates
1090 [Arguments] ${value_1} ${value_2}
1091 ${unix_v1} Parse RFC3339 ${value_1}
1092 ${unix_v2} Parse RFC3339 ${value_2}
1093 Run Keyword If ${unix_v1} < ${unix_v2}
1094 ... Fail The value ${value_1} is not newer than or equal to ${value_2}
1095
Scott Baker60e570d2020-02-02 22:10:13 -08001096Get Current Time
1097 [Documentation] Return the current time in RFC3339 format
1098 ${output}= Run date -u +"%FT%T%:z"
1099 [return] ${output}
Scott Bakeree675552020-02-11 10:43:34 -08001100
1101Parse RFC3339
1102 [Documentation] Parse an RFC3339 timestamp
1103 [Arguments] ${dateStr}
1104 ${rc} ${output}= Run and Return Rc and Output date --date="${dateStr}" "+%s"
1105 Should Be Equal As Numbers ${rc} 0
1106 [return] ${output}
Matteo Scandolo142e6272020-04-29 17:36:59 -07001107
Gayathri.Selvan92d16862020-03-19 14:47:58 +00001108Get Bandwidth Profile Name For Given Subscriber
1109 [Arguments] ${subscriber_id} ${stream_type}=upstreamBandwidthProfile
1110 [Documentation] Keyword to get the bandwidth details of the given subscriber
1111 ${bandwidth_profile_output}= Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
1112 ... volt-programmed-subscribers | grep ${subscriber_id}
1113 @{bandwidth_profile_array}= Split String ${bandwidth_profile_output} ,
1114 Log ${bandwidth_profile_array}
1115 FOR ${value} IN @{bandwidth_profile_array}
1116 @{row_value}= Split String ${value} =
1117 ${bandwidth_profile_name}= Set Variable If '${row_value[0]}' == ' ${stream_type}'
1118 ... ${row_value[1]}
1119 ${bandwidth_profile_name}= Convert To String ${bandwidth_profile_name}
1120 Run Keyword If "${bandwidth_profile_name}" != "None" Exit For Loop
1121 END
1122 Log ${bandwidth_profile_name}
1123 [Return] ${bandwidth_profile_name}
1124
1125Execute Remote Command
1126 [Documentation] SSH into a remote host and execute a command on the bare host or in a container.
1127 ... This replaces and simplifies the Login And Run Command On Remote System keyword in CORDRobot.
1128 [Arguments] ${cmd} ${ip} ${user} ${pass}=${None}
Andy Baviereff938d2020-06-29 18:27:49 -07001129 ... ${container_type}=${None} ${container_name}=${None} ${timeout}=${None}
Gayathri.Selvan92d16862020-03-19 14:47:58 +00001130 ${conn_id}= SSHLibrary.Open Connection ${ip}
1131 Run Keyword If '${pass}' != '${None}'
1132 ... SSHLibrary.Login ${user} ${pass}
1133 ... ELSE
1134 ... SSHLibrary.Login With Public Key ${user} %{HOME}/.ssh/id_rsa
1135 ${namespace}= Run Keyword If '${container_type}' == 'K8S' SSHLibrary.Execute Command
1136 ... kubectl get pods --all-namespaces | grep ${container_name} | awk '{print $1}'
Andy Bavierf6ab19c2020-05-14 10:34:47 -07001137 ${stdout} ${stderr} ${rc}= Run Keyword If '${container_type}' == 'LXC'
1138 ... SSHLibrary.Execute Command lxc exec ${container_name} -- ${cmd}
Andy Baviereff938d2020-06-29 18:27:49 -07001139 ... return_stderr=True return_rc=True timeout=${timeout}
Gayathri.Selvan92d16862020-03-19 14:47:58 +00001140 ... ELSE IF '${container_type}' == 'K8S'
Andy Bavierf6ab19c2020-05-14 10:34:47 -07001141 ... SSHLibrary.Execute Command kubectl -n ${namespace} exec ${container_name} -- ${cmd}
Andy Baviereff938d2020-06-29 18:27:49 -07001142 ... return_stderr=True return_rc=True timeout=${timeout}
Gayathri.Selvan92d16862020-03-19 14:47:58 +00001143 ... ELSE
Andy Baviereff938d2020-06-29 18:27:49 -07001144 ... SSHLibrary.Execute Command ${cmd} return_stderr=True return_rc=True timeout=${timeout}
Andy Bavierf6ab19c2020-05-14 10:34:47 -07001145
1146 Log ${stdout}
1147 Log ${stderr}
1148 Log ${rc}
Gayathri.Selvan92d16862020-03-19 14:47:58 +00001149 SSHLibrary.Close Connection
Andy Bavierf6ab19c2020-05-14 10:34:47 -07001150 [Return] ${stdout} ${stderr} ${rc}
Gayathri.Selvan92d16862020-03-19 14:47:58 +00001151
Suraj Gour33651272020-05-04 10:10:16 +05301152Start Remote Command
1153 [Documentation] SSH into a remote host and execute a command on the bare host or in a container.
1154 ... This replaces and simplifies the Login And Run Command On Remote System keyword in CORDRobot.
1155 [Arguments] ${cmd} ${ip} ${user} ${pass}=${None}
1156 ... ${container_type}=${None} ${container_name}=${None}
1157 ${conn_id}= SSHLibrary.Open Connection ${ip}
1158 Run Keyword If '${pass}' != '${None}'
1159 ... SSHLibrary.Login ${user} ${pass}
1160 ... ELSE
1161 ... SSHLibrary.Login With Public Key ${user} %{HOME}/.ssh/id_rsa
1162 ${namespace}= Run Keyword If '${container_type}' == 'K8S' SSHLibrary.Execute Command
1163 ... kubectl get pods --all-namespaces | grep ${container_name} | awk '{print $1}'
1164 Run Keyword If '${container_type}' == 'LXC'
1165 ... SSHLibrary.Start Command lxc exec ${container_name} -- ${cmd}
1166 ... ELSE IF '${container_type}' == 'K8S'
1167 ... SSHLibrary.Start Command kubectl -n ${namespace} exec ${container_name} -- ${cmd}
1168 ... ELSE
1169 ... SSHLibrary.Start Command ${cmd}
Andy Bavier9fb23232020-06-30 15:12:20 -07001170 # It seems that closing the connection immediately will sometimes kill the command
1171 Sleep 1s
Suraj Gour33651272020-05-04 10:10:16 +05301172 SSHLibrary.Close Connection
1173
Gayathri.Selvan92d16862020-03-19 14:47:58 +00001174Run Iperf3 Test Client
1175 [Arguments] ${src} ${server} ${args}
1176 [Documentation] Login to ${src} and run the iperf3 client against ${server} using ${args}.
1177 ... Return a Dictionary containing the results of the test.
Andy Bavierf6ab19c2020-05-14 10:34:47 -07001178 ${output} ${stderr} ${rc}= Execute Remote Command iperf3 -J -c ${server} ${args} | jq -M -c '.'
Gayathri.Selvan92d16862020-03-19 14:47:58 +00001179 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
Andy Bavierf6ab19c2020-05-14 10:34:47 -07001180 Should Be Equal As Integers ${rc} 0
Gayathri.Selvan92d16862020-03-19 14:47:58 +00001181 ${object}= Evaluate json.loads(r'''${output}''') json
1182 [Return] ${object}
Hung-Wei Chiue0bec7c2020-05-29 22:16:56 +00001183
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -07001184Run Iperf Test Client for MCAST
1185 [Arguments] ${src} ${server} ${args}
1186 [Documentation] Login to ${src} and run the iperf client against ${server} using ${args}.
1187 ... Return a Dictionary containing the results of the test.
1188 ${output} ${stderr} ${rc}= Execute Remote Command sudo iperf -c ${server} ${args} | jq -M -c '.'
1189 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
1190 Should Be Equal As Integers ${rc} 0
1191 ${object}= Evaluate json.loads(r'''${output}''') json
1192 [Return] ${object}
1193
Hung-Wei Chiue0bec7c2020-05-29 22:16:56 +00001194RestoreONUs
1195 [Documentation] Restore all connected ONUs
Suchitra Vemuria6879aa2020-11-03 11:03:11 -08001196 [Arguments] ${num_all_onus}
1197 FOR ${I} IN RANGE 0 ${num_all_onus}
Hung-Wei Chiue0bec7c2020-05-29 22:16:56 +00001198 ${src}= Set Variable ${hosts.src[${I}]}
Hung-Wei Chiucc6e6552020-06-04 12:57:38 -07001199 ${container_type}= Get Variable Value ${src['container_type']} "null"
1200 ${container_name}= Get Variable Value ${src['container_name']} "null"
Hung-Wei Chiue0bec7c2020-05-29 22:16:56 +00001201 ${onu_type}= Get Variable Value ${src['onu_type']} "null"
Hung-Wei Chiucc6e6552020-06-04 12:57:38 -07001202 #Get ens6f0 from ens6f0.22
1203 ${if_name}= Replace String Using Regexp ${src['dp_iface_name']} \\..* \
Hung-Wei Chiue0bec7c2020-05-29 22:16:56 +00001204 Run Keyword IF '${onu_type}' == 'alpha' AlphaONURestoreDefault ${src['ip']} ${src['user']}
Hung-Wei Chiucc6e6552020-06-04 12:57:38 -07001205 ... ${src['pass']} ${if_name} admin admin ${container_type} ${container_name}
Hung-Wei Chiue0bec7c2020-05-29 22:16:56 +00001206 END
1207
1208AlphaONURestoreDefault
1209 [Documentation] Restore the Alpha ONU to factory setting
1210 [Arguments] ${rg_ip} ${rg_user} ${rg_pass} ${onu_ifname}
Hung-Wei Chiucc6e6552020-06-04 12:57:38 -07001211 ... ${onu_user} ${onu_pass} ${container_type}=${None} ${container_name}=${None}
Hung-Wei Chiue0bec7c2020-05-29 22:16:56 +00001212 ${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 -07001213 ... ${rg_ip} ${rg_user} ${rg_pass} ${container_type} ${container_name}
Hung-Wei Chiue0bec7c2020-05-29 22:16:56 +00001214 ${cmd} Catenate
1215 ... (echo open "192.168.1.1"; sleep 1;
1216 ... echo "${onu_user}"; sleep 1;
1217 ... echo "${onu_pass}"; sleep 1;
1218 ... echo "restoredefault"; sleep 1) | telnet
1219 ${output}= Login And Run Command On Remote System ${cmd}
Hung-Wei Chiucc6e6552020-06-04 12:57:38 -07001220 ... ${rg_ip} ${rg_user} ${rg_pass} ${container_type} ${container_name}
Hung-Wei Chiue0bec7c2020-05-29 22:16:56 +00001221 Log To Console ${output}
1222 ${output}= Login And Run Command On Remote System sudo ifconfig ${onu_ifname} 0
Hung-Wei Chiucc6e6552020-06-04 12:57:38 -07001223 ... ${rg_ip} ${rg_user} ${rg_pass} ${container_type} ${container_name}
Suraj Gour33651272020-05-04 10:10:16 +05301224
1225Create traffic with each pbit and capture at other end
1226 [Documentation] Generates upstream traffic using Mausezahn tool
1227 ... with each pbit and validates reception at other end using tcpdump
1228 [Arguments] ${target_ip} ${target_iface} ${src_iface}
1229 ... ${packet_count} ${packet_type} ${target_port} ${vlan} ${tcpdump_filter}
1230 ... ${dst_ip} ${dst_user} ${dst_pass} ${dst_container_type} ${dst_container_name}
1231 ... ${src_ip} ${src_user} ${src_pass} ${src_container_type} ${src_container_name}
1232 FOR ${pbit} IN RANGE 8
Andy Baviereff938d2020-06-29 18:27:49 -07001233 Execute Remote Command sudo pkill mausezahn
Suraj Gour33651272020-05-04 10:10:16 +05301234 ... ${src_ip} ${src_user} ${src_pass} ${src_container_type} ${src_container_name}
Andy Baviereff938d2020-06-29 18:27:49 -07001235 ${var1}= Set Variable sudo mausezahn ${src_iface} -B ${target_ip} -c ${packet_count} -d 100m
Suraj Gour33651272020-05-04 10:10:16 +05301236 ${var2}= Set Variable -t ${packet_type} "dp=${target_port}" -p 1472 -Q ${pbit}:${vlan}
1237 ${cmd}= Set Variable ${var1} ${var2}
1238 Start Remote Command ${cmd} ${src_ip} ${src_user} ${src_pass}
1239 ... ${src_container_type} ${src_container_name}
1240 ${output} ${stderr} ${rc}= Execute Remote Command
Andy Baviereff938d2020-06-29 18:27:49 -07001241 ... sudo tcpdump -l -U -c 30 -i ${target_iface} -e ${tcpdump_filter}
Suraj Gour33651272020-05-04 10:10:16 +05301242 ... ${dst_ip} ${dst_user} ${dst_pass} ${dst_container_type} ${dst_container_name}
Andy Baviereff938d2020-06-29 18:27:49 -07001243 ... timeout=30 seconds
1244 Execute Remote Command sudo pkill mausezahn
Suraj Gour33651272020-05-04 10:10:16 +05301245 ... ${src_ip} ${src_user} ${src_pass} ${src_container_type} ${src_container_name}
1246 # VOL-3262: I'm seeing untagged downstream traffic at RG for pbit 0. According to Girish this is
1247 # incorrect behavior. Simplify the following check when VOL-3262 is resolved.
1248 Run Keyword If ${pbit}==0 and "${tcpdump_filter}"=="udp"
1249 ... Should Match Regexp ${output} \\.${target_port}: UDP,
1250 ... ELSE Should Match Regexp ${output} , p ${pbit},.*\\.${target_port}: UDP,
1251 END