blob: a141cf45d628a644f56ee0e821f56e488003e7e5 [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
Hardik Windlassaaea3402020-03-10 19:45:45 +0530590Validate ONUs After OLT Disable
591 [Documentation] Validates the ONUs state in Voltha, ONUs port state in ONOS
592 ... and that pings do not succeed After corresponding OLT is Disabled
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800593 [Arguments] ${num_onus}
Hardik Windlassaaea3402020-03-10 19:45:45 +0530594 FOR ${I} IN RANGE 0 ${num_onus}
595 ${src}= Set Variable ${hosts.src[${I}]}
596 ${dst}= Set Variable ${hosts.dst[${I}]}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800597 ${of_id}= Get ofID From OLT List ${src['olt']}
Hardik Windlassaaea3402020-03-10 19:45:45 +0530598 ${onu_device_id}= Get Device ID From SN ${src['onu']}
599 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
600 ... ${of_id}
601 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
602 ... Validate Device ENABLED DISCOVERED
603 ... UNREACHABLE ${src['onu']} onu=True onu_reason=stopping-openomci
604 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
Suchitra Vemuri760bdd32020-06-17 12:34:48 -0700605 ... Verify ONU Port Is Disabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
Hardik Windlassaaea3402020-03-10 19:45:45 +0530606 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
607 ... Wait Until Keyword Succeeds 60s 2s
608 ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
609 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
610 Run Keyword and Ignore Error Get Device Output from Voltha ${onu_device_id}
611 Run Keyword and Ignore Error Collect Logs
612 END
613
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000614Delete All Devices and Verify
615 [Documentation] Remove any devices from VOLTHA and ONOS
616 # Clear devices from VOLTHA
617 Disable Devices In Voltha Root=true
Suchitra Vemuri970747f2020-03-30 17:31:34 -0700618 Sleep 5s
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000619 Wait Until Keyword Succeeds ${timeout} 2s Test Devices Disabled In Voltha Root=true
620 Delete Devices In Voltha Root=true
Matteo Scandolof6cea382020-04-20 14:32:00 -0700621 Run Keyword If ${has_dataplane} Sleep 30s
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000622 Wait Until Keyword Succeeds ${timeout} 2s Test Empty Device List
623 # Clear devices from ONOS
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800624 #Remove All Devices From ONOS
ubuntu6b6e7d42020-03-02 12:35:42 -0800625 #... http://karaf:karaf@${ONOS_REST_IP}:${ONOS_REST_PORT}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000626
627Teardown
628 [Documentation] kills processes and cleans up interfaces on src+dst servers
629 Run Keyword If ${has_dataplane} Clean Up Linux
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000630
631Teardown Suite
632 [Documentation] Clean up device if desired
633 Run Keyword If ${teardown_device} Delete All Devices and Verify
634
635Delete Device and Verify
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800636 [Arguments] ${olt_serial_number}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000637 [Documentation] Disable -> Delete devices via voltctl and verify its removed
Suchitra Vemuri2fa9bba2020-01-22 17:38:48 -0800638 ${olt_device_id}= Get Device ID From SN ${olt_serial_number}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000639 ${rc} ${output}= Run and Return Rc and Output
Matteo Scandolo5899be12020-11-11 15:38:07 -0800640 ... voltctl -c ${VOLTCTL_CONFIG} device disable ${olt_device_id}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000641 Should Be Equal As Integers ${rc} 0
642 Sleep 5s
643 Wait Until Keyword Succeeds ${timeout} 5s
644 ... Validate OLT Device DISABLED UNKNOWN REACHABLE ${olt_serial_number}
645 ${rc} ${output}= Run and Return Rc and Output
Matteo Scandolo5899be12020-11-11 15:38:07 -0800646 ... voltctl -c ${VOLTCTL_CONFIG} device delete ${olt_device_id}
Matteo Scandolof6cea382020-04-20 14:32:00 -0700647 Run Keyword If ${has_dataplane} Sleep 50s
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000648 Should Be Equal As Integers ${rc} 0
649 Wait Until Keyword Succeeds ${timeout} 5s Validate Device Removed ${olt_device_id}
650
Gayathri.Selvan283a63c2020-01-23 04:09:18 +0000651Repeat Sanity Test
652 [Documentation] This keyword performs Sanity Test Procedure
653 ... Sanity test performs authentication, dhcp and pings for all the ONUs given for the POD
654 ... This keyword can be used to call in any other tests where sanity check is required
655 ... with wpa reassociation
656 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${olt_serial_number}
657 Set Global Variable ${of_id}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800658 FOR ${I} IN RANGE 0 ${num_all_onus}
Suchitra Vemuri03005912020-02-20 18:59:46 -0800659 Run Keyword and Ignore Error Collect Logs
Gayathri.Selvan283a63c2020-01-23 04:09:18 +0000660 ${src}= Set Variable ${hosts.src[${I}]}
661 ${dst}= Set Variable ${hosts.dst[${I}]}
Suchitra Vemuri8078b972020-02-06 19:07:41 -0800662 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
663 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
664 # Check ONU port is Enabled in ONOD
665 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
Suchitra Vemuri760bdd32020-06-17 12:34:48 -0700666 ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
Suchitra Vemuri8078b972020-02-06 19:07:41 -0800667 # Verify EAPOL flows are added for the ONU port
668 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
David K. Bainbridgec0617c92020-03-05 21:17:19 -0800669 ... Verify Eapol Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Suchitra Vemuri8078b972020-02-06 19:07:41 -0800670 # Verify ONU state in voltha
Suchitra Vemurid1e27fb2020-02-01 16:34:37 -0800671 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
Suchitra Vemuri81e4f022020-02-01 13:16:02 -0800672 ... ENABLED ACTIVE REACHABLE
673 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
Suchitra Vemuri8078b972020-02-06 19:07:41 -0800674 # Perform Authentication
Gayathri.Selvan283a63c2020-01-23 04:09:18 +0000675 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
676 ... Validate Authentication After Reassociate
677 ... True ${src['dp_iface_name']} ${src['ip']} ${src['user']} ${src['pass']}
678 ... ${src['container_type']} ${src['container_name']}
679 Wait Until Keyword Succeeds ${timeout} 2s
David K. Bainbridgec0617c92020-03-05 21:17:19 -0800680 ... Verify ONU in AAA-Users ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Gayathri.Selvan283a63c2020-01-23 04:09:18 +0000681 Wait Until Keyword Succeeds ${timeout} 2s
David K. Bainbridgec0617c92020-03-05 21:17:19 -0800682 ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
Gayathri.Selvan283a63c2020-01-23 04:09:18 +0000683 ... volt-add-subscriber-access ${of_id} ${onu_port}
684 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
685 ... Validate DHCP and Ping True True
686 ... ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
687 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
688 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
689 ... ${dst['container_name']}
690 Wait Until Keyword Succeeds ${timeout} 2s Run Keyword And Continue On Failure
David K. Bainbridgec0617c92020-03-05 21:17:19 -0800691 ... Validate Subscriber DHCP Allocation ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Gayathri.Selvan283a63c2020-01-23 04:09:18 +0000692 Run Keyword and Ignore Error Get Device Output from Voltha ${onu_device_id}
693 Run Keyword and Ignore Error Collect Logs
694 END
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000695
Hardik Windlass16cdf962020-04-29 15:26:50 +0530696Validate ONUs for PON OLT Disable
697 [Arguments] ${olt_peer_list}
698 [Documentation] This keyword validates that Ping fails for ONUs connected to Disabled OLT PON port
699 ... And Pings succeed for other Active OLT PON port ONUs
700 ... Also it removes subscriber for Disabled OLT PON port ONUs to replicate ATT workflow
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800701 FOR ${I} IN RANGE 0 ${num_all_nus}
Hardik Windlass16cdf962020-04-29 15:26:50 +0530702 ${src}= Set Variable ${hosts.src[${I}]}
703 ${dst}= Set Variable ${hosts.dst[${I}]}
704 ${onu_device_id}= Get Device ID From SN ${src['onu']}
705 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
706 ... ${of_id}
707 ${matched}= Match ONU in PON OLT Peer List ${olt_peer_list} ${onu_device_id}
708 Run Keyword If ${matched}
709 ... Run Keywords
710 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
711 ... Validate Device ENABLED DISCOVERED
712 ... UNREACHABLE ${src['onu']} onu=True onu_reason=stopping-openomci
713 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
714 ... Verify ONU Port Is Disabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
715 ... AND Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
716 ... Wait Until Keyword Succeeds 60s 2s
717 ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
718 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']}
719 ... ${src['container_name']}
720 # Remove Subscriber Access (To replicate ATT workflow)
721 ... AND Wait Until Keyword Succeeds ${timeout} 2s Execute ONOS CLI Command ${ONOS_SSH_IP}
722 ... ${ONOS_SSH_PORT} volt-remove-subscriber-access ${of_id} ${onu_port}
723 ... ELSE
724 ... Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
725 ... Wait Until Keyword Succeeds 60s 2s
726 ... Check Ping True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
727 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']}
728 ... ${src['container_name']}
729 Run Keyword and Ignore Error Collect Logs
730 END
731
732Validate ONUs for PON OLT Enable
733 [Arguments] ${olt_peer_list}
734 [Documentation] This keyword validates Ping succeeds for all Enabled/Acitve OLT PON ports
735 ... Also performs Auth/subscriberAdd/DHCP/Ping for the ONUs on Re-Enabled OLT PON port
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800736 FOR ${I} IN RANGE 0 ${num_all_onus}
Hardik Windlass16cdf962020-04-29 15:26:50 +0530737 ${src}= Set Variable ${hosts.src[${I}]}
738 ${dst}= Set Variable ${hosts.dst[${I}]}
739 ${onu_device_id}= Get Device ID From SN ${src['onu']}
740 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
741 ... ${of_id}
742 ${matched}= Match ONU in PON OLT Peer List ${olt_peer_list} ${onu_device_id}
743 ${wpa_log}= Run Keyword If ${has_dataplane} and ${matched} Catenate SEPARATOR=.
744 ... /tmp/wpa ${src['dp_iface_name']} log
745 Run Keyword If ${matched}
746 ... Run Keywords
747 # Perform Cleanup
748 ... Run Keyword If ${has_dataplane} Clean Up Linux ${onu_device_id}
749 # Verify ONU port status
750 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
751 ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
752 # Verify EAPOL flows are added for the ONU port
753 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
754 ... Verify Eapol Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
755 # Verify ONU state in voltha
756 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
757 ... Validate Device ENABLED ACTIVE REACHABLE
758 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
759 # Perform Authentication
760 ... AND Run Keyword If ${has_dataplane}
761 ... Run Keyword And Continue On Failure Validate Authentication True
762 ... ${src['dp_iface_name']} wpa_supplicant.conf ${src['ip']} ${src['user']} ${src['pass']}
763 ... ${src['container_type']} ${src['container_name']} ${wpa_log}
764 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
765 ... Verify ONU in AAA-Users ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
766 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
767 ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
768 ... volt-add-subscriber-access ${of_id} ${onu_port}
769 # Verify that no pending flows exist for the ONU port
770 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
771 ... Verify No Pending Flows For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
772 # Verify subscriber access flows are added for the ONU port
773 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
774 ... Verify Subscriber Access Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
775 ... ${onu_port} ${nni_port} ${src['c_tag']} ${src['s_tag']}
776 ... AND Run Keyword If ${has_dataplane}
777 ... Run Keyword And Continue On Failure Validate DHCP and Ping True
778 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
779 ... ${src['ip']} ${src['user']} ${src['pass']}
780 ... ${src['container_type']} ${src['container_name']}
781 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']}
782 ... ${dst['container_type']} ${dst['container_name']}
783 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
784 ... Validate Subscriber DHCP Allocation ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
785 ... AND Run Keyword and Ignore Error Get Device Output from Voltha ${onu_device_id}
786 ... ELSE
787 ... Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
788 ... Wait Until Keyword Succeeds 60s 2s
789 ... Check Ping True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
790 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']}
791 ... ${src['container_name']}
792 Run Keyword and Ignore Error Collect Logs
793 END
794
795Validate ONUs for PON OLT Disable DT
796 [Arguments] ${olt_peer_list}
797 [Documentation] This keyword validates that Ping fails for ONUs connected to Disabled OLT PON port
798 ... And Pings succeed for other Active OLT PON port ONUs
799 ... Also it removes subscriber and deletes ONUs for Disabled OLT PON port to replicate DT workflow
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800800 FOR ${I} IN RANGE 0 ${num_all_onus}
Hardik Windlass16cdf962020-04-29 15:26:50 +0530801 ${src}= Set Variable ${hosts.src[${I}]}
802 ${dst}= Set Variable ${hosts.dst[${I}]}
803 ${onu_device_id}= Get Device ID From SN ${src['onu']}
804 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
805 ... ${of_id}
806 ${matched}= Match ONU in PON OLT Peer List ${olt_peer_list} ${onu_device_id}
807 Run Keyword If ${matched}
808 ... Run Keywords
809 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
810 ... Validate Device ENABLED DISCOVERED
811 ... UNREACHABLE ${src['onu']} onu=True onu_reason=stopping-openomci
812 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
813 ... Verify ONU Port Is Disabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
814 ... AND Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
815 ... Wait Until Keyword Succeeds 60s 2s
816 ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
817 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']}
818 ... ${src['container_name']}
819 # Remove Subscriber Access (To replicate DT workflow)
820 ... AND Wait Until Keyword Succeeds ${timeout} 2s Execute ONOS CLI Command ${ONOS_SSH_IP}
821 ... ${ONOS_SSH_PORT} volt-remove-subscriber-access ${of_id} ${onu_port}
822 ... AND Sleep 10s
823 # Delete ONU Device (To replicate DT workflow)
824 ... AND Delete Device ${onu_device_id}
825 ... AND Sleep 5s
826 ... ELSE
827 ... Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
828 ... Wait Until Keyword Succeeds 60s 2s
829 ... Check Ping True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
830 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']}
831 ... ${src['container_name']}
832 Run Keyword and Ignore Error Collect Logs
833 END
834
835Validate ONUs for PON OLT Enable DT
836 [Arguments] ${olt_peer_list}
837 [Documentation] This keyword validates Ping succeeds for all Enabled/Acitve OLT PON ports
838 ... Also performs subscriberAdd/DHCP/Ping for the ONUs on Re-Enabled OLT PON port
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800839 FOR ${I} IN RANGE 0 ${num_all_onus}
Hardik Windlass16cdf962020-04-29 15:26:50 +0530840 ${src}= Set Variable ${hosts.src[${I}]}
841 ${dst}= Set Variable ${hosts.dst[${I}]}
842 ${onu_device_id}= Get Device ID From SN ${src['onu']}
843 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
844 ... ${of_id}
845 ${matched}= Match ONU in PON OLT Peer List ${olt_peer_list} ${onu_device_id}
846 Run Keyword If ${matched}
847 ... Run Keywords
848 # Perform Cleanup
849 ... Run Keyword If ${has_dataplane} Clean Up Linux ${onu_device_id}
850 # Verify ONU port status
851 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
852 ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
853 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
854 ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
855 ... volt-add-subscriber-access ${of_id} ${onu_port}
856 # Verify ONU state in voltha
857 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
858 ... Validate Device ENABLED ACTIVE REACHABLE
859 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
860 # Verify subscriber access flows are added for the ONU port
861 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
862 ... Verify Subscriber Access Flows Added For ONU DT ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
863 ... ${onu_port} ${nni_port} ${src['s_tag']}
864 ... AND Run Keyword If ${has_dataplane}
865 ... Run Keyword And Continue On Failure Validate DHCP and Ping True
866 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
867 ... ${src['ip']} ${src['user']} ${src['pass']}
868 ... ${src['container_type']} ${src['container_name']}
869 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']}
870 ... ${dst['container_type']} ${dst['container_name']}
871 ... ELSE
872 ... Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
873 ... Wait Until Keyword Succeeds 60s 2s
874 ... Check Ping True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
875 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']}
876 ... ${src['container_name']}
877 Run Keyword and Ignore Error Collect Logs
878 END
879
880Match ONU in PON OLT Peer List
881 [Arguments] ${olt_peer_list} ${onu_device_id}
882 [Documentation] This keyword matches if ONU device is present in OLT PON port peer list
883 ${matched}= Set Variable False
884 FOR ${olt_peer} IN @{olt_peer_list}
885 ${matched}= Set Variable If '${onu_device_id}' == '${olt_peer}' True False
886 Exit For Loop If ${matched}
887 END
888 [Return] ${matched}
889
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000890Collect Logs
891 [Documentation] Collect Logs from voltha and onos cli for various commands
892 Run Keyword and Ignore Error Get Device List from Voltha
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800893 FOR ${I} IN RANGE 0 ${num_olts}
894 Run Keyword and Ignore Error Get Logical Device Output from Voltha ${logical_id}
895 Run Keyword and Ignore Error Get Device Output from Voltha ${olt_ids}[${I}][device_id]
896 Run Keyword and Ignore Error Get Logical Device Output from Voltha ${olt_ids}[${I}][logical_id]
897 END
898 #Run Keyword and Ignore Error Get Device Output from Voltha ${olt_device_id}
899 #Run Keyword and Ignore Error Get Logical Device Output from Voltha ${logical_id}
ubuntu6b6e7d42020-03-02 12:35:42 -0800900 Get ONOS Status ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
Gayathri.Selvanf68ea4b2020-02-03 07:36:39 +0000901
902Verify ping is succesful except for given device
903 [Arguments] ${num_onus} ${exceptional_onu_id}
904 [Documentation] Checks that ping for all the devices are successful except the given ONU.
905 ${pingStatus} Set Variable True
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800906 FOR ${I} IN RANGE 0 ${num_all_onus}
Gayathri.Selvanf68ea4b2020-02-03 07:36:39 +0000907 ${src}= Set Variable ${hosts.src[${I}]}
908 ${dst}= Set Variable ${hosts.dst[${I}]}
909 ${onu_device_id}= Get Device ID From SN ${src['onu']}
910 ${pingStatus} Run Keyword If '${onu_device_id}' == '${exceptional_onu_id}' Set Variable False
911 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 60s 2s
912 ... Check Ping ${pingStatus} ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
913 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
914 END
Andy Bavier4a8450e2020-02-04 08:58:37 -0700915
Andy Bavier1923ecc2020-06-18 14:06:40 -0700916Echo Message to OLT Logs
917 [Arguments] ${message}
918 [Documentation] Echoes ${message} into the OLT logs
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800919 FOR ${I} IN RANGE 0 ${num_olts}
920 ${olt_user} Evaluate ${olts}[${I}].get("user")
921 ${olt_pass} Evaluate ${olts}[${I}].get("pass")
922 ${olt_ssh_ip} Evaluate ${olts}[${I}].get("sship")
923 Wait Until Keyword Succeeds 180s 10s Execute Remote Command
924 ... printf '%s\n' '' '' '${message}' '' >> /var/log/openolt.log
925 ... ${olt_ssh_ip} ${olt_user} ${olt_pass}
926 Wait Until Keyword Succeeds 180s 10s Execute Remote Command
927 ... printf '%s\n' '' '' '${message}' '' >> /var/log/dev_mgmt_daemon.log
928 ... ${olt_ssh_ip} ${olt_user} ${olt_pass}
929 Wait Until Keyword Succeeds 180s 10s Execute Remote Command
930 ... printf '%s\n' '' '' '${message}' '' >> /var/log/openolt_process_watchdog.log
931 ... ${olt_ssh_ip} ${olt_user} ${olt_pass}
932 END
Andy Bavier1923ecc2020-06-18 14:06:40 -0700933
Andy Bavierabeba262020-02-07 16:22:16 -0700934Start Logging
935 [Arguments] ${label}
936 [Documentation] Start logging for test ${label}
937 ${kail_process}= Run Keyword If "${container_log_dir}" != "${None}" Start Process kail -n default
938 ... -n voltha cwd=${container_log_dir} stdout=${label}-combined.log
939 Set Test Variable ${kail_process}
Andy Bavier1923ecc2020-06-18 14:06:40 -0700940 Run Keyword If ${has_dataplane} Echo Message to OLT Logs START ${label}
Andy Bavierabeba262020-02-07 16:22:16 -0700941
942Stop Logging
943 [Arguments] ${label}
944 [Documentation] End logging for test; remove logfile if test passed
945 Run sync
946 Run Keyword If ${kail_process} Terminate Process ${kail_process}
947 ${test_logfile}= Run Keyword If "${container_log_dir}" != "${None}"
948 ... Join Path ${container_log_dir} ${label}-combined.log
949 Run Keyword If Test Passed Run Keyword If "${test_logfile}" != "${None}" Remove File ${test_logfile}
Andy Bavier1923ecc2020-06-18 14:06:40 -0700950 Run Keyword If ${has_dataplane} Echo Message to OLT Logs END ${label}
Andy Bavierabeba262020-02-07 16:22:16 -0700951
Suchitra Vemuria5fa3dd2020-02-04 14:38:49 -0800952Clean Up Linux
953 [Documentation] Kill processes and clean up interfaces on src+dst servers
Hardik Windlass16cdf962020-04-29 15:26:50 +0530954 [Arguments] ${onu_id}=${EMPTY}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800955 FOR ${I} IN RANGE 0 ${num_all_onus}
Suchitra Vemuria5fa3dd2020-02-04 14:38:49 -0800956 ${src}= Set Variable ${hosts.src[${I}]}
957 ${dst}= Set Variable ${hosts.dst[${I}]}
Hardik Windlass16cdf962020-04-29 15:26:50 +0530958 ${onu_device_id}= Get Device ID From SN ${src['onu']}
959 Continue For Loop If '${onu_id}' != '${EMPTY}' and '${onu_id}' != '${onu_device_id}'
Andy Bavier84b83282020-06-30 05:47:49 -0700960 Execute Remote Command sudo pkill wpa_supplicant ${src['ip']}
Suchitra Vemuria5fa3dd2020-02-04 14:38:49 -0800961 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
Andy Bavier84b83282020-06-30 05:47:49 -0700962 Execute Remote Command sudo pkill dhclient ${src['ip']}
Suchitra Vemuria5fa3dd2020-02-04 14:38:49 -0800963 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
Andy Baviereff938d2020-06-29 18:27:49 -0700964 Execute Remote Command sudo pkill mausezahn ${src['ip']}
965 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
966 Run Keyword If '${dst['ip']}' != '${None}' Execute Remote Command pkill dhcpd
967 ... ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']} ${dst['container_name']}
Suchitra Vemuria5fa3dd2020-02-04 14:38:49 -0800968 Delete IP Addresses from Interface on Remote Host ${src['dp_iface_name']} ${src['ip']}
969 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
970 Run Keyword If '${dst['ip']}' != '${None}' Delete Interface on Remote Host
971 ... ${dst['dp_iface_name']}.${src['s_tag']} ${dst['ip']} ${dst['user']} ${dst['pass']}
972 ... ${dst['container_type']} ${dst['container_name']}
Andy Bavier84b83282020-06-30 05:47:49 -0700973 ${bng_ip}= Get Variable Value ${dst['noroot_ip']}
974 ${bng_user}= Get Variable Value ${dst['noroot_user']}
975 ${bng_pass}= Get Variable Value ${dst['noroot_pass']}
Andy Bavierf4b7d1d2020-06-30 11:14:04 -0700976 Run Keyword If "${bng_ip}" != "${NONE}" and "${bng_user}" != "${NONE}" and "${bng_pass}" != "${NONE}"
977 ... Execute Remote Command sudo pkill mausezahn ${bng_ip} ${bng_user} ${bng_pass}
Andy Baviereff938d2020-06-29 18:27:49 -0700978 ... ${dst['container_type']} ${dst['container_name']}
Suchitra Vemuria5fa3dd2020-02-04 14:38:49 -0800979 END
Scott Baker60e570d2020-02-02 22:10:13 -0800980
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800981Clean Up Linux Per OLT
982 [Documentation] Kill processes and clean up interfaces on src+dst servers
983 [Arguments] ${olt_serial_number}
984 FOR ${I} IN RANGE 0 ${num_all_onus}
985 ${src}= Set Variable ${hosts.src[${I}]}
986 ${dst}= Set Variable ${hosts.dst[${I}]}
987 ${onu_device_id}= Get Device ID From SN ${src['onu']}
988 ${sn}= Get Device ID From SN ${src['olt']}
989 #Continue For Loop If '${onu_id}' != '${EMPTY}' and '${onu_id}' != '${onu_device_id}'
990 Continue For Loop If '${olt_serial_number}' == '${sn}'
991 Execute Remote Command sudo pkill wpa_supplicant ${src['ip']}
992 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
993 Execute Remote Command sudo pkill dhclient ${src['ip']}
994 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
995 Execute Remote Command sudo pkill mausezahn ${src['ip']}
996 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
997 Run Keyword If '${dst['ip']}' != '${None}' Execute Remote Command pkill dhcpd
998 ... ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']} ${dst['container_name']}
999 Delete IP Addresses from Interface on Remote Host ${src['dp_iface_name']} ${src['ip']}
1000 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
1001 Run Keyword If '${dst['ip']}' != '${None}' Delete Interface on Remote Host
1002 ... ${dst['dp_iface_name']}.${src['s_tag']} ${dst['ip']} ${dst['user']} ${dst['pass']}
1003 ... ${dst['container_type']} ${dst['container_name']}
1004 ${bng_ip}= Get Variable Value ${dst['noroot_ip']}
1005 ${bng_user}= Get Variable Value ${dst['noroot_user']}
1006 ${bng_pass}= Get Variable Value ${dst['noroot_pass']}
1007 Run Keyword If "${bng_ip}" != "${NONE}" and "${bng_user}" != "${NONE}" and "${bng_pass}" != "${NONE}"
1008 ... Execute Remote Command sudo pkill mausezahn ${bng_ip} ${bng_user} ${bng_pass}
1009 ... ${dst['container_type']} ${dst['container_name']}
1010 END
1011
Suchitra Vemuri8d3b0032020-09-11 17:49:08 -07001012Clean dhclient
1013 [Documentation] Kills dhclient processes only for all RGs
Suchitra Vemuria6879aa2020-11-03 11:03:11 -08001014 FOR ${I} IN RANGE 0 ${num_all_nus}
Suchitra Vemuri8d3b0032020-09-11 17:49:08 -07001015 ${src}= Set Variable ${hosts.src[${I}]}
1016 ${dst}= Set Variable ${hosts.dst[${I}]}
1017 Execute Remote Command sudo pkill dhclient ${src['ip']}
1018 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
1019 END
1020
Suchitra Vemurif7a033c2020-02-26 17:22:41 -08001021Clean WPA Process
1022 [Documentation] Kills wpa_supplicant processes only for all RGs
Suchitra Vemuria6879aa2020-11-03 11:03:11 -08001023 FOR ${I} IN RANGE 0 ${num_all_onus}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -08001024 ${src}= Set Variable ${hosts.src[${I}]}
1025 ${dst}= Set Variable ${hosts.dst[${I}]}
1026 Run Keyword And Ignore Error Kill Linux Process [w]pa_supplicant ${src['ip']}
1027 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
1028 END
1029
Scott Baker60e570d2020-02-02 22:10:13 -08001030Should Be Larger Than
1031 [Documentation] Verify that value_1 is > value_2
1032 [Arguments] ${value_1} ${value_2}
1033 Run Keyword If ${value_1} <= ${value_2}
1034 ... Fail The value ${value_1} is not larger than ${value_2}
1035
Scott Bakeree675552020-02-11 10:43:34 -08001036Should Be Larger Than Or Equal To
1037 [Documentation] Verify that value_1 is >= value_2
1038 [Arguments] ${value_1} ${value_2}
1039 Run Keyword If ${value_1} < ${value_2}
1040 ... Fail The value ${value_1} is not larger than or equal to ${value_2}
1041
Scott Baker60e570d2020-02-02 22:10:13 -08001042Should Be Float
1043 [Documentation] Verify that value is a floating point number type
1044 [Arguments] ${value}
1045 ${type} Evaluate type(${value}).__name__
1046 Should Be Equal ${type} float
1047
Scott Bakeree675552020-02-11 10:43:34 -08001048Should Be Newer Than Or Equal To
1049 [Documentation] Compare two RFC3339 dates
1050 [Arguments] ${value_1} ${value_2}
1051 ${unix_v1} Parse RFC3339 ${value_1}
1052 ${unix_v2} Parse RFC3339 ${value_2}
1053 Run Keyword If ${unix_v1} < ${unix_v2}
1054 ... Fail The value ${value_1} is not newer than or equal to ${value_2}
1055
Scott Baker60e570d2020-02-02 22:10:13 -08001056Get Current Time
1057 [Documentation] Return the current time in RFC3339 format
1058 ${output}= Run date -u +"%FT%T%:z"
1059 [return] ${output}
Scott Bakeree675552020-02-11 10:43:34 -08001060
1061Parse RFC3339
1062 [Documentation] Parse an RFC3339 timestamp
1063 [Arguments] ${dateStr}
1064 ${rc} ${output}= Run and Return Rc and Output date --date="${dateStr}" "+%s"
1065 Should Be Equal As Numbers ${rc} 0
1066 [return] ${output}
Matteo Scandolo142e6272020-04-29 17:36:59 -07001067
Gayathri.Selvan92d16862020-03-19 14:47:58 +00001068Get Bandwidth Profile Name For Given Subscriber
1069 [Arguments] ${subscriber_id} ${stream_type}=upstreamBandwidthProfile
1070 [Documentation] Keyword to get the bandwidth details of the given subscriber
1071 ${bandwidth_profile_output}= Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
1072 ... volt-programmed-subscribers | grep ${subscriber_id}
1073 @{bandwidth_profile_array}= Split String ${bandwidth_profile_output} ,
1074 Log ${bandwidth_profile_array}
1075 FOR ${value} IN @{bandwidth_profile_array}
1076 @{row_value}= Split String ${value} =
1077 ${bandwidth_profile_name}= Set Variable If '${row_value[0]}' == ' ${stream_type}'
1078 ... ${row_value[1]}
1079 ${bandwidth_profile_name}= Convert To String ${bandwidth_profile_name}
1080 Run Keyword If "${bandwidth_profile_name}" != "None" Exit For Loop
1081 END
1082 Log ${bandwidth_profile_name}
1083 [Return] ${bandwidth_profile_name}
1084
1085Execute Remote Command
1086 [Documentation] SSH into a remote host and execute a command on the bare host or in a container.
1087 ... This replaces and simplifies the Login And Run Command On Remote System keyword in CORDRobot.
1088 [Arguments] ${cmd} ${ip} ${user} ${pass}=${None}
Andy Baviereff938d2020-06-29 18:27:49 -07001089 ... ${container_type}=${None} ${container_name}=${None} ${timeout}=${None}
Gayathri.Selvan92d16862020-03-19 14:47:58 +00001090 ${conn_id}= SSHLibrary.Open Connection ${ip}
1091 Run Keyword If '${pass}' != '${None}'
1092 ... SSHLibrary.Login ${user} ${pass}
1093 ... ELSE
1094 ... SSHLibrary.Login With Public Key ${user} %{HOME}/.ssh/id_rsa
1095 ${namespace}= Run Keyword If '${container_type}' == 'K8S' SSHLibrary.Execute Command
1096 ... kubectl get pods --all-namespaces | grep ${container_name} | awk '{print $1}'
Andy Bavierf6ab19c2020-05-14 10:34:47 -07001097 ${stdout} ${stderr} ${rc}= Run Keyword If '${container_type}' == 'LXC'
1098 ... SSHLibrary.Execute Command lxc exec ${container_name} -- ${cmd}
Andy Baviereff938d2020-06-29 18:27:49 -07001099 ... return_stderr=True return_rc=True timeout=${timeout}
Gayathri.Selvan92d16862020-03-19 14:47:58 +00001100 ... ELSE IF '${container_type}' == 'K8S'
Andy Bavierf6ab19c2020-05-14 10:34:47 -07001101 ... SSHLibrary.Execute Command kubectl -n ${namespace} exec ${container_name} -- ${cmd}
Andy Baviereff938d2020-06-29 18:27:49 -07001102 ... return_stderr=True return_rc=True timeout=${timeout}
Gayathri.Selvan92d16862020-03-19 14:47:58 +00001103 ... ELSE
Andy Baviereff938d2020-06-29 18:27:49 -07001104 ... SSHLibrary.Execute Command ${cmd} return_stderr=True return_rc=True timeout=${timeout}
Andy Bavierf6ab19c2020-05-14 10:34:47 -07001105
1106 Log ${stdout}
1107 Log ${stderr}
1108 Log ${rc}
Gayathri.Selvan92d16862020-03-19 14:47:58 +00001109 SSHLibrary.Close Connection
Andy Bavierf6ab19c2020-05-14 10:34:47 -07001110 [Return] ${stdout} ${stderr} ${rc}
Gayathri.Selvan92d16862020-03-19 14:47:58 +00001111
Suraj Gour33651272020-05-04 10:10:16 +05301112Start Remote Command
1113 [Documentation] SSH into a remote host and execute a command on the bare host or in a container.
1114 ... This replaces and simplifies the Login And Run Command On Remote System keyword in CORDRobot.
1115 [Arguments] ${cmd} ${ip} ${user} ${pass}=${None}
1116 ... ${container_type}=${None} ${container_name}=${None}
1117 ${conn_id}= SSHLibrary.Open Connection ${ip}
1118 Run Keyword If '${pass}' != '${None}'
1119 ... SSHLibrary.Login ${user} ${pass}
1120 ... ELSE
1121 ... SSHLibrary.Login With Public Key ${user} %{HOME}/.ssh/id_rsa
1122 ${namespace}= Run Keyword If '${container_type}' == 'K8S' SSHLibrary.Execute Command
1123 ... kubectl get pods --all-namespaces | grep ${container_name} | awk '{print $1}'
1124 Run Keyword If '${container_type}' == 'LXC'
1125 ... SSHLibrary.Start Command lxc exec ${container_name} -- ${cmd}
1126 ... ELSE IF '${container_type}' == 'K8S'
1127 ... SSHLibrary.Start Command kubectl -n ${namespace} exec ${container_name} -- ${cmd}
1128 ... ELSE
1129 ... SSHLibrary.Start Command ${cmd}
Andy Bavier9fb23232020-06-30 15:12:20 -07001130 # It seems that closing the connection immediately will sometimes kill the command
1131 Sleep 1s
Suraj Gour33651272020-05-04 10:10:16 +05301132 SSHLibrary.Close Connection
1133
Gayathri.Selvan92d16862020-03-19 14:47:58 +00001134Run Iperf3 Test Client
1135 [Arguments] ${src} ${server} ${args}
1136 [Documentation] Login to ${src} and run the iperf3 client against ${server} using ${args}.
1137 ... Return a Dictionary containing the results of the test.
Andy Bavierf6ab19c2020-05-14 10:34:47 -07001138 ${output} ${stderr} ${rc}= Execute Remote Command iperf3 -J -c ${server} ${args} | jq -M -c '.'
Gayathri.Selvan92d16862020-03-19 14:47:58 +00001139 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
Andy Bavierf6ab19c2020-05-14 10:34:47 -07001140 Should Be Equal As Integers ${rc} 0
Gayathri.Selvan92d16862020-03-19 14:47:58 +00001141 ${object}= Evaluate json.loads(r'''${output}''') json
1142 [Return] ${object}
Hung-Wei Chiue0bec7c2020-05-29 22:16:56 +00001143
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -07001144Run Iperf Test Client for MCAST
1145 [Arguments] ${src} ${server} ${args}
1146 [Documentation] Login to ${src} and run the iperf client against ${server} using ${args}.
1147 ... Return a Dictionary containing the results of the test.
1148 ${output} ${stderr} ${rc}= Execute Remote Command sudo iperf -c ${server} ${args} | jq -M -c '.'
1149 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
1150 Should Be Equal As Integers ${rc} 0
1151 ${object}= Evaluate json.loads(r'''${output}''') json
1152 [Return] ${object}
1153
Hung-Wei Chiue0bec7c2020-05-29 22:16:56 +00001154RestoreONUs
1155 [Documentation] Restore all connected ONUs
Suchitra Vemuria6879aa2020-11-03 11:03:11 -08001156 [Arguments] ${num_all_onus}
1157 FOR ${I} IN RANGE 0 ${num_all_onus}
Hung-Wei Chiue0bec7c2020-05-29 22:16:56 +00001158 ${src}= Set Variable ${hosts.src[${I}]}
Hung-Wei Chiucc6e6552020-06-04 12:57:38 -07001159 ${container_type}= Get Variable Value ${src['container_type']} "null"
1160 ${container_name}= Get Variable Value ${src['container_name']} "null"
Hung-Wei Chiue0bec7c2020-05-29 22:16:56 +00001161 ${onu_type}= Get Variable Value ${src['onu_type']} "null"
Hung-Wei Chiucc6e6552020-06-04 12:57:38 -07001162 #Get ens6f0 from ens6f0.22
1163 ${if_name}= Replace String Using Regexp ${src['dp_iface_name']} \\..* \
Hung-Wei Chiue0bec7c2020-05-29 22:16:56 +00001164 Run Keyword IF '${onu_type}' == 'alpha' AlphaONURestoreDefault ${src['ip']} ${src['user']}
Hung-Wei Chiucc6e6552020-06-04 12:57:38 -07001165 ... ${src['pass']} ${if_name} admin admin ${container_type} ${container_name}
Hung-Wei Chiue0bec7c2020-05-29 22:16:56 +00001166 END
1167
1168AlphaONURestoreDefault
1169 [Documentation] Restore the Alpha ONU to factory setting
1170 [Arguments] ${rg_ip} ${rg_user} ${rg_pass} ${onu_ifname}
Hung-Wei Chiucc6e6552020-06-04 12:57:38 -07001171 ... ${onu_user} ${onu_pass} ${container_type}=${None} ${container_name}=${None}
Hung-Wei Chiue0bec7c2020-05-29 22:16:56 +00001172 ${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 -07001173 ... ${rg_ip} ${rg_user} ${rg_pass} ${container_type} ${container_name}
Hung-Wei Chiue0bec7c2020-05-29 22:16:56 +00001174 ${cmd} Catenate
1175 ... (echo open "192.168.1.1"; sleep 1;
1176 ... echo "${onu_user}"; sleep 1;
1177 ... echo "${onu_pass}"; sleep 1;
1178 ... echo "restoredefault"; sleep 1) | telnet
1179 ${output}= Login And Run Command On Remote System ${cmd}
Hung-Wei Chiucc6e6552020-06-04 12:57:38 -07001180 ... ${rg_ip} ${rg_user} ${rg_pass} ${container_type} ${container_name}
Hung-Wei Chiue0bec7c2020-05-29 22:16:56 +00001181 Log To Console ${output}
1182 ${output}= Login And Run Command On Remote System sudo ifconfig ${onu_ifname} 0
Hung-Wei Chiucc6e6552020-06-04 12:57:38 -07001183 ... ${rg_ip} ${rg_user} ${rg_pass} ${container_type} ${container_name}
Suraj Gour33651272020-05-04 10:10:16 +05301184
1185Create traffic with each pbit and capture at other end
1186 [Documentation] Generates upstream traffic using Mausezahn tool
1187 ... with each pbit and validates reception at other end using tcpdump
1188 [Arguments] ${target_ip} ${target_iface} ${src_iface}
1189 ... ${packet_count} ${packet_type} ${target_port} ${vlan} ${tcpdump_filter}
1190 ... ${dst_ip} ${dst_user} ${dst_pass} ${dst_container_type} ${dst_container_name}
1191 ... ${src_ip} ${src_user} ${src_pass} ${src_container_type} ${src_container_name}
1192 FOR ${pbit} IN RANGE 8
Andy Baviereff938d2020-06-29 18:27:49 -07001193 Execute Remote Command sudo pkill mausezahn
Suraj Gour33651272020-05-04 10:10:16 +05301194 ... ${src_ip} ${src_user} ${src_pass} ${src_container_type} ${src_container_name}
Andy Baviereff938d2020-06-29 18:27:49 -07001195 ${var1}= Set Variable sudo mausezahn ${src_iface} -B ${target_ip} -c ${packet_count} -d 100m
Suraj Gour33651272020-05-04 10:10:16 +05301196 ${var2}= Set Variable -t ${packet_type} "dp=${target_port}" -p 1472 -Q ${pbit}:${vlan}
1197 ${cmd}= Set Variable ${var1} ${var2}
1198 Start Remote Command ${cmd} ${src_ip} ${src_user} ${src_pass}
1199 ... ${src_container_type} ${src_container_name}
1200 ${output} ${stderr} ${rc}= Execute Remote Command
Andy Baviereff938d2020-06-29 18:27:49 -07001201 ... sudo tcpdump -l -U -c 30 -i ${target_iface} -e ${tcpdump_filter}
Suraj Gour33651272020-05-04 10:10:16 +05301202 ... ${dst_ip} ${dst_user} ${dst_pass} ${dst_container_type} ${dst_container_name}
Andy Baviereff938d2020-06-29 18:27:49 -07001203 ... timeout=30 seconds
1204 Execute Remote Command sudo pkill mausezahn
Suraj Gour33651272020-05-04 10:10:16 +05301205 ... ${src_ip} ${src_user} ${src_pass} ${src_container_type} ${src_container_name}
1206 # VOL-3262: I'm seeing untagged downstream traffic at RG for pbit 0. According to Girish this is
1207 # incorrect behavior. Simplify the following check when VOL-3262 is resolved.
1208 Run Keyword If ${pbit}==0 and "${tcpdump_filter}"=="udp"
1209 ... Should Match Regexp ${output} \\.${target_port}: UDP,
1210 ... ELSE Should Match Regexp ${output} , p ${pbit},.*\\.${target_port}: UDP,
1211 END