blob: c0a146dbb81b195ae8617bb28aaa69cfc449899a [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
Matteo Scandolo74bd5c32020-12-08 09:52:19 -080027Resource ./libraries/voltctl.robot
Kailash92764922019-07-25 08:21:39 -070028
29*** Keywords ***
Kailash528f7c02019-07-31 10:55:49 -070030Check CLI Tools Configured
31 [Documentation] Tests that use 'voltctl' and 'kubectl' should execute this keyword in suite setup
32 # check voltctl and kubectl configured
Zack Williamsa8fe75a2020-01-10 14:25:27 -070033 ${voltctl_rc}= Run And Return RC voltctl device list
34 ${kubectl_rc}= Run And Return RC kubectl get pods
Gilles Depatie675a2062019-10-22 12:44:42 -040035 Run Keyword If ${voltctl_rc} != 0 or ${kubectl_rc} != 0 FATAL ERROR
36 ... VOLTCTL and KUBECTL not configured. Please configure before executing tests.
Gilles Depatieb5682f82019-10-31 10:39:45 -040037
38Send File To Onos
Zack Williamsa8fe75a2020-01-10 14:25:27 -070039 [Documentation] Send the content of the file to Onos to selected section of configuration
40 ... using Post Request
41 [Arguments] ${CONFIG_FILE} ${section}
42 ${Headers}= Create Dictionary Content-Type application/json
43 ${File_Data}= OperatingSystem.Get File ${CONFIG_FILE}
44 Log ${Headers}
45 Log ${File_Data}
46 ${resp}= Post Request ONOS
47 ... /onos/v1/network/configuration/${section} headers=${Headers} data=${File_Data}
48 Should Be Equal As Strings ${resp.status_code} 200
Andy Bavier88cd9f62019-11-26 16:22:33 -070049
50Common Test Suite Setup
51 [Documentation] Setup the test suite
Andy Bavier88cd9f62019-11-26 16:22:33 -070052 Set Global Variable ${KUBECTL_CONFIG} export KUBECONFIG=%{KUBECONFIG}
Matteo Scandolo5899be12020-11-11 15:38:07 -080053 Set Global Variable ${VOLTCTL_CONFIG} %{VOLTCONFIG}
Andy Bavier88cd9f62019-11-26 16:22:33 -070054 ${k8s_node_ip}= Evaluate ${nodes}[0].get("ip")
ubuntu6b6e7d42020-03-02 12:35:42 -080055 ${ONOS_REST_IP}= Get Environment Variable ONOS_REST_IP ${k8s_node_ip}
56 ${ONOS_SSH_IP}= Get Environment Variable ONOS_SSH_IP ${k8s_node_ip}
57 Set Global Variable ${ONOS_REST_IP}
58 Set Global Variable ${ONOS_SSH_IP}
Andy Bavier88cd9f62019-11-26 16:22:33 -070059 ${k8s_node_user}= Evaluate ${nodes}[0].get("user")
60 ${k8s_node_pass}= Evaluate ${nodes}[0].get("pass")
61 Check CLI Tools Configured
62 ${onos_auth}= Create List karaf karaf
63 ${HEADERS} Create Dictionary Content-Type=application/json
ubuntu6b6e7d42020-03-02 12:35:42 -080064 Create Session ONOS http://${ONOS_REST_IP}:${ONOS_REST_PORT} auth=${ONOS_AUTH}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -080065 #${olt_ip}= Evaluate ${olts}[0].get("ip")
66 #${olt_ssh_ip}= Evaluate ${olts}[0].get("sship")
67 #${olt_user}= Evaluate ${olts}[0].get("user")
68 #${olt_pass}= Evaluate ${olts}[0].get("pass")
69 #${olt_serial_number}= Evaluate ${olts}[0].get("serial")
70 ${num_olts} Get Length ${olts}
71 ${list_olts} Create List
72 FOR ${I} IN RANGE 0 ${num_olts}
73 ${ip} Evaluate ${olts}[${I}].get("ip")
74 ${user} Evaluate ${olts}[${I}].get("user")
75 ${pass} Evaluate ${olts}[${I}].get("pass")
76 ${serial_number} Evaluate ${olts}[${I}].get("serial")
77 ${olt_ssh_ip} Evaluate ${olts}[${I}].get("sship")
78 ${onu_count}= Get ONU Count For OLT ${hosts.src} ${serial_number}
Suchitra Vemurife309412020-12-01 19:19:52 -080079 ${onu_list}= Get ONU List For OLT ${hosts.src} ${serial_number}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -080080 ${olt} Create Dictionary ip ${ip} user ${user} pass
81 ... ${pass} sn ${serial_number} onucount ${onu_count}
Suchitra Vemurife309412020-12-01 19:19:52 -080082 ... sship ${olt_ssh_ip} onus ${onu_list}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -080083 Append To List ${list_olts} ${olt}
84 END
85 ${num_all_onus}= Get Length ${hosts.src}
86 ${num_all_onus}= Convert to String ${num_all_onus}
Andy Bavier88cd9f62019-11-26 16:22:33 -070087 #send sadis file to onos
Andy Baviera2691752019-11-27 12:18:38 -070088 ${sadis_file}= Get Variable Value ${sadis.file}
Zack Williamsa8fe75a2020-01-10 14:25:27 -070089 Log To Console \nSadis File:${sadis_file}
Andy Bavier88cd9f62019-11-26 16:22:33 -070090 Run Keyword Unless '${sadis_file}' is '${None}' Send File To Onos ${sadis_file} apps/
Suchitra Vemuria6879aa2020-11-03 11:03:11 -080091 Set Suite Variable ${num_all_onus}
92 Set Suite Variable ${num_olts}
93 Set Suite Variable ${list_olts}
94 ${olt_count}= Get Length ${list_olts}
95 Set Suite Variable ${olt_count}
96 #Set Suite Variable ${olt_serial_number}
97 #Set Suite Variable ${olt_ip}
98 #Set Suite Variable ${olt_ssh_ip}
99 #Set Suite Variable ${olt_user}
100 #Set Suite Variable ${olt_pass}
Andy Bavier88cd9f62019-11-26 16:22:33 -0700101 @{container_list}= Create List adapter-open-olt adapter-open-onu voltha-api-server
102 ... voltha-ro-core voltha-rw-core-11 voltha-rw-core-12 voltha-ofagent
103 Set Suite Variable ${container_list}
104 ${datetime}= Get Current Date
suraj gour7f6d5fe2019-11-29 10:56:35 +0000105 Set Suite Variable ${datetime}
106
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800107Get ONU Count For OLT
108 [Arguments] ${src} ${serial_number}
109 [Documentation] Gets ONU Count for the specified OLT
110 ${src_length}= Get Length ${src}
111 ${count}= Set Variable 0
112 FOR ${I} IN RANGE 0 ${src_length}
113 ${sn} Evaluate ${src}[${I}].get("olt")
Andrea Campanella155c2aa2020-11-12 18:41:34 +0100114 ${count}= Run Keyword If '${serial_number}' == '${sn}' Evaluate ${count} + 1 ELSE Set Variable ${count}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800115 END
116 [Return] ${count}
117
Suchitra Vemurife309412020-12-01 19:19:52 -0800118Get ONU List For OLT
119 [Arguments] ${src} ${serial_number}
120 [Documentation] Gets ONU List for the specified OLT
121 ${src_length}= Get Length ${src}
122 ${onu_list}= Create List
123 FOR ${I} IN RANGE 0 ${src_length}
124 ${sn} Evaluate ${src}[${I}].get("olt")
125 Run Keyword If '${serial_number}' == '${sn}' Append To List ${onu_list} ${src}[${I}].get("onu")
126 ... ELSE Set Variable ${onu_list}
127 END
128 [Return] ${onu_list}
129
suraj gour7f6d5fe2019-11-29 10:56:35 +0000130WPA Reassociate
suraj gour7f6d5fe2019-11-29 10:56:35 +0000131 [Documentation] Executes a particular wpa_cli reassociate, which performs force reassociation
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700132 [Arguments] ${iface} ${ip} ${user} ${pass}=${None}
133 ... ${container_type}=${None} ${container_name}=${None}
suraj gour7f6d5fe2019-11-29 10:56:35 +0000134 #Below for loops are used instead of sleep time, to execute reassociate command and check status
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700135 FOR ${i} IN RANGE 70
136 ${output}= Login And Run Command On Remote System
137 ... wpa_cli -i ${iface} reassociate ${ip} ${user}
138 ... ${pass} ${container_type} ${container_name}
139 ${passed}= Run Keyword And Return Status Should Contain ${output} OK
Andy Bavierb63f6d22020-03-12 15:34:37 -0700140 Exit For Loop If ${passed}
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700141 END
Andy Bavierb63f6d22020-03-12 15:34:37 -0700142 Should Be True ${passed} Status does not contain 'SUCCESS'
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700143 FOR ${i} IN RANGE 70
144 ${output}= Login And Run Command On Remote System
Andy Bavierae4a17e2020-02-25 14:54:36 -0700145 ... wpa_cli -i ${iface} status | grep SUCCESS ${ip} ${user}
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700146 ... ${pass} ${container_type} ${container_name}
147 ${passed}= Run Keyword And Return Status Should Contain ${output} SUCCESS
Andy Bavierb63f6d22020-03-12 15:34:37 -0700148 Exit For Loop If ${passed}
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700149 END
Andy Bavierb63f6d22020-03-12 15:34:37 -0700150 Should Be True ${passed} Status does not contain 'SUCCESS'
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700151
suraj gour7f6d5fe2019-11-29 10:56:35 +0000152Validate Authentication After Reassociate
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700153 [Arguments] ${auth_pass} ${iface} ${ip} ${user} ${pass}=${None}
154 ... ${container_type}=${None} ${container_name}=${None}
155 [Documentation]
156 ... Executes a particular reassociate request on the RG using wpa_cli.
157 ... auth_pass determines if authentication should pass
Andy Bavier84834d42020-02-25 13:49:50 -0700158 ${wpa_log}= Catenate SEPARATOR=. /tmp/wpa ${iface} log
159 ${output}= Login And Run Command On Remote System truncate -s 0 ${wpa_log}; cat ${wpa_log}
160 ... ${ip} ${user} ${pass} ${container_type} ${container_name}
161 Log ${output}
162 Should Not Contain ${output} authentication completed successfully
suraj gour7f6d5fe2019-11-29 10:56:35 +0000163 WPA Reassociate ${iface} ${ip} ${user} ${pass} ${container_type} ${container_name}
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700164 Run Keyword If '${auth_pass}' == 'True' Wait Until Keyword Succeeds ${timeout} 2s
Andy Bavier84834d42020-02-25 13:49:50 -0700165 ... Check Remote File Contents True ${wpa_log} ${iface}.*authentication completed successfully
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700166 ... ${ip} ${user} ${pass} ${container_type} ${container_name}
suraj gour7f6d5fe2019-11-29 10:56:35 +0000167 Run Keyword If '${auth_pass}' == 'False' Sleep 20s
Suchitra Vemuri3cb29f82020-02-25 13:59:58 -0800168 Run Keyword If '${auth_pass}' == 'False' Check Remote File Contents False /tmp/wpa.log
Andy Bavier84834d42020-02-25 13:49:50 -0700169 ... ${iface}.*authentication completed successfully ${ip} ${user} ${pass}
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700170 ... ${container_type} ${container_name}
suraj gourd5cfdbb2019-12-13 12:44:55 +0000171
172Send Dhclient Request To Release Assigned IP
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700173 [Arguments] ${iface} ${ip} ${user} ${path_dhcpleasefile} ${pass}=${None}
174 ... ${container_type}=${None} ${container_name}=${None}
suraj gourd5cfdbb2019-12-13 12:44:55 +0000175 [Documentation] Executes a dhclient with option to release ip against a particular interface on the RG (src)
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700176 ${result}= Login And Run Command On Remote System
177 ... dhclient -nw -r ${iface} && rm ${path_dhcpleasefile}/dhclient.* ${ip} ${user}
suraj gourd5cfdbb2019-12-13 12:44:55 +0000178 ... ${pass} ${container_type} ${container_name}
179 Log ${result}
180 #Should Contain ${result} DHCPRELEASE
181 [Return] ${result}
suraj gour1ecfae92019-12-20 15:11:40 +0000182
183Check Remote File Contents For WPA Logs
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700184 [Arguments] ${file_should_exist} ${file} ${pattern} ${ip} ${user} ${pass}=${None}
185 ... ${container_type}=${None} ${container_name}=${None} ${prompt}=~$
suraj gour1ecfae92019-12-20 15:11:40 +0000186 [Documentation] Checks for particular pattern count in a file
Zack Williamsa8fe75a2020-01-10 14:25:27 -0700187 ${result}= Login And Run Command On Remote System
188 ... cat ${file} | grep '${pattern}' | wc -l ${ip} ${user} ${pass}
suraj gour1ecfae92019-12-20 15:11:40 +0000189 ... ${container_type} ${container_name} ${prompt}
190 [Return] ${result}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000191
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800192
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000193Perform Sanity Test
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800194 [Documentation] This keyword iterate all OLTs and performs Sanity Test Procedure
195 ... for all the ONUs connected to each OLT - ATT workflow
196 FOR ${J} IN RANGE 0 ${num_olts}
197 ${olt_serial_number}= Set Variable ${list_olts}[${J}][sn]
198 ${onu_count}= Set Variable ${list_olts}[${J}][onucount]
199 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS
200 ... ${olt_serial_number}
201 Set Global Variable ${of_id}
202 ${nni_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
203 ... Get NNI Port in ONOS ${of_id}
204 Set Global Variable ${nni_port}
205 # Verify Default Meter in ONOS (valid only for ATT)
206 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
207 ... Verify Default Meter Present in ONOS ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
208 Perform Sanity Test Per OLT ${of_id} ${nni_port} ${olt_serial_number} ${onu_count}
209 END
210
211Perform Sanity Test Per OLT
212 [Arguments] ${of_id} ${nni_port} ${olt_serial_number} ${num_onus}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000213 [Documentation] This keyword performs Sanity Test Procedure
214 ... Sanity test performs authentication, dhcp and pings for all the ONUs given for the POD
215 ... This keyword can be used to call in any other tests where sanity check is required
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800216 ... and avoids duplication of code. - ATT workflow
217 #${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${olt_serial_number}
218 #Set Global Variable ${of_id}
219 #${nni_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
220 #... Get NNI Port in ONOS ${of_id}
221 #Set Global Variable ${nni_port}
Hardik Windlass2a9b1592020-07-23 18:28:13 +0530222 # Verify Default Meter in ONOS (valid only for ATT)
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800223 #Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
224 #... Verify Default Meter Present in ONOS ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
225 FOR ${I} IN RANGE 0 ${num_all_onus}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000226 ${src}= Set Variable ${hosts.src[${I}]}
227 ${dst}= Set Variable ${hosts.dst[${I}]}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800228 Continue For Loop If "${olt_serial_number}"!="${src['olt']}"
Suchitra Vemuri03005912020-02-20 18:59:46 -0800229 Run Keyword and Ignore Error Collect Logs
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000230 ${onu_device_id}= Get Device ID From SN ${src['onu']}
231 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
232 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
Suchitra Vemuri8078b972020-02-06 19:07:41 -0800233 # Check ONU port is Enabled in ONOS
234 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
Suchitra Vemuri760bdd32020-06-17 12:34:48 -0700235 ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
Suchitra Vemuri8078b972020-02-06 19:07:41 -0800236 # Verify EAPOL flows are added for the ONU port
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000237 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
ubuntu6b6e7d42020-03-02 12:35:42 -0800238 ... Verify Eapol Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Suchitra Vemuri8078b972020-02-06 19:07:41 -0800239 # Verify ONU state in voltha
240 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
241 ... ENABLED ACTIVE REACHABLE
242 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
243 # Perform Authentication
Andy Bavier84834d42020-02-25 13:49:50 -0700244 ${wpa_log}= Run Keyword If ${has_dataplane} Catenate SEPARATOR=.
245 ... /tmp/wpa ${src['dp_iface_name']} log
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000246 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate Authentication True
247 ... ${src['dp_iface_name']} wpa_supplicant.conf ${src['ip']} ${src['user']} ${src['pass']}
Andy Bavier84834d42020-02-25 13:49:50 -0700248 ... ${src['container_type']} ${src['container_name']} ${wpa_log}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000249 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
ubuntu6b6e7d42020-03-02 12:35:42 -0800250 ... Verify ONU in AAA-Users ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000251 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
ubuntu6b6e7d42020-03-02 12:35:42 -0800252 ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000253 ... volt-add-subscriber-access ${of_id} ${onu_port}
Suchitra Vemuri9da44302020-03-04 14:24:49 -0800254 # Verify that no pending flows exist for the ONU port
255 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
256 ... Verify No Pending Flows For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Hardik Windlass21807632020-04-14 16:24:55 +0530257 # Verify subscriber access flows are added for the ONU port
258 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
259 ... Verify Subscriber Access Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
260 ... ${onu_port} ${nni_port} ${src['c_tag']} ${src['s_tag']}
Hardik Windlass2a9b1592020-07-23 18:28:13 +0530261 # Verify Meters in ONOS
262 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
263 ... Verify Meters in ONOS ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id} ${onu_port}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000264 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate DHCP and Ping True
265 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
266 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
267 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
268 ... ${dst['container_name']}
269 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
ubuntu6b6e7d42020-03-02 12:35:42 -0800270 ... Validate Subscriber DHCP Allocation ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000271 Run Keyword and Ignore Error Get Device Output from Voltha ${onu_device_id}
272 Run Keyword and Ignore Error Collect Logs
273 END
274
Hardik Windlassa3d04b92020-02-17 15:06:05 +0000275Perform Sanity Test DT
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800276 [Documentation] This keyword iterate all OLTs and performs Sanity Test Procedure for DT workflow
277 FOR ${J} IN RANGE 0 ${num_olts}
278 ${olt_serial_number}= Set Variable ${list_olts}[${J}][sn]
279 ${num_onus}= Set Variable ${list_olts}[${J}][onucount]
280 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
Suchitra Vemuri4b8f4f52020-11-17 19:12:50 -0800281 Run Keyword and Ignore Error Collect Logs
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800282 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS
283 ... ${olt_serial_number}
284 Set Global Variable ${of_id}
285 ${nni_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
286 ... Get NNI Port in ONOS ${of_id}
287 Set Global Variable ${nni_port}
288 Perform Sanity Test DT Per OLT ${of_id} ${nni_port} ${olt_serial_number} ${num_onus}
289 # Verify ONOS Flows
290 # Number of Access Flows on ONOS equals 4 * the Number of Active ONUs (2 for each downstream and upstream)
291 ${onos_flows_count}= Evaluate 4 * ${num_onus}
292 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
293 ... Verify Subscriber Access Flows Added Count DT ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
294 ... ${onos_flows_count}
295 # Verify VOLTHA Flows
296 # Number of per OLT Flows equals Twice the Number of Active ONUs (each for downstream and upstream) + 1 for LLDP
297 ${olt_flows}= Evaluate 2 * ${num_onus} + 1
298 # Number of per ONU Flows equals 2 (one each for downstream and upstream)
299 ${onu_flows}= Set Variable 2
300 Run Keyword Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Flows ${olt_flows}
301 ... ${olt_device_id}
302 ${List_ONU_Serial} Create List
303 Set Suite Variable ${List_ONU_Serial}
Suchitra Vemuri21a47fd2020-11-16 18:39:09 -0800304 Build ONU SN List ${List_ONU_Serial} ${olt_serial_number}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800305 Log ${List_ONU_Serial}
306 Run Keyword Wait Until Keyword Succeeds ${timeout} 5s Validate ONU Flows
307 ... ${List_ONU_Serial} ${onu_flows}
308 END
309
310
311Perform Sanity Test DT Per OLT
312 [Arguments] ${of_id} ${nni_port} ${olt_serial_number} ${num_onus}
Hardik Windlassa3d04b92020-02-17 15:06:05 +0000313 [Documentation] This keyword performs Sanity Test Procedure for DT Workflow
314 ... Sanity test performs dhcp and pings (without EAPOL and DHCP flows) for all the ONUs given for the POD
315 ... This keyword can be used to call in any other tests where sanity check is required
316 ... and avoids duplication of code.
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800317 #${of_id}= Wait Until Keyword Succeeds 360s 15s Validate OLT Device in ONOS ${olt_serial_number}
318 #Set Global Variable ${of_id}
319 #${nni_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
320 #... Get NNI Port in ONOS ${of_id}
321 #Set Global Variable ${nni_port}
322 FOR ${I} IN RANGE 0 ${num_all_onus}
Hardik Windlassa3d04b92020-02-17 15:06:05 +0000323 ${src}= Set Variable ${hosts.src[${I}]}
324 ${dst}= Set Variable ${hosts.dst[${I}]}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800325 Continue For Loop If "${olt_serial_number}"!="${src['olt']}"
Suchitra Vemuri4b8f4f52020-11-17 19:12:50 -0800326 Run Keyword and Ignore Error Collect Logs
Hardik Windlassa3d04b92020-02-17 15:06:05 +0000327 ${onu_device_id}= Get Device ID From SN ${src['onu']}
328 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
329 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
330 # Check ONU port is Enabled in ONOS
331 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
Suchitra Vemuri760bdd32020-06-17 12:34:48 -0700332 ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
Hardik Windlassa3d04b92020-02-17 15:06:05 +0000333 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
ubuntu6b6e7d42020-03-02 12:35:42 -0800334 ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
Hardik Windlassa3d04b92020-02-17 15:06:05 +0000335 ... volt-add-subscriber-access ${of_id} ${onu_port}
Hardik Windlassfb5eace2020-03-26 14:49:01 +0530336 # Verify subscriber access flows are added for the ONU port
337 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
Hardik Windlass25e11702020-03-30 20:05:19 +0530338 ... Verify Subscriber Access Flows Added For ONU DT ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
339 ... ${onu_port} ${nni_port} ${src['s_tag']}
Hardik Windlassa3d04b92020-02-17 15:06:05 +0000340 # Verify ONU state in voltha
341 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
342 ... ENABLED ACTIVE REACHABLE
343 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
Hardik Windlass2a9b1592020-07-23 18:28:13 +0530344 # Verify Meters in ONOS
345 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
346 ... Verify Meters in ONOS ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id} ${onu_port}
Hardik Windlassfb5eace2020-03-26 14:49:01 +0530347 # TODO: Yet to Verify on the GPON based Physical POD (VOL-2652)
Hardik Windlassa3d04b92020-02-17 15:06:05 +0000348 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate DHCP and Ping True
349 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
350 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
351 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
352 ... ${dst['container_name']}
353 Run Keyword and Ignore Error Get Device Output from Voltha ${onu_device_id}
354 Run Keyword and Ignore Error Collect Logs
355 END
Hardik Windlassfb5eace2020-03-26 14:49:01 +0530356 # Verify ONOS Flows
357 # 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 -0800358 #${onos_flows_count}= Evaluate 4 * ${num_onus}
359 #Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
360 #... Verify Subscriber Access Flows Added Count DT ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
361 #... ${onos_flows_count}
Hardik Windlassfb5eace2020-03-26 14:49:01 +0530362 # Verify VOLTHA Flows
Hardik Windlassa3d04b92020-02-17 15:06:05 +0000363 # 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 -0800364 #${olt_flows}= Evaluate 2 * ${num_onus} + 1
Hardik Windlassa3d04b92020-02-17 15:06:05 +0000365 # Number of per ONU Flows equals 2 (one each for downstream and upstream)
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800366 #${onu_flows}= Set Variable 2
367 #Run Keyword Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Flows ${olt_flows}
368 #${List_ONU_Serial} Create List
369 #Set Suite Variable ${List_ONU_Serial}
Andrea Campanella6391f842020-11-16 10:01:18 +0100370 #Build ONU SN List ${List_ONU_Serial} ${olt_serial_number}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800371 #Log ${List_ONU_Serial}
372 #Run Keyword Wait Until Keyword Succeeds ${timeout} 5s Validate ONU Flows
373 #... ${List_ONU_Serial} ${onu_flows}
374
375Validate All OLT Flows
376 [Documentation] This keyword iterate all OLTs and performs Sanity Test Procedure for DT workflow
377 FOR ${J} IN RANGE 0 ${num_olts}
378 ${olt_serial_number}= Set Variable ${list_olts}[${J}][sn]
379 ${num_onus}= Set Variable ${list_olts}[${J}][onucount]
380 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
381 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS
382 ... ${olt_serial_number}
383 Set Global Variable ${of_id}
384 # Verify ONOS Flows
385 # Number of Access Flows on ONOS equals 4 * the Number of Active ONUs (2 for each downstream and upstream)
386 ${onos_flows_count}= Evaluate 4 * ${num_onus}
387 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
388 ... Verify Subscriber Access Flows Added Count DT ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
389 ... ${onos_flows_count}
390 # Verify VOLTHA Flows
391 # Number of per OLT Flows equals Twice the Number of Active ONUs (each for downstream and upstream) + 1 for LLDP
392 ${olt_flows}= Evaluate 2 * ${num_onus} + 1
393 # Number of per ONU Flows equals 2 (one each for downstream and upstream)
394 ${onu_flows}= Set Variable 2
395 Run Keyword Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Flows ${olt_flows}
396 ... ${olt_device_id}
397 ${List_ONU_Serial} Create List
398 Set Suite Variable ${List_ONU_Serial}
Andrea Campanella6391f842020-11-16 10:01:18 +0100399 Build ONU SN List ${List_ONU_Serial} ${olt_serial_number}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800400 Log ${List_ONU_Serial}
401 Run Keyword Wait Until Keyword Succeeds ${timeout} 5s Validate ONU Flows
402 ... ${List_ONU_Serial} ${onu_flows}
403 END
Hardik Windlassa3d04b92020-02-17 15:06:05 +0000404
Suchitra Vemuri2f1e07d2020-06-26 19:18:01 -0700405Perform Sanity Test TT
406 [Documentation] This keyword performs Sanity Test Procedure for TT Workflow
407 ... Sanity test performs dhcp and pings (without EAPOL and DHCP flows) for all the ONUs given for the POD
408 ... This keyword can be used to call in any other tests where sanity check is required
409 ... and avoids duplication of code.
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800410 FOR ${I} IN RANGE 0 ${num_all_onus}
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -0700411 ${src}= Set Variable ${hosts.src[${I}]}
412 ${dst}= Set Variable ${hosts.dst[${I}]}
413 ${service_type}= Get Variable Value ${src['service_type']} "null"
414 Run Keyword IF '${service_type}' != 'mcast' Sanity Test TT one ONU ${src} ${dst}
415 Run Keyword and Ignore Error Collect Logs
416 END
417 Run Keyword and Ignore Error Collect Logs
418
419Sanity Test TT one ONU
420 [Documentation] This keyword performs sanity test for a single ONU for TT workflow
421 ... Tests for one ONU
422 ... Assertions apply to HSIA, VoD, VoIP services
423 [Arguments] ${src} ${dst}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800424 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${src['olt']}
Suchitra Vemuri2f1e07d2020-06-26 19:18:01 -0700425 Set Global Variable ${of_id}
426 ${nni_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
427 ... Get NNI Port in ONOS ${of_id}
428 Set Global Variable ${nni_port}
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -0700429 ${onu_device_id}= Get Device ID From SN ${src['onu']}
430 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
431 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
432 # Check ONU port is Enabled in ONOS
433 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
434 ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
435 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
436 ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
437 ... volt-add-subscriber-access ${of_id} ${onu_port}
438 Sleep 30s
439 # Verify ONU state in voltha
Matteo Scandolo74bd5c32020-12-08 09:52:19 -0800440 ${onu_reasons}= Create List tech-profile-config-download-success omci-flows-pushed
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -0700441 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
442 ... ENABLED ACTIVE REACHABLE
Matteo Scandolo74bd5c32020-12-08 09:52:19 -0800443 ... ${src['onu']} onu=True onu_reason=${onu_reasons}
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -0700444 # TODO: Yet to Verify on the GPON based Physical POD (VOL-2652)
445 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate DHCP and Ping True
446 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
447 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
448 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
449 ... ${dst['container_name']}
Suchitra Vemuri16644bd2020-10-03 14:06:12 -0700450 Run Keyword IF ${has_dataplane}
Suchitra Vemurib4d9e8d2020-10-05 20:49:21 -0700451 ... Run Keyword IF '${src['service_type']}'!='hsia'
Suchitra Vemuri42819412020-10-01 17:45:43 -0700452 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
Suchitra Vemuri8d3b0032020-09-11 17:49:08 -0700453 ... Validate Subscriber DHCP Allocation ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Suchitra Vemuri42819412020-10-01 17:45:43 -0700454 ... ${src['c_tag']}
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -0700455 Run Keyword and Ignore Error Get Device Output from Voltha ${onu_device_id}
456 Run Keyword and Ignore Error Collect Logs
457
458Perform Sanity Test TT MCAST
459 [Documentation] This keyword performs Sanity Test Procedure for TT Workflow
460 ... Adds subscribers
461 ... Validates for MCAST
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800462 FOR ${I} IN RANGE 0 ${num_all_onus}
Suchitra Vemuri2f1e07d2020-06-26 19:18:01 -0700463 ${src}= Set Variable ${hosts.src[${I}]}
464 ${dst}= Set Variable ${hosts.dst[${I}]}
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -0700465 ${service_type}= Get Variable Value ${src['service_type']} "null"
466 Run Keyword IF '${service_type}' == 'mcast' Sanity Test TT MCAST one ONU ${src}
467 ... ${dst}
Suchitra Vemuri2f1e07d2020-06-26 19:18:01 -0700468 Run Keyword and Ignore Error Collect Logs
469 END
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -0700470 Run Keyword and Ignore Error Collect Logs
471
472Sanity Test TT MCAST one ONU
473 [Documentation] This keyword performs sanity test for a single ONU for TT workflow
474 ... Tests for one ONU
475 ... Assertions apply to MCAST services
476 [Arguments] ${src} ${dst}
477 # Check for iperf and jq tools
478 ${stdout} ${stderr} ${rc}= Execute Remote Command which iperf jq
479 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']}
480 ... ${src['container_name']}
481 Pass Execution If ${rc} != 0 Skipping test: iperf / jq not found on the RG
482
483 #Reset the IP on the interface
484 ${output}= Login And Run Command On Remote System sudo ifconfig ${src['dp_iface_name']} 0
485 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
486 # Kill iperf on BNG
487 ${rg_output}= Run Keyword and Continue On Failure Login And Run Command On Remote System
488 ... sudo kill -9 `pidof iperf`
489 ... ${dst['bng_ip']} ${dst['bng_user']} ${dst['bng_pass']} ${dst['container_type']}
490 ... ${dst['container_name']}
491
492 # Setup RG for Multi-cast test
493 ${output}= Login And Run Command On Remote System
494 ... sudo ifconfig ${src['dp_iface_name']} ${src['mcast_rg']} up ; sudo kill -9 `pidof iperf`
495 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
496 ${output}= Login And Run Command On Remote System
497 ... sudo ip route add ${src['mcast_grp_subnet_mask']} dev ${src['dp_iface_name']} scope link
498 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
499
500 # Perform operations for adding subscriber
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800501 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${src['olt']}
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -0700502 Set Global Variable ${of_id}
503 ${nni_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
504 ... Get NNI Port in ONOS ${of_id}
505 Set Global Variable ${nni_port}
506 ${onu_device_id}= Get Device ID From SN ${src['onu']}
507 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
508 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
509 # Check ONU port is Enabled in ONOS
510 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
511 ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
512 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
513 ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
514 ... volt-add-subscriber-access ${of_id} ${onu_port}
515 Sleep 30s
516 # Verify ONU state in voltha
Matteo Scandolo74bd5c32020-12-08 09:52:19 -0800517 ${onu_reasons}= Create List tech-profile-config-download-success omci-flows-pushed
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -0700518 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
519 ... ENABLED ACTIVE REACHABLE
Matteo Scandolo74bd5c32020-12-08 09:52:19 -0800520 ... ${src['onu']} onu=True onu_reason=${onu_reasons}
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -0700521
522 # Setup iperf on the BNG
523 ${server_output}= Login And Run Command On Remote System
524 ... sudo iperf -c ${dst['dp_iface_ip_qinq']} -u -T 32 -t 60 -i 1 &
525 ... ${dst['bng_ip']} ${dst['bng_user']} ${dst['bng_pass']} ${dst['container_type']}
526 ... ${dst['container_name']}
527
528 # Setup iperf on the RG
529 ${rg_output}= Run Keyword and Continue On Failure Wait Until Keyword Succeeds 90s 5s
530 ... Login And Run Command On Remote System
531 ... rm -rf /tmp/rg_output ; sudo iperf -s -u -B ${dst['dp_iface_ip_qinq']} -i 1 -D >> /tmp/rg_output
532 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
533 Log ${rg_output}
534 Sleep 60s
535 ${output}= Run Keyword and Continue On Failure Wait Until Keyword Succeeds 90s 5s
536 ... Login And Run Command On Remote System
537 ... cat /tmp/rg_output | grep KBytes
538 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
539 Log ${output}
540 Should Contain ${output} KBytes
541
542 # Kill iperf on BNG
543 ${rg_output}= Run Keyword and Continue On Failure Login And Run Command On Remote System
544 ... sudo kill -9 `pidof iperf`
545 ... ${dst['bng_ip']} ${dst['bng_user']} ${dst['bng_pass']} ${dst['container_type']}
546 ... ${dst['container_name']}
547
548 # Kill iperf on the RG
549 ${output}= Run Keyword and Continue On Failure Login And Run Command On Remote System
550 ... sudo kill -9 `pidof iperf`
551 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
552
Suchitra Vemuri2f1e07d2020-06-26 19:18:01 -0700553
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000554Setup
555 [Documentation] Pre-test Setup
556 #test for empty device list
557 Test Empty Device List
Suchitra Vemuri3158f3c2020-05-28 17:58:26 -0700558 #Run Keyword If ${has_dataplane} Wait Until Keyword Succeeds 120s 10s Openolt is Up
559 #... ${olt_ip} ${olt_user} ${olt_pass}
Suchitra Vemuri1d8e8172020-06-17 17:43:56 -0700560 Run Keyword If ${has_dataplane} Sleep 230s
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800561 # Create a list of olt ids (logical and device_id)
562 ${olt_ids} Create List
563 FOR ${I} IN RANGE 0 ${num_olts}
564 #create/preprovision device
565 ${olt_device_id}= Create Device ${list_olts}[${I}][ip] ${OLT_PORT}
566 ${olt_serial_number}= Set Variable ${list_olts}[${I}][sn]
567 #Set Suite Variable ${olt_device_id}
568 #validate olt states
569 Wait Until Keyword Succeeds ${timeout} 5s
570 ... Validate OLT Device PREPROVISIONED UNKNOWN UNKNOWN ${olt_device_id}
571 Sleep 5s
572 Enable Device ${olt_device_id}
573 Wait Until Keyword Succeeds 380s 5s
574 ... Validate OLT Device ENABLED ACTIVE REACHABLE ${olt_serial_number}
575 ${logical_id}= Get Logical Device ID From SN ${olt_serial_number}
576 # Set Suite Variable ${logical_id}
577 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS
578 ... ${olt_serial_number}
579 ${olt} Create Dictionary device_id ${olt_device_id} logical_id ${logical_id}
580 ... of_id ${of_id} sn ${olt_serial_number}
581 Append To List ${olt_ids} ${olt}
582 END
583 Set Global Variable ${olt_ids}
584
585Get ofID From OLT List
586 [Documentation] Retrieves the corresponding of_id for the OLT serial number specified
587 [Arguments] ${serial_number}
588 FOR ${I} IN RANGE 0 ${olt_count}
589 ${sn}= Get From Dictionary ${olt_ids}[${I}] sn
Andrea Campanella317a94c2020-11-13 10:38:19 +0100590 ${of_id}= Run Keyword IF "${serial_number}"=="${sn}"
591 ... Get From Dictionary ${olt_ids}[${I}] of_id ELSE Set Variable ${of_id}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800592 END
593 [Return] ${of_id}
594
595Get OLTDeviceID From OLT List
596 [Documentation] Retrieves the corresponding olt_device_id for the OLT serial number specified
597 [Arguments] ${serial_number}
Suchitra Vemuri4b8f4f52020-11-17 19:12:50 -0800598 ${olt_device_id}= Set Variable 0
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800599 FOR ${I} IN RANGE 0 ${olt_count}
600 ${sn}= Get From Dictionary ${olt_ids}[${I}] sn
Andrea Campanella317a94c2020-11-13 10:38:19 +0100601 ${olt_device_id}= Run Keyword IF "${serial_number}"=="${sn}"
602 ... Get From Dictionary ${olt_ids}[${I}] device_id ELSE Set Variable ${olt_device_id}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800603 END
604 [Return] ${olt_device_id}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000605
Andrea Campanellad848de02020-11-24 10:23:41 +0100606Get Num of Onus From OLT SN
607 [Documentation] Retrieves the corresponding number of ONUs for a given OLT based on serial number specified
608 [Arguments] ${serial_number}
609 ${num_of_olt_onus}= Set Variable 0
610 FOR ${I} IN RANGE 0 ${olt_count}
611 ${sn}= Get From Dictionary ${olt_ids}[${I}] sn
612 ${num_of_olt_onus}= Run Keyword IF "${serial_number}"=="${sn}"
613 ... Get From Dictionary ${list_olts}[${I}] onucount ELSE Set Variable ${num_of_olt_onus}
614 END
615 [Return] ${num_of_olt_onus}
616
Hardik Windlassaaea3402020-03-10 19:45:45 +0530617Validate ONUs After OLT Disable
618 [Documentation] Validates the ONUs state in Voltha, ONUs port state in ONOS
619 ... and that pings do not succeed After corresponding OLT is Disabled
Andrea Campanella4e507882020-11-26 11:33:11 +0100620 [Arguments] ${num_onus} ${olt_serial_number}
Hardik Windlassaaea3402020-03-10 19:45:45 +0530621 FOR ${I} IN RANGE 0 ${num_onus}
622 ${src}= Set Variable ${hosts.src[${I}]}
623 ${dst}= Set Variable ${hosts.dst[${I}]}
Andrea Campanella4e507882020-11-26 11:33:11 +0100624 Continue For Loop If "${olt_serial_number}"!="${src['olt']}"
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800625 ${of_id}= Get ofID From OLT List ${src['olt']}
Hardik Windlassaaea3402020-03-10 19:45:45 +0530626 ${onu_device_id}= Get Device ID From SN ${src['onu']}
627 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
628 ... ${of_id}
629 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
630 ... Validate Device ENABLED DISCOVERED
631 ... UNREACHABLE ${src['onu']} onu=True onu_reason=stopping-openomci
632 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
Suchitra Vemuri760bdd32020-06-17 12:34:48 -0700633 ... Verify ONU Port Is Disabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
Hardik Windlassaaea3402020-03-10 19:45:45 +0530634 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
635 ... Wait Until Keyword Succeeds 60s 2s
636 ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
637 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
638 Run Keyword and Ignore Error Get Device Output from Voltha ${onu_device_id}
639 Run Keyword and Ignore Error Collect Logs
640 END
641
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000642Delete All Devices and Verify
643 [Documentation] Remove any devices from VOLTHA and ONOS
644 # Clear devices from VOLTHA
645 Disable Devices In Voltha Root=true
Suchitra Vemuri970747f2020-03-30 17:31:34 -0700646 Sleep 5s
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000647 Wait Until Keyword Succeeds ${timeout} 2s Test Devices Disabled In Voltha Root=true
648 Delete Devices In Voltha Root=true
Matteo Scandolof6cea382020-04-20 14:32:00 -0700649 Run Keyword If ${has_dataplane} Sleep 30s
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000650 Wait Until Keyword Succeeds ${timeout} 2s Test Empty Device List
651 # Clear devices from ONOS
Suchitra Vemurif7a033c2020-02-26 17:22:41 -0800652 #Remove All Devices From ONOS
ubuntu6b6e7d42020-03-02 12:35:42 -0800653 #... http://karaf:karaf@${ONOS_REST_IP}:${ONOS_REST_PORT}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000654
655Teardown
656 [Documentation] kills processes and cleans up interfaces on src+dst servers
657 Run Keyword If ${has_dataplane} Clean Up Linux
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000658
659Teardown Suite
660 [Documentation] Clean up device if desired
661 Run Keyword If ${teardown_device} Delete All Devices and Verify
662
663Delete Device and Verify
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800664 [Arguments] ${olt_serial_number}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000665 [Documentation] Disable -> Delete devices via voltctl and verify its removed
Suchitra Vemuri2fa9bba2020-01-22 17:38:48 -0800666 ${olt_device_id}= Get Device ID From SN ${olt_serial_number}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000667 ${rc} ${output}= Run and Return Rc and Output
Matteo Scandolo5899be12020-11-11 15:38:07 -0800668 ... voltctl -c ${VOLTCTL_CONFIG} device disable ${olt_device_id}
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000669 Should Be Equal As Integers ${rc} 0
670 Sleep 5s
671 Wait Until Keyword Succeeds ${timeout} 5s
672 ... Validate OLT Device DISABLED UNKNOWN REACHABLE ${olt_serial_number}
673 ${rc} ${output}= Run and Return Rc and Output
Matteo Scandolo5899be12020-11-11 15:38:07 -0800674 ... voltctl -c ${VOLTCTL_CONFIG} device delete ${olt_device_id}
Matteo Scandolof6cea382020-04-20 14:32:00 -0700675 Run Keyword If ${has_dataplane} Sleep 50s
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +0000676 Should Be Equal As Integers ${rc} 0
677 Wait Until Keyword Succeeds ${timeout} 5s Validate Device Removed ${olt_device_id}
678
Gayathri.Selvan283a63c2020-01-23 04:09:18 +0000679Repeat Sanity Test
680 [Documentation] This keyword performs Sanity Test Procedure
681 ... Sanity test performs authentication, dhcp and pings for all the ONUs given for the POD
682 ... This keyword can be used to call in any other tests where sanity check is required
683 ... with wpa reassociation
684 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${olt_serial_number}
685 Set Global Variable ${of_id}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800686 FOR ${I} IN RANGE 0 ${num_all_onus}
Suchitra Vemuri03005912020-02-20 18:59:46 -0800687 Run Keyword and Ignore Error Collect Logs
Gayathri.Selvan283a63c2020-01-23 04:09:18 +0000688 ${src}= Set Variable ${hosts.src[${I}]}
689 ${dst}= Set Variable ${hosts.dst[${I}]}
Suchitra Vemuri8078b972020-02-06 19:07:41 -0800690 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
691 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
692 # Check ONU port is Enabled in ONOD
693 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
Suchitra Vemuri760bdd32020-06-17 12:34:48 -0700694 ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
Suchitra Vemuri8078b972020-02-06 19:07:41 -0800695 # Verify EAPOL flows are added for the ONU port
696 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
David K. Bainbridgec0617c92020-03-05 21:17:19 -0800697 ... Verify Eapol Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Suchitra Vemuri8078b972020-02-06 19:07:41 -0800698 # Verify ONU state in voltha
Suchitra Vemurid1e27fb2020-02-01 16:34:37 -0800699 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
Suchitra Vemuri81e4f022020-02-01 13:16:02 -0800700 ... ENABLED ACTIVE REACHABLE
701 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
Suchitra Vemuri8078b972020-02-06 19:07:41 -0800702 # Perform Authentication
Gayathri.Selvan283a63c2020-01-23 04:09:18 +0000703 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
704 ... Validate Authentication After Reassociate
705 ... True ${src['dp_iface_name']} ${src['ip']} ${src['user']} ${src['pass']}
706 ... ${src['container_type']} ${src['container_name']}
707 Wait Until Keyword Succeeds ${timeout} 2s
David K. Bainbridgec0617c92020-03-05 21:17:19 -0800708 ... Verify ONU in AAA-Users ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Gayathri.Selvan283a63c2020-01-23 04:09:18 +0000709 Wait Until Keyword Succeeds ${timeout} 2s
David K. Bainbridgec0617c92020-03-05 21:17:19 -0800710 ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
Gayathri.Selvan283a63c2020-01-23 04:09:18 +0000711 ... volt-add-subscriber-access ${of_id} ${onu_port}
712 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
713 ... Validate DHCP and Ping True True
714 ... ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
715 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
716 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
717 ... ${dst['container_name']}
718 Wait Until Keyword Succeeds ${timeout} 2s Run Keyword And Continue On Failure
David K. Bainbridgec0617c92020-03-05 21:17:19 -0800719 ... Validate Subscriber DHCP Allocation ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
Gayathri.Selvan283a63c2020-01-23 04:09:18 +0000720 Run Keyword and Ignore Error Get Device Output from Voltha ${onu_device_id}
721 Run Keyword and Ignore Error Collect Logs
722 END
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000723
Hardik Windlass16cdf962020-04-29 15:26:50 +0530724Validate ONUs for PON OLT Disable
725 [Arguments] ${olt_peer_list}
726 [Documentation] This keyword validates that Ping fails for ONUs connected to Disabled OLT PON port
727 ... And Pings succeed for other Active OLT PON port ONUs
728 ... Also it removes subscriber for Disabled OLT PON port ONUs to replicate ATT workflow
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800729 FOR ${I} IN RANGE 0 ${num_all_nus}
Hardik Windlass16cdf962020-04-29 15:26:50 +0530730 ${src}= Set Variable ${hosts.src[${I}]}
731 ${dst}= Set Variable ${hosts.dst[${I}]}
732 ${onu_device_id}= Get Device ID From SN ${src['onu']}
733 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
734 ... ${of_id}
735 ${matched}= Match ONU in PON OLT Peer List ${olt_peer_list} ${onu_device_id}
736 Run Keyword If ${matched}
737 ... Run Keywords
738 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
739 ... Validate Device ENABLED DISCOVERED
740 ... UNREACHABLE ${src['onu']} onu=True onu_reason=stopping-openomci
741 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
742 ... Verify ONU Port Is Disabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
743 ... AND Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
744 ... Wait Until Keyword Succeeds 60s 2s
745 ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
746 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']}
747 ... ${src['container_name']}
748 # Remove Subscriber Access (To replicate ATT workflow)
749 ... AND Wait Until Keyword Succeeds ${timeout} 2s Execute ONOS CLI Command ${ONOS_SSH_IP}
750 ... ${ONOS_SSH_PORT} volt-remove-subscriber-access ${of_id} ${onu_port}
751 ... ELSE
752 ... Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
753 ... Wait Until Keyword Succeeds 60s 2s
754 ... Check Ping True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
755 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']}
756 ... ${src['container_name']}
757 Run Keyword and Ignore Error Collect Logs
758 END
759
760Validate ONUs for PON OLT Enable
761 [Arguments] ${olt_peer_list}
762 [Documentation] This keyword validates Ping succeeds for all Enabled/Acitve OLT PON ports
763 ... Also performs Auth/subscriberAdd/DHCP/Ping for the ONUs on Re-Enabled OLT PON port
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800764 FOR ${I} IN RANGE 0 ${num_all_onus}
Hardik Windlass16cdf962020-04-29 15:26:50 +0530765 ${src}= Set Variable ${hosts.src[${I}]}
766 ${dst}= Set Variable ${hosts.dst[${I}]}
767 ${onu_device_id}= Get Device ID From SN ${src['onu']}
768 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
769 ... ${of_id}
770 ${matched}= Match ONU in PON OLT Peer List ${olt_peer_list} ${onu_device_id}
771 ${wpa_log}= Run Keyword If ${has_dataplane} and ${matched} Catenate SEPARATOR=.
772 ... /tmp/wpa ${src['dp_iface_name']} log
773 Run Keyword If ${matched}
774 ... Run Keywords
775 # Perform Cleanup
776 ... Run Keyword If ${has_dataplane} Clean Up Linux ${onu_device_id}
777 # Verify ONU port status
778 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
779 ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
780 # Verify EAPOL flows are added for the ONU port
781 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
782 ... Verify Eapol Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
783 # Verify ONU state in voltha
784 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
785 ... Validate Device ENABLED ACTIVE REACHABLE
786 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
787 # Perform Authentication
788 ... AND Run Keyword If ${has_dataplane}
789 ... Run Keyword And Continue On Failure Validate Authentication True
790 ... ${src['dp_iface_name']} wpa_supplicant.conf ${src['ip']} ${src['user']} ${src['pass']}
791 ... ${src['container_type']} ${src['container_name']} ${wpa_log}
792 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
793 ... Verify ONU in AAA-Users ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
794 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
795 ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
796 ... volt-add-subscriber-access ${of_id} ${onu_port}
797 # Verify that no pending flows exist for the ONU port
798 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
799 ... Verify No Pending Flows For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
800 # Verify subscriber access flows are added for the ONU port
801 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
802 ... Verify Subscriber Access Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
803 ... ${onu_port} ${nni_port} ${src['c_tag']} ${src['s_tag']}
804 ... AND Run Keyword If ${has_dataplane}
805 ... Run Keyword And Continue On Failure Validate DHCP and Ping True
806 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
807 ... ${src['ip']} ${src['user']} ${src['pass']}
808 ... ${src['container_type']} ${src['container_name']}
809 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']}
810 ... ${dst['container_type']} ${dst['container_name']}
811 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
812 ... Validate Subscriber DHCP Allocation ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
813 ... AND Run Keyword and Ignore Error Get Device Output from Voltha ${onu_device_id}
814 ... ELSE
815 ... Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
816 ... Wait Until Keyword Succeeds 60s 2s
817 ... Check Ping True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
818 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']}
819 ... ${src['container_name']}
820 Run Keyword and Ignore Error Collect Logs
821 END
822
823Validate ONUs for PON OLT Disable DT
824 [Arguments] ${olt_peer_list}
825 [Documentation] This keyword validates that Ping fails for ONUs connected to Disabled OLT PON port
826 ... And Pings succeed for other Active OLT PON port ONUs
827 ... Also it removes subscriber and deletes ONUs for Disabled OLT PON port to replicate DT workflow
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800828 FOR ${I} IN RANGE 0 ${num_all_onus}
Hardik Windlass16cdf962020-04-29 15:26:50 +0530829 ${src}= Set Variable ${hosts.src[${I}]}
830 ${dst}= Set Variable ${hosts.dst[${I}]}
831 ${onu_device_id}= Get Device ID From SN ${src['onu']}
832 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
833 ... ${of_id}
834 ${matched}= Match ONU in PON OLT Peer List ${olt_peer_list} ${onu_device_id}
835 Run Keyword If ${matched}
836 ... Run Keywords
837 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
838 ... Validate Device ENABLED DISCOVERED
839 ... UNREACHABLE ${src['onu']} onu=True onu_reason=stopping-openomci
840 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
841 ... Verify ONU Port Is Disabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
842 ... AND Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
843 ... Wait Until Keyword Succeeds 60s 2s
844 ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
845 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']}
846 ... ${src['container_name']}
847 # Remove Subscriber Access (To replicate DT workflow)
848 ... AND Wait Until Keyword Succeeds ${timeout} 2s Execute ONOS CLI Command ${ONOS_SSH_IP}
849 ... ${ONOS_SSH_PORT} volt-remove-subscriber-access ${of_id} ${onu_port}
850 ... AND Sleep 10s
851 # Delete ONU Device (To replicate DT workflow)
852 ... AND Delete Device ${onu_device_id}
853 ... AND Sleep 5s
854 ... ELSE
855 ... Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
856 ... Wait Until Keyword Succeeds 60s 2s
857 ... Check Ping True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
858 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']}
859 ... ${src['container_name']}
860 Run Keyword and Ignore Error Collect Logs
861 END
862
863Validate ONUs for PON OLT Enable DT
864 [Arguments] ${olt_peer_list}
865 [Documentation] This keyword validates Ping succeeds for all Enabled/Acitve OLT PON ports
866 ... Also performs subscriberAdd/DHCP/Ping for the ONUs on Re-Enabled OLT PON port
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800867 FOR ${I} IN RANGE 0 ${num_all_onus}
Hardik Windlass16cdf962020-04-29 15:26:50 +0530868 ${src}= Set Variable ${hosts.src[${I}]}
869 ${dst}= Set Variable ${hosts.dst[${I}]}
870 ${onu_device_id}= Get Device ID From SN ${src['onu']}
871 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
872 ... ${of_id}
873 ${matched}= Match ONU in PON OLT Peer List ${olt_peer_list} ${onu_device_id}
874 Run Keyword If ${matched}
875 ... Run Keywords
876 # Perform Cleanup
877 ... Run Keyword If ${has_dataplane} Clean Up Linux ${onu_device_id}
878 # Verify ONU port status
879 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
880 ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
881 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
882 ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
883 ... volt-add-subscriber-access ${of_id} ${onu_port}
884 # Verify ONU state in voltha
885 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
886 ... Validate Device ENABLED ACTIVE REACHABLE
887 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
888 # Verify subscriber access flows are added for the ONU port
889 ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
890 ... Verify Subscriber Access Flows Added For ONU DT ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
891 ... ${onu_port} ${nni_port} ${src['s_tag']}
892 ... AND Run Keyword If ${has_dataplane}
893 ... Run Keyword And Continue On Failure Validate DHCP and Ping True
894 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
895 ... ${src['ip']} ${src['user']} ${src['pass']}
896 ... ${src['container_type']} ${src['container_name']}
897 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']}
898 ... ${dst['container_type']} ${dst['container_name']}
899 ... ELSE
900 ... Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
901 ... Wait Until Keyword Succeeds 60s 2s
902 ... Check Ping True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
903 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']}
904 ... ${src['container_name']}
905 Run Keyword and Ignore Error Collect Logs
906 END
907
908Match ONU in PON OLT Peer List
909 [Arguments] ${olt_peer_list} ${onu_device_id}
910 [Documentation] This keyword matches if ONU device is present in OLT PON port peer list
911 ${matched}= Set Variable False
912 FOR ${olt_peer} IN @{olt_peer_list}
913 ${matched}= Set Variable If '${onu_device_id}' == '${olt_peer}' True False
914 Exit For Loop If ${matched}
915 END
916 [Return] ${matched}
917
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000918Collect Logs
919 [Documentation] Collect Logs from voltha and onos cli for various commands
920 Run Keyword and Ignore Error Get Device List from Voltha
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800921 FOR ${I} IN RANGE 0 ${num_olts}
922 Run Keyword and Ignore Error Get Logical Device Output from Voltha ${logical_id}
923 Run Keyword and Ignore Error Get Device Output from Voltha ${olt_ids}[${I}][device_id]
924 Run Keyword and Ignore Error Get Logical Device Output from Voltha ${olt_ids}[${I}][logical_id]
925 END
926 #Run Keyword and Ignore Error Get Device Output from Voltha ${olt_device_id}
927 #Run Keyword and Ignore Error Get Logical Device Output from Voltha ${logical_id}
ubuntu6b6e7d42020-03-02 12:35:42 -0800928 Get ONOS Status ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
Gayathri.Selvanf68ea4b2020-02-03 07:36:39 +0000929
930Verify ping is succesful except for given device
931 [Arguments] ${num_onus} ${exceptional_onu_id}
932 [Documentation] Checks that ping for all the devices are successful except the given ONU.
933 ${pingStatus} Set Variable True
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800934 FOR ${I} IN RANGE 0 ${num_all_onus}
Gayathri.Selvanf68ea4b2020-02-03 07:36:39 +0000935 ${src}= Set Variable ${hosts.src[${I}]}
936 ${dst}= Set Variable ${hosts.dst[${I}]}
937 ${onu_device_id}= Get Device ID From SN ${src['onu']}
938 ${pingStatus} Run Keyword If '${onu_device_id}' == '${exceptional_onu_id}' Set Variable False
939 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 60s 2s
940 ... Check Ping ${pingStatus} ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
941 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
942 END
Andy Bavier4a8450e2020-02-04 08:58:37 -0700943
Suchitra Vemurife309412020-12-01 19:19:52 -0800944Verify ping is successful for ONUs not on this OLT
945 [Arguments] ${num_all_onus} ${exceptional_olt_id}
946 [Documentation] Checks that pings work for all the ONUs except for the ONUs on the given OLT.
947 #${pingStatus} Set Variable True
948 FOR ${I} IN RANGE 0 ${num_all_onus}
949 ${src}= Set Variable ${hosts.src[${I}]}
950 ${dst}= Set Variable ${hosts.dst[${I}]}
951 ${olt_device_id}= Get Device ID From SN ${src['olt']}
952 Continue For Loop If "${olt_device_id}"=="${exceptional_olt_id}"
953 #${pingStatus} Run Keyword If '${olt_device_id}' == '${exceptional_olt_id}' Set Variable False
954 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 60s 2s
955 ... Check Ping True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
956 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
957 END
958
Andy Bavier1923ecc2020-06-18 14:06:40 -0700959Echo Message to OLT Logs
960 [Arguments] ${message}
961 [Documentation] Echoes ${message} into the OLT logs
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800962 FOR ${I} IN RANGE 0 ${num_olts}
963 ${olt_user} Evaluate ${olts}[${I}].get("user")
964 ${olt_pass} Evaluate ${olts}[${I}].get("pass")
965 ${olt_ssh_ip} Evaluate ${olts}[${I}].get("sship")
966 Wait Until Keyword Succeeds 180s 10s Execute Remote Command
967 ... printf '%s\n' '' '' '${message}' '' >> /var/log/openolt.log
968 ... ${olt_ssh_ip} ${olt_user} ${olt_pass}
969 Wait Until Keyword Succeeds 180s 10s Execute Remote Command
970 ... printf '%s\n' '' '' '${message}' '' >> /var/log/dev_mgmt_daemon.log
971 ... ${olt_ssh_ip} ${olt_user} ${olt_pass}
972 Wait Until Keyword Succeeds 180s 10s Execute Remote Command
973 ... printf '%s\n' '' '' '${message}' '' >> /var/log/openolt_process_watchdog.log
974 ... ${olt_ssh_ip} ${olt_user} ${olt_pass}
975 END
Andy Bavier1923ecc2020-06-18 14:06:40 -0700976
Andy Bavierabeba262020-02-07 16:22:16 -0700977Start Logging
978 [Arguments] ${label}
979 [Documentation] Start logging for test ${label}
980 ${kail_process}= Run Keyword If "${container_log_dir}" != "${None}" Start Process kail -n default
981 ... -n voltha cwd=${container_log_dir} stdout=${label}-combined.log
982 Set Test Variable ${kail_process}
Andy Bavier1923ecc2020-06-18 14:06:40 -0700983 Run Keyword If ${has_dataplane} Echo Message to OLT Logs START ${label}
Andy Bavierabeba262020-02-07 16:22:16 -0700984
985Stop Logging
986 [Arguments] ${label}
987 [Documentation] End logging for test; remove logfile if test passed
988 Run sync
989 Run Keyword If ${kail_process} Terminate Process ${kail_process}
990 ${test_logfile}= Run Keyword If "${container_log_dir}" != "${None}"
991 ... Join Path ${container_log_dir} ${label}-combined.log
992 Run Keyword If Test Passed Run Keyword If "${test_logfile}" != "${None}" Remove File ${test_logfile}
Andy Bavier1923ecc2020-06-18 14:06:40 -0700993 Run Keyword If ${has_dataplane} Echo Message to OLT Logs END ${label}
Andy Bavierabeba262020-02-07 16:22:16 -0700994
Suchitra Vemuria5fa3dd2020-02-04 14:38:49 -0800995Clean Up Linux
996 [Documentation] Kill processes and clean up interfaces on src+dst servers
Hardik Windlass16cdf962020-04-29 15:26:50 +0530997 [Arguments] ${onu_id}=${EMPTY}
Suchitra Vemuria6879aa2020-11-03 11:03:11 -0800998 FOR ${I} IN RANGE 0 ${num_all_onus}
Suchitra Vemuria5fa3dd2020-02-04 14:38:49 -0800999 ${src}= Set Variable ${hosts.src[${I}]}
1000 ${dst}= Set Variable ${hosts.dst[${I}]}
Hardik Windlass16cdf962020-04-29 15:26:50 +05301001 ${onu_device_id}= Get Device ID From SN ${src['onu']}
1002 Continue For Loop If '${onu_id}' != '${EMPTY}' and '${onu_id}' != '${onu_device_id}'
Andy Bavier84b83282020-06-30 05:47:49 -07001003 Execute Remote Command sudo pkill wpa_supplicant ${src['ip']}
Suchitra Vemuria5fa3dd2020-02-04 14:38:49 -08001004 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
Andy Bavier84b83282020-06-30 05:47:49 -07001005 Execute Remote Command sudo pkill dhclient ${src['ip']}
Suchitra Vemuria5fa3dd2020-02-04 14:38:49 -08001006 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
Andy Baviereff938d2020-06-29 18:27:49 -07001007 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']}
Suchitra Vemuria5fa3dd2020-02-04 14:38:49 -08001011 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']}
Andy Bavier84b83282020-06-30 05:47:49 -07001016 ${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']}
Andy Bavierf4b7d1d2020-06-30 11:14:04 -07001019 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}
Andy Baviereff938d2020-06-29 18:27:49 -07001021 ... ${dst['container_type']} ${dst['container_name']}
Suchitra Vemuria5fa3dd2020-02-04 14:38:49 -08001022 END
Scott Baker60e570d2020-02-02 22:10:13 -08001023
Suchitra Vemuria6879aa2020-11-03 11:03:11 -08001024Clean Up Linux Per OLT
1025 [Documentation] Kill processes and clean up interfaces on src+dst servers
1026 [Arguments] ${olt_serial_number}
1027 FOR ${I} IN RANGE 0 ${num_all_onus}
1028 ${src}= Set Variable ${hosts.src[${I}]}
1029 ${dst}= Set Variable ${hosts.dst[${I}]}
1030 ${onu_device_id}= Get Device ID From SN ${src['onu']}
1031 ${sn}= Get Device ID From SN ${src['olt']}
1032 #Continue For Loop If '${onu_id}' != '${EMPTY}' and '${onu_id}' != '${onu_device_id}'
1033 Continue For Loop If '${olt_serial_number}' == '${sn}'
1034 Execute Remote Command sudo pkill wpa_supplicant ${src['ip']}
1035 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
1036 Execute Remote Command sudo pkill dhclient ${src['ip']}
1037 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
1038 Execute Remote Command sudo pkill mausezahn ${src['ip']}
1039 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
1040 Run Keyword If '${dst['ip']}' != '${None}' Execute Remote Command pkill dhcpd
1041 ... ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']} ${dst['container_name']}
1042 Delete IP Addresses from Interface on Remote Host ${src['dp_iface_name']} ${src['ip']}
1043 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
1044 Run Keyword If '${dst['ip']}' != '${None}' Delete Interface on Remote Host
1045 ... ${dst['dp_iface_name']}.${src['s_tag']} ${dst['ip']} ${dst['user']} ${dst['pass']}
1046 ... ${dst['container_type']} ${dst['container_name']}
1047 ${bng_ip}= Get Variable Value ${dst['noroot_ip']}
1048 ${bng_user}= Get Variable Value ${dst['noroot_user']}
1049 ${bng_pass}= Get Variable Value ${dst['noroot_pass']}
1050 Run Keyword If "${bng_ip}" != "${NONE}" and "${bng_user}" != "${NONE}" and "${bng_pass}" != "${NONE}"
1051 ... Execute Remote Command sudo pkill mausezahn ${bng_ip} ${bng_user} ${bng_pass}
1052 ... ${dst['container_type']} ${dst['container_name']}
1053 END
1054
Suchitra Vemuri8d3b0032020-09-11 17:49:08 -07001055Clean dhclient
1056 [Documentation] Kills dhclient processes only for all RGs
Suchitra Vemuria6879aa2020-11-03 11:03:11 -08001057 FOR ${I} IN RANGE 0 ${num_all_nus}
Suchitra Vemuri8d3b0032020-09-11 17:49:08 -07001058 ${src}= Set Variable ${hosts.src[${I}]}
1059 ${dst}= Set Variable ${hosts.dst[${I}]}
1060 Execute Remote Command sudo pkill dhclient ${src['ip']}
1061 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
1062 END
1063
Suchitra Vemurif7a033c2020-02-26 17:22:41 -08001064Clean WPA Process
1065 [Documentation] Kills wpa_supplicant processes only for all RGs
Suchitra Vemuria6879aa2020-11-03 11:03:11 -08001066 FOR ${I} IN RANGE 0 ${num_all_onus}
Suchitra Vemurif7a033c2020-02-26 17:22:41 -08001067 ${src}= Set Variable ${hosts.src[${I}]}
1068 ${dst}= Set Variable ${hosts.dst[${I}]}
1069 Run Keyword And Ignore Error Kill Linux Process [w]pa_supplicant ${src['ip']}
1070 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
1071 END
1072
Scott Baker60e570d2020-02-02 22:10:13 -08001073Should Be Larger Than
1074 [Documentation] Verify that value_1 is > value_2
1075 [Arguments] ${value_1} ${value_2}
1076 Run Keyword If ${value_1} <= ${value_2}
1077 ... Fail The value ${value_1} is not larger than ${value_2}
1078
Scott Bakeree675552020-02-11 10:43:34 -08001079Should Be Larger Than Or Equal To
1080 [Documentation] Verify that value_1 is >= value_2
1081 [Arguments] ${value_1} ${value_2}
1082 Run Keyword If ${value_1} < ${value_2}
1083 ... Fail The value ${value_1} is not larger than or equal to ${value_2}
1084
Scott Baker60e570d2020-02-02 22:10:13 -08001085Should Be Float
1086 [Documentation] Verify that value is a floating point number type
1087 [Arguments] ${value}
1088 ${type} Evaluate type(${value}).__name__
1089 Should Be Equal ${type} float
1090
Scott Bakeree675552020-02-11 10:43:34 -08001091Should Be Newer Than Or Equal To
1092 [Documentation] Compare two RFC3339 dates
1093 [Arguments] ${value_1} ${value_2}
1094 ${unix_v1} Parse RFC3339 ${value_1}
1095 ${unix_v2} Parse RFC3339 ${value_2}
1096 Run Keyword If ${unix_v1} < ${unix_v2}
1097 ... Fail The value ${value_1} is not newer than or equal to ${value_2}
1098
Scott Baker60e570d2020-02-02 22:10:13 -08001099Get Current Time
1100 [Documentation] Return the current time in RFC3339 format
1101 ${output}= Run date -u +"%FT%T%:z"
1102 [return] ${output}
Scott Bakeree675552020-02-11 10:43:34 -08001103
1104Parse RFC3339
1105 [Documentation] Parse an RFC3339 timestamp
1106 [Arguments] ${dateStr}
1107 ${rc} ${output}= Run and Return Rc and Output date --date="${dateStr}" "+%s"
1108 Should Be Equal As Numbers ${rc} 0
1109 [return] ${output}
Matteo Scandolo142e6272020-04-29 17:36:59 -07001110
Gayathri.Selvan92d16862020-03-19 14:47:58 +00001111Get Bandwidth Profile Name For Given Subscriber
1112 [Arguments] ${subscriber_id} ${stream_type}=upstreamBandwidthProfile
1113 [Documentation] Keyword to get the bandwidth details of the given subscriber
1114 ${bandwidth_profile_output}= Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
1115 ... volt-programmed-subscribers | grep ${subscriber_id}
1116 @{bandwidth_profile_array}= Split String ${bandwidth_profile_output} ,
1117 Log ${bandwidth_profile_array}
1118 FOR ${value} IN @{bandwidth_profile_array}
1119 @{row_value}= Split String ${value} =
1120 ${bandwidth_profile_name}= Set Variable If '${row_value[0]}' == ' ${stream_type}'
1121 ... ${row_value[1]}
1122 ${bandwidth_profile_name}= Convert To String ${bandwidth_profile_name}
1123 Run Keyword If "${bandwidth_profile_name}" != "None" Exit For Loop
1124 END
1125 Log ${bandwidth_profile_name}
1126 [Return] ${bandwidth_profile_name}
1127
1128Execute Remote Command
1129 [Documentation] SSH into a remote host and execute a command on the bare host or in a container.
1130 ... This replaces and simplifies the Login And Run Command On Remote System keyword in CORDRobot.
1131 [Arguments] ${cmd} ${ip} ${user} ${pass}=${None}
Andy Baviereff938d2020-06-29 18:27:49 -07001132 ... ${container_type}=${None} ${container_name}=${None} ${timeout}=${None}
Gayathri.Selvan92d16862020-03-19 14:47:58 +00001133 ${conn_id}= SSHLibrary.Open Connection ${ip}
1134 Run Keyword If '${pass}' != '${None}'
1135 ... SSHLibrary.Login ${user} ${pass}
1136 ... ELSE
1137 ... SSHLibrary.Login With Public Key ${user} %{HOME}/.ssh/id_rsa
1138 ${namespace}= Run Keyword If '${container_type}' == 'K8S' SSHLibrary.Execute Command
1139 ... kubectl get pods --all-namespaces | grep ${container_name} | awk '{print $1}'
Andy Bavierf6ab19c2020-05-14 10:34:47 -07001140 ${stdout} ${stderr} ${rc}= Run Keyword If '${container_type}' == 'LXC'
1141 ... SSHLibrary.Execute Command lxc exec ${container_name} -- ${cmd}
Andy Baviereff938d2020-06-29 18:27:49 -07001142 ... return_stderr=True return_rc=True timeout=${timeout}
Gayathri.Selvan92d16862020-03-19 14:47:58 +00001143 ... ELSE IF '${container_type}' == 'K8S'
Andy Bavierf6ab19c2020-05-14 10:34:47 -07001144 ... SSHLibrary.Execute Command kubectl -n ${namespace} exec ${container_name} -- ${cmd}
Andy Baviereff938d2020-06-29 18:27:49 -07001145 ... return_stderr=True return_rc=True timeout=${timeout}
Gayathri.Selvan92d16862020-03-19 14:47:58 +00001146 ... ELSE
Andy Baviereff938d2020-06-29 18:27:49 -07001147 ... SSHLibrary.Execute Command ${cmd} return_stderr=True return_rc=True timeout=${timeout}
Andy Bavierf6ab19c2020-05-14 10:34:47 -07001148
1149 Log ${stdout}
1150 Log ${stderr}
1151 Log ${rc}
Gayathri.Selvan92d16862020-03-19 14:47:58 +00001152 SSHLibrary.Close Connection
Andy Bavierf6ab19c2020-05-14 10:34:47 -07001153 [Return] ${stdout} ${stderr} ${rc}
Gayathri.Selvan92d16862020-03-19 14:47:58 +00001154
Suraj Gour33651272020-05-04 10:10:16 +05301155Start Remote Command
1156 [Documentation] SSH into a remote host and execute a command on the bare host or in a container.
1157 ... This replaces and simplifies the Login And Run Command On Remote System keyword in CORDRobot.
1158 [Arguments] ${cmd} ${ip} ${user} ${pass}=${None}
1159 ... ${container_type}=${None} ${container_name}=${None}
1160 ${conn_id}= SSHLibrary.Open Connection ${ip}
1161 Run Keyword If '${pass}' != '${None}'
1162 ... SSHLibrary.Login ${user} ${pass}
1163 ... ELSE
1164 ... SSHLibrary.Login With Public Key ${user} %{HOME}/.ssh/id_rsa
1165 ${namespace}= Run Keyword If '${container_type}' == 'K8S' SSHLibrary.Execute Command
1166 ... kubectl get pods --all-namespaces | grep ${container_name} | awk '{print $1}'
1167 Run Keyword If '${container_type}' == 'LXC'
1168 ... SSHLibrary.Start Command lxc exec ${container_name} -- ${cmd}
1169 ... ELSE IF '${container_type}' == 'K8S'
1170 ... SSHLibrary.Start Command kubectl -n ${namespace} exec ${container_name} -- ${cmd}
1171 ... ELSE
1172 ... SSHLibrary.Start Command ${cmd}
Andy Bavier9fb23232020-06-30 15:12:20 -07001173 # It seems that closing the connection immediately will sometimes kill the command
1174 Sleep 1s
Suraj Gour33651272020-05-04 10:10:16 +05301175 SSHLibrary.Close Connection
1176
Gayathri.Selvan92d16862020-03-19 14:47:58 +00001177Run Iperf3 Test Client
1178 [Arguments] ${src} ${server} ${args}
1179 [Documentation] Login to ${src} and run the iperf3 client against ${server} using ${args}.
1180 ... Return a Dictionary containing the results of the test.
Andy Bavierf6ab19c2020-05-14 10:34:47 -07001181 ${output} ${stderr} ${rc}= Execute Remote Command iperf3 -J -c ${server} ${args} | jq -M -c '.'
Gayathri.Selvan92d16862020-03-19 14:47:58 +00001182 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
Andy Bavierf6ab19c2020-05-14 10:34:47 -07001183 Should Be Equal As Integers ${rc} 0
Gayathri.Selvan92d16862020-03-19 14:47:58 +00001184 ${object}= Evaluate json.loads(r'''${output}''') json
1185 [Return] ${object}
Hung-Wei Chiue0bec7c2020-05-29 22:16:56 +00001186
Suchitra Vemuri85cb7d62020-07-16 23:46:16 -07001187Run Iperf Test Client for MCAST
1188 [Arguments] ${src} ${server} ${args}
1189 [Documentation] Login to ${src} and run the iperf client against ${server} using ${args}.
1190 ... Return a Dictionary containing the results of the test.
1191 ${output} ${stderr} ${rc}= Execute Remote Command sudo iperf -c ${server} ${args} | jq -M -c '.'
1192 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
1193 Should Be Equal As Integers ${rc} 0
1194 ${object}= Evaluate json.loads(r'''${output}''') json
1195 [Return] ${object}
1196
Hung-Wei Chiue0bec7c2020-05-29 22:16:56 +00001197RestoreONUs
1198 [Documentation] Restore all connected ONUs
Suchitra Vemuria6879aa2020-11-03 11:03:11 -08001199 [Arguments] ${num_all_onus}
1200 FOR ${I} IN RANGE 0 ${num_all_onus}
Hung-Wei Chiue0bec7c2020-05-29 22:16:56 +00001201 ${src}= Set Variable ${hosts.src[${I}]}
Hung-Wei Chiucc6e6552020-06-04 12:57:38 -07001202 ${container_type}= Get Variable Value ${src['container_type']} "null"
1203 ${container_name}= Get Variable Value ${src['container_name']} "null"
Hung-Wei Chiue0bec7c2020-05-29 22:16:56 +00001204 ${onu_type}= Get Variable Value ${src['onu_type']} "null"
Hung-Wei Chiucc6e6552020-06-04 12:57:38 -07001205 #Get ens6f0 from ens6f0.22
1206 ${if_name}= Replace String Using Regexp ${src['dp_iface_name']} \\..* \
Hung-Wei Chiue0bec7c2020-05-29 22:16:56 +00001207 Run Keyword IF '${onu_type}' == 'alpha' AlphaONURestoreDefault ${src['ip']} ${src['user']}
Hung-Wei Chiucc6e6552020-06-04 12:57:38 -07001208 ... ${src['pass']} ${if_name} admin admin ${container_type} ${container_name}
Hung-Wei Chiue0bec7c2020-05-29 22:16:56 +00001209 END
1210
1211AlphaONURestoreDefault
1212 [Documentation] Restore the Alpha ONU to factory setting
1213 [Arguments] ${rg_ip} ${rg_user} ${rg_pass} ${onu_ifname}
Hung-Wei Chiucc6e6552020-06-04 12:57:38 -07001214 ... ${onu_user} ${onu_pass} ${container_type}=${None} ${container_name}=${None}
Hung-Wei Chiue0bec7c2020-05-29 22:16:56 +00001215 ${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 -07001216 ... ${rg_ip} ${rg_user} ${rg_pass} ${container_type} ${container_name}
Hung-Wei Chiue0bec7c2020-05-29 22:16:56 +00001217 ${cmd} Catenate
1218 ... (echo open "192.168.1.1"; sleep 1;
1219 ... echo "${onu_user}"; sleep 1;
1220 ... echo "${onu_pass}"; sleep 1;
1221 ... echo "restoredefault"; sleep 1) | telnet
1222 ${output}= Login And Run Command On Remote System ${cmd}
Hung-Wei Chiucc6e6552020-06-04 12:57:38 -07001223 ... ${rg_ip} ${rg_user} ${rg_pass} ${container_type} ${container_name}
Hung-Wei Chiue0bec7c2020-05-29 22:16:56 +00001224 Log To Console ${output}
1225 ${output}= Login And Run Command On Remote System sudo ifconfig ${onu_ifname} 0
Hung-Wei Chiucc6e6552020-06-04 12:57:38 -07001226 ... ${rg_ip} ${rg_user} ${rg_pass} ${container_type} ${container_name}
Suraj Gour33651272020-05-04 10:10:16 +05301227
1228Create traffic with each pbit and capture at other end
1229 [Documentation] Generates upstream traffic using Mausezahn tool
1230 ... with each pbit and validates reception at other end using tcpdump
1231 [Arguments] ${target_ip} ${target_iface} ${src_iface}
1232 ... ${packet_count} ${packet_type} ${target_port} ${vlan} ${tcpdump_filter}
1233 ... ${dst_ip} ${dst_user} ${dst_pass} ${dst_container_type} ${dst_container_name}
1234 ... ${src_ip} ${src_user} ${src_pass} ${src_container_type} ${src_container_name}
1235 FOR ${pbit} IN RANGE 8
Andy Baviereff938d2020-06-29 18:27:49 -07001236 Execute Remote Command sudo pkill mausezahn
Suraj Gour33651272020-05-04 10:10:16 +05301237 ... ${src_ip} ${src_user} ${src_pass} ${src_container_type} ${src_container_name}
Andy Baviereff938d2020-06-29 18:27:49 -07001238 ${var1}= Set Variable sudo mausezahn ${src_iface} -B ${target_ip} -c ${packet_count} -d 100m
Suraj Gour33651272020-05-04 10:10:16 +05301239 ${var2}= Set Variable -t ${packet_type} "dp=${target_port}" -p 1472 -Q ${pbit}:${vlan}
1240 ${cmd}= Set Variable ${var1} ${var2}
1241 Start Remote Command ${cmd} ${src_ip} ${src_user} ${src_pass}
1242 ... ${src_container_type} ${src_container_name}
1243 ${output} ${stderr} ${rc}= Execute Remote Command
Andy Baviereff938d2020-06-29 18:27:49 -07001244 ... sudo tcpdump -l -U -c 30 -i ${target_iface} -e ${tcpdump_filter}
Suraj Gour33651272020-05-04 10:10:16 +05301245 ... ${dst_ip} ${dst_user} ${dst_pass} ${dst_container_type} ${dst_container_name}
Andy Baviereff938d2020-06-29 18:27:49 -07001246 ... timeout=30 seconds
1247 Execute Remote Command sudo pkill mausezahn
Suraj Gour33651272020-05-04 10:10:16 +05301248 ... ${src_ip} ${src_user} ${src_pass} ${src_container_type} ${src_container_name}
1249 # VOL-3262: I'm seeing untagged downstream traffic at RG for pbit 0. According to Girish this is
1250 # incorrect behavior. Simplify the following check when VOL-3262 is resolved.
1251 Run Keyword If ${pbit}==0 and "${tcpdump_filter}"=="udp"
1252 ... Should Match Regexp ${output} \\.${target_port}: UDP,
1253 ... ELSE Should Match Regexp ${output} , p ${pbit},.*\\.${target_port}: UDP,
1254 END