blob: 6e6a8cbaa37f4505b602239005335052e4b9bc76 [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}
78 ${olt} Create Dictionary ip ${ip} user ${user} pass
79 ... ${pass} sn ${serial_number} onucount ${onu_count}
80 ... sship ${olt_ssh_ip}
81 Append To List ${list_olts} ${olt}
82 END
83 ${num_all_onus}= Get Length ${hosts.src}
84 ${num_all_onus}= Convert to String ${num_all_onus}
Andy Bavier88cd9f62019-11-26 16:22:33 -070085 #send sadis file to onos
Andy Baviera2691752019-11-27 12:18:38 -070086 ${sadis_file}= Get Variable Value ${sadis.file}
Zack Williamsa8fe75a2020-01-10 14:25:27 -070087 Log To Console \nSadis File:${sadis_file}
Andy Bavier88cd9f62019-11-26 16:22:33 -070088 Run Keyword Unless '${sadis_file}' is '${None}' Send File To Onos ${sadis_file} apps/
Suchitra Vemuria6879aa2020-11-03 11:03:11 -080089 Set Suite Variable ${num_all_onus}
90 Set Suite Variable ${num_olts}
91 Set Suite Variable ${list_olts}
92 ${olt_count}= Get Length ${list_olts}
93 Set Suite Variable ${olt_count}
94 #Set Suite Variable ${olt_serial_number}
95 #Set Suite Variable ${olt_ip}
96 #Set Suite Variable ${olt_ssh_ip}
97 #Set Suite Variable ${olt_user}
98 #Set Suite Variable ${olt_pass}
Andy Bavier88cd9f62019-11-26 16:22:33 -070099 @{container_list}= Create List adapter-open-olt adapter-open-onu voltha-api-server
100 ... voltha-ro-core voltha-rw-core-11 voltha-rw-core-12 voltha-ofagent
101 Set Suite Variable ${container_list}
102 ${datetime}= Get Current Date
suraj gour7f6d5fe2019-11-29 10:56:35 +0000103 Set Suite Variable ${datetime}
104
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800105Get ONU Count For OLT
106 [Arguments] ${src} ${serial_number}
107 [Documentation] Gets ONU Count for the specified OLT
108 ${src_length}= Get Length ${src}
109 ${count}= Set Variable 0
110 FOR ${I} IN RANGE 0 ${src_length}
111 ${sn} Evaluate ${src}[${I}].get("olt")
Andrea Campanella155c2aa2020-11-12 18:41:34 +0100112 ${count}= Run Keyword If '${serial_number}' == '${sn}' Evaluate ${count} + 1 ELSE Set Variable ${count}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800113 END
114 [Return] ${count}
115
suraj gour7f6d5fe2019-11-29 10:56:35 +0000116WPA Reassociate
suraj gour7f6d5fe2019-11-29 10:56:35 +0000117 [Documentation] Executes a particular wpa_cli reassociate, which performs force reassociation
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700118 [Arguments] ${iface} ${ip} ${user} ${pass}=${None}
119 ... ${container_type}=${None} ${container_name}=${None}
suraj gour7f6d5fe2019-11-29 10:56:35 +0000120 #Below for loops are used instead of sleep time, to execute reassociate command and check status
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700121 FOR ${i} IN RANGE 70
122 ${output}= Login And Run Command On Remote System
123 ... wpa_cli -i ${iface} reassociate ${ip} ${user}
124 ... ${pass} ${container_type} ${container_name}
125 ${passed}= Run Keyword And Return Status Should Contain ${output} OK
Andy Bavierb63f6d22020-03-12 15:34:37 -0700126 Exit For Loop If ${passed}
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700127 END
Andy Bavierb63f6d22020-03-12 15:34:37 -0700128 Should Be True ${passed} Status does not contain 'SUCCESS'
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700129 FOR ${i} IN RANGE 70
130 ${output}= Login And Run Command On Remote System
Andy Bavierae4a17e2020-02-25 14:54:36 -0700131 ... wpa_cli -i ${iface} status | grep SUCCESS ${ip} ${user}
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700132 ... ${pass} ${container_type} ${container_name}
133 ${passed}= Run Keyword And Return Status Should Contain ${output} SUCCESS
Andy Bavierb63f6d22020-03-12 15:34:37 -0700134 Exit For Loop If ${passed}
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700135 END
Andy Bavierb63f6d22020-03-12 15:34:37 -0700136 Should Be True ${passed} Status does not contain 'SUCCESS'
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700137
suraj gour7f6d5fe2019-11-29 10:56:35 +0000138Validate Authentication After Reassociate
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700139 [Arguments] ${auth_pass} ${iface} ${ip} ${user} ${pass}=${None}
140 ... ${container_type}=${None} ${container_name}=${None}
141 [Documentation]
142 ... Executes a particular reassociate request on the RG using wpa_cli.
143 ... auth_pass determines if authentication should pass
Andy Bavier84834d42020-02-25 13:49:50 -0700144 ${wpa_log}= Catenate SEPARATOR=. /tmp/wpa ${iface} log
145 ${output}= Login And Run Command On Remote System truncate -s 0 ${wpa_log}; cat ${wpa_log}
146 ... ${ip} ${user} ${pass} ${container_type} ${container_name}
147 Log ${output}
148 Should Not Contain ${output} authentication completed successfully
suraj gour7f6d5fe2019-11-29 10:56:35 +0000149 WPA Reassociate ${iface} ${ip} ${user} ${pass} ${container_type} ${container_name}
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700150 Run Keyword If '${auth_pass}' == 'True' Wait Until Keyword Succeeds ${timeout} 2s
Andy Bavier84834d42020-02-25 13:49:50 -0700151 ... Check Remote File Contents True ${wpa_log} ${iface}.*authentication completed successfully
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700152 ... ${ip} ${user} ${pass} ${container_type} ${container_name}
suraj gour7f6d5fe2019-11-29 10:56:35 +0000153 Run Keyword If '${auth_pass}' == 'False' Sleep 20s
Suchitra Vemuri3cb29f82020-02-25 13:59:58 -0800154 Run Keyword If '${auth_pass}' == 'False' Check Remote File Contents False /tmp/wpa.log
Andy Bavier84834d42020-02-25 13:49:50 -0700155 ... ${iface}.*authentication completed successfully ${ip} ${user} ${pass}
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700156 ... ${container_type} ${container_name}
suraj gourd5cfdbb2019-12-13 12:44:55 +0000157
158Send Dhclient Request To Release Assigned IP
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700159 [Arguments] ${iface} ${ip} ${user} ${path_dhcpleasefile} ${pass}=${None}
160 ... ${container_type}=${None} ${container_name}=${None}
suraj gourd5cfdbb2019-12-13 12:44:55 +0000161 [Documentation] Executes a dhclient with option to release ip against a particular interface on the RG (src)
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700162 ${result}= Login And Run Command On Remote System
163 ... dhclient -nw -r ${iface} && rm ${path_dhcpleasefile}/dhclient.* ${ip} ${user}
suraj gourd5cfdbb2019-12-13 12:44:55 +0000164 ... ${pass} ${container_type} ${container_name}
165 Log ${result}
166 #Should Contain ${result} DHCPRELEASE
167 [Return] ${result}
suraj gour1ecfae92019-12-20 15:11:40 +0000168
169Check Remote File Contents For WPA Logs
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700170 [Arguments] ${file_should_exist} ${file} ${pattern} ${ip} ${user} ${pass}=${None}
171 ... ${container_type}=${None} ${container_name}=${None} ${prompt}=~$
suraj gour1ecfae92019-12-20 15:11:40 +0000172 [Documentation] Checks for particular pattern count in a file
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700173 ${result}= Login And Run Command On Remote System
174 ... cat ${file} | grep '${pattern}' | wc -l ${ip} ${user} ${pass}
suraj gour1ecfae92019-12-20 15:11:40 +0000175 ... ${container_type} ${container_name} ${prompt}
176 [Return] ${result}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000177
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800178
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000179Perform Sanity Test
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800180 [Documentation] This keyword iterate all OLTs and performs Sanity Test Procedure
181 ... for all the ONUs connected to each OLT - ATT workflow
182 FOR ${J} IN RANGE 0 ${num_olts}
183 ${olt_serial_number}= Set Variable ${list_olts}[${J}][sn]
184 ${onu_count}= Set Variable ${list_olts}[${J}][onucount]
185 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS
186 ... ${olt_serial_number}
187 Set Global Variable ${of_id}
188 ${nni_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
189 ... Get NNI Port in ONOS ${of_id}
190 Set Global Variable ${nni_port}
191 # Verify Default Meter in ONOS (valid only for ATT)
192 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
193 ... Verify Default Meter Present in ONOS ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
194 Perform Sanity Test Per OLT ${of_id} ${nni_port} ${olt_serial_number} ${onu_count}
195 END
196
197Perform Sanity Test Per OLT
198 [Arguments] ${of_id} ${nni_port} ${olt_serial_number} ${num_onus}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000199 [Documentation] This keyword performs Sanity Test Procedure
200 ... Sanity test performs authentication, dhcp and pings for all the ONUs given for the POD
201 ... This keyword can be used to call in any other tests where sanity check is required
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800202 ... and avoids duplication of code. - ATT workflow
203 #${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${olt_serial_number}
204 #Set Global Variable ${of_id}
205 #${nni_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
206 #... Get NNI Port in ONOS ${of_id}
207 #Set Global Variable ${nni_port}
Hardik Windlass2a9b1592020-07-23 18:28:13 +0530208 # Verify Default Meter in ONOS (valid only for ATT)
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800209 #Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
210 #... Verify Default Meter Present in ONOS ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
211 FOR ${I} IN RANGE 0 ${num_all_onus}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000212 ${src}= Set Variable ${hosts.src[${I}]}
213 ${dst}= Set Variable ${hosts.dst[${I}]}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800214 Continue For Loop If "${olt_serial_number}"!="${src['olt']}"
Suchitra Vemuri03005912020-02-20 18:59:46 -0800215 Run Keyword and Ignore Error Collect Logs
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000216 ${onu_device_id}= Get Device ID From SN ${src['onu']}
217 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
218 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
Suchitra Vemuri8078b972020-02-06 19:07:41 -0800219 # Check ONU port is Enabled in ONOS
220 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
Suchitra Vemuri760bdd32020-06-17 12:34:48 -0700221 ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
Suchitra Vemuri8078b972020-02-06 19:07:41 -0800222 # Verify EAPOL flows are added for the ONU port
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000223 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
ubuntu6b6e7d42020-03-02 12:35:42 -0800224 ... Verify Eapol Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Suchitra Vemuri8078b972020-02-06 19:07:41 -0800225 # Verify ONU state in voltha
226 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
227 ... ENABLED ACTIVE REACHABLE
228 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
229 # Perform Authentication
Andy Bavier84834d42020-02-25 13:49:50 -0700230 ${wpa_log}= Run Keyword If ${has_dataplane} Catenate SEPARATOR=.
231 ... /tmp/wpa ${src['dp_iface_name']} log
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000232 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate Authentication True
233 ... ${src['dp_iface_name']} wpa_supplicant.conf ${src['ip']} ${src['user']} ${src['pass']}
Andy Bavier84834d42020-02-25 13:49:50 -0700234 ... ${src['container_type']} ${src['container_name']} ${wpa_log}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000235 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
ubuntu6b6e7d42020-03-02 12:35:42 -0800236 ... Verify ONU in AAA-Users ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000237 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
ubuntu6b6e7d42020-03-02 12:35:42 -0800238 ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000239 ... volt-add-subscriber-access ${of_id} ${onu_port}
Suchitra Vemuri9da44302020-03-04 14:24:49 -0800240 # Verify that no pending flows exist for the ONU port
241 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
242 ... Verify No Pending Flows For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Hardik Windlass21807632020-04-14 16:24:55 +0530243 # Verify subscriber access flows are added for the ONU port
244 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
245 ... Verify Subscriber Access Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
246 ... ${onu_port} ${nni_port} ${src['c_tag']} ${src['s_tag']}
Hardik Windlass2a9b1592020-07-23 18:28:13 +0530247 # Verify Meters in ONOS
248 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
249 ... Verify Meters in ONOS ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id} ${onu_port}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000250 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate DHCP and Ping True
251 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
252 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
253 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
254 ... ${dst['container_name']}
255 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
ubuntu6b6e7d42020-03-02 12:35:42 -0800256 ... Validate Subscriber DHCP Allocation ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000257 Run Keyword and Ignore Error Get Device Output from Voltha ${onu_device_id}
258 Run Keyword and Ignore Error Collect Logs
259 END
260
Hardik Windlassa3d04b92020-02-17 15:06:05 +0000261Perform Sanity Test DT
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800262 [Documentation] This keyword iterate all OLTs and performs Sanity Test Procedure for DT workflow
263 FOR ${J} IN RANGE 0 ${num_olts}
264 ${olt_serial_number}= Set Variable ${list_olts}[${J}][sn]
265 ${num_onus}= Set Variable ${list_olts}[${J}][onucount]
266 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
Suchitra Vemuri4b8f4f52020-11-17 19:12:50 -0800267 Run Keyword and Ignore Error Collect Logs
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800268 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS
269 ... ${olt_serial_number}
270 Set Global Variable ${of_id}
271 ${nni_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
272 ... Get NNI Port in ONOS ${of_id}
273 Set Global Variable ${nni_port}
274 Perform Sanity Test DT Per OLT ${of_id} ${nni_port} ${olt_serial_number} ${num_onus}
275 # Verify ONOS Flows
276 # Number of Access Flows on ONOS equals 4 * the Number of Active ONUs (2 for each downstream and upstream)
277 ${onos_flows_count}= Evaluate 4 * ${num_onus}
278 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
279 ... Verify Subscriber Access Flows Added Count DT ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
280 ... ${onos_flows_count}
281 # Verify VOLTHA Flows
282 # Number of per OLT Flows equals Twice the Number of Active ONUs (each for downstream and upstream) + 1 for LLDP
283 ${olt_flows}= Evaluate 2 * ${num_onus} + 1
284 # Number of per ONU Flows equals 2 (one each for downstream and upstream)
285 ${onu_flows}= Set Variable 2
286 Run Keyword Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Flows ${olt_flows}
287 ... ${olt_device_id}
288 ${List_ONU_Serial} Create List
289 Set Suite Variable ${List_ONU_Serial}
Suchitra Vemuri21a47fd2020-11-16 18:39:09 -0800290 Build ONU SN List ${List_ONU_Serial} ${olt_serial_number}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800291 Log ${List_ONU_Serial}
292 Run Keyword Wait Until Keyword Succeeds ${timeout} 5s Validate ONU Flows
293 ... ${List_ONU_Serial} ${onu_flows}
294 END
295
296
297Perform Sanity Test DT Per OLT
298 [Arguments] ${of_id} ${nni_port} ${olt_serial_number} ${num_onus}
Hardik Windlassa3d04b92020-02-17 15:06:05 +0000299 [Documentation] This keyword performs Sanity Test Procedure for DT Workflow
300 ... Sanity test performs dhcp and pings (without EAPOL and DHCP flows) for all the ONUs given for the POD
301 ... This keyword can be used to call in any other tests where sanity check is required
302 ... and avoids duplication of code.
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800303 #${of_id}= Wait Until Keyword Succeeds 360s 15s Validate OLT Device in ONOS ${olt_serial_number}
304 #Set Global Variable ${of_id}
305 #${nni_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
306 #... Get NNI Port in ONOS ${of_id}
307 #Set Global Variable ${nni_port}
308 FOR ${I} IN RANGE 0 ${num_all_onus}
Hardik Windlassa3d04b92020-02-17 15:06:05 +0000309 ${src}= Set Variable ${hosts.src[${I}]}
310 ${dst}= Set Variable ${hosts.dst[${I}]}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800311 Continue For Loop If "${olt_serial_number}"!="${src['olt']}"
Suchitra Vemuri4b8f4f52020-11-17 19:12:50 -0800312 Run Keyword and Ignore Error Collect Logs
Hardik Windlassa3d04b92020-02-17 15:06:05 +0000313 ${onu_device_id}= Get Device ID From SN ${src['onu']}
314 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
315 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
316 # Check ONU port is Enabled in ONOS
317 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
Suchitra Vemuri760bdd32020-06-17 12:34:48 -0700318 ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
Hardik Windlassa3d04b92020-02-17 15:06:05 +0000319 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
ubuntu6b6e7d42020-03-02 12:35:42 -0800320 ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
Hardik Windlassa3d04b92020-02-17 15:06:05 +0000321 ... volt-add-subscriber-access ${of_id} ${onu_port}
Hardik Windlassfb5eace2020-03-26 14:49:01 +0530322 # Verify subscriber access flows are added for the ONU port
323 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
Hardik Windlass25e11702020-03-30 20:05:19 +0530324 ... Verify Subscriber Access Flows Added For ONU DT ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
325 ... ${onu_port} ${nni_port} ${src['s_tag']}
Hardik Windlassa3d04b92020-02-17 15:06:05 +0000326 # Verify ONU state in voltha
327 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
328 ... ENABLED ACTIVE REACHABLE
329 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
Hardik Windlass2a9b1592020-07-23 18:28:13 +0530330 # Verify Meters in ONOS
331 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
332 ... Verify Meters in ONOS ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id} ${onu_port}
Hardik Windlassfb5eace2020-03-26 14:49:01 +0530333 # TODO: Yet to Verify on the GPON based Physical POD (VOL-2652)
Hardik Windlassa3d04b92020-02-17 15:06:05 +0000334 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate DHCP and Ping True
335 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
336 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
337 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
338 ... ${dst['container_name']}
339 Run Keyword and Ignore Error Get Device Output from Voltha ${onu_device_id}
340 Run Keyword and Ignore Error Collect Logs
341 END
Hardik Windlassfb5eace2020-03-26 14:49:01 +0530342 # Verify ONOS Flows
343 # 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 -0800344 #${onos_flows_count}= Evaluate 4 * ${num_onus}
345 #Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
346 #... Verify Subscriber Access Flows Added Count DT ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
347 #... ${onos_flows_count}
Hardik Windlassfb5eace2020-03-26 14:49:01 +0530348 # Verify VOLTHA Flows
Hardik Windlassa3d04b92020-02-17 15:06:05 +0000349 # 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 -0800350 #${olt_flows}= Evaluate 2 * ${num_onus} + 1
Hardik Windlassa3d04b92020-02-17 15:06:05 +0000351 # Number of per ONU Flows equals 2 (one each for downstream and upstream)
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800352 #${onu_flows}= Set Variable 2
353 #Run Keyword Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Flows ${olt_flows}
354 #${List_ONU_Serial} Create List
355 #Set Suite Variable ${List_ONU_Serial}
Andrea Campanella6391f842020-11-16 10:01:18 +0100356 #Build ONU SN List ${List_ONU_Serial} ${olt_serial_number}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800357 #Log ${List_ONU_Serial}
358 #Run Keyword Wait Until Keyword Succeeds ${timeout} 5s Validate ONU Flows
359 #... ${List_ONU_Serial} ${onu_flows}
360
361Validate All OLT Flows
362 [Documentation] This keyword iterate all OLTs and performs Sanity Test Procedure for DT workflow
363 FOR ${J} IN RANGE 0 ${num_olts}
364 ${olt_serial_number}= Set Variable ${list_olts}[${J}][sn]
365 ${num_onus}= Set Variable ${list_olts}[${J}][onucount]
366 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
367 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS
368 ... ${olt_serial_number}
369 Set Global Variable ${of_id}
370 # Verify ONOS Flows
371 # Number of Access Flows on ONOS equals 4 * the Number of Active ONUs (2 for each downstream and upstream)
372 ${onos_flows_count}= Evaluate 4 * ${num_onus}
373 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
374 ... Verify Subscriber Access Flows Added Count DT ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
375 ... ${onos_flows_count}
376 # Verify VOLTHA Flows
377 # Number of per OLT Flows equals Twice the Number of Active ONUs (each for downstream and upstream) + 1 for LLDP
378 ${olt_flows}= Evaluate 2 * ${num_onus} + 1
379 # Number of per ONU Flows equals 2 (one each for downstream and upstream)
380 ${onu_flows}= Set Variable 2
381 Run Keyword Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Flows ${olt_flows}
382 ... ${olt_device_id}
383 ${List_ONU_Serial} Create List
384 Set Suite Variable ${List_ONU_Serial}
Andrea Campanella6391f842020-11-16 10:01:18 +0100385 Build ONU SN List ${List_ONU_Serial} ${olt_serial_number}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800386 Log ${List_ONU_Serial}
387 Run Keyword Wait Until Keyword Succeeds ${timeout} 5s Validate ONU Flows
388 ... ${List_ONU_Serial} ${onu_flows}
389 END
Hardik Windlassa3d04b92020-02-17 15:06:05 +0000390
Suchitra Vemuri2f1e07d2020-06-26 19:18:01 -0700391Perform Sanity Test TT
392 [Documentation] This keyword performs Sanity Test Procedure for TT Workflow
393 ... Sanity test performs dhcp and pings (without EAPOL and DHCP flows) for all the ONUs given for the POD
394 ... This keyword can be used to call in any other tests where sanity check is required
395 ... and avoids duplication of code.
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800396 FOR ${I} IN RANGE 0 ${num_all_onus}
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -0700397 ${src}= Set Variable ${hosts.src[${I}]}
398 ${dst}= Set Variable ${hosts.dst[${I}]}
399 ${service_type}= Get Variable Value ${src['service_type']} "null"
400 Run Keyword IF '${service_type}' != 'mcast' Sanity Test TT one ONU ${src} ${dst}
401 Run Keyword and Ignore Error Collect Logs
402 END
403 Run Keyword and Ignore Error Collect Logs
404
405Sanity Test TT one ONU
406 [Documentation] This keyword performs sanity test for a single ONU for TT workflow
407 ... Tests for one ONU
408 ... Assertions apply to HSIA, VoD, VoIP services
409 [Arguments] ${src} ${dst}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800410 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${src['olt']}
Suchitra Vemuri2f1e07d2020-06-26 19:18:01 -0700411 Set Global Variable ${of_id}
412 ${nni_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
413 ... Get NNI Port in ONOS ${of_id}
414 Set Global Variable ${nni_port}
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -0700415 ${onu_device_id}= Get Device ID From SN ${src['onu']}
416 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
417 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
418 # Check ONU port is Enabled in ONOS
419 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
420 ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
421 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
422 ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
423 ... volt-add-subscriber-access ${of_id} ${onu_port}
424 Sleep 30s
425 # Verify ONU state in voltha
426 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
427 ... ENABLED ACTIVE REACHABLE
428 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
429 # TODO: Yet to Verify on the GPON based Physical POD (VOL-2652)
430 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate DHCP and Ping True
431 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
432 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
433 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
434 ... ${dst['container_name']}
Suchitra Vemuri16644bd2020-10-03 14:06:12 -0700435 Run Keyword IF ${has_dataplane}
Suchitra Vemurib4d9e8d2020-10-05 20:49:21 -0700436 ... Run Keyword IF '${src['service_type']}'!='hsia'
Suchitra Vemuri42819412020-10-01 17:45:43 -0700437 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
Suchitra Vemuri8d3b0032020-09-11 17:49:08 -0700438 ... Validate Subscriber DHCP Allocation ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Suchitra Vemuri42819412020-10-01 17:45:43 -0700439 ... ${src['c_tag']}
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -0700440 Run Keyword and Ignore Error Get Device Output from Voltha ${onu_device_id}
441 Run Keyword and Ignore Error Collect Logs
442
443Perform Sanity Test TT MCAST
444 [Documentation] This keyword performs Sanity Test Procedure for TT Workflow
445 ... Adds subscribers
446 ... Validates for MCAST
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800447 FOR ${I} IN RANGE 0 ${num_all_onus}
Suchitra Vemuri2f1e07d2020-06-26 19:18:01 -0700448 ${src}= Set Variable ${hosts.src[${I}]}
449 ${dst}= Set Variable ${hosts.dst[${I}]}
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -0700450 ${service_type}= Get Variable Value ${src['service_type']} "null"
451 Run Keyword IF '${service_type}' == 'mcast' Sanity Test TT MCAST one ONU ${src}
452 ... ${dst}
Suchitra Vemuri2f1e07d2020-06-26 19:18:01 -0700453 Run Keyword and Ignore Error Collect Logs
454 END
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -0700455 Run Keyword and Ignore Error Collect Logs
456
457Sanity Test TT MCAST one ONU
458 [Documentation] This keyword performs sanity test for a single ONU for TT workflow
459 ... Tests for one ONU
460 ... Assertions apply to MCAST services
461 [Arguments] ${src} ${dst}
462 # Check for iperf and jq tools
463 ${stdout} ${stderr} ${rc}= Execute Remote Command which iperf jq
464 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']}
465 ... ${src['container_name']}
466 Pass Execution If ${rc} != 0 Skipping test: iperf / jq not found on the RG
467
468 #Reset the IP on the interface
469 ${output}= Login And Run Command On Remote System sudo ifconfig ${src['dp_iface_name']} 0
470 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
471 # Kill iperf on BNG
472 ${rg_output}= Run Keyword and Continue On Failure Login And Run Command On Remote System
473 ... sudo kill -9 `pidof iperf`
474 ... ${dst['bng_ip']} ${dst['bng_user']} ${dst['bng_pass']} ${dst['container_type']}
475 ... ${dst['container_name']}
476
477 # Setup RG for Multi-cast test
478 ${output}= Login And Run Command On Remote System
479 ... sudo ifconfig ${src['dp_iface_name']} ${src['mcast_rg']} up ; sudo kill -9 `pidof iperf`
480 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
481 ${output}= Login And Run Command On Remote System
482 ... sudo ip route add ${src['mcast_grp_subnet_mask']} dev ${src['dp_iface_name']} scope link
483 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
484
485 # Perform operations for adding subscriber
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800486 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${src['olt']}
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -0700487 Set Global Variable ${of_id}
488 ${nni_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
489 ... Get NNI Port in ONOS ${of_id}
490 Set Global Variable ${nni_port}
491 ${onu_device_id}= Get Device ID From SN ${src['onu']}
492 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
493 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
494 # Check ONU port is Enabled in ONOS
495 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
496 ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
497 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
498 ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
499 ... volt-add-subscriber-access ${of_id} ${onu_port}
500 Sleep 30s
501 # Verify ONU state in voltha
502 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
503 ... ENABLED ACTIVE REACHABLE
504 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
505
506 # Setup iperf on the BNG
507 ${server_output}= Login And Run Command On Remote System
508 ... sudo iperf -c ${dst['dp_iface_ip_qinq']} -u -T 32 -t 60 -i 1 &
509 ... ${dst['bng_ip']} ${dst['bng_user']} ${dst['bng_pass']} ${dst['container_type']}
510 ... ${dst['container_name']}
511
512 # Setup iperf on the RG
513 ${rg_output}= Run Keyword and Continue On Failure Wait Until Keyword Succeeds 90s 5s
514 ... Login And Run Command On Remote System
515 ... rm -rf /tmp/rg_output ; sudo iperf -s -u -B ${dst['dp_iface_ip_qinq']} -i 1 -D >> /tmp/rg_output
516 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
517 Log ${rg_output}
518 Sleep 60s
519 ${output}= Run Keyword and Continue On Failure Wait Until Keyword Succeeds 90s 5s
520 ... Login And Run Command On Remote System
521 ... cat /tmp/rg_output | grep KBytes
522 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
523 Log ${output}
524 Should Contain ${output} KBytes
525
526 # Kill iperf on BNG
527 ${rg_output}= Run Keyword and Continue On Failure Login And Run Command On Remote System
528 ... sudo kill -9 `pidof iperf`
529 ... ${dst['bng_ip']} ${dst['bng_user']} ${dst['bng_pass']} ${dst['container_type']}
530 ... ${dst['container_name']}
531
532 # Kill iperf on the RG
533 ${output}= Run Keyword and Continue On Failure Login And Run Command On Remote System
534 ... sudo kill -9 `pidof iperf`
535 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
536
Suchitra Vemuri2f1e07d2020-06-26 19:18:01 -0700537
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000538Setup
539 [Documentation] Pre-test Setup
540 #test for empty device list
541 Test Empty Device List
Suchitra Vemuri3158f3c2020-05-28 17:58:26 -0700542 #Run Keyword If ${has_dataplane} Wait Until Keyword Succeeds 120s 10s Openolt is Up
543 #... ${olt_ip} ${olt_user} ${olt_pass}
Suchitra Vemuri1d8e8172020-06-17 17:43:56 -0700544 Run Keyword If ${has_dataplane} Sleep 230s
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800545 # Create a list of olt ids (logical and device_id)
546 ${olt_ids} Create List
547 FOR ${I} IN RANGE 0 ${num_olts}
548 #create/preprovision device
549 ${olt_device_id}= Create Device ${list_olts}[${I}][ip] ${OLT_PORT}
550 ${olt_serial_number}= Set Variable ${list_olts}[${I}][sn]
551 #Set Suite Variable ${olt_device_id}
552 #validate olt states
553 Wait Until Keyword Succeeds ${timeout} 5s
554 ... Validate OLT Device PREPROVISIONED UNKNOWN UNKNOWN ${olt_device_id}
555 Sleep 5s
556 Enable Device ${olt_device_id}
557 Wait Until Keyword Succeeds 380s 5s
558 ... Validate OLT Device ENABLED ACTIVE REACHABLE ${olt_serial_number}
559 ${logical_id}= Get Logical Device ID From SN ${olt_serial_number}
560 # Set Suite Variable ${logical_id}
561 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS
562 ... ${olt_serial_number}
563 ${olt} Create Dictionary device_id ${olt_device_id} logical_id ${logical_id}
564 ... of_id ${of_id} sn ${olt_serial_number}
565 Append To List ${olt_ids} ${olt}
566 END
567 Set Global Variable ${olt_ids}
568
569Get ofID From OLT List
570 [Documentation] Retrieves the corresponding of_id for the OLT serial number specified
571 [Arguments] ${serial_number}
572 FOR ${I} IN RANGE 0 ${olt_count}
573 ${sn}= Get From Dictionary ${olt_ids}[${I}] sn
Andrea Campanella317a94c2020-11-13 10:38:19 +0100574 ${of_id}= Run Keyword IF "${serial_number}"=="${sn}"
575 ... Get From Dictionary ${olt_ids}[${I}] of_id ELSE Set Variable ${of_id}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800576 END
577 [Return] ${of_id}
578
579Get OLTDeviceID From OLT List
580 [Documentation] Retrieves the corresponding olt_device_id for the OLT serial number specified
581 [Arguments] ${serial_number}
Suchitra Vemuri4b8f4f52020-11-17 19:12:50 -0800582 ${olt_device_id}= Set Variable 0
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800583 FOR ${I} IN RANGE 0 ${olt_count}
584 ${sn}= Get From Dictionary ${olt_ids}[${I}] sn
Andrea Campanella317a94c2020-11-13 10:38:19 +0100585 ${olt_device_id}= Run Keyword IF "${serial_number}"=="${sn}"
586 ... Get From Dictionary ${olt_ids}[${I}] device_id ELSE Set Variable ${olt_device_id}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800587 END
588 [Return] ${olt_device_id}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000589
Andrea Campanellad848de02020-11-24 10:23:41 +0100590Get Num of Onus From OLT SN
591 [Documentation] Retrieves the corresponding number of ONUs for a given OLT based on serial number specified
592 [Arguments] ${serial_number}
593 ${num_of_olt_onus}= Set Variable 0
594 FOR ${I} IN RANGE 0 ${olt_count}
595 ${sn}= Get From Dictionary ${olt_ids}[${I}] sn
596 ${num_of_olt_onus}= Run Keyword IF "${serial_number}"=="${sn}"
597 ... Get From Dictionary ${list_olts}[${I}] onucount ELSE Set Variable ${num_of_olt_onus}
598 END
599 [Return] ${num_of_olt_onus}
600
Hardik Windlassaaea3402020-03-10 19:45:45 +0530601Validate ONUs After OLT Disable
602 [Documentation] Validates the ONUs state in Voltha, ONUs port state in ONOS
603 ... and that pings do not succeed After corresponding OLT is Disabled
Andrea Campanella4e507882020-11-26 11:33:11 +0100604 [Arguments] ${num_onus} ${olt_serial_number}
Hardik Windlassaaea3402020-03-10 19:45:45 +0530605 FOR ${I} IN RANGE 0 ${num_onus}
606 ${src}= Set Variable ${hosts.src[${I}]}
607 ${dst}= Set Variable ${hosts.dst[${I}]}
Andrea Campanella4e507882020-11-26 11:33:11 +0100608 Continue For Loop If "${olt_serial_number}"!="${src['olt']}"
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800609 ${of_id}= Get ofID From OLT List ${src['olt']}
Hardik Windlassaaea3402020-03-10 19:45:45 +0530610 ${onu_device_id}= Get Device ID From SN ${src['onu']}
611 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
612 ... ${of_id}
613 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
614 ... Validate Device ENABLED DISCOVERED
615 ... UNREACHABLE ${src['onu']} onu=True onu_reason=stopping-openomci
616 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
Suchitra Vemuri760bdd32020-06-17 12:34:48 -0700617 ... Verify ONU Port Is Disabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
Hardik Windlassaaea3402020-03-10 19:45:45 +0530618 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
619 ... Wait Until Keyword Succeeds 60s 2s
620 ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
621 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
622 Run Keyword and Ignore Error Get Device Output from Voltha ${onu_device_id}
623 Run Keyword and Ignore Error Collect Logs
624 END
625
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000626Delete All Devices and Verify
627 [Documentation] Remove any devices from VOLTHA and ONOS
628 # Clear devices from VOLTHA
629 Disable Devices In Voltha Root=true
Suchitra Vemuri970747f2020-03-30 17:31:34 -0700630 Sleep 5s
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000631 Wait Until Keyword Succeeds ${timeout} 2s Test Devices Disabled In Voltha Root=true
632 Delete Devices In Voltha Root=true
Matteo Scandolof6cea382020-04-20 14:32:00 -0700633 Run Keyword If ${has_dataplane} Sleep 30s
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000634 Wait Until Keyword Succeeds ${timeout} 2s Test Empty Device List
635 # Clear devices from ONOS
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800636 #Remove All Devices From ONOS
ubuntu6b6e7d42020-03-02 12:35:42 -0800637 #... http://karaf:karaf@${ONOS_REST_IP}:${ONOS_REST_PORT}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000638
639Teardown
640 [Documentation] kills processes and cleans up interfaces on src+dst servers
641 Run Keyword If ${has_dataplane} Clean Up Linux
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000642
643Teardown Suite
644 [Documentation] Clean up device if desired
645 Run Keyword If ${teardown_device} Delete All Devices and Verify
646
647Delete Device and Verify
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800648 [Arguments] ${olt_serial_number}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000649 [Documentation] Disable -> Delete devices via voltctl and verify its removed
Suchitra Vemuri2fa9bba2020-01-22 17:38:48 -0800650 ${olt_device_id}= Get Device ID From SN ${olt_serial_number}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000651 ${rc} ${output}= Run and Return Rc and Output
Matteo Scandolo5899be12020-11-11 15:38:07 -0800652 ... voltctl -c ${VOLTCTL_CONFIG} device disable ${olt_device_id}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000653 Should Be Equal As Integers ${rc} 0
654 Sleep 5s
655 Wait Until Keyword Succeeds ${timeout} 5s
656 ... Validate OLT Device DISABLED UNKNOWN REACHABLE ${olt_serial_number}
657 ${rc} ${output}= Run and Return Rc and Output
Matteo Scandolo5899be12020-11-11 15:38:07 -0800658 ... voltctl -c ${VOLTCTL_CONFIG} device delete ${olt_device_id}
Matteo Scandolof6cea382020-04-20 14:32:00 -0700659 Run Keyword If ${has_dataplane} Sleep 50s
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000660 Should Be Equal As Integers ${rc} 0
661 Wait Until Keyword Succeeds ${timeout} 5s Validate Device Removed ${olt_device_id}
662
Gayathri.Selvan283a63c2020-01-23 04:09:18 +0000663Repeat Sanity Test
664 [Documentation] This keyword performs Sanity Test Procedure
665 ... Sanity test performs authentication, dhcp and pings for all the ONUs given for the POD
666 ... This keyword can be used to call in any other tests where sanity check is required
667 ... with wpa reassociation
668 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${olt_serial_number}
669 Set Global Variable ${of_id}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800670 FOR ${I} IN RANGE 0 ${num_all_onus}
Suchitra Vemuri03005912020-02-20 18:59:46 -0800671 Run Keyword and Ignore Error Collect Logs
Gayathri.Selvan283a63c2020-01-23 04:09:18 +0000672 ${src}= Set Variable ${hosts.src[${I}]}
673 ${dst}= Set Variable ${hosts.dst[${I}]}
Suchitra Vemuri8078b972020-02-06 19:07:41 -0800674 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
675 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
676 # Check ONU port is Enabled in ONOD
677 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
Suchitra Vemuri760bdd32020-06-17 12:34:48 -0700678 ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
Suchitra Vemuri8078b972020-02-06 19:07:41 -0800679 # Verify EAPOL flows are added for the ONU port
680 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
David K. Bainbridgec0617c92020-03-05 21:17:19 -0800681 ... Verify Eapol Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Suchitra Vemuri8078b972020-02-06 19:07:41 -0800682 # Verify ONU state in voltha
Suchitra Vemurid1e27fb2020-02-01 16:34:37 -0800683 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
Suchitra Vemuri81e4f022020-02-01 13:16:02 -0800684 ... ENABLED ACTIVE REACHABLE
685 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
Suchitra Vemuri8078b972020-02-06 19:07:41 -0800686 # Perform Authentication
Gayathri.Selvan283a63c2020-01-23 04:09:18 +0000687 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
688 ... Validate Authentication After Reassociate
689 ... True ${src['dp_iface_name']} ${src['ip']} ${src['user']} ${src['pass']}
690 ... ${src['container_type']} ${src['container_name']}
691 Wait Until Keyword Succeeds ${timeout} 2s
David K. Bainbridgec0617c92020-03-05 21:17:19 -0800692 ... Verify ONU in AAA-Users ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Gayathri.Selvan283a63c2020-01-23 04:09:18 +0000693 Wait Until Keyword Succeeds ${timeout} 2s
David K. Bainbridgec0617c92020-03-05 21:17:19 -0800694 ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
Gayathri.Selvan283a63c2020-01-23 04:09:18 +0000695 ... volt-add-subscriber-access ${of_id} ${onu_port}
696 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
697 ... Validate DHCP and Ping True True
698 ... ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
699 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
700 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
701 ... ${dst['container_name']}
702 Wait Until Keyword Succeeds ${timeout} 2s Run Keyword And Continue On Failure
David K. Bainbridgec0617c92020-03-05 21:17:19 -0800703 ... Validate Subscriber DHCP Allocation ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Gayathri.Selvan283a63c2020-01-23 04:09:18 +0000704 Run Keyword and Ignore Error Get Device Output from Voltha ${onu_device_id}
705 Run Keyword and Ignore Error Collect Logs
706 END
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000707
Hardik Windlass16cdf962020-04-29 15:26:50 +0530708Validate ONUs for PON OLT Disable
709 [Arguments] ${olt_peer_list}
710 [Documentation] This keyword validates that Ping fails for ONUs connected to Disabled OLT PON port
711 ... And Pings succeed for other Active OLT PON port ONUs
712 ... Also it removes subscriber for Disabled OLT PON port ONUs to replicate ATT workflow
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800713 FOR ${I} IN RANGE 0 ${num_all_nus}
Hardik Windlass16cdf962020-04-29 15:26:50 +0530714 ${src}= Set Variable ${hosts.src[${I}]}
715 ${dst}= Set Variable ${hosts.dst[${I}]}
716 ${onu_device_id}= Get Device ID From SN ${src['onu']}
717 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
718 ... ${of_id}
719 ${matched}= Match ONU in PON OLT Peer List ${olt_peer_list} ${onu_device_id}
720 Run Keyword If ${matched}
721 ... Run Keywords
722 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
723 ... Validate Device ENABLED DISCOVERED
724 ... UNREACHABLE ${src['onu']} onu=True onu_reason=stopping-openomci
725 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
726 ... Verify ONU Port Is Disabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
727 ... AND Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
728 ... Wait Until Keyword Succeeds 60s 2s
729 ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
730 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']}
731 ... ${src['container_name']}
732 # Remove Subscriber Access (To replicate ATT workflow)
733 ... AND Wait Until Keyword Succeeds ${timeout} 2s Execute ONOS CLI Command ${ONOS_SSH_IP}
734 ... ${ONOS_SSH_PORT} volt-remove-subscriber-access ${of_id} ${onu_port}
735 ... ELSE
736 ... Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
737 ... Wait Until Keyword Succeeds 60s 2s
738 ... Check Ping True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
739 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']}
740 ... ${src['container_name']}
741 Run Keyword and Ignore Error Collect Logs
742 END
743
744Validate ONUs for PON OLT Enable
745 [Arguments] ${olt_peer_list}
746 [Documentation] This keyword validates Ping succeeds for all Enabled/Acitve OLT PON ports
747 ... Also performs Auth/subscriberAdd/DHCP/Ping for the ONUs on Re-Enabled OLT PON port
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800748 FOR ${I} IN RANGE 0 ${num_all_onus}
Hardik Windlass16cdf962020-04-29 15:26:50 +0530749 ${src}= Set Variable ${hosts.src[${I}]}
750 ${dst}= Set Variable ${hosts.dst[${I}]}
751 ${onu_device_id}= Get Device ID From SN ${src['onu']}
752 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
753 ... ${of_id}
754 ${matched}= Match ONU in PON OLT Peer List ${olt_peer_list} ${onu_device_id}
755 ${wpa_log}= Run Keyword If ${has_dataplane} and ${matched} Catenate SEPARATOR=.
756 ... /tmp/wpa ${src['dp_iface_name']} log
757 Run Keyword If ${matched}
758 ... Run Keywords
759 # Perform Cleanup
760 ... Run Keyword If ${has_dataplane} Clean Up Linux ${onu_device_id}
761 # Verify ONU port status
762 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
763 ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
764 # Verify EAPOL flows are added for the ONU port
765 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
766 ... Verify Eapol Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
767 # Verify ONU state in voltha
768 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
769 ... Validate Device ENABLED ACTIVE REACHABLE
770 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
771 # Perform Authentication
772 ... AND Run Keyword If ${has_dataplane}
773 ... Run Keyword And Continue On Failure Validate Authentication True
774 ... ${src['dp_iface_name']} wpa_supplicant.conf ${src['ip']} ${src['user']} ${src['pass']}
775 ... ${src['container_type']} ${src['container_name']} ${wpa_log}
776 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
777 ... Verify ONU in AAA-Users ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
778 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
779 ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
780 ... volt-add-subscriber-access ${of_id} ${onu_port}
781 # Verify that no pending flows exist for the ONU port
782 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
783 ... Verify No Pending Flows For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
784 # Verify subscriber access flows are added for the ONU port
785 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
786 ... Verify Subscriber Access Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
787 ... ${onu_port} ${nni_port} ${src['c_tag']} ${src['s_tag']}
788 ... AND Run Keyword If ${has_dataplane}
789 ... Run Keyword And Continue On Failure Validate DHCP and Ping True
790 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
791 ... ${src['ip']} ${src['user']} ${src['pass']}
792 ... ${src['container_type']} ${src['container_name']}
793 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']}
794 ... ${dst['container_type']} ${dst['container_name']}
795 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
796 ... Validate Subscriber DHCP Allocation ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
797 ... AND Run Keyword and Ignore Error Get Device Output from Voltha ${onu_device_id}
798 ... ELSE
799 ... Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
800 ... Wait Until Keyword Succeeds 60s 2s
801 ... Check Ping True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
802 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']}
803 ... ${src['container_name']}
804 Run Keyword and Ignore Error Collect Logs
805 END
806
807Validate ONUs for PON OLT Disable DT
808 [Arguments] ${olt_peer_list}
809 [Documentation] This keyword validates that Ping fails for ONUs connected to Disabled OLT PON port
810 ... And Pings succeed for other Active OLT PON port ONUs
811 ... Also it removes subscriber and deletes ONUs for Disabled OLT PON port to replicate DT workflow
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800812 FOR ${I} IN RANGE 0 ${num_all_onus}
Hardik Windlass16cdf962020-04-29 15:26:50 +0530813 ${src}= Set Variable ${hosts.src[${I}]}
814 ${dst}= Set Variable ${hosts.dst[${I}]}
815 ${onu_device_id}= Get Device ID From SN ${src['onu']}
816 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
817 ... ${of_id}
818 ${matched}= Match ONU in PON OLT Peer List ${olt_peer_list} ${onu_device_id}
819 Run Keyword If ${matched}
820 ... Run Keywords
821 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
822 ... Validate Device ENABLED DISCOVERED
823 ... UNREACHABLE ${src['onu']} onu=True onu_reason=stopping-openomci
824 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
825 ... Verify ONU Port Is Disabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
826 ... AND Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
827 ... Wait Until Keyword Succeeds 60s 2s
828 ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
829 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']}
830 ... ${src['container_name']}
831 # Remove Subscriber Access (To replicate DT workflow)
832 ... AND Wait Until Keyword Succeeds ${timeout} 2s Execute ONOS CLI Command ${ONOS_SSH_IP}
833 ... ${ONOS_SSH_PORT} volt-remove-subscriber-access ${of_id} ${onu_port}
834 ... AND Sleep 10s
835 # Delete ONU Device (To replicate DT workflow)
836 ... AND Delete Device ${onu_device_id}
837 ... AND Sleep 5s
838 ... ELSE
839 ... Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
840 ... Wait Until Keyword Succeeds 60s 2s
841 ... Check Ping True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
842 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']}
843 ... ${src['container_name']}
844 Run Keyword and Ignore Error Collect Logs
845 END
846
847Validate ONUs for PON OLT Enable DT
848 [Arguments] ${olt_peer_list}
849 [Documentation] This keyword validates Ping succeeds for all Enabled/Acitve OLT PON ports
850 ... Also performs subscriberAdd/DHCP/Ping for the ONUs on Re-Enabled OLT PON port
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800851 FOR ${I} IN RANGE 0 ${num_all_onus}
Hardik Windlass16cdf962020-04-29 15:26:50 +0530852 ${src}= Set Variable ${hosts.src[${I}]}
853 ${dst}= Set Variable ${hosts.dst[${I}]}
854 ${onu_device_id}= Get Device ID From SN ${src['onu']}
855 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
856 ... ${of_id}
857 ${matched}= Match ONU in PON OLT Peer List ${olt_peer_list} ${onu_device_id}
858 Run Keyword If ${matched}
859 ... Run Keywords
860 # Perform Cleanup
861 ... Run Keyword If ${has_dataplane} Clean Up Linux ${onu_device_id}
862 # Verify ONU port status
863 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
864 ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
865 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
866 ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
867 ... volt-add-subscriber-access ${of_id} ${onu_port}
868 # Verify ONU state in voltha
869 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
870 ... Validate Device ENABLED ACTIVE REACHABLE
871 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
872 # Verify subscriber access flows are added for the ONU port
873 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
874 ... Verify Subscriber Access Flows Added For ONU DT ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
875 ... ${onu_port} ${nni_port} ${src['s_tag']}
876 ... AND Run Keyword If ${has_dataplane}
877 ... Run Keyword And Continue On Failure Validate DHCP and Ping True
878 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
879 ... ${src['ip']} ${src['user']} ${src['pass']}
880 ... ${src['container_type']} ${src['container_name']}
881 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']}
882 ... ${dst['container_type']} ${dst['container_name']}
883 ... ELSE
884 ... Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
885 ... Wait Until Keyword Succeeds 60s 2s
886 ... Check Ping True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
887 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']}
888 ... ${src['container_name']}
889 Run Keyword and Ignore Error Collect Logs
890 END
891
892Match ONU in PON OLT Peer List
893 [Arguments] ${olt_peer_list} ${onu_device_id}
894 [Documentation] This keyword matches if ONU device is present in OLT PON port peer list
895 ${matched}= Set Variable False
896 FOR ${olt_peer} IN @{olt_peer_list}
897 ${matched}= Set Variable If '${onu_device_id}' == '${olt_peer}' True False
898 Exit For Loop If ${matched}
899 END
900 [Return] ${matched}
901
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000902Collect Logs
903 [Documentation] Collect Logs from voltha and onos cli for various commands
904 Run Keyword and Ignore Error Get Device List from Voltha
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800905 FOR ${I} IN RANGE 0 ${num_olts}
906 Run Keyword and Ignore Error Get Logical Device Output from Voltha ${logical_id}
907 Run Keyword and Ignore Error Get Device Output from Voltha ${olt_ids}[${I}][device_id]
908 Run Keyword and Ignore Error Get Logical Device Output from Voltha ${olt_ids}[${I}][logical_id]
909 END
910 #Run Keyword and Ignore Error Get Device Output from Voltha ${olt_device_id}
911 #Run Keyword and Ignore Error Get Logical Device Output from Voltha ${logical_id}
ubuntu6b6e7d42020-03-02 12:35:42 -0800912 Get ONOS Status ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
Gayathri.Selvanf68ea4b2020-02-03 07:36:39 +0000913
914Verify ping is succesful except for given device
915 [Arguments] ${num_onus} ${exceptional_onu_id}
916 [Documentation] Checks that ping for all the devices are successful except the given ONU.
917 ${pingStatus} Set Variable True
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800918 FOR ${I} IN RANGE 0 ${num_all_onus}
Gayathri.Selvanf68ea4b2020-02-03 07:36:39 +0000919 ${src}= Set Variable ${hosts.src[${I}]}
920 ${dst}= Set Variable ${hosts.dst[${I}]}
921 ${onu_device_id}= Get Device ID From SN ${src['onu']}
922 ${pingStatus} Run Keyword If '${onu_device_id}' == '${exceptional_onu_id}' Set Variable False
923 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 60s 2s
924 ... Check Ping ${pingStatus} ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
925 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
926 END
Andy Bavier4a8450e2020-02-04 08:58:37 -0700927
Andy Bavier1923ecc2020-06-18 14:06:40 -0700928Echo Message to OLT Logs
929 [Arguments] ${message}
930 [Documentation] Echoes ${message} into the OLT logs
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800931 FOR ${I} IN RANGE 0 ${num_olts}
932 ${olt_user} Evaluate ${olts}[${I}].get("user")
933 ${olt_pass} Evaluate ${olts}[${I}].get("pass")
934 ${olt_ssh_ip} Evaluate ${olts}[${I}].get("sship")
935 Wait Until Keyword Succeeds 180s 10s Execute Remote Command
936 ... printf '%s\n' '' '' '${message}' '' >> /var/log/openolt.log
937 ... ${olt_ssh_ip} ${olt_user} ${olt_pass}
938 Wait Until Keyword Succeeds 180s 10s Execute Remote Command
939 ... printf '%s\n' '' '' '${message}' '' >> /var/log/dev_mgmt_daemon.log
940 ... ${olt_ssh_ip} ${olt_user} ${olt_pass}
941 Wait Until Keyword Succeeds 180s 10s Execute Remote Command
942 ... printf '%s\n' '' '' '${message}' '' >> /var/log/openolt_process_watchdog.log
943 ... ${olt_ssh_ip} ${olt_user} ${olt_pass}
944 END
Andy Bavier1923ecc2020-06-18 14:06:40 -0700945
Andy Bavierabeba262020-02-07 16:22:16 -0700946Start Logging
947 [Arguments] ${label}
948 [Documentation] Start logging for test ${label}
949 ${kail_process}= Run Keyword If "${container_log_dir}" != "${None}" Start Process kail -n default
950 ... -n voltha cwd=${container_log_dir} stdout=${label}-combined.log
951 Set Test Variable ${kail_process}
Andy Bavier1923ecc2020-06-18 14:06:40 -0700952 Run Keyword If ${has_dataplane} Echo Message to OLT Logs START ${label}
Andy Bavierabeba262020-02-07 16:22:16 -0700953
954Stop Logging
955 [Arguments] ${label}
956 [Documentation] End logging for test; remove logfile if test passed
957 Run sync
958 Run Keyword If ${kail_process} Terminate Process ${kail_process}
959 ${test_logfile}= Run Keyword If "${container_log_dir}" != "${None}"
960 ... Join Path ${container_log_dir} ${label}-combined.log
961 Run Keyword If Test Passed Run Keyword If "${test_logfile}" != "${None}" Remove File ${test_logfile}
Andy Bavier1923ecc2020-06-18 14:06:40 -0700962 Run Keyword If ${has_dataplane} Echo Message to OLT Logs END ${label}
Andy Bavierabeba262020-02-07 16:22:16 -0700963
Suchitra Vemuria5fa3dd2020-02-04 14:38:49 -0800964Clean Up Linux
965 [Documentation] Kill processes and clean up interfaces on src+dst servers
Hardik Windlass16cdf962020-04-29 15:26:50 +0530966 [Arguments] ${onu_id}=${EMPTY}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800967 FOR ${I} IN RANGE 0 ${num_all_onus}
Suchitra Vemuria5fa3dd2020-02-04 14:38:49 -0800968 ${src}= Set Variable ${hosts.src[${I}]}
969 ${dst}= Set Variable ${hosts.dst[${I}]}
Hardik Windlass16cdf962020-04-29 15:26:50 +0530970 ${onu_device_id}= Get Device ID From SN ${src['onu']}
971 Continue For Loop If '${onu_id}' != '${EMPTY}' and '${onu_id}' != '${onu_device_id}'
Andy Bavier84b83282020-06-30 05:47:49 -0700972 Execute Remote Command sudo pkill wpa_supplicant ${src['ip']}
Suchitra Vemuria5fa3dd2020-02-04 14:38:49 -0800973 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
Andy Bavier84b83282020-06-30 05:47:49 -0700974 Execute Remote Command sudo pkill dhclient ${src['ip']}
Suchitra Vemuria5fa3dd2020-02-04 14:38:49 -0800975 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
Andy Baviereff938d2020-06-29 18:27:49 -0700976 Execute Remote Command sudo pkill mausezahn ${src['ip']}
977 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
978 Run Keyword If '${dst['ip']}' != '${None}' Execute Remote Command pkill dhcpd
979 ... ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']} ${dst['container_name']}
Suchitra Vemuria5fa3dd2020-02-04 14:38:49 -0800980 Delete IP Addresses from Interface on Remote Host ${src['dp_iface_name']} ${src['ip']}
981 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
982 Run Keyword If '${dst['ip']}' != '${None}' Delete Interface on Remote Host
983 ... ${dst['dp_iface_name']}.${src['s_tag']} ${dst['ip']} ${dst['user']} ${dst['pass']}
984 ... ${dst['container_type']} ${dst['container_name']}
Andy Bavier84b83282020-06-30 05:47:49 -0700985 ${bng_ip}= Get Variable Value ${dst['noroot_ip']}
986 ${bng_user}= Get Variable Value ${dst['noroot_user']}
987 ${bng_pass}= Get Variable Value ${dst['noroot_pass']}
Andy Bavierf4b7d1d2020-06-30 11:14:04 -0700988 Run Keyword If "${bng_ip}" != "${NONE}" and "${bng_user}" != "${NONE}" and "${bng_pass}" != "${NONE}"
989 ... Execute Remote Command sudo pkill mausezahn ${bng_ip} ${bng_user} ${bng_pass}
Andy Baviereff938d2020-06-29 18:27:49 -0700990 ... ${dst['container_type']} ${dst['container_name']}
Suchitra Vemuria5fa3dd2020-02-04 14:38:49 -0800991 END
Scott Baker60e570d2020-02-02 22:10:13 -0800992
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800993Clean Up Linux Per OLT
994 [Documentation] Kill processes and clean up interfaces on src+dst servers
995 [Arguments] ${olt_serial_number}
996 FOR ${I} IN RANGE 0 ${num_all_onus}
997 ${src}= Set Variable ${hosts.src[${I}]}
998 ${dst}= Set Variable ${hosts.dst[${I}]}
999 ${onu_device_id}= Get Device ID From SN ${src['onu']}
1000 ${sn}= Get Device ID From SN ${src['olt']}
1001 #Continue For Loop If '${onu_id}' != '${EMPTY}' and '${onu_id}' != '${onu_device_id}'
1002 Continue For Loop If '${olt_serial_number}' == '${sn}'
1003 Execute Remote Command sudo pkill wpa_supplicant ${src['ip']}
1004 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
1005 Execute Remote Command sudo pkill dhclient ${src['ip']}
1006 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
1007 Execute Remote Command sudo pkill mausezahn ${src['ip']}
1008 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
1009 Run Keyword If '${dst['ip']}' != '${None}' Execute Remote Command pkill dhcpd
1010 ... ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']} ${dst['container_name']}
1011 Delete IP Addresses from Interface on Remote Host ${src['dp_iface_name']} ${src['ip']}
1012 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
1013 Run Keyword If '${dst['ip']}' != '${None}' Delete Interface on Remote Host
1014 ... ${dst['dp_iface_name']}.${src['s_tag']} ${dst['ip']} ${dst['user']} ${dst['pass']}
1015 ... ${dst['container_type']} ${dst['container_name']}
1016 ${bng_ip}= Get Variable Value ${dst['noroot_ip']}
1017 ${bng_user}= Get Variable Value ${dst['noroot_user']}
1018 ${bng_pass}= Get Variable Value ${dst['noroot_pass']}
1019 Run Keyword If "${bng_ip}" != "${NONE}" and "${bng_user}" != "${NONE}" and "${bng_pass}" != "${NONE}"
1020 ... Execute Remote Command sudo pkill mausezahn ${bng_ip} ${bng_user} ${bng_pass}
1021 ... ${dst['container_type']} ${dst['container_name']}
1022 END
1023
Suchitra Vemuri8d3b0032020-09-11 17:49:08 -07001024Clean dhclient
1025 [Documentation] Kills dhclient processes only for all RGs
Suchitra Vemuria6879aa2020-11-03 11:03:11 -08001026 FOR ${I} IN RANGE 0 ${num_all_nus}
Suchitra Vemuri8d3b0032020-09-11 17:49:08 -07001027 ${src}= Set Variable ${hosts.src[${I}]}
1028 ${dst}= Set Variable ${hosts.dst[${I}]}
1029 Execute Remote Command sudo pkill dhclient ${src['ip']}
1030 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
1031 END
1032
Suchitra Vemurif7a033c2020-02-26 17:22:41 -08001033Clean WPA Process
1034 [Documentation] Kills wpa_supplicant processes only for all RGs
Suchitra Vemuria6879aa2020-11-03 11:03:11 -08001035 FOR ${I} IN RANGE 0 ${num_all_onus}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -08001036 ${src}= Set Variable ${hosts.src[${I}]}
1037 ${dst}= Set Variable ${hosts.dst[${I}]}
1038 Run Keyword And Ignore Error Kill Linux Process [w]pa_supplicant ${src['ip']}
1039 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
1040 END
1041
Scott Baker60e570d2020-02-02 22:10:13 -08001042Should Be Larger Than
1043 [Documentation] Verify that value_1 is > value_2
1044 [Arguments] ${value_1} ${value_2}
1045 Run Keyword If ${value_1} <= ${value_2}
1046 ... Fail The value ${value_1} is not larger than ${value_2}
1047
Scott Bakeree675552020-02-11 10:43:34 -08001048Should Be Larger Than Or Equal To
1049 [Documentation] Verify that value_1 is >= value_2
1050 [Arguments] ${value_1} ${value_2}
1051 Run Keyword If ${value_1} < ${value_2}
1052 ... Fail The value ${value_1} is not larger than or equal to ${value_2}
1053
Scott Baker60e570d2020-02-02 22:10:13 -08001054Should Be Float
1055 [Documentation] Verify that value is a floating point number type
1056 [Arguments] ${value}
1057 ${type} Evaluate type(${value}).__name__
1058 Should Be Equal ${type} float
1059
Scott Bakeree675552020-02-11 10:43:34 -08001060Should Be Newer Than Or Equal To
1061 [Documentation] Compare two RFC3339 dates
1062 [Arguments] ${value_1} ${value_2}
1063 ${unix_v1} Parse RFC3339 ${value_1}
1064 ${unix_v2} Parse RFC3339 ${value_2}
1065 Run Keyword If ${unix_v1} < ${unix_v2}
1066 ... Fail The value ${value_1} is not newer than or equal to ${value_2}
1067
Scott Baker60e570d2020-02-02 22:10:13 -08001068Get Current Time
1069 [Documentation] Return the current time in RFC3339 format
1070 ${output}= Run date -u +"%FT%T%:z"
1071 [return] ${output}
Scott Bakeree675552020-02-11 10:43:34 -08001072
1073Parse RFC3339
1074 [Documentation] Parse an RFC3339 timestamp
1075 [Arguments] ${dateStr}
1076 ${rc} ${output}= Run and Return Rc and Output date --date="${dateStr}" "+%s"
1077 Should Be Equal As Numbers ${rc} 0
1078 [return] ${output}
Matteo Scandolo142e6272020-04-29 17:36:59 -07001079
Gayathri.Selvan92d16862020-03-19 14:47:58 +00001080Get Bandwidth Profile Name For Given Subscriber
1081 [Arguments] ${subscriber_id} ${stream_type}=upstreamBandwidthProfile
1082 [Documentation] Keyword to get the bandwidth details of the given subscriber
1083 ${bandwidth_profile_output}= Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
1084 ... volt-programmed-subscribers | grep ${subscriber_id}
1085 @{bandwidth_profile_array}= Split String ${bandwidth_profile_output} ,
1086 Log ${bandwidth_profile_array}
1087 FOR ${value} IN @{bandwidth_profile_array}
1088 @{row_value}= Split String ${value} =
1089 ${bandwidth_profile_name}= Set Variable If '${row_value[0]}' == ' ${stream_type}'
1090 ... ${row_value[1]}
1091 ${bandwidth_profile_name}= Convert To String ${bandwidth_profile_name}
1092 Run Keyword If "${bandwidth_profile_name}" != "None" Exit For Loop
1093 END
1094 Log ${bandwidth_profile_name}
1095 [Return] ${bandwidth_profile_name}
1096
1097Execute Remote Command
1098 [Documentation] SSH into a remote host and execute a command on the bare host or in a container.
1099 ... This replaces and simplifies the Login And Run Command On Remote System keyword in CORDRobot.
1100 [Arguments] ${cmd} ${ip} ${user} ${pass}=${None}
Andy Baviereff938d2020-06-29 18:27:49 -07001101 ... ${container_type}=${None} ${container_name}=${None} ${timeout}=${None}
Gayathri.Selvan92d16862020-03-19 14:47:58 +00001102 ${conn_id}= SSHLibrary.Open Connection ${ip}
1103 Run Keyword If '${pass}' != '${None}'
1104 ... SSHLibrary.Login ${user} ${pass}
1105 ... ELSE
1106 ... SSHLibrary.Login With Public Key ${user} %{HOME}/.ssh/id_rsa
1107 ${namespace}= Run Keyword If '${container_type}' == 'K8S' SSHLibrary.Execute Command
1108 ... kubectl get pods --all-namespaces | grep ${container_name} | awk '{print $1}'
Andy Bavierf6ab19c2020-05-14 10:34:47 -07001109 ${stdout} ${stderr} ${rc}= Run Keyword If '${container_type}' == 'LXC'
1110 ... SSHLibrary.Execute Command lxc exec ${container_name} -- ${cmd}
Andy Baviereff938d2020-06-29 18:27:49 -07001111 ... return_stderr=True return_rc=True timeout=${timeout}
Gayathri.Selvan92d16862020-03-19 14:47:58 +00001112 ... ELSE IF '${container_type}' == 'K8S'
Andy Bavierf6ab19c2020-05-14 10:34:47 -07001113 ... SSHLibrary.Execute Command kubectl -n ${namespace} exec ${container_name} -- ${cmd}
Andy Baviereff938d2020-06-29 18:27:49 -07001114 ... return_stderr=True return_rc=True timeout=${timeout}
Gayathri.Selvan92d16862020-03-19 14:47:58 +00001115 ... ELSE
Andy Baviereff938d2020-06-29 18:27:49 -07001116 ... SSHLibrary.Execute Command ${cmd} return_stderr=True return_rc=True timeout=${timeout}
Andy Bavierf6ab19c2020-05-14 10:34:47 -07001117
1118 Log ${stdout}
1119 Log ${stderr}
1120 Log ${rc}
Gayathri.Selvan92d16862020-03-19 14:47:58 +00001121 SSHLibrary.Close Connection
Andy Bavierf6ab19c2020-05-14 10:34:47 -07001122 [Return] ${stdout} ${stderr} ${rc}
Gayathri.Selvan92d16862020-03-19 14:47:58 +00001123
Suraj Gour33651272020-05-04 10:10:16 +05301124Start Remote Command
1125 [Documentation] SSH into a remote host and execute a command on the bare host or in a container.
1126 ... This replaces and simplifies the Login And Run Command On Remote System keyword in CORDRobot.
1127 [Arguments] ${cmd} ${ip} ${user} ${pass}=${None}
1128 ... ${container_type}=${None} ${container_name}=${None}
1129 ${conn_id}= SSHLibrary.Open Connection ${ip}
1130 Run Keyword If '${pass}' != '${None}'
1131 ... SSHLibrary.Login ${user} ${pass}
1132 ... ELSE
1133 ... SSHLibrary.Login With Public Key ${user} %{HOME}/.ssh/id_rsa
1134 ${namespace}= Run Keyword If '${container_type}' == 'K8S' SSHLibrary.Execute Command
1135 ... kubectl get pods --all-namespaces | grep ${container_name} | awk '{print $1}'
1136 Run Keyword If '${container_type}' == 'LXC'
1137 ... SSHLibrary.Start Command lxc exec ${container_name} -- ${cmd}
1138 ... ELSE IF '${container_type}' == 'K8S'
1139 ... SSHLibrary.Start Command kubectl -n ${namespace} exec ${container_name} -- ${cmd}
1140 ... ELSE
1141 ... SSHLibrary.Start Command ${cmd}
Andy Bavier9fb23232020-06-30 15:12:20 -07001142 # It seems that closing the connection immediately will sometimes kill the command
1143 Sleep 1s
Suraj Gour33651272020-05-04 10:10:16 +05301144 SSHLibrary.Close Connection
1145
Gayathri.Selvan92d16862020-03-19 14:47:58 +00001146Run Iperf3 Test Client
1147 [Arguments] ${src} ${server} ${args}
1148 [Documentation] Login to ${src} and run the iperf3 client against ${server} using ${args}.
1149 ... Return a Dictionary containing the results of the test.
Andy Bavierf6ab19c2020-05-14 10:34:47 -07001150 ${output} ${stderr} ${rc}= Execute Remote Command iperf3 -J -c ${server} ${args} | jq -M -c '.'
Gayathri.Selvan92d16862020-03-19 14:47:58 +00001151 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
Andy Bavierf6ab19c2020-05-14 10:34:47 -07001152 Should Be Equal As Integers ${rc} 0
Gayathri.Selvan92d16862020-03-19 14:47:58 +00001153 ${object}= Evaluate json.loads(r'''${output}''') json
1154 [Return] ${object}
Hung-Wei Chiue0bec7c2020-05-29 22:16:56 +00001155
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -07001156Run Iperf Test Client for MCAST
1157 [Arguments] ${src} ${server} ${args}
1158 [Documentation] Login to ${src} and run the iperf client against ${server} using ${args}.
1159 ... Return a Dictionary containing the results of the test.
1160 ${output} ${stderr} ${rc}= Execute Remote Command sudo iperf -c ${server} ${args} | jq -M -c '.'
1161 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
1162 Should Be Equal As Integers ${rc} 0
1163 ${object}= Evaluate json.loads(r'''${output}''') json
1164 [Return] ${object}
1165
Hung-Wei Chiue0bec7c2020-05-29 22:16:56 +00001166RestoreONUs
1167 [Documentation] Restore all connected ONUs
Suchitra Vemuria6879aa2020-11-03 11:03:11 -08001168 [Arguments] ${num_all_onus}
1169 FOR ${I} IN RANGE 0 ${num_all_onus}
Hung-Wei Chiue0bec7c2020-05-29 22:16:56 +00001170 ${src}= Set Variable ${hosts.src[${I}]}
Hung-Wei Chiucc6e6552020-06-04 12:57:38 -07001171 ${container_type}= Get Variable Value ${src['container_type']} "null"
1172 ${container_name}= Get Variable Value ${src['container_name']} "null"
Hung-Wei Chiue0bec7c2020-05-29 22:16:56 +00001173 ${onu_type}= Get Variable Value ${src['onu_type']} "null"
Hung-Wei Chiucc6e6552020-06-04 12:57:38 -07001174 #Get ens6f0 from ens6f0.22
1175 ${if_name}= Replace String Using Regexp ${src['dp_iface_name']} \\..* \
Hung-Wei Chiue0bec7c2020-05-29 22:16:56 +00001176 Run Keyword IF '${onu_type}' == 'alpha' AlphaONURestoreDefault ${src['ip']} ${src['user']}
Hung-Wei Chiucc6e6552020-06-04 12:57:38 -07001177 ... ${src['pass']} ${if_name} admin admin ${container_type} ${container_name}
Hung-Wei Chiue0bec7c2020-05-29 22:16:56 +00001178 END
1179
1180AlphaONURestoreDefault
1181 [Documentation] Restore the Alpha ONU to factory setting
1182 [Arguments] ${rg_ip} ${rg_user} ${rg_pass} ${onu_ifname}
Hung-Wei Chiucc6e6552020-06-04 12:57:38 -07001183 ... ${onu_user} ${onu_pass} ${container_type}=${None} ${container_name}=${None}
Hung-Wei Chiue0bec7c2020-05-29 22:16:56 +00001184 ${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 -07001185 ... ${rg_ip} ${rg_user} ${rg_pass} ${container_type} ${container_name}
Hung-Wei Chiue0bec7c2020-05-29 22:16:56 +00001186 ${cmd} Catenate
1187 ... (echo open "192.168.1.1"; sleep 1;
1188 ... echo "${onu_user}"; sleep 1;
1189 ... echo "${onu_pass}"; sleep 1;
1190 ... echo "restoredefault"; sleep 1) | telnet
1191 ${output}= Login And Run Command On Remote System ${cmd}
Hung-Wei Chiucc6e6552020-06-04 12:57:38 -07001192 ... ${rg_ip} ${rg_user} ${rg_pass} ${container_type} ${container_name}
Hung-Wei Chiue0bec7c2020-05-29 22:16:56 +00001193 Log To Console ${output}
1194 ${output}= Login And Run Command On Remote System sudo ifconfig ${onu_ifname} 0
Hung-Wei Chiucc6e6552020-06-04 12:57:38 -07001195 ... ${rg_ip} ${rg_user} ${rg_pass} ${container_type} ${container_name}
Suraj Gour33651272020-05-04 10:10:16 +05301196
1197Create traffic with each pbit and capture at other end
1198 [Documentation] Generates upstream traffic using Mausezahn tool
1199 ... with each pbit and validates reception at other end using tcpdump
1200 [Arguments] ${target_ip} ${target_iface} ${src_iface}
1201 ... ${packet_count} ${packet_type} ${target_port} ${vlan} ${tcpdump_filter}
1202 ... ${dst_ip} ${dst_user} ${dst_pass} ${dst_container_type} ${dst_container_name}
1203 ... ${src_ip} ${src_user} ${src_pass} ${src_container_type} ${src_container_name}
1204 FOR ${pbit} IN RANGE 8
Andy Baviereff938d2020-06-29 18:27:49 -07001205 Execute Remote Command sudo pkill mausezahn
Suraj Gour33651272020-05-04 10:10:16 +05301206 ... ${src_ip} ${src_user} ${src_pass} ${src_container_type} ${src_container_name}
Andy Baviereff938d2020-06-29 18:27:49 -07001207 ${var1}= Set Variable sudo mausezahn ${src_iface} -B ${target_ip} -c ${packet_count} -d 100m
Suraj Gour33651272020-05-04 10:10:16 +05301208 ${var2}= Set Variable -t ${packet_type} "dp=${target_port}" -p 1472 -Q ${pbit}:${vlan}
1209 ${cmd}= Set Variable ${var1} ${var2}
1210 Start Remote Command ${cmd} ${src_ip} ${src_user} ${src_pass}
1211 ... ${src_container_type} ${src_container_name}
1212 ${output} ${stderr} ${rc}= Execute Remote Command
Andy Baviereff938d2020-06-29 18:27:49 -07001213 ... sudo tcpdump -l -U -c 30 -i ${target_iface} -e ${tcpdump_filter}
Suraj Gour33651272020-05-04 10:10:16 +05301214 ... ${dst_ip} ${dst_user} ${dst_pass} ${dst_container_type} ${dst_container_name}
Andy Baviereff938d2020-06-29 18:27:49 -07001215 ... timeout=30 seconds
1216 Execute Remote Command sudo pkill mausezahn
Suraj Gour33651272020-05-04 10:10:16 +05301217 ... ${src_ip} ${src_user} ${src_pass} ${src_container_type} ${src_container_name}
1218 # VOL-3262: I'm seeing untagged downstream traffic at RG for pbit 0. According to Girish this is
1219 # incorrect behavior. Simplify the following check when VOL-3262 is resolved.
1220 Run Keyword If ${pbit}==0 and "${tcpdump_filter}"=="udp"
1221 ... Should Match Regexp ${output} \\.${target_port}: UDP,
1222 ... ELSE Should Match Regexp ${output} , p ${pbit},.*\\.${target_port}: UDP,
1223 END