blob: e78b5163e2b8e7be3ce85fde73281c85ba86e597 [file] [log] [blame]
TorstenThiemed4f48962020-12-08 12:17:19 +00001# Copyright 2020 - 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.
14
TorstenThieme1619db22020-04-03 12:01:15 +000015*** Settings ***
TorstenThieme109683b2020-09-24 12:35:41 +000016Documentation Test states of ONU Go adapter with ATT workflows only (not for DT/TT workflow!)
TorstenThieme1619db22020-04-03 12:01:15 +000017Suite Setup Setup Suite
18Suite Teardown Teardown Suite
19Test Setup Setup
20Test Teardown Teardown
21Library Collections
22Library String
23Library OperatingSystem
24Library XML
25Library RequestsLibrary
26Library ../../libraries/DependencyLibrary.py
27Resource ../../libraries/onos.robot
28Resource ../../libraries/voltctl.robot
29Resource ../../libraries/voltha.robot
30Resource ../../libraries/utils.robot
31Resource ../../libraries/k8s.robot
TorstenThieme440b7c02020-12-18 15:42:57 +000032Resource ../../libraries/onu_utilities.robot
TorstenThiemefe7099e2021-01-29 08:41:04 +000033Resource ../../libraries/bbsim.robot
TorstenThieme1619db22020-04-03 12:01:15 +000034Resource ../../variables/variables.robot
35
36*** Variables ***
TorstenThieme440b7c02020-12-18 15:42:57 +000037${namespace} voltha
TorstenThiemed4f48962020-12-08 12:17:19 +000038${timeout} 60s
TorstenThieme1619db22020-04-03 12:01:15 +000039${of_id} 0
40${logical_id} 0
41${has_dataplane} True
42${external_libs} True
43${teardown_device} True
44${scripts} ../../scripts
45# Per-test logging on failure is turned off by default; set this variable to enable
46${container_log_dir} ${None}
TorstenThieme3385cdc2021-02-04 13:50:50 +000047# KV Store Prefix
48# example: -v kvstoreprefix:voltha_voltha
49${kvstoreprefix} voltha_voltha
TorstenThiemee0e5bba2020-08-05 11:20:13 +000050# state to test variable, can be passed via the command line too, valid values: 1-6
51# 1 -> activating-onu
52# 2 -> starting-openomci
53# 3 -> discovery-mibsync-complete
54# 4 -> initial-mib-downloaded
55# 5 -> tech-profile-config-download-success
56# 6 -> omci-flows-pushed
TorstenThieme87cd6202020-09-09 10:01:28 +000057# example: -v state2test:5
TorstenThieme66c91a82020-10-19 13:37:53 +000058# example: -v state2test:omci-flows-pushed
TorstenThieme1619db22020-04-03 12:01:15 +000059${state2test} 6
TorstenThiemee0e5bba2020-08-05 11:20:13 +000060# test mode variable, can be passed via the command line too, valid values: SingleState, Up2State, SingleStateTime
TorstenThieme87cd6202020-09-09 10:01:28 +000061# example: -v testmode:SingleStateTime
TorstenThieme1619db22020-04-03 12:01:15 +000062${testmode} SingleState
TorstenThieme87cd6202020-09-09 10:01:28 +000063# used tech profile, can be passed via the command line too, valid values: default (=1T1GEM), 1T4GEM, 1T8GEM
64# example: -v techprofile:1T4GEM
TorstenThiemee0e5bba2020-08-05 11:20:13 +000065${techprofile} default
TorstenThiemee0e5bba2020-08-05 11:20:13 +000066# flag debugmode is used, if true timeout calculation various, can be passed via the command line too
TorstenThieme87cd6202020-09-09 10:01:28 +000067# example: -v debugmode:True
TorstenThieme401af432020-06-11 15:53:53 +000068${debugmode} False
TorstenThiemee0e5bba2020-08-05 11:20:13 +000069# logging flag to enable Collect Logs, can be passed via the command line too
TorstenThieme87cd6202020-09-09 10:01:28 +000070# example: -v logging:True
TorstenThieme5e324e42020-07-27 09:36:16 +000071${logging} False
TorstenThieme66c91a82020-10-19 13:37:53 +000072# if True execution will be paused before clean up, only use in case of manual testing, do not use in ci pipeline!
TorstenThieme87cd6202020-09-09 10:01:28 +000073# example: -v pausebeforecleanup:True
TorstenThiemeb41007d2020-06-22 12:14:12 +000074${pausebeforecleanup} False
TorstenThiemed4f48962020-12-08 12:17:19 +000075# if True some outputs to console are done during running tests e.g. long duration flow test
76# example: -v print2console:True
77${print2console} False
TorstenThiemee0e5bba2020-08-05 11:20:13 +000078${data_dir} ../data
79
TorstenThieme1619db22020-04-03 12:01:15 +000080
81*** Test Cases ***
82ONU State Test
83 [Documentation] Validates the ONU Go adapter states
TorstenThieme66c91a82020-10-19 13:37:53 +000084 [Tags] sanityOnuGo StateTestOnuGo
TorstenThieme1619db22020-04-03 12:01:15 +000085 [Setup] Run Keywords Start Logging ONUStateTest
86 ... AND Setup Test
87 Run Keyword If ${has_dataplane} Clean Up Linux
TorstenThiemefd7e7ba2020-11-06 13:57:57 +000088 FOR ${I} IN RANGE 0 ${num_olts}
89 #get olt serial number
90 ${olt_serial_number}= Set Variable ${list_olts}[${I}][sn]
91 #validate olt states
92 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
93 Enable Device ${olt_device_id}
94 END
TorstenThieme94e4ae42020-05-18 13:01:42 +000095 ${timeStart} = Get Current Date
96 Set Global Variable ${timeStart}
TorstenThieme1619db22020-04-03 12:01:15 +000097 Run Keyword If "${testmode}"=="SingleState" Do ONU Single State Test
98 ... ELSE IF "${testmode}"=="Up2State" Do ONU Up To State Test
TorstenThieme94e4ae42020-05-18 13:01:42 +000099 ... ELSE IF "${testmode}"=="SingleStateTime" Do ONU Single State Test Time
TorstenThieme1619db22020-04-03 12:01:15 +0000100 ... ELSE Fail The testmode (${testmode}) is not valid!
TorstenThieme5e324e42020-07-27 09:36:16 +0000101 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
TorstenThieme1619db22020-04-03 12:01:15 +0000102 ... AND Stop Logging ONUStateTest
103
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000104Check Loaded Tech Profile
105 [Documentation] Validates the loaded Tech Profile
106 ... Assuming that ONU State Test was executed where all the ONUs are reached the expected state!
107 ... Check will be executed only the reached ONU state is 5 (tech-profile-config-download-success) or higher
TorstenThieme66c91a82020-10-19 13:37:53 +0000108 [Tags] functionalOnuGo CheckTechProfileOnuGo
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000109 [Setup] Start Logging ONUCheckTechProfile
TorstenThieme66c91a82020-10-19 13:37:53 +0000110 Run Keyword If '${onu_state}'=='tech-profile-config-download-success' or '${onu_state}'=='omci-flows-pushed'
111 ... Do Check Tech Profile
TorstenThieme5a205ba2020-09-29 08:08:29 +0000112 ... ELSE Pass Execution ${skip_message} skipped
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000113 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
114 ... AND Stop Logging ONUCheckTechProfile
115
TorstenThieme401af432020-06-11 15:53:53 +0000116Onu Port Check
TorstenThieme87cd6202020-09-09 10:01:28 +0000117 [Documentation] Validates that all the UNI ports show up in ONOS
TorstenThieme00958682020-06-19 11:29:31 +0000118 ... Assuming that ONU State Test was executed where all the ONUs are reached the expected state!
TorstenThieme66c91a82020-10-19 13:37:53 +0000119 [Tags] functionalOnuGo PortTestOnuGo
TorstenThieme401af432020-06-11 15:53:53 +0000120 [Setup] Start Logging ONUPortTest
TorstenThiemed4f48962020-12-08 12:17:19 +0000121 Run Keyword If '${onu_state}'=='tech-profile-config-download-success' or '${onu_state}'=='omci-flows-pushed'
122 ... Do Onu Port Check
123 ... ELSE Pass Execution ${skip_message} skipped
TorstenThieme5e324e42020-07-27 09:36:16 +0000124 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
TorstenThieme401af432020-06-11 15:53:53 +0000125 ... AND Stop Logging ONUPortTest
126
TorstenThieme17756ea2020-11-11 14:09:47 +0000127Onu Etcd Data Check
128 [Documentation] Validates ONU data stored in ETCD
129 ... Assuming that ONU State Test was executed where all the ONUs are reached the expected state!
130 [Tags] functionalOnuGo EtcdDataOnuGo
131 [Setup] Start Logging ONUEtcdDataTest
132 Run Keyword If '${onu_state}'=='tech-profile-config-download-success' or '${onu_state}'=='omci-flows-pushed'
133 ... Do Onu Etcd Data Check
134 ... ELSE Pass Execution ${skip_message} skipped
135 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
136 ... AND Stop Logging ONUEtcdDataTest
137
TorstenThieme109683b2020-09-24 12:35:41 +0000138Onu Flow Check
139 [Documentation] Validates the onu flows in ONOS and Voltha
140 ... Assuming that ONU State Test was executed where all the ONUs are reached the expected state!
mpagenkoc2e7ba52020-11-12 13:50:57 +0000141 [Tags] functionalOnuGo FlowTestOnuGo
TorstenThieme109683b2020-09-24 12:35:41 +0000142 [Setup] Start Logging ONUFlowTest
TorstenThieme66c91a82020-10-19 13:37:53 +0000143 Run Keyword If '${onu_state}'=='omci-flows-pushed' Do Onu Flow Check
TorstenThieme5a205ba2020-09-29 08:08:29 +0000144 ... ELSE Pass Execution ${skip_message} skipped
TorstenThieme109683b2020-09-24 12:35:41 +0000145 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
146 ... AND Stop Logging ONUFlowTest
147
TorstenThiemee3841a02020-09-23 08:20:43 +0000148Disable Enable Onu Device
149 [Documentation] Disables/enables ONU Device and check states
150 ... Assuming that ONU State Test was executed where all the ONUs are reached the expected state!
TorstenThieme66c91a82020-10-19 13:37:53 +0000151 [Tags] functionalOnuGo DisableEnableOnuGo
TorstenThiemee3841a02020-09-23 08:20:43 +0000152 [Setup] Start Logging DisableEnableONUDevice
TorstenThieme66c91a82020-10-19 13:37:53 +0000153 Run Keyword If '${onu_state}'=='tech-profile-config-download-success' or '${onu_state}'=='omci-flows-pushed'
154 ... Do Disable Enable Onu Test
TorstenThieme5a205ba2020-09-29 08:08:29 +0000155 ... ELSE Pass Execution ${skip_message} skipped
TorstenThiemee3841a02020-09-23 08:20:43 +0000156 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
157 ... AND Stop Logging DisableEnableONUDevice
158
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000159Power Off Power On Onu Device
160 [Documentation] Power off and Power on of all ONU Devices and check state
161 ... Assuming that ONU State Test was executed where all the ONUs are reached the expected state!
TorstenThieme66c91a82020-10-19 13:37:53 +0000162 [Tags] functionalOnuGo PowerOffPowerOnOnuGo
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000163 [Setup] Start Logging PowerOffPowerOnONUDevice
TorstenThieme66c91a82020-10-19 13:37:53 +0000164 Run Keyword If '${onu_state}'=='tech-profile-config-download-success' or '${onu_state}'=='omci-flows-pushed'
165 ... Do Power Off Power On Onu Device
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000166 ... ELSE Pass Execution ${skip_message} skipped
167 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
168 ... AND Stop Logging PowerOffPowerOnONUDevice
169
TorstenThieme1fbe8082020-10-21 13:27:59 +0000170Soft Reboot Onu Device
171 [Documentation] Reboots softly all ONU Devices and check state
172 ... Assuming that ONU State Test was executed where all the ONUs are reached the expected state!
173 [Tags] functionalOnuGo SoftRebootOnuGo
174 [Setup] Start Logging SoftRebootONUDevice
175 Run Keyword If '${onu_state}'=='tech-profile-config-download-success' or '${onu_state}'=='omci-flows-pushed'
176 ... Do Soft Reboot Onu Device
177 ... ELSE Pass Execution ${skip_message} skipped
178 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
179 ... AND Stop Logging SoftRebootONUDevice
180
TorstenThieme1619db22020-04-03 12:01:15 +0000181*** Keywords ***
182Setup Suite
183 [Documentation] Set up the test suite
TorstenThieme87cd6202020-09-09 10:01:28 +0000184 ${LogInfo}= Catenate
185 ... \r\nPassed arguments:
TorstenThieme66c91a82020-10-19 13:37:53 +0000186 ... state2test:${state2test}, testmode:${testmode}, techprofile:${techprofile},
TorstenThieme015d5c02020-09-11 09:53:34 +0000187 ... debugmode:${debugmode}, logging:${logging}, pausebeforecleanup:${pausebeforecleanup},
TorstenThiemed4f48962020-12-08 12:17:19 +0000188 ... print2console:${print2console}
TorstenThieme87cd6202020-09-09 10:01:28 +0000189 Log ${LogInfo} console=yes
TorstenThieme1619db22020-04-03 12:01:15 +0000190 Common Test Suite Setup
TorstenThieme5a205ba2020-09-29 08:08:29 +0000191 # prepare skip message in yellow for console log
192 ${skip}= Evaluate "\\033[33mSKIP\\033[0m"
193 ${skipped}= Evaluate "\\033[33m${SPACE*14} ===> Test case above was skipped! <=== ${SPACE*15}\\033[0m"
194 ${skip_message} Catenate ${skipped} | ${skip} |
195 Set Suite Variable ${skip_message}
TorstenThieme440b7c02020-12-18 15:42:57 +0000196 ${all_onu_timeout}= Run Keyword If ${num_all_onus}>4 Calculate Timeout ${timeout}
197 ... ELSE Set Variable ${timeout}
198 Set Suite Variable ${all_onu_timeout}
TorstenThieme1488d772020-09-28 10:52:43 +0000199 ${techprofile}= Set Variable If "${techprofile}"=="1T1GEM" default ${techprofile}
TorstenThieme73850052020-12-10 12:43:28 +0000200 Set Suite Variable ${techprofile}
TorstenThieme87cd6202020-09-09 10:01:28 +0000201 Run Keyword If "${techprofile}"=="default" Log To Console \nTechProfile:default (1T1GEM)
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000202 ... ELSE IF "${techprofile}"=="1T4GEM" Set Tech Profile 1T4GEM
203 ... ELSE IF "${techprofile}"=="1T8GEM" Set Tech Profile 1T8GEM
204 ... ELSE Fail The TechProfile (${techprofile}) is not valid!
205 ${onos_ssh_connection} Open ONOS SSH Connection ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
206 Set Suite Variable ${onos_ssh_connection}
TorstenThieme66c91a82020-10-19 13:37:53 +0000207 # map the passed onu state to reached and make it visible for test suite
208 ${admin_state} ${oper_status} ${connect_status} ${onu_state_nb} ${onu_state}=
209 ... Map State ${state2test}
210 Set Suite Variable ${admin_state}
211 Set Suite Variable ${oper_status}
212 Set Suite Variable ${connect_status}
213 Set Suite Variable ${onu_state_nb}
214 Set Suite Variable ${onu_state}
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000215 # delete etcd MIB Template Data
216 Delete MIB Template Data
TorstenThieme1619db22020-04-03 12:01:15 +0000217
TorstenThiemeb41007d2020-06-22 12:14:12 +0000218Teardown Suite
219 [Documentation] Replaces the Suite Teardown in utils.robot.
220 ... Cleans up and checks all ONU ports disabled in ONOS.
221 ... Furthermore gives the possibility to pause the execution.
222 Run Keyword If ${pausebeforecleanup} Import Library Dialogs
223 Run Keyword If ${pausebeforecleanup} Pause Execution Press OK to continue with clean up!
TorstenThieme87cd6202020-09-09 10:01:28 +0000224 Run Keyword If ${pausebeforecleanup} Log Teardown will be continued... console=yes
TorstenThiemeb41007d2020-06-22 12:14:12 +0000225 Run Keyword If ${teardown_device} Delete All Devices and Verify
TorstenThieme3385cdc2021-02-04 13:50:50 +0000226 Validate Onu Data In Etcd 0 ${kvstoreprefix}
TorstenThiemed4f48962020-12-08 12:17:19 +0000227 Wait for Ports in ONOS for all OLTs ${onos_ssh_connection} 0 BBSM ${timeout}
TorstenThieme440b7c02020-12-18 15:42:57 +0000228 Close All ONOS SSH Connections
TorstenThieme87cd6202020-09-09 10:01:28 +0000229 Remove Tech Profile
TorstenThiemeb41007d2020-06-22 12:14:12 +0000230
TorstenThieme1619db22020-04-03 12:01:15 +0000231Setup Test
232 [Documentation] Pre-test Setup
233 #test for empty device list
234 Test Empty Device List
235 Run Keyword If ${has_dataplane} Wait Until Keyword Succeeds 120s 10s Openolt is Up
Suchitra Vemurib7253a52020-07-14 22:35:17 -0700236 ... ${olt_ssh_ip} ${olt_user} ${olt_pass}
TorstenThieme1619db22020-04-03 12:01:15 +0000237 Run Keyword If ${has_dataplane} Sleep 60s
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000238 # Create a list of olt ids (logical and device_id)
239 ${olt_ids} Create List
240 FOR ${I} IN RANGE 0 ${num_olts}
241 #create/preprovision device
Andrea Campanella3dcce272021-01-15 16:04:47 +0100242 ${olt_device_id}= Run Keyword If "${list_olts}[${I}][type]" == "${None}"
TorstenThieme44136642021-02-12 13:41:17 +0000243 ... Create Device ${list_olts}[${I}][ip] ${list_olts}[${I}][oltport]
244 ... ELSE Create Device ${list_olts}[${I}][ip] ${list_olts}[${I}][oltport] ${list_olts}[${I}][type]
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000245 ${olt_serial_number}= Set Variable ${list_olts}[${I}][sn]
246 #validate olt states
247 Wait Until Keyword Succeeds ${timeout} 5s
248 ... Validate OLT Device PREPROVISIONED UNKNOWN UNKNOWN ${olt_device_id}
249 Sleep 5s
250 ${logical_id}= Get Logical Device ID From SN ${olt_serial_number}
251 ${olt} Create Dictionary device_id ${olt_device_id} logical_id ${logical_id}
252 ... of_id ${of_id} sn ${olt_serial_number}
253 Append To List ${olt_ids} ${olt}
254 END
255 Set Global Variable ${olt_ids}
TorstenThieme1619db22020-04-03 12:01:15 +0000256
TorstenThieme1619db22020-04-03 12:01:15 +0000257Do ONU Up To State Test
258 [Documentation] This keyword performs Up2State Test
259 ... All states up to the passed have to be checked
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000260 FOR ${I} IN RANGE 0 ${num_all_onus}
TorstenThieme1619db22020-04-03 12:01:15 +0000261 ${src}= Set Variable ${hosts.src[${I}]}
262 ${dst}= Set Variable ${hosts.dst[${I}]}
TorstenThieme66c91a82020-10-19 13:37:53 +0000263 Run Keyword If ${onu_state_nb}>=1
TorstenThiemed4f48962020-12-08 12:17:19 +0000264 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${all_onu_timeout} 50ms
TorstenThieme1619db22020-04-03 12:01:15 +0000265 ... Validate Device ENABLED ACTIVATING REACHABLE
266 ... ${src['onu']} onu=True onu_reason=activating-onu
TorstenThieme66c91a82020-10-19 13:37:53 +0000267 Run Keyword If ${onu_state_nb}>=2
TorstenThiemed4f48962020-12-08 12:17:19 +0000268 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${all_onu_timeout} 50ms
TorstenThieme1619db22020-04-03 12:01:15 +0000269 ... Validate Device ENABLED ACTIVATING REACHABLE
270 ... ${src['onu']} onu=True onu_reason=starting-openomci
TorstenThieme66c91a82020-10-19 13:37:53 +0000271 Run Keyword If ${onu_state_nb}>=3
TorstenThiemed4f48962020-12-08 12:17:19 +0000272 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${all_onu_timeout} 50ms
TorstenThieme1619db22020-04-03 12:01:15 +0000273 ... Validate Device ENABLED ACTIVATING REACHABLE
274 ... ${src['onu']} onu=True onu_reason=discovery-mibsync-complete
TorstenThieme66c91a82020-10-19 13:37:53 +0000275 Run Keyword If ${onu_state_nb}>=4
TorstenThiemed4f48962020-12-08 12:17:19 +0000276 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${all_onu_timeout} 50ms
TorstenThieme1619db22020-04-03 12:01:15 +0000277 ... Validate Device ENABLED ACTIVE REACHABLE
278 ... ${src['onu']} onu=True onu_reason=initial-mib-downloaded
TorstenThieme66c91a82020-10-19 13:37:53 +0000279 Run Keyword If ${onu_state_nb}>=5
TorstenThiemed4f48962020-12-08 12:17:19 +0000280 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${all_onu_timeout} 50ms
TorstenThieme1619db22020-04-03 12:01:15 +0000281 ... Validate Device ENABLED ACTIVE REACHABLE
282 ... ${src['onu']} onu=True onu_reason=tech-profile-config-download-success
TorstenThieme66c91a82020-10-19 13:37:53 +0000283 Run Keyword If ${onu_state_nb}>=6
TorstenThiemed4f48962020-12-08 12:17:19 +0000284 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${all_onu_timeout} 50ms
TorstenThieme1619db22020-04-03 12:01:15 +0000285 ... Validate Device ENABLED ACTIVE REACHABLE
286 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
287 END
288
289Do ONU Single State Test
290 [Documentation] This keyword performs SingleState Test
291 ... Only the passed state has to be checked
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000292 FOR ${I} IN RANGE 0 ${num_all_onus}
TorstenThieme1619db22020-04-03 12:01:15 +0000293 ${src}= Set Variable ${hosts.src[${I}]}
294 ${dst}= Set Variable ${hosts.dst[${I}]}
TorstenThiemed4f48962020-12-08 12:17:19 +0000295 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${all_onu_timeout} 50ms
TorstenThieme015d5c02020-09-11 09:53:34 +0000296 ... Validate Device ${admin_state} ${oper_status} ${connect_status}
297 ... ${src['onu']} onu=True onu_reason=${onu_state}
TorstenThieme1619db22020-04-03 12:01:15 +0000298 END
299
TorstenThieme94e4ae42020-05-18 13:01:42 +0000300Do ONU Single State Test Time
301 [Documentation] This keyword performs SingleState Test with calculate running time
302 ... Only the passed state has to be checked and the duration each single onu adapter needed
303 ... will be calculated and printed out
TorstenThieme17becfc2020-10-08 09:46:27 +0000304 #${ListfinishedONUs} Create List
305 #Set Global Variable ${ListfinishedONUs}
TorstenThieme94e4ae42020-05-18 13:01:42 +0000306 Create File ONU_Startup_Time.txt This file contains the startup times of all ONUs.
307 ${list_onus} Create List
TorstenThieme401af432020-06-11 15:53:53 +0000308 Build ONU SN List ${list_onus}
TorstenThiemed4f48962020-12-08 12:17:19 +0000309 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${all_onu_timeout} 50ms
TorstenThieme9949b172020-06-16 10:00:15 +0000310 ... Validate ONU Devices MIB State With Duration
TorstenThiemed4f48962020-12-08 12:17:19 +0000311 ... ${onu_state} ${list_onus} ${timeStart} print2console=${print2console}
TorstenThieme401af432020-06-11 15:53:53 +0000312 ... output_file=ONU_Startup_Time.txt
TorstenThieme94e4ae42020-05-18 13:01:42 +0000313
TorstenThieme1619db22020-04-03 12:01:15 +0000314Do Onu Port Check
TorstenThieme00958682020-06-19 11:29:31 +0000315 [Documentation] Check that all the UNI ports show up in ONOS
TorstenThiemefe7099e2021-01-29 08:41:04 +0000316 Wait for Ports in ONOS for all OLTs ${onos_ssh_connection} ${num_all_onus} BBSM ${timeout}
TorstenThieme9949b172020-06-16 10:00:15 +0000317
TorstenThieme17756ea2020-11-11 14:09:47 +0000318Do Onu Etcd Data Check
319 [Documentation] Check Onu data stored in etcd
TorstenThieme3385cdc2021-02-04 13:50:50 +0000320 Validate Onu Data In Etcd defaultkvstoreprefix=${kvstoreprefix}
TorstenThieme17756ea2020-11-11 14:09:47 +0000321
TorstenThieme109683b2020-09-24 12:35:41 +0000322Do Onu Flow Check
TorstenThieme52ef8392020-11-10 13:42:26 +0000323 [Documentation] This keyword iterate all OLTs and performs Do Onu Flow Checks Per OLT
324 # Check and store vlan rules
325 ${firstvlanrules}= Run Keyword And Continue On Failure Validate Vlan Rules In Etcd
TorstenThieme3385cdc2021-02-04 13:50:50 +0000326 ... defaultkvstoreprefix=${kvstoreprefix}
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000327 FOR ${J} IN RANGE 0 ${num_olts}
328 ${olt_serial_number}= Set Variable ${list_olts}[${J}][sn]
329 ${onu_count}= Set Variable ${list_olts}[${J}][onucount]
330 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS
331 ... ${olt_serial_number}
332 Set Global Variable ${of_id}
TorstenThiemed4f48962020-12-08 12:17:19 +0000333 # Verify Default Meter in ONOS (valid only for ATT)
334 Do Onu Subscriber Add Per OLT ${of_id} ${olt_serial_number} ${onu_count}
335 END
336 FOR ${J} IN RANGE 0 ${num_olts}
337 ${olt_serial_number}= Set Variable ${list_olts}[${J}][sn]
338 ${onu_count}= Set Variable ${list_olts}[${J}][onucount]
339 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS
340 ... ${olt_serial_number}
341 Set Global Variable ${of_id}
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000342 ${nni_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
343 ... Get NNI Port in ONOS ${of_id}
344 Set Global Variable ${nni_port}
345 # Verify Default Meter in ONOS (valid only for ATT)
TorstenThiemed4f48962020-12-08 12:17:19 +0000346 Do Onu Flow Check Per OLT ${of_id} ${nni_port} ${olt_serial_number} ${onu_count}
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000347 END
TorstenThieme52ef8392020-11-10 13:42:26 +0000348 #log flows for verification
349 ${flowsresult}= Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT} flows -s
350 log ${flowsresult}
351 #check for previous state is kept (normally omci-flows-pushed)
352 Sleep 10s
TorstenThieme440b7c02020-12-18 15:42:57 +0000353 Run Keyword And Continue On Failure Current State Test All Onus ${state2test}
TorstenThieme52ef8392020-11-10 13:42:26 +0000354 ${secondvlanrules}= Run Keyword And Continue On Failure Validate Vlan Rules In Etcd nbofcookieslice=3
TorstenThieme3385cdc2021-02-04 13:50:50 +0000355 ... prevvlanrules=${firstvlanrules} defaultkvstoreprefix=${kvstoreprefix}
TorstenThieme52ef8392020-11-10 13:42:26 +0000356 FOR ${J} IN RANGE 0 ${num_olts}
357 ${olt_serial_number}= Set Variable ${list_olts}[${J}][sn]
358 ${onu_count}= Set Variable ${list_olts}[${J}][onucount]
359 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS
360 ... ${olt_serial_number}
361 Set Global Variable ${of_id}
362 ${nni_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
363 ... Get NNI Port in ONOS ${of_id}
364 Set Global Variable ${nni_port}
365 # Verify Default Meter in ONOS (valid only for ATT)
366 Do Onu Subscriber Remove Per OLT ${of_id} ${nni_port} ${olt_serial_number} ${onu_count}
367 END
368 #check for previous state is kept (normally omci-flows-pushed)
369 Sleep 10s
TorstenThiemed4f48962020-12-08 12:17:19 +0000370 Run Keyword If ${print2console} Log \r\nStart State Test All Onus. console=yes
TorstenThieme440b7c02020-12-18 15:42:57 +0000371 Run Keyword And Continue On Failure Current State Test All Onus ${state2test}
TorstenThiemed4f48962020-12-08 12:17:19 +0000372 Run Keyword If ${print2console} Log \r\nFinished State Test All Onus. console=yes
TorstenThieme52ef8392020-11-10 13:42:26 +0000373 Run Keyword And Continue On Failure Validate Vlan Rules In Etcd prevvlanrules=${firstvlanrules}
TorstenThieme3385cdc2021-02-04 13:50:50 +0000374 ... setvidequal=True defaultkvstoreprefix=${kvstoreprefix}
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000375
TorstenThiemed4f48962020-12-08 12:17:19 +0000376Do Onu Subscriber Add Per OLT
377 [Documentation] Add Subscriber per OLT
378 [Arguments] ${of_id} ${olt_serial_number} ${num_onus}
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000379 FOR ${I} IN RANGE 0 ${num_all_onus}
TorstenThieme109683b2020-09-24 12:35:41 +0000380 ${src}= Set Variable ${hosts.src[${I}]}
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000381 Continue For Loop If "${olt_serial_number}"!="${src['olt']}"
TorstenThieme109683b2020-09-24 12:35:41 +0000382 ${onu_device_id}= Get Device ID From SN ${src['onu']}
383 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
384 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
385 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
386 ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
387 ... volt-add-subscriber-access ${of_id} ${onu_port}
TorstenThiemed4f48962020-12-08 12:17:19 +0000388 Run Keyword If ${print2console} Log \r\n[${I}] volt-add-subscriber-access ${of_id} ${onu_port}.
389 ... console=yes
390 END
391
392Do Onu Flow Check Per OLT
393 [Documentation] Checks all ONU flows show up in ONOS and Voltha
394 [Arguments] ${of_id} ${nni_port} ${olt_serial_number} ${num_onus}
395 FOR ${I} IN RANGE 0 ${num_all_onus}
396 ${src}= Set Variable ${hosts.src[${I}]}
397 Continue For Loop If "${olt_serial_number}"!="${src['olt']}"
398 ${onu_device_id}= Get Device ID From SN ${src['onu']}
399 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
400 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
TorstenThieme109683b2020-09-24 12:35:41 +0000401 # Verify subscriber access flows are added for the ONU port
402 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
403 ... Verify Subscriber Access Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
404 ... ${onu_port} ${nni_port} ${src['c_tag']} ${src['s_tag']}
TorstenThiemed4f48962020-12-08 12:17:19 +0000405 ${logoutput} Catenate \r\n[${I}] Verify Subscriber Access Flows Added For
406 ... ONU ${of_id} ${onu_port} ${src['c_tag']} ${src['s_tag']}.
407 Run Keyword If ${print2console} Log ${logoutput} console=yes
TorstenThieme109683b2020-09-24 12:35:41 +0000408 END
TorstenThieme52ef8392020-11-10 13:42:26 +0000409
410Do Onu Subscriber Remove Per OLT
411 [Documentation] Removes per OLT subscribers in ONOS and Voltha
412 [Arguments] ${of_id} ${nni_port} ${olt_serial_number} ${num_onus}
413 FOR ${I} IN RANGE 0 ${num_all_onus}
414 ${src}= Set Variable ${hosts.src[${I}]}
415 ${dst}= Set Variable ${hosts.dst[${I}]}
416 Continue For Loop If "${olt_serial_number}"!="${src['olt']}"
417 ${onu_device_id}= Get Device ID From SN ${src['onu']}
418 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
419 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
420 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
421 ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
422 ... volt-remove-subscriber-access ${of_id} ${onu_port}
TorstenThiemed4f48962020-12-08 12:17:19 +0000423 Run Keyword If ${print2console} Log \r\n[${I}] volt-remove-subscriber-access ${of_id} ${onu_port}.
424 ... console=yes
TorstenThieme52ef8392020-11-10 13:42:26 +0000425 END
TorstenThieme109683b2020-09-24 12:35:41 +0000426
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000427Do Check Tech Profile
428 [Documentation] This keyword checks the loaded TechProfile
429 ${namespace}= Set Variable default
Andrea Campanella60dde302020-09-09 18:42:56 +0200430 ${podname}= Set Variable etcd
TorstenThieme3385cdc2021-02-04 13:50:50 +0000431 ${kvstoreprefix}= Get Kv Store Prefix
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000432 ${commandget} Catenate
TorstenThieme3385cdc2021-02-04 13:50:50 +0000433 ... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/${kvstoreprefix}/technology_profiles/XGS-PON/64'
Holger Hildebrandt23147742020-11-16 10:13:21 +0000434 ${result}= Exec Pod In Kube ${namespace} ${podname} ${commandget}
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000435 ${num_gem_ports}= Set Variable 1
436 ${num_gem_ports}= Set Variable If
437 ... "${techprofile}"=="default" 1
438 ... "${techprofile}"=="1T4GEM" 4
439 ... "${techprofile}"=="1T8GEM" 8
440 @{resultList} Split String ${result} separator=,
441 ${num_of_count_matches}= Get Match Count ${resultList} "num_gem_ports": ${num_gem_ports}
442 ... whitespace_insensitive=True
TorstenThiemea0221942020-12-09 11:35:03 +0000443 ${num_of_expected_matches}= Evaluate ${num_all_onus}
TorstenThiemea0221942020-12-09 11:35:03 +0000444 Should Be Equal As Integers ${num_of_expected_matches} ${num_of_count_matches}
445 ... TechProfile (${TechProfile}) not loaded correctly:${num_of_count_matches} of ${num_of_expected_matches}
TorstenThieme015d5c02020-09-11 09:53:34 +0000446
447Do Disable Enable Onu Test
448 [Documentation] This keyword disables/enables all onus and checks the states.
TorstenThieme1fbe8082020-10-21 13:27:59 +0000449 [Arguments] ${state2check}=${state2test} ${checkstatebeforedisable}=True
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000450 ... ${state2checkafterdisable}=tech-profile-config-delete-success
TorstenThieme440b7c02020-12-18 15:42:57 +0000451 Run Keyword If ${checkstatebeforedisable} Current State Test All Onus ${state2check}
452 Disable Onu Device
TorstenThiemed4f48962020-12-08 12:17:19 +0000453 ${alternative_onu_reason}= Set Variable If
454 ... '${state2checkafterdisable}'=='tech-profile-config-delete-success' omci-flows-deleted
455 ... '${state2checkafterdisable}'=='omci-admin-lock' tech-profile-config-delete-success ${EMPTY}
TorstenThiemec3c23232021-01-13 13:06:31 +0000456 ${alternativeonustates}= Create List ${alternative_onu_reason}
457 Current State Test All Onus ${state2checkafterdisable} alternativeonustate=${alternativeonustates}
TorstenThieme17becfc2020-10-08 09:46:27 +0000458 Log Ports
459 #check no port is enabled in ONOS
TorstenThiemed4f48962020-12-08 12:17:19 +0000460 Wait for Ports in ONOS for all OLTs ${onos_ssh_connection} 0 BBSM
TorstenThieme440b7c02020-12-18 15:42:57 +0000461 Enable Onu Device
462 Current State Test All Onus ${state2check}
TorstenThieme17becfc2020-10-08 09:46:27 +0000463 Log Ports onlyenabled=True
464 #check that all the UNI ports show up in ONOS again
TorstenThiemed4f48962020-12-08 12:17:19 +0000465 Wait for Ports in ONOS for all OLTs ${onos_ssh_connection} ${num_all_onus} BBSM
TorstenThieme015d5c02020-09-11 09:53:34 +0000466
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000467Do Power Off Power On Onu Device
468 [Documentation] This keyword power off/on all onus and checks the states.
TorstenThieme440b7c02020-12-18 15:42:57 +0000469 Power Off ONU Device ${namespace}
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000470 Sleep 5s
TorstenThiemec3c23232021-01-13 13:06:31 +0000471 ${alternativeonustates}= Create List omci-flows-deleted
TorstenThieme440b7c02020-12-18 15:42:57 +0000472 Current State Test All Onus tech-profile-config-delete-success
TorstenThiemec3c23232021-01-13 13:06:31 +0000473 ... ENABLED DISCOVERED UNREACHABLE alternativeonustate=${alternativeonustates}
TorstenThieme440b7c02020-12-18 15:42:57 +0000474 Power On ONU Device ${namespace}
475 Current State Test All Onus ${state2test}
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000476
TorstenThieme1fbe8082020-10-21 13:27:59 +0000477Do Soft Reboot Onu Device
478 [Documentation] This keyword reboots softly all onus and checks the states.
TorstenThiemef78a9d82021-03-05 13:42:09 +0000479 ${device_list}= Set Variable ${EMPTY}
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000480 FOR ${I} IN RANGE 0 ${num_all_onus}
TorstenThieme1fbe8082020-10-21 13:27:59 +0000481 ${src}= Set Variable ${hosts.src[${I}]}
482 ${onu_device_id}= Get Device ID From SN ${src['onu']}
TorstenThiemef78a9d82021-03-05 13:42:09 +0000483 ${device_list}= Catenate ${device_list} ${onu_device_id}
TorstenThieme1fbe8082020-10-21 13:27:59 +0000484 END
TorstenThiemef78a9d82021-03-05 13:42:09 +0000485 Reboot ONU ${device_list} False
TorstenThieme6cc43762021-03-03 10:20:16 +0000486 ${alternativeonustates}= Create List stopping-openomci
487 Current State Test All Onus omci-flows-deleted
Matteo Scandoloc14525a2021-02-02 08:34:43 -0800488 ... ENABLED DISCOVERED UNREACHABLE alternativeonustate=${alternativeonustates}
TorstenThieme73850052020-12-10 12:43:28 +0000489 Sleep 5s
TorstenThieme6cc43762021-03-03 10:20:16 +0000490 Current State Test All Onus omci-flows-pushed
TorstenThiemed4f48962020-12-08 12:17:19 +0000491 Do Onu Port Check