blob: 32287834be868f961d649bf5a3d338790cd3a48f [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
TorstenThieme1619db22020-04-03 12:01:15 +000033Resource ../../variables/variables.robot
34
35*** Variables ***
TorstenThieme440b7c02020-12-18 15:42:57 +000036${namespace} voltha
TorstenThiemed4f48962020-12-08 12:17:19 +000037${timeout} 60s
TorstenThieme1619db22020-04-03 12:01:15 +000038${of_id} 0
39${logical_id} 0
40${has_dataplane} True
41${external_libs} True
42${teardown_device} True
43${scripts} ../../scripts
44# Per-test logging on failure is turned off by default; set this variable to enable
45${container_log_dir} ${None}
TorstenThiemee0e5bba2020-08-05 11:20:13 +000046# state to test variable, can be passed via the command line too, valid values: 1-6
47# 1 -> activating-onu
48# 2 -> starting-openomci
49# 3 -> discovery-mibsync-complete
50# 4 -> initial-mib-downloaded
51# 5 -> tech-profile-config-download-success
52# 6 -> omci-flows-pushed
TorstenThieme87cd6202020-09-09 10:01:28 +000053# example: -v state2test:5
TorstenThieme66c91a82020-10-19 13:37:53 +000054# example: -v state2test:omci-flows-pushed
TorstenThieme1619db22020-04-03 12:01:15 +000055${state2test} 6
TorstenThiemee0e5bba2020-08-05 11:20:13 +000056# test mode variable, can be passed via the command line too, valid values: SingleState, Up2State, SingleStateTime
TorstenThieme87cd6202020-09-09 10:01:28 +000057# example: -v testmode:SingleStateTime
TorstenThieme1619db22020-04-03 12:01:15 +000058${testmode} SingleState
TorstenThieme87cd6202020-09-09 10:01:28 +000059# used tech profile, can be passed via the command line too, valid values: default (=1T1GEM), 1T4GEM, 1T8GEM
60# example: -v techprofile:1T4GEM
TorstenThiemee0e5bba2020-08-05 11:20:13 +000061${techprofile} default
TorstenThiemee0e5bba2020-08-05 11:20:13 +000062# flag debugmode is used, if true timeout calculation various, can be passed via the command line too
TorstenThieme87cd6202020-09-09 10:01:28 +000063# example: -v debugmode:True
TorstenThieme401af432020-06-11 15:53:53 +000064${debugmode} False
TorstenThiemee0e5bba2020-08-05 11:20:13 +000065# logging flag to enable Collect Logs, can be passed via the command line too
TorstenThieme87cd6202020-09-09 10:01:28 +000066# example: -v logging:True
TorstenThieme5e324e42020-07-27 09:36:16 +000067${logging} False
TorstenThieme66c91a82020-10-19 13:37:53 +000068# 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 +000069# example: -v pausebeforecleanup:True
TorstenThiemeb41007d2020-06-22 12:14:12 +000070${pausebeforecleanup} False
TorstenThiemed4f48962020-12-08 12:17:19 +000071# if True some outputs to console are done during running tests e.g. long duration flow test
72# example: -v print2console:True
73${print2console} False
TorstenThiemee0e5bba2020-08-05 11:20:13 +000074${data_dir} ../data
75
TorstenThieme1619db22020-04-03 12:01:15 +000076
77*** Test Cases ***
78ONU State Test
79 [Documentation] Validates the ONU Go adapter states
TorstenThieme66c91a82020-10-19 13:37:53 +000080 [Tags] sanityOnuGo StateTestOnuGo
TorstenThieme1619db22020-04-03 12:01:15 +000081 [Setup] Run Keywords Start Logging ONUStateTest
82 ... AND Setup Test
83 Run Keyword If ${has_dataplane} Clean Up Linux
TorstenThiemefd7e7ba2020-11-06 13:57:57 +000084 FOR ${I} IN RANGE 0 ${num_olts}
85 #get olt serial number
86 ${olt_serial_number}= Set Variable ${list_olts}[${I}][sn]
87 #validate olt states
88 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
89 Enable Device ${olt_device_id}
90 END
TorstenThieme94e4ae42020-05-18 13:01:42 +000091 ${timeStart} = Get Current Date
92 Set Global Variable ${timeStart}
TorstenThieme1619db22020-04-03 12:01:15 +000093 Run Keyword If "${testmode}"=="SingleState" Do ONU Single State Test
94 ... ELSE IF "${testmode}"=="Up2State" Do ONU Up To State Test
TorstenThieme94e4ae42020-05-18 13:01:42 +000095 ... ELSE IF "${testmode}"=="SingleStateTime" Do ONU Single State Test Time
TorstenThieme1619db22020-04-03 12:01:15 +000096 ... ELSE Fail The testmode (${testmode}) is not valid!
TorstenThieme5e324e42020-07-27 09:36:16 +000097 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
TorstenThieme1619db22020-04-03 12:01:15 +000098 ... AND Stop Logging ONUStateTest
99
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000100Check Loaded Tech Profile
101 [Documentation] Validates the loaded Tech Profile
102 ... Assuming that ONU State Test was executed where all the ONUs are reached the expected state!
103 ... Check will be executed only the reached ONU state is 5 (tech-profile-config-download-success) or higher
TorstenThieme66c91a82020-10-19 13:37:53 +0000104 [Tags] functionalOnuGo CheckTechProfileOnuGo
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000105 [Setup] Start Logging ONUCheckTechProfile
TorstenThieme66c91a82020-10-19 13:37:53 +0000106 Run Keyword If '${onu_state}'=='tech-profile-config-download-success' or '${onu_state}'=='omci-flows-pushed'
107 ... Do Check Tech Profile
TorstenThieme5a205ba2020-09-29 08:08:29 +0000108 ... ELSE Pass Execution ${skip_message} skipped
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000109 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
110 ... AND Stop Logging ONUCheckTechProfile
111
TorstenThieme401af432020-06-11 15:53:53 +0000112Onu Port Check
TorstenThieme87cd6202020-09-09 10:01:28 +0000113 [Documentation] Validates that all the UNI ports show up in ONOS
TorstenThieme00958682020-06-19 11:29:31 +0000114 ... Assuming that ONU State Test was executed where all the ONUs are reached the expected state!
TorstenThieme66c91a82020-10-19 13:37:53 +0000115 [Tags] functionalOnuGo PortTestOnuGo
TorstenThieme401af432020-06-11 15:53:53 +0000116 [Setup] Start Logging ONUPortTest
TorstenThiemed4f48962020-12-08 12:17:19 +0000117 Run Keyword If '${onu_state}'=='tech-profile-config-download-success' or '${onu_state}'=='omci-flows-pushed'
118 ... Do Onu Port Check
119 ... ELSE Pass Execution ${skip_message} skipped
TorstenThieme5e324e42020-07-27 09:36:16 +0000120 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
TorstenThieme401af432020-06-11 15:53:53 +0000121 ... AND Stop Logging ONUPortTest
122
TorstenThieme17756ea2020-11-11 14:09:47 +0000123Onu Etcd Data Check
124 [Documentation] Validates ONU data stored in ETCD
125 ... Assuming that ONU State Test was executed where all the ONUs are reached the expected state!
126 [Tags] functionalOnuGo EtcdDataOnuGo
127 [Setup] Start Logging ONUEtcdDataTest
128 Run Keyword If '${onu_state}'=='tech-profile-config-download-success' or '${onu_state}'=='omci-flows-pushed'
129 ... Do Onu Etcd Data Check
130 ... ELSE Pass Execution ${skip_message} skipped
131 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
132 ... AND Stop Logging ONUEtcdDataTest
133
TorstenThieme109683b2020-09-24 12:35:41 +0000134Onu Flow Check
135 [Documentation] Validates the onu flows in ONOS and Voltha
136 ... Assuming that ONU State Test was executed where all the ONUs are reached the expected state!
mpagenkoc2e7ba52020-11-12 13:50:57 +0000137 [Tags] functionalOnuGo FlowTestOnuGo
TorstenThieme109683b2020-09-24 12:35:41 +0000138 [Setup] Start Logging ONUFlowTest
TorstenThieme66c91a82020-10-19 13:37:53 +0000139 Run Keyword If '${onu_state}'=='omci-flows-pushed' Do Onu Flow Check
TorstenThieme5a205ba2020-09-29 08:08:29 +0000140 ... ELSE Pass Execution ${skip_message} skipped
TorstenThieme109683b2020-09-24 12:35:41 +0000141 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
142 ... AND Stop Logging ONUFlowTest
143
TorstenThiemee3841a02020-09-23 08:20:43 +0000144Disable Enable Onu Device
145 [Documentation] Disables/enables ONU Device and check states
146 ... Assuming that ONU State Test was executed where all the ONUs are reached the expected state!
TorstenThieme66c91a82020-10-19 13:37:53 +0000147 [Tags] functionalOnuGo DisableEnableOnuGo
TorstenThiemee3841a02020-09-23 08:20:43 +0000148 [Setup] Start Logging DisableEnableONUDevice
TorstenThieme66c91a82020-10-19 13:37:53 +0000149 Run Keyword If '${onu_state}'=='tech-profile-config-download-success' or '${onu_state}'=='omci-flows-pushed'
150 ... Do Disable Enable Onu Test
TorstenThieme5a205ba2020-09-29 08:08:29 +0000151 ... ELSE Pass Execution ${skip_message} skipped
TorstenThiemee3841a02020-09-23 08:20:43 +0000152 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
153 ... AND Stop Logging DisableEnableONUDevice
154
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000155Power Off Power On Onu Device
156 [Documentation] Power off and Power on of all ONU Devices and check state
157 ... Assuming that ONU State Test was executed where all the ONUs are reached the expected state!
TorstenThieme66c91a82020-10-19 13:37:53 +0000158 [Tags] functionalOnuGo PowerOffPowerOnOnuGo
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000159 [Setup] Start Logging PowerOffPowerOnONUDevice
TorstenThieme66c91a82020-10-19 13:37:53 +0000160 Run Keyword If '${onu_state}'=='tech-profile-config-download-success' or '${onu_state}'=='omci-flows-pushed'
161 ... Do Power Off Power On Onu Device
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000162 ... ELSE Pass Execution ${skip_message} skipped
163 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
164 ... AND Stop Logging PowerOffPowerOnONUDevice
165
TorstenThieme1fbe8082020-10-21 13:27:59 +0000166Soft Reboot Onu Device
167 [Documentation] Reboots softly all ONU Devices and check state
168 ... Assuming that ONU State Test was executed where all the ONUs are reached the expected state!
169 [Tags] functionalOnuGo SoftRebootOnuGo
170 [Setup] Start Logging SoftRebootONUDevice
171 Run Keyword If '${onu_state}'=='tech-profile-config-download-success' or '${onu_state}'=='omci-flows-pushed'
172 ... Do Soft Reboot Onu Device
173 ... ELSE Pass Execution ${skip_message} skipped
174 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
175 ... AND Stop Logging SoftRebootONUDevice
176
TorstenThieme1619db22020-04-03 12:01:15 +0000177*** Keywords ***
178Setup Suite
179 [Documentation] Set up the test suite
TorstenThieme87cd6202020-09-09 10:01:28 +0000180 ${LogInfo}= Catenate
181 ... \r\nPassed arguments:
TorstenThieme66c91a82020-10-19 13:37:53 +0000182 ... state2test:${state2test}, testmode:${testmode}, techprofile:${techprofile},
TorstenThieme015d5c02020-09-11 09:53:34 +0000183 ... debugmode:${debugmode}, logging:${logging}, pausebeforecleanup:${pausebeforecleanup},
TorstenThiemed4f48962020-12-08 12:17:19 +0000184 ... print2console:${print2console}
TorstenThieme87cd6202020-09-09 10:01:28 +0000185 Log ${LogInfo} console=yes
TorstenThieme1619db22020-04-03 12:01:15 +0000186 Common Test Suite Setup
TorstenThieme5a205ba2020-09-29 08:08:29 +0000187 # prepare skip message in yellow for console log
188 ${skip}= Evaluate "\\033[33mSKIP\\033[0m"
189 ${skipped}= Evaluate "\\033[33m${SPACE*14} ===> Test case above was skipped! <=== ${SPACE*15}\\033[0m"
190 ${skip_message} Catenate ${skipped} | ${skip} |
191 Set Suite Variable ${skip_message}
TorstenThieme440b7c02020-12-18 15:42:57 +0000192 ${all_onu_timeout}= Run Keyword If ${num_all_onus}>4 Calculate Timeout ${timeout}
193 ... ELSE Set Variable ${timeout}
194 Set Suite Variable ${all_onu_timeout}
TorstenThieme1488d772020-09-28 10:52:43 +0000195 ${techprofile}= Set Variable If "${techprofile}"=="1T1GEM" default ${techprofile}
TorstenThieme73850052020-12-10 12:43:28 +0000196 Set Suite Variable ${techprofile}
TorstenThieme87cd6202020-09-09 10:01:28 +0000197 Run Keyword If "${techprofile}"=="default" Log To Console \nTechProfile:default (1T1GEM)
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000198 ... ELSE IF "${techprofile}"=="1T4GEM" Set Tech Profile 1T4GEM
199 ... ELSE IF "${techprofile}"=="1T8GEM" Set Tech Profile 1T8GEM
200 ... ELSE Fail The TechProfile (${techprofile}) is not valid!
201 ${onos_ssh_connection} Open ONOS SSH Connection ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
202 Set Suite Variable ${onos_ssh_connection}
TorstenThieme66c91a82020-10-19 13:37:53 +0000203 # map the passed onu state to reached and make it visible for test suite
204 ${admin_state} ${oper_status} ${connect_status} ${onu_state_nb} ${onu_state}=
205 ... Map State ${state2test}
206 Set Suite Variable ${admin_state}
207 Set Suite Variable ${oper_status}
208 Set Suite Variable ${connect_status}
209 Set Suite Variable ${onu_state_nb}
210 Set Suite Variable ${onu_state}
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000211 # delete etcd MIB Template Data
212 Delete MIB Template Data
TorstenThieme1619db22020-04-03 12:01:15 +0000213
TorstenThiemeb41007d2020-06-22 12:14:12 +0000214Teardown Suite
215 [Documentation] Replaces the Suite Teardown in utils.robot.
216 ... Cleans up and checks all ONU ports disabled in ONOS.
217 ... Furthermore gives the possibility to pause the execution.
218 Run Keyword If ${pausebeforecleanup} Import Library Dialogs
219 Run Keyword If ${pausebeforecleanup} Pause Execution Press OK to continue with clean up!
TorstenThieme87cd6202020-09-09 10:01:28 +0000220 Run Keyword If ${pausebeforecleanup} Log Teardown will be continued... console=yes
TorstenThiemeb41007d2020-06-22 12:14:12 +0000221 Run Keyword If ${teardown_device} Delete All Devices and Verify
TorstenThiemefcafba02020-11-11 16:18:50 +0000222 Validate Onu Data In Etcd 0
TorstenThiemed4f48962020-12-08 12:17:19 +0000223 Wait for Ports in ONOS for all OLTs ${onos_ssh_connection} 0 BBSM ${timeout}
TorstenThieme440b7c02020-12-18 15:42:57 +0000224 Close All ONOS SSH Connections
TorstenThieme87cd6202020-09-09 10:01:28 +0000225 Remove Tech Profile
TorstenThiemeb41007d2020-06-22 12:14:12 +0000226
TorstenThieme1619db22020-04-03 12:01:15 +0000227Setup Test
228 [Documentation] Pre-test Setup
229 #test for empty device list
230 Test Empty Device List
231 Run Keyword If ${has_dataplane} Wait Until Keyword Succeeds 120s 10s Openolt is Up
Suchitra Vemurib7253a52020-07-14 22:35:17 -0700232 ... ${olt_ssh_ip} ${olt_user} ${olt_pass}
TorstenThieme1619db22020-04-03 12:01:15 +0000233 Run Keyword If ${has_dataplane} Sleep 60s
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000234 # Create a list of olt ids (logical and device_id)
235 ${olt_ids} Create List
236 FOR ${I} IN RANGE 0 ${num_olts}
237 #create/preprovision device
238 ${olt_device_id}= Create Device ${list_olts}[${I}][ip] ${OLT_PORT}
239 ${olt_serial_number}= Set Variable ${list_olts}[${I}][sn]
240 #validate olt states
241 Wait Until Keyword Succeeds ${timeout} 5s
242 ... Validate OLT Device PREPROVISIONED UNKNOWN UNKNOWN ${olt_device_id}
243 Sleep 5s
244 ${logical_id}= Get Logical Device ID From SN ${olt_serial_number}
245 ${olt} Create Dictionary device_id ${olt_device_id} logical_id ${logical_id}
246 ... of_id ${of_id} sn ${olt_serial_number}
247 Append To List ${olt_ids} ${olt}
248 END
249 Set Global Variable ${olt_ids}
TorstenThieme1619db22020-04-03 12:01:15 +0000250
TorstenThieme1619db22020-04-03 12:01:15 +0000251Do ONU Up To State Test
252 [Documentation] This keyword performs Up2State Test
253 ... All states up to the passed have to be checked
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000254 FOR ${I} IN RANGE 0 ${num_all_onus}
TorstenThieme1619db22020-04-03 12:01:15 +0000255 ${src}= Set Variable ${hosts.src[${I}]}
256 ${dst}= Set Variable ${hosts.dst[${I}]}
TorstenThieme66c91a82020-10-19 13:37:53 +0000257 Run Keyword If ${onu_state_nb}>=1
TorstenThiemed4f48962020-12-08 12:17:19 +0000258 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${all_onu_timeout} 50ms
TorstenThieme1619db22020-04-03 12:01:15 +0000259 ... Validate Device ENABLED ACTIVATING REACHABLE
260 ... ${src['onu']} onu=True onu_reason=activating-onu
TorstenThieme66c91a82020-10-19 13:37:53 +0000261 Run Keyword If ${onu_state_nb}>=2
TorstenThiemed4f48962020-12-08 12:17:19 +0000262 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${all_onu_timeout} 50ms
TorstenThieme1619db22020-04-03 12:01:15 +0000263 ... Validate Device ENABLED ACTIVATING REACHABLE
264 ... ${src['onu']} onu=True onu_reason=starting-openomci
TorstenThieme66c91a82020-10-19 13:37:53 +0000265 Run Keyword If ${onu_state_nb}>=3
TorstenThiemed4f48962020-12-08 12:17:19 +0000266 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${all_onu_timeout} 50ms
TorstenThieme1619db22020-04-03 12:01:15 +0000267 ... Validate Device ENABLED ACTIVATING REACHABLE
268 ... ${src['onu']} onu=True onu_reason=discovery-mibsync-complete
TorstenThieme66c91a82020-10-19 13:37:53 +0000269 Run Keyword If ${onu_state_nb}>=4
TorstenThiemed4f48962020-12-08 12:17:19 +0000270 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${all_onu_timeout} 50ms
TorstenThieme1619db22020-04-03 12:01:15 +0000271 ... Validate Device ENABLED ACTIVE REACHABLE
272 ... ${src['onu']} onu=True onu_reason=initial-mib-downloaded
TorstenThieme66c91a82020-10-19 13:37:53 +0000273 Run Keyword If ${onu_state_nb}>=5
TorstenThiemed4f48962020-12-08 12:17:19 +0000274 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${all_onu_timeout} 50ms
TorstenThieme1619db22020-04-03 12:01:15 +0000275 ... Validate Device ENABLED ACTIVE REACHABLE
276 ... ${src['onu']} onu=True onu_reason=tech-profile-config-download-success
TorstenThieme66c91a82020-10-19 13:37:53 +0000277 Run Keyword If ${onu_state_nb}>=6
TorstenThiemed4f48962020-12-08 12:17:19 +0000278 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${all_onu_timeout} 50ms
TorstenThieme1619db22020-04-03 12:01:15 +0000279 ... Validate Device ENABLED ACTIVE REACHABLE
280 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
281 END
282
283Do ONU Single State Test
284 [Documentation] This keyword performs SingleState Test
285 ... Only the passed state has to be checked
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000286 FOR ${I} IN RANGE 0 ${num_all_onus}
TorstenThieme1619db22020-04-03 12:01:15 +0000287 ${src}= Set Variable ${hosts.src[${I}]}
288 ${dst}= Set Variable ${hosts.dst[${I}]}
TorstenThiemed4f48962020-12-08 12:17:19 +0000289 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${all_onu_timeout} 50ms
TorstenThieme015d5c02020-09-11 09:53:34 +0000290 ... Validate Device ${admin_state} ${oper_status} ${connect_status}
291 ... ${src['onu']} onu=True onu_reason=${onu_state}
TorstenThieme1619db22020-04-03 12:01:15 +0000292 END
293
TorstenThieme94e4ae42020-05-18 13:01:42 +0000294Do ONU Single State Test Time
295 [Documentation] This keyword performs SingleState Test with calculate running time
296 ... Only the passed state has to be checked and the duration each single onu adapter needed
297 ... will be calculated and printed out
TorstenThieme17becfc2020-10-08 09:46:27 +0000298 #${ListfinishedONUs} Create List
299 #Set Global Variable ${ListfinishedONUs}
TorstenThieme94e4ae42020-05-18 13:01:42 +0000300 Create File ONU_Startup_Time.txt This file contains the startup times of all ONUs.
301 ${list_onus} Create List
TorstenThieme401af432020-06-11 15:53:53 +0000302 Build ONU SN List ${list_onus}
TorstenThiemed4f48962020-12-08 12:17:19 +0000303 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${all_onu_timeout} 50ms
TorstenThieme9949b172020-06-16 10:00:15 +0000304 ... Validate ONU Devices MIB State With Duration
TorstenThiemed4f48962020-12-08 12:17:19 +0000305 ... ${onu_state} ${list_onus} ${timeStart} print2console=${print2console}
TorstenThieme401af432020-06-11 15:53:53 +0000306 ... output_file=ONU_Startup_Time.txt
TorstenThieme94e4ae42020-05-18 13:01:42 +0000307
TorstenThieme1619db22020-04-03 12:01:15 +0000308Do Onu Port Check
TorstenThieme00958682020-06-19 11:29:31 +0000309 [Documentation] Check that all the UNI ports show up in ONOS
TorstenThiemed4f48962020-12-08 12:17:19 +0000310 Wait for Ports in ONOS for all OLTs ${onos_ssh_connection} ${num_all_onus} BBSM
TorstenThieme9949b172020-06-16 10:00:15 +0000311
TorstenThieme17756ea2020-11-11 14:09:47 +0000312Do Onu Etcd Data Check
313 [Documentation] Check Onu data stored in etcd
314 Validate Onu Data In Etcd
315
TorstenThieme109683b2020-09-24 12:35:41 +0000316Do Onu Flow Check
TorstenThieme52ef8392020-11-10 13:42:26 +0000317 [Documentation] This keyword iterate all OLTs and performs Do Onu Flow Checks Per OLT
318 # Check and store vlan rules
319 ${firstvlanrules}= Run Keyword And Continue On Failure Validate Vlan Rules In Etcd
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000320 FOR ${J} IN RANGE 0 ${num_olts}
321 ${olt_serial_number}= Set Variable ${list_olts}[${J}][sn]
322 ${onu_count}= Set Variable ${list_olts}[${J}][onucount]
323 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS
324 ... ${olt_serial_number}
325 Set Global Variable ${of_id}
TorstenThiemed4f48962020-12-08 12:17:19 +0000326 # Verify Default Meter in ONOS (valid only for ATT)
327 Do Onu Subscriber Add Per OLT ${of_id} ${olt_serial_number} ${onu_count}
328 END
329 FOR ${J} IN RANGE 0 ${num_olts}
330 ${olt_serial_number}= Set Variable ${list_olts}[${J}][sn]
331 ${onu_count}= Set Variable ${list_olts}[${J}][onucount]
332 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS
333 ... ${olt_serial_number}
334 Set Global Variable ${of_id}
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000335 ${nni_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
336 ... Get NNI Port in ONOS ${of_id}
337 Set Global Variable ${nni_port}
338 # Verify Default Meter in ONOS (valid only for ATT)
TorstenThiemed4f48962020-12-08 12:17:19 +0000339 Do Onu Flow Check Per OLT ${of_id} ${nni_port} ${olt_serial_number} ${onu_count}
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000340 END
TorstenThieme52ef8392020-11-10 13:42:26 +0000341 #log flows for verification
342 ${flowsresult}= Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT} flows -s
343 log ${flowsresult}
344 #check for previous state is kept (normally omci-flows-pushed)
345 Sleep 10s
TorstenThieme440b7c02020-12-18 15:42:57 +0000346 Run Keyword And Continue On Failure Current State Test All Onus ${state2test}
TorstenThieme52ef8392020-11-10 13:42:26 +0000347 ${secondvlanrules}= Run Keyword And Continue On Failure Validate Vlan Rules In Etcd nbofcookieslice=3
348 ... prevvlanrules=${firstvlanrules}
349 FOR ${J} IN RANGE 0 ${num_olts}
350 ${olt_serial_number}= Set Variable ${list_olts}[${J}][sn]
351 ${onu_count}= Set Variable ${list_olts}[${J}][onucount]
352 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS
353 ... ${olt_serial_number}
354 Set Global Variable ${of_id}
355 ${nni_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
356 ... Get NNI Port in ONOS ${of_id}
357 Set Global Variable ${nni_port}
358 # Verify Default Meter in ONOS (valid only for ATT)
359 Do Onu Subscriber Remove Per OLT ${of_id} ${nni_port} ${olt_serial_number} ${onu_count}
360 END
361 #check for previous state is kept (normally omci-flows-pushed)
362 Sleep 10s
TorstenThiemed4f48962020-12-08 12:17:19 +0000363 Run Keyword If ${print2console} Log \r\nStart State Test All Onus. console=yes
TorstenThieme440b7c02020-12-18 15:42:57 +0000364 Run Keyword And Continue On Failure Current State Test All Onus ${state2test}
TorstenThiemed4f48962020-12-08 12:17:19 +0000365 Run Keyword If ${print2console} Log \r\nFinished State Test All Onus. console=yes
TorstenThieme52ef8392020-11-10 13:42:26 +0000366 Run Keyword And Continue On Failure Validate Vlan Rules In Etcd prevvlanrules=${firstvlanrules}
367 ... setvidequal=True
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000368
TorstenThiemed4f48962020-12-08 12:17:19 +0000369Do Onu Subscriber Add Per OLT
370 [Documentation] Add Subscriber per OLT
371 [Arguments] ${of_id} ${olt_serial_number} ${num_onus}
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000372 FOR ${I} IN RANGE 0 ${num_all_onus}
TorstenThieme109683b2020-09-24 12:35:41 +0000373 ${src}= Set Variable ${hosts.src[${I}]}
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000374 Continue For Loop If "${olt_serial_number}"!="${src['olt']}"
TorstenThieme109683b2020-09-24 12:35:41 +0000375 ${onu_device_id}= Get Device ID From SN ${src['onu']}
376 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
377 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
378 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
379 ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
380 ... volt-add-subscriber-access ${of_id} ${onu_port}
TorstenThiemed4f48962020-12-08 12:17:19 +0000381 Run Keyword If ${print2console} Log \r\n[${I}] volt-add-subscriber-access ${of_id} ${onu_port}.
382 ... console=yes
383 END
384
385Do Onu Flow Check Per OLT
386 [Documentation] Checks all ONU flows show up in ONOS and Voltha
387 [Arguments] ${of_id} ${nni_port} ${olt_serial_number} ${num_onus}
388 FOR ${I} IN RANGE 0 ${num_all_onus}
389 ${src}= Set Variable ${hosts.src[${I}]}
390 Continue For Loop If "${olt_serial_number}"!="${src['olt']}"
391 ${onu_device_id}= Get Device ID From SN ${src['onu']}
392 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
393 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
TorstenThieme109683b2020-09-24 12:35:41 +0000394 # Verify subscriber access flows are added for the ONU port
395 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
396 ... Verify Subscriber Access Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
397 ... ${onu_port} ${nni_port} ${src['c_tag']} ${src['s_tag']}
TorstenThiemed4f48962020-12-08 12:17:19 +0000398 ${logoutput} Catenate \r\n[${I}] Verify Subscriber Access Flows Added For
399 ... ONU ${of_id} ${onu_port} ${src['c_tag']} ${src['s_tag']}.
400 Run Keyword If ${print2console} Log ${logoutput} console=yes
TorstenThieme109683b2020-09-24 12:35:41 +0000401 END
TorstenThieme52ef8392020-11-10 13:42:26 +0000402
403Do Onu Subscriber Remove Per OLT
404 [Documentation] Removes per OLT subscribers in ONOS and Voltha
405 [Arguments] ${of_id} ${nni_port} ${olt_serial_number} ${num_onus}
406 FOR ${I} IN RANGE 0 ${num_all_onus}
407 ${src}= Set Variable ${hosts.src[${I}]}
408 ${dst}= Set Variable ${hosts.dst[${I}]}
409 Continue For Loop If "${olt_serial_number}"!="${src['olt']}"
410 ${onu_device_id}= Get Device ID From SN ${src['onu']}
411 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
412 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
413 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
414 ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
415 ... volt-remove-subscriber-access ${of_id} ${onu_port}
TorstenThiemed4f48962020-12-08 12:17:19 +0000416 Run Keyword If ${print2console} Log \r\n[${I}] volt-remove-subscriber-access ${of_id} ${onu_port}.
417 ... console=yes
TorstenThieme52ef8392020-11-10 13:42:26 +0000418 END
TorstenThieme109683b2020-09-24 12:35:41 +0000419
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000420Do Check Tech Profile
421 [Documentation] This keyword checks the loaded TechProfile
422 ${namespace}= Set Variable default
Andrea Campanella60dde302020-09-09 18:42:56 +0200423 ${podname}= Set Variable etcd
TorstenThiemed4f48962020-12-08 12:17:19 +0000424 ${stackname}= Get Stack Name
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000425 ${commandget} Catenate
TorstenThiemed4f48962020-12-08 12:17:19 +0000426 ... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/${stackname}/technology_profiles/XGS-PON/64'
Holger Hildebrandt23147742020-11-16 10:13:21 +0000427 ${result}= Exec Pod In Kube ${namespace} ${podname} ${commandget}
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000428 ${num_gem_ports}= Set Variable 1
429 ${num_gem_ports}= Set Variable If
430 ... "${techprofile}"=="default" 1
431 ... "${techprofile}"=="1T4GEM" 4
432 ... "${techprofile}"=="1T8GEM" 8
433 @{resultList} Split String ${result} separator=,
434 ${num_of_count_matches}= Get Match Count ${resultList} "num_gem_ports": ${num_gem_ports}
435 ... whitespace_insensitive=True
TorstenThiemea0221942020-12-09 11:35:03 +0000436 ${num_of_expected_matches}= Evaluate ${num_all_onus}
TorstenThiemea0221942020-12-09 11:35:03 +0000437 Should Be Equal As Integers ${num_of_expected_matches} ${num_of_count_matches}
438 ... TechProfile (${TechProfile}) not loaded correctly:${num_of_count_matches} of ${num_of_expected_matches}
TorstenThieme015d5c02020-09-11 09:53:34 +0000439
440Do Disable Enable Onu Test
441 [Documentation] This keyword disables/enables all onus and checks the states.
TorstenThieme1fbe8082020-10-21 13:27:59 +0000442 [Arguments] ${state2check}=${state2test} ${checkstatebeforedisable}=True
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000443 ... ${state2checkafterdisable}=tech-profile-config-delete-success
TorstenThieme440b7c02020-12-18 15:42:57 +0000444 Run Keyword If ${checkstatebeforedisable} Current State Test All Onus ${state2check}
445 Disable Onu Device
TorstenThiemed4f48962020-12-08 12:17:19 +0000446 ${alternative_onu_reason}= Set Variable If
447 ... '${state2checkafterdisable}'=='tech-profile-config-delete-success' omci-flows-deleted
448 ... '${state2checkafterdisable}'=='omci-admin-lock' tech-profile-config-delete-success ${EMPTY}
TorstenThiemec3c23232021-01-13 13:06:31 +0000449 ${alternativeonustates}= Create List ${alternative_onu_reason}
450 Current State Test All Onus ${state2checkafterdisable} alternativeonustate=${alternativeonustates}
TorstenThieme17becfc2020-10-08 09:46:27 +0000451 Log Ports
452 #check no port is enabled in ONOS
TorstenThiemed4f48962020-12-08 12:17:19 +0000453 Wait for Ports in ONOS for all OLTs ${onos_ssh_connection} 0 BBSM
TorstenThieme440b7c02020-12-18 15:42:57 +0000454 Enable Onu Device
455 Current State Test All Onus ${state2check}
TorstenThieme17becfc2020-10-08 09:46:27 +0000456 Log Ports onlyenabled=True
457 #check that all the UNI ports show up in ONOS again
TorstenThiemed4f48962020-12-08 12:17:19 +0000458 Wait for Ports in ONOS for all OLTs ${onos_ssh_connection} ${num_all_onus} BBSM
TorstenThieme015d5c02020-09-11 09:53:34 +0000459
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000460Do Power Off Power On Onu Device
461 [Documentation] This keyword power off/on all onus and checks the states.
TorstenThieme440b7c02020-12-18 15:42:57 +0000462 Power Off ONU Device ${namespace}
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000463 Sleep 5s
TorstenThiemec3c23232021-01-13 13:06:31 +0000464 ${alternativeonustates}= Create List omci-flows-deleted
TorstenThieme440b7c02020-12-18 15:42:57 +0000465 Current State Test All Onus tech-profile-config-delete-success
TorstenThiemec3c23232021-01-13 13:06:31 +0000466 ... ENABLED DISCOVERED UNREACHABLE alternativeonustate=${alternativeonustates}
TorstenThieme440b7c02020-12-18 15:42:57 +0000467 Power On ONU Device ${namespace}
468 Current State Test All Onus ${state2test}
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000469
TorstenThieme1fbe8082020-10-21 13:27:59 +0000470Do Soft Reboot Onu Device
471 [Documentation] This keyword reboots softly all onus and checks the states.
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000472 FOR ${I} IN RANGE 0 ${num_all_onus}
TorstenThieme1fbe8082020-10-21 13:27:59 +0000473 ${src}= Set Variable ${hosts.src[${I}]}
474 ${onu_device_id}= Get Device ID From SN ${src['onu']}
TorstenThiemea0b11602020-10-30 08:39:24 +0000475 Reboot ONU ${onu_device_id} False
TorstenThieme1fbe8082020-10-21 13:27:59 +0000476 END
TorstenThiemec3c23232021-01-13 13:06:31 +0000477 ${alternativeonustates}= Create List omci-flows-deleted
TorstenThieme440b7c02020-12-18 15:42:57 +0000478 Run Keyword Unless ${has_dataplane} Current State Test All Onus tech-profile-config-delete-success
TorstenThiemec3c23232021-01-13 13:06:31 +0000479 ... ENABLED DISCOVERED REACHABLE alternativeonustate=${alternativeonustates}
TorstenThieme73850052020-12-10 12:43:28 +0000480 Sleep 5s
TorstenThiemea0b11602020-10-30 08:39:24 +0000481 Run Keyword Unless ${has_dataplane} Do Disable Enable Onu Test checkstatebeforedisable=False
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000482 ... state2checkafterdisable=omci-admin-lock
TorstenThieme440b7c02020-12-18 15:42:57 +0000483 Run Keyword If ${has_dataplane} Current State Test All Onus omci-flows-pushed
TorstenThiemed4f48962020-12-08 12:17:19 +0000484 Do Onu Port Check