blob: 3b240088c556d7c6ef560383c7a6a8dfa57f5b17 [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
Hardik Windlassa9b38262021-10-27 08:14:22 +000038${INFRA_NAMESPACE} default
TorstenThiemed4f48962020-12-08 12:17:19 +000039${timeout} 60s
TorstenThieme1619db22020-04-03 12:01:15 +000040${of_id} 0
41${logical_id} 0
42${has_dataplane} True
43${external_libs} True
44${teardown_device} True
45${scripts} ../../scripts
46# Per-test logging on failure is turned off by default; set this variable to enable
47${container_log_dir} ${None}
TorstenThieme3385cdc2021-02-04 13:50:50 +000048# KV Store Prefix
49# example: -v kvstoreprefix:voltha_voltha
50${kvstoreprefix} voltha_voltha
TorstenThiemee0e5bba2020-08-05 11:20:13 +000051# state to test variable, can be passed via the command line too, valid values: 1-6
52# 1 -> activating-onu
53# 2 -> starting-openomci
54# 3 -> discovery-mibsync-complete
55# 4 -> initial-mib-downloaded
56# 5 -> tech-profile-config-download-success
57# 6 -> omci-flows-pushed
TorstenThieme87cd6202020-09-09 10:01:28 +000058# example: -v state2test:5
TorstenThieme66c91a82020-10-19 13:37:53 +000059# example: -v state2test:omci-flows-pushed
TorstenThieme1619db22020-04-03 12:01:15 +000060${state2test} 6
TorstenThiemee0e5bba2020-08-05 11:20:13 +000061# test mode variable, can be passed via the command line too, valid values: SingleState, Up2State, SingleStateTime
TorstenThieme87cd6202020-09-09 10:01:28 +000062# example: -v testmode:SingleStateTime
TorstenThieme1619db22020-04-03 12:01:15 +000063${testmode} SingleState
TorstenThieme87cd6202020-09-09 10:01:28 +000064# used tech profile, can be passed via the command line too, valid values: default (=1T1GEM), 1T4GEM, 1T8GEM
65# example: -v techprofile:1T4GEM
TorstenThiemee0e5bba2020-08-05 11:20:13 +000066${techprofile} default
TorstenThiemee0e5bba2020-08-05 11:20:13 +000067# flag debugmode is used, if true timeout calculation various, can be passed via the command line too
TorstenThieme87cd6202020-09-09 10:01:28 +000068# example: -v debugmode:True
TorstenThieme401af432020-06-11 15:53:53 +000069${debugmode} False
TorstenThiemee0e5bba2020-08-05 11:20:13 +000070# logging flag to enable Collect Logs, can be passed via the command line too
TorstenThieme87cd6202020-09-09 10:01:28 +000071# example: -v logging:True
TorstenThieme5e324e42020-07-27 09:36:16 +000072${logging} False
TorstenThieme66c91a82020-10-19 13:37:53 +000073# 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 +000074# example: -v pausebeforecleanup:True
TorstenThiemeb41007d2020-06-22 12:14:12 +000075${pausebeforecleanup} False
TorstenThiemed4f48962020-12-08 12:17:19 +000076# if True some outputs to console are done during running tests e.g. long duration flow test
77# example: -v print2console:True
78${print2console} False
TorstenThiemee0e5bba2020-08-05 11:20:13 +000079${data_dir} ../data
80
TorstenThieme1619db22020-04-03 12:01:15 +000081
82*** Test Cases ***
83ONU State Test
84 [Documentation] Validates the ONU Go adapter states
TorstenThieme66c91a82020-10-19 13:37:53 +000085 [Tags] sanityOnuGo StateTestOnuGo
TorstenThieme1619db22020-04-03 12:01:15 +000086 [Setup] Run Keywords Start Logging ONUStateTest
87 ... AND Setup Test
88 Run Keyword If ${has_dataplane} Clean Up Linux
TorstenThiemefd7e7ba2020-11-06 13:57:57 +000089 FOR ${I} IN RANGE 0 ${num_olts}
90 #get olt serial number
91 ${olt_serial_number}= Set Variable ${list_olts}[${I}][sn]
92 #validate olt states
93 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
94 Enable Device ${olt_device_id}
95 END
TorstenThieme94e4ae42020-05-18 13:01:42 +000096 ${timeStart} = Get Current Date
97 Set Global Variable ${timeStart}
TorstenThieme1619db22020-04-03 12:01:15 +000098 Run Keyword If "${testmode}"=="SingleState" Do ONU Single State Test
99 ... ELSE IF "${testmode}"=="Up2State" Do ONU Up To State Test
TorstenThieme94e4ae42020-05-18 13:01:42 +0000100 ... ELSE IF "${testmode}"=="SingleStateTime" Do ONU Single State Test Time
TorstenThieme1619db22020-04-03 12:01:15 +0000101 ... ELSE Fail The testmode (${testmode}) is not valid!
TorstenThieme5e324e42020-07-27 09:36:16 +0000102 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
TorstenThieme1619db22020-04-03 12:01:15 +0000103 ... AND Stop Logging ONUStateTest
104
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000105Check Loaded Tech Profile
106 [Documentation] Validates the loaded Tech Profile
107 ... Assuming that ONU State Test was executed where all the ONUs are reached the expected state!
108 ... Check will be executed only the reached ONU state is 5 (tech-profile-config-download-success) or higher
TorstenThieme66c91a82020-10-19 13:37:53 +0000109 [Tags] functionalOnuGo CheckTechProfileOnuGo
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000110 [Setup] Start Logging ONUCheckTechProfile
TorstenThieme66c91a82020-10-19 13:37:53 +0000111 Run Keyword If '${onu_state}'=='tech-profile-config-download-success' or '${onu_state}'=='omci-flows-pushed'
112 ... Do Check Tech Profile
TorstenThieme5a205ba2020-09-29 08:08:29 +0000113 ... ELSE Pass Execution ${skip_message} skipped
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000114 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
115 ... AND Stop Logging ONUCheckTechProfile
116
TorstenThieme401af432020-06-11 15:53:53 +0000117Onu Port Check
TorstenThieme87cd6202020-09-09 10:01:28 +0000118 [Documentation] Validates that all the UNI ports show up in ONOS
TorstenThieme00958682020-06-19 11:29:31 +0000119 ... Assuming that ONU State Test was executed where all the ONUs are reached the expected state!
TorstenThieme66c91a82020-10-19 13:37:53 +0000120 [Tags] functionalOnuGo PortTestOnuGo
TorstenThieme401af432020-06-11 15:53:53 +0000121 [Setup] Start Logging ONUPortTest
TorstenThiemed4f48962020-12-08 12:17:19 +0000122 Run Keyword If '${onu_state}'=='tech-profile-config-download-success' or '${onu_state}'=='omci-flows-pushed'
123 ... Do Onu Port Check
124 ... ELSE Pass Execution ${skip_message} skipped
TorstenThieme5e324e42020-07-27 09:36:16 +0000125 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
TorstenThieme401af432020-06-11 15:53:53 +0000126 ... AND Stop Logging ONUPortTest
127
TorstenThieme17756ea2020-11-11 14:09:47 +0000128Onu Etcd Data Check
129 [Documentation] Validates ONU data stored in ETCD
130 ... Assuming that ONU State Test was executed where all the ONUs are reached the expected state!
131 [Tags] functionalOnuGo EtcdDataOnuGo
132 [Setup] Start Logging ONUEtcdDataTest
133 Run Keyword If '${onu_state}'=='tech-profile-config-download-success' or '${onu_state}'=='omci-flows-pushed'
134 ... Do Onu Etcd Data Check
135 ... ELSE Pass Execution ${skip_message} skipped
136 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
137 ... AND Stop Logging ONUEtcdDataTest
138
TorstenThieme109683b2020-09-24 12:35:41 +0000139Onu Flow Check
140 [Documentation] Validates the onu flows in ONOS and Voltha
141 ... Assuming that ONU State Test was executed where all the ONUs are reached the expected state!
mpagenkoc2e7ba52020-11-12 13:50:57 +0000142 [Tags] functionalOnuGo FlowTestOnuGo
TorstenThieme109683b2020-09-24 12:35:41 +0000143 [Setup] Start Logging ONUFlowTest
TorstenThieme66c91a82020-10-19 13:37:53 +0000144 Run Keyword If '${onu_state}'=='omci-flows-pushed' Do Onu Flow Check
TorstenThieme5a205ba2020-09-29 08:08:29 +0000145 ... ELSE Pass Execution ${skip_message} skipped
TorstenThieme109683b2020-09-24 12:35:41 +0000146 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
147 ... AND Stop Logging ONUFlowTest
148
TorstenThiemee3841a02020-09-23 08:20:43 +0000149Disable Enable Onu Device
150 [Documentation] Disables/enables ONU Device and check states
151 ... Assuming that ONU State Test was executed where all the ONUs are reached the expected state!
TorstenThieme66c91a82020-10-19 13:37:53 +0000152 [Tags] functionalOnuGo DisableEnableOnuGo
TorstenThiemee3841a02020-09-23 08:20:43 +0000153 [Setup] Start Logging DisableEnableONUDevice
TorstenThieme66c91a82020-10-19 13:37:53 +0000154 Run Keyword If '${onu_state}'=='tech-profile-config-download-success' or '${onu_state}'=='omci-flows-pushed'
155 ... Do Disable Enable Onu Test
TorstenThieme5a205ba2020-09-29 08:08:29 +0000156 ... ELSE Pass Execution ${skip_message} skipped
TorstenThiemee3841a02020-09-23 08:20:43 +0000157 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
158 ... AND Stop Logging DisableEnableONUDevice
159
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000160Power Off Power On Onu Device
161 [Documentation] Power off and Power on of all ONU Devices and check state
162 ... Assuming that ONU State Test was executed where all the ONUs are reached the expected state!
TorstenThieme66c91a82020-10-19 13:37:53 +0000163 [Tags] functionalOnuGo PowerOffPowerOnOnuGo
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000164 [Setup] Start Logging PowerOffPowerOnONUDevice
TorstenThieme66c91a82020-10-19 13:37:53 +0000165 Run Keyword If '${onu_state}'=='tech-profile-config-download-success' or '${onu_state}'=='omci-flows-pushed'
166 ... Do Power Off Power On Onu Device
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000167 ... ELSE Pass Execution ${skip_message} skipped
168 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
169 ... AND Stop Logging PowerOffPowerOnONUDevice
170
TorstenThieme1fbe8082020-10-21 13:27:59 +0000171Soft Reboot Onu Device
172 [Documentation] Reboots softly all ONU Devices and check state
173 ... Assuming that ONU State Test was executed where all the ONUs are reached the expected state!
174 [Tags] functionalOnuGo SoftRebootOnuGo
175 [Setup] Start Logging SoftRebootONUDevice
176 Run Keyword If '${onu_state}'=='tech-profile-config-download-success' or '${onu_state}'=='omci-flows-pushed'
177 ... Do Soft Reboot Onu Device
178 ... ELSE Pass Execution ${skip_message} skipped
179 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
180 ... AND Stop Logging SoftRebootONUDevice
181
TorstenThieme1619db22020-04-03 12:01:15 +0000182*** Keywords ***
183Setup Suite
184 [Documentation] Set up the test suite
Andrea Campanellade6ee322021-11-05 12:01:15 +0100185 Start Logging Setup or Teardown Setup-${SUITE NAME}
TorstenThieme87cd6202020-09-09 10:01:28 +0000186 ${LogInfo}= Catenate
187 ... \r\nPassed arguments:
TorstenThieme66c91a82020-10-19 13:37:53 +0000188 ... state2test:${state2test}, testmode:${testmode}, techprofile:${techprofile},
TorstenThieme015d5c02020-09-11 09:53:34 +0000189 ... debugmode:${debugmode}, logging:${logging}, pausebeforecleanup:${pausebeforecleanup},
TorstenThieme47983692021-06-17 10:43:35 +0000190 ... print2console:${print2console}, kvstoreprefix:${kvstoreprefix}
TorstenThieme87cd6202020-09-09 10:01:28 +0000191 Log ${LogInfo} console=yes
TorstenThieme1619db22020-04-03 12:01:15 +0000192 Common Test Suite Setup
TorstenThieme5a205ba2020-09-29 08:08:29 +0000193 # prepare skip message in yellow for console log
194 ${skip}= Evaluate "\\033[33mSKIP\\033[0m"
195 ${skipped}= Evaluate "\\033[33m${SPACE*14} ===> Test case above was skipped! <=== ${SPACE*15}\\033[0m"
196 ${skip_message} Catenate ${skipped} | ${skip} |
197 Set Suite Variable ${skip_message}
TorstenThieme440b7c02020-12-18 15:42:57 +0000198 ${all_onu_timeout}= Run Keyword If ${num_all_onus}>4 Calculate Timeout ${timeout}
199 ... ELSE Set Variable ${timeout}
200 Set Suite Variable ${all_onu_timeout}
TorstenThieme1488d772020-09-28 10:52:43 +0000201 ${techprofile}= Set Variable If "${techprofile}"=="1T1GEM" default ${techprofile}
TorstenThieme73850052020-12-10 12:43:28 +0000202 Set Suite Variable ${techprofile}
TorstenThieme87cd6202020-09-09 10:01:28 +0000203 Run Keyword If "${techprofile}"=="default" Log To Console \nTechProfile:default (1T1GEM)
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000204 ... ELSE IF "${techprofile}"=="1T4GEM" Set Tech Profile 1T4GEM
205 ... ELSE IF "${techprofile}"=="1T8GEM" Set Tech Profile 1T8GEM
206 ... ELSE Fail The TechProfile (${techprofile}) is not valid!
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
TorstenThieme45071602021-03-16 12:14:37 +0000217 # delete etcd onu data
218 Delete ONU Go Adapter ETCD Data validate=True
Andrea Campanellade6ee322021-11-05 12:01:15 +0100219 Run Keyword If ${logging} Collect Logs
220 Stop Logging Setup or Teardown Setup-${SUITE NAME}
TorstenThieme1619db22020-04-03 12:01:15 +0000221
TorstenThiemeb41007d2020-06-22 12:14:12 +0000222Teardown Suite
223 [Documentation] Replaces the Suite Teardown in utils.robot.
224 ... Cleans up and checks all ONU ports disabled in ONOS.
225 ... Furthermore gives the possibility to pause the execution.
Andrea Campanellade6ee322021-11-05 12:01:15 +0100226 Start Logging Setup or Teardown Teardown-${SUITE NAME}
TorstenThiemeb41007d2020-06-22 12:14:12 +0000227 Run Keyword If ${pausebeforecleanup} Import Library Dialogs
228 Run Keyword If ${pausebeforecleanup} Pause Execution Press OK to continue with clean up!
TorstenThieme87cd6202020-09-09 10:01:28 +0000229 Run Keyword If ${pausebeforecleanup} Log Teardown will be continued... console=yes
TorstenThiemeb41007d2020-06-22 12:14:12 +0000230 Run Keyword If ${teardown_device} Delete All Devices and Verify
TorstenThieme45071602021-03-16 12:14:37 +0000231 Wait Until Keyword Succeeds ${timeout} 1s Validate Onu Data In Etcd 0 ${kvstoreprefix} without_pm_data=False
TorstenThieme731a7592021-07-01 14:26:54 +0000232 Wait for Ports in ONOS for all OLTs ${ONOS_SSH_IP} ${ONOS_SSH_PORT} 0 BBSM ${timeout}
Andrea Campanellade6ee322021-11-05 12:01:15 +0100233 Run Keyword If ${logging} Collect Logs
TorstenThieme440b7c02020-12-18 15:42:57 +0000234 Close All ONOS SSH Connections
TorstenThieme87cd6202020-09-09 10:01:28 +0000235 Remove Tech Profile
Andrea Campanellade6ee322021-11-05 12:01:15 +0100236 Stop Logging Setup or Teardown Teardown-${SUITE NAME}
TorstenThiemeb41007d2020-06-22 12:14:12 +0000237
TorstenThieme1619db22020-04-03 12:01:15 +0000238Setup Test
239 [Documentation] Pre-test Setup
240 #test for empty device list
241 Test Empty Device List
242 Run Keyword If ${has_dataplane} Wait Until Keyword Succeeds 120s 10s Openolt is Up
Suchitra Vemurib7253a52020-07-14 22:35:17 -0700243 ... ${olt_ssh_ip} ${olt_user} ${olt_pass}
TorstenThieme1619db22020-04-03 12:01:15 +0000244 Run Keyword If ${has_dataplane} Sleep 60s
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000245 # Create a list of olt ids (logical and device_id)
246 ${olt_ids} Create List
247 FOR ${I} IN RANGE 0 ${num_olts}
248 #create/preprovision device
Andrea Campanella3dcce272021-01-15 16:04:47 +0100249 ${olt_device_id}= Run Keyword If "${list_olts}[${I}][type]" == "${None}"
TorstenThieme44136642021-02-12 13:41:17 +0000250 ... Create Device ${list_olts}[${I}][ip] ${list_olts}[${I}][oltport]
251 ... ELSE Create Device ${list_olts}[${I}][ip] ${list_olts}[${I}][oltport] ${list_olts}[${I}][type]
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000252 ${olt_serial_number}= Set Variable ${list_olts}[${I}][sn]
253 #validate olt states
254 Wait Until Keyword Succeeds ${timeout} 5s
Hardik Windlass8b446492021-06-10 06:25:23 +0000255 ... Validate OLT Device PREPROVISIONED UNKNOWN UNKNOWN ${olt_device_id} by_dev_id=True
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000256 Sleep 5s
257 ${logical_id}= Get Logical Device ID From SN ${olt_serial_number}
258 ${olt} Create Dictionary device_id ${olt_device_id} logical_id ${logical_id}
259 ... of_id ${of_id} sn ${olt_serial_number}
260 Append To List ${olt_ids} ${olt}
261 END
262 Set Global Variable ${olt_ids}
TorstenThieme1619db22020-04-03 12:01:15 +0000263
TorstenThieme1619db22020-04-03 12:01:15 +0000264Do ONU Up To State Test
265 [Documentation] This keyword performs Up2State Test
266 ... All states up to the passed have to be checked
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000267 FOR ${I} IN RANGE 0 ${num_all_onus}
TorstenThieme1619db22020-04-03 12:01:15 +0000268 ${src}= Set Variable ${hosts.src[${I}]}
269 ${dst}= Set Variable ${hosts.dst[${I}]}
TorstenThieme66c91a82020-10-19 13:37:53 +0000270 Run Keyword If ${onu_state_nb}>=1
TorstenThiemed4f48962020-12-08 12:17:19 +0000271 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${all_onu_timeout} 50ms
TorstenThieme1619db22020-04-03 12:01:15 +0000272 ... Validate Device ENABLED ACTIVATING REACHABLE
273 ... ${src['onu']} onu=True onu_reason=activating-onu
TorstenThieme66c91a82020-10-19 13:37:53 +0000274 Run Keyword If ${onu_state_nb}>=2
TorstenThiemed4f48962020-12-08 12:17:19 +0000275 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${all_onu_timeout} 50ms
TorstenThieme1619db22020-04-03 12:01:15 +0000276 ... Validate Device ENABLED ACTIVATING REACHABLE
277 ... ${src['onu']} onu=True onu_reason=starting-openomci
TorstenThieme66c91a82020-10-19 13:37:53 +0000278 Run Keyword If ${onu_state_nb}>=3
TorstenThiemed4f48962020-12-08 12:17:19 +0000279 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${all_onu_timeout} 50ms
TorstenThieme1619db22020-04-03 12:01:15 +0000280 ... Validate Device ENABLED ACTIVATING REACHABLE
281 ... ${src['onu']} onu=True onu_reason=discovery-mibsync-complete
TorstenThieme66c91a82020-10-19 13:37:53 +0000282 Run Keyword If ${onu_state_nb}>=4
TorstenThiemed4f48962020-12-08 12:17:19 +0000283 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${all_onu_timeout} 50ms
TorstenThieme1619db22020-04-03 12:01:15 +0000284 ... Validate Device ENABLED ACTIVE REACHABLE
285 ... ${src['onu']} onu=True onu_reason=initial-mib-downloaded
TorstenThieme66c91a82020-10-19 13:37:53 +0000286 Run Keyword If ${onu_state_nb}>=5
TorstenThiemed4f48962020-12-08 12:17:19 +0000287 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${all_onu_timeout} 50ms
TorstenThieme1619db22020-04-03 12:01:15 +0000288 ... Validate Device ENABLED ACTIVE REACHABLE
289 ... ${src['onu']} onu=True onu_reason=tech-profile-config-download-success
TorstenThieme66c91a82020-10-19 13:37:53 +0000290 Run Keyword If ${onu_state_nb}>=6
TorstenThiemed4f48962020-12-08 12:17:19 +0000291 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${all_onu_timeout} 50ms
TorstenThieme1619db22020-04-03 12:01:15 +0000292 ... Validate Device ENABLED ACTIVE REACHABLE
293 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
294 END
295
296Do ONU Single State Test
297 [Documentation] This keyword performs SingleState Test
298 ... Only the passed state has to be checked
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000299 FOR ${I} IN RANGE 0 ${num_all_onus}
TorstenThieme1619db22020-04-03 12:01:15 +0000300 ${src}= Set Variable ${hosts.src[${I}]}
301 ${dst}= Set Variable ${hosts.dst[${I}]}
TorstenThiemed4f48962020-12-08 12:17:19 +0000302 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${all_onu_timeout} 50ms
TorstenThieme015d5c02020-09-11 09:53:34 +0000303 ... Validate Device ${admin_state} ${oper_status} ${connect_status}
304 ... ${src['onu']} onu=True onu_reason=${onu_state}
TorstenThieme1619db22020-04-03 12:01:15 +0000305 END
306
TorstenThieme94e4ae42020-05-18 13:01:42 +0000307Do ONU Single State Test Time
308 [Documentation] This keyword performs SingleState Test with calculate running time
309 ... Only the passed state has to be checked and the duration each single onu adapter needed
310 ... will be calculated and printed out
TorstenThieme17becfc2020-10-08 09:46:27 +0000311 #${ListfinishedONUs} Create List
312 #Set Global Variable ${ListfinishedONUs}
TorstenThieme94e4ae42020-05-18 13:01:42 +0000313 Create File ONU_Startup_Time.txt This file contains the startup times of all ONUs.
314 ${list_onus} Create List
TorstenThieme401af432020-06-11 15:53:53 +0000315 Build ONU SN List ${list_onus}
TorstenThiemed4f48962020-12-08 12:17:19 +0000316 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${all_onu_timeout} 50ms
TorstenThieme9949b172020-06-16 10:00:15 +0000317 ... Validate ONU Devices MIB State With Duration
TorstenThiemed4f48962020-12-08 12:17:19 +0000318 ... ${onu_state} ${list_onus} ${timeStart} print2console=${print2console}
TorstenThieme401af432020-06-11 15:53:53 +0000319 ... output_file=ONU_Startup_Time.txt
TorstenThieme94e4ae42020-05-18 13:01:42 +0000320
TorstenThieme1619db22020-04-03 12:01:15 +0000321Do Onu Port Check
TorstenThieme00958682020-06-19 11:29:31 +0000322 [Documentation] Check that all the UNI ports show up in ONOS
TorstenThieme731a7592021-07-01 14:26:54 +0000323 Wait for Ports in ONOS for all OLTs ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${num_all_onus} BBSM ${timeout}
TorstenThieme9949b172020-06-16 10:00:15 +0000324
TorstenThieme17756ea2020-11-11 14:09:47 +0000325Do Onu Etcd Data Check
326 [Documentation] Check Onu data stored in etcd
TorstenThieme3385cdc2021-02-04 13:50:50 +0000327 Validate Onu Data In Etcd defaultkvstoreprefix=${kvstoreprefix}
TorstenThieme17756ea2020-11-11 14:09:47 +0000328
TorstenThieme109683b2020-09-24 12:35:41 +0000329Do Onu Flow Check
TorstenThieme52ef8392020-11-10 13:42:26 +0000330 [Documentation] This keyword iterate all OLTs and performs Do Onu Flow Checks Per OLT
331 # Check and store vlan rules
332 ${firstvlanrules}= Run Keyword And Continue On Failure Validate Vlan Rules In Etcd
TorstenThieme3385cdc2021-02-04 13:50:50 +0000333 ... defaultkvstoreprefix=${kvstoreprefix}
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000334 FOR ${J} IN RANGE 0 ${num_olts}
335 ${olt_serial_number}= Set Variable ${list_olts}[${J}][sn]
336 ${onu_count}= Set Variable ${list_olts}[${J}][onucount]
337 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS
338 ... ${olt_serial_number}
339 Set Global Variable ${of_id}
TorstenThiemed4f48962020-12-08 12:17:19 +0000340 # Verify Default Meter in ONOS (valid only for ATT)
341 Do Onu Subscriber Add Per OLT ${of_id} ${olt_serial_number} ${onu_count}
342 END
343 FOR ${J} IN RANGE 0 ${num_olts}
344 ${olt_serial_number}= Set Variable ${list_olts}[${J}][sn]
345 ${onu_count}= Set Variable ${list_olts}[${J}][onucount]
346 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS
347 ... ${olt_serial_number}
348 Set Global Variable ${of_id}
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000349 ${nni_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
350 ... Get NNI Port in ONOS ${of_id}
351 Set Global Variable ${nni_port}
352 # Verify Default Meter in ONOS (valid only for ATT)
TorstenThiemed4f48962020-12-08 12:17:19 +0000353 Do Onu Flow Check Per OLT ${of_id} ${nni_port} ${olt_serial_number} ${onu_count}
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000354 END
TorstenThieme52ef8392020-11-10 13:42:26 +0000355 #log flows for verification
TorstenThieme4e2168e2021-06-22 14:01:47 +0000356 ${flowsresult}= Execute ONOS CLI Command use single connection ${ONOS_SSH_IP} ${ONOS_SSH_PORT} flows -s
TorstenThieme52ef8392020-11-10 13:42:26 +0000357 log ${flowsresult}
358 #check for previous state is kept (normally omci-flows-pushed)
359 Sleep 10s
TorstenThieme440b7c02020-12-18 15:42:57 +0000360 Run Keyword And Continue On Failure Current State Test All Onus ${state2test}
TorstenThieme52ef8392020-11-10 13:42:26 +0000361 ${secondvlanrules}= Run Keyword And Continue On Failure Validate Vlan Rules In Etcd nbofcookieslice=3
TorstenThieme3385cdc2021-02-04 13:50:50 +0000362 ... prevvlanrules=${firstvlanrules} defaultkvstoreprefix=${kvstoreprefix}
TorstenThieme52ef8392020-11-10 13:42:26 +0000363 FOR ${J} IN RANGE 0 ${num_olts}
364 ${olt_serial_number}= Set Variable ${list_olts}[${J}][sn]
365 ${onu_count}= Set Variable ${list_olts}[${J}][onucount]
366 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS
367 ... ${olt_serial_number}
368 Set Global Variable ${of_id}
369 ${nni_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
370 ... Get NNI Port in ONOS ${of_id}
371 Set Global Variable ${nni_port}
372 # Verify Default Meter in ONOS (valid only for ATT)
373 Do Onu Subscriber Remove Per OLT ${of_id} ${nni_port} ${olt_serial_number} ${onu_count}
374 END
375 #check for previous state is kept (normally omci-flows-pushed)
376 Sleep 10s
TorstenThiemed4f48962020-12-08 12:17:19 +0000377 Run Keyword If ${print2console} Log \r\nStart State Test All Onus. console=yes
TorstenThieme440b7c02020-12-18 15:42:57 +0000378 Run Keyword And Continue On Failure Current State Test All Onus ${state2test}
TorstenThiemed4f48962020-12-08 12:17:19 +0000379 Run Keyword If ${print2console} Log \r\nFinished State Test All Onus. console=yes
TorstenThieme52ef8392020-11-10 13:42:26 +0000380 Run Keyword And Continue On Failure Validate Vlan Rules In Etcd prevvlanrules=${firstvlanrules}
TorstenThieme3385cdc2021-02-04 13:50:50 +0000381 ... setvidequal=True defaultkvstoreprefix=${kvstoreprefix}
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000382
TorstenThiemed4f48962020-12-08 12:17:19 +0000383Do Onu Subscriber Add Per OLT
384 [Documentation] Add Subscriber per OLT
385 [Arguments] ${of_id} ${olt_serial_number} ${num_onus}
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000386 FOR ${I} IN RANGE 0 ${num_all_onus}
TorstenThieme109683b2020-09-24 12:35:41 +0000387 ${src}= Set Variable ${hosts.src[${I}]}
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000388 Continue For Loop If "${olt_serial_number}"!="${src['olt']}"
TorstenThieme109683b2020-09-24 12:35:41 +0000389 ${onu_device_id}= Get Device ID From SN ${src['onu']}
390 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
391 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
392 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
TorstenThieme4e2168e2021-06-22 14:01:47 +0000393 ... Execute ONOS CLI Command use single connection ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
TorstenThieme109683b2020-09-24 12:35:41 +0000394 ... volt-add-subscriber-access ${of_id} ${onu_port}
TorstenThiemed4f48962020-12-08 12:17:19 +0000395 Run Keyword If ${print2console} Log \r\n[${I}] volt-add-subscriber-access ${of_id} ${onu_port}.
396 ... console=yes
397 END
398
399Do Onu Flow Check Per OLT
400 [Documentation] Checks all ONU flows show up in ONOS and Voltha
401 [Arguments] ${of_id} ${nni_port} ${olt_serial_number} ${num_onus}
402 FOR ${I} IN RANGE 0 ${num_all_onus}
403 ${src}= Set Variable ${hosts.src[${I}]}
404 Continue For Loop If "${olt_serial_number}"!="${src['olt']}"
405 ${onu_device_id}= Get Device ID From SN ${src['onu']}
406 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
407 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
TorstenThieme109683b2020-09-24 12:35:41 +0000408 # Verify subscriber access flows are added for the ONU port
409 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
410 ... Verify Subscriber Access Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
411 ... ${onu_port} ${nni_port} ${src['c_tag']} ${src['s_tag']}
TorstenThiemed4f48962020-12-08 12:17:19 +0000412 ${logoutput} Catenate \r\n[${I}] Verify Subscriber Access Flows Added For
413 ... ONU ${of_id} ${onu_port} ${src['c_tag']} ${src['s_tag']}.
414 Run Keyword If ${print2console} Log ${logoutput} console=yes
TorstenThieme109683b2020-09-24 12:35:41 +0000415 END
TorstenThieme52ef8392020-11-10 13:42:26 +0000416
417Do Onu Subscriber Remove Per OLT
418 [Documentation] Removes per OLT subscribers in ONOS and Voltha
419 [Arguments] ${of_id} ${nni_port} ${olt_serial_number} ${num_onus}
420 FOR ${I} IN RANGE 0 ${num_all_onus}
421 ${src}= Set Variable ${hosts.src[${I}]}
422 ${dst}= Set Variable ${hosts.dst[${I}]}
423 Continue For Loop If "${olt_serial_number}"!="${src['olt']}"
424 ${onu_device_id}= Get Device ID From SN ${src['onu']}
425 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
426 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
427 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
TorstenThieme4e2168e2021-06-22 14:01:47 +0000428 ... Execute ONOS CLI Command use single connection ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
TorstenThieme52ef8392020-11-10 13:42:26 +0000429 ... volt-remove-subscriber-access ${of_id} ${onu_port}
TorstenThiemed4f48962020-12-08 12:17:19 +0000430 Run Keyword If ${print2console} Log \r\n[${I}] volt-remove-subscriber-access ${of_id} ${onu_port}.
431 ... console=yes
TorstenThieme52ef8392020-11-10 13:42:26 +0000432 END
TorstenThieme109683b2020-09-24 12:35:41 +0000433
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000434Do Check Tech Profile
435 [Documentation] This keyword checks the loaded TechProfile
436 ${namespace}= Set Variable default
Andrea Campanella60dde302020-09-09 18:42:56 +0200437 ${podname}= Set Variable etcd
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000438 ${commandget} Catenate
TorstenThieme2980d8c2021-06-24 10:11:48 +0000439 ... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/voltha/technology_profiles/XGS-PON/64'
Holger Hildebrandt23147742020-11-16 10:13:21 +0000440 ${result}= Exec Pod In Kube ${namespace} ${podname} ${commandget}
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000441 ${num_gem_ports}= Set Variable 1
442 ${num_gem_ports}= Set Variable If
443 ... "${techprofile}"=="default" 1
444 ... "${techprofile}"=="1T4GEM" 4
445 ... "${techprofile}"=="1T8GEM" 8
TorstenThieme9362c732021-06-25 08:25:51 +0000446 ${length}= Get Length ${result}
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000447 @{resultList} Split String ${result} separator=,
448 ${num_of_count_matches}= Get Match Count ${resultList} "num_gem_ports": ${num_gem_ports}
449 ... whitespace_insensitive=True
TorstenThieme9362c732021-06-25 08:25:51 +0000450 # In case of default tech profile (1T1GEM) no file have to exist, so no entry will be found, but in case of a file is
451 # available corresponding entry has to be found!
452 ${num_of_expected_matches}= Set Variable If "${techprofile}"!="default" or ${length}>0 1 0
TorstenThiemea0221942020-12-09 11:35:03 +0000453 Should Be Equal As Integers ${num_of_expected_matches} ${num_of_count_matches}
TorstenThieme2980d8c2021-06-24 10:11:48 +0000454 ... TechProfile (${TechProfile}) not loaded correctly: found(${num_of_count_matches}) expected(${num_of_expected_matches})
TorstenThieme015d5c02020-09-11 09:53:34 +0000455
456Do Disable Enable Onu Test
457 [Documentation] This keyword disables/enables all onus and checks the states.
TorstenThieme1fbe8082020-10-21 13:27:59 +0000458 [Arguments] ${state2check}=${state2test} ${checkstatebeforedisable}=True
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000459 ... ${state2checkafterdisable}=tech-profile-config-delete-success
TorstenThieme440b7c02020-12-18 15:42:57 +0000460 Run Keyword If ${checkstatebeforedisable} Current State Test All Onus ${state2check}
461 Disable Onu Device
TorstenThiemed4f48962020-12-08 12:17:19 +0000462 ${alternative_onu_reason}= Set Variable If
463 ... '${state2checkafterdisable}'=='tech-profile-config-delete-success' omci-flows-deleted
464 ... '${state2checkafterdisable}'=='omci-admin-lock' tech-profile-config-delete-success ${EMPTY}
TorstenThiemec3c23232021-01-13 13:06:31 +0000465 ${alternativeonustates}= Create List ${alternative_onu_reason}
466 Current State Test All Onus ${state2checkafterdisable} alternativeonustate=${alternativeonustates}
TorstenThieme17becfc2020-10-08 09:46:27 +0000467 Log Ports
468 #check no port is enabled in ONOS
TorstenThieme731a7592021-07-01 14:26:54 +0000469 Wait for Ports in ONOS for all OLTs ${ONOS_SSH_IP} ${ONOS_SSH_PORT} 0 BBSM
TorstenThieme440b7c02020-12-18 15:42:57 +0000470 Enable Onu Device
471 Current State Test All Onus ${state2check}
TorstenThieme17becfc2020-10-08 09:46:27 +0000472 Log Ports onlyenabled=True
473 #check that all the UNI ports show up in ONOS again
TorstenThieme731a7592021-07-01 14:26:54 +0000474 Wait for Ports in ONOS for all OLTs ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${num_all_onus} BBSM
TorstenThieme015d5c02020-09-11 09:53:34 +0000475
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000476Do Power Off Power On Onu Device
477 [Documentation] This keyword power off/on all onus and checks the states.
TorstenThieme440b7c02020-12-18 15:42:57 +0000478 Power Off ONU Device ${namespace}
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000479 Sleep 5s
TorstenThiemec3c23232021-01-13 13:06:31 +0000480 ${alternativeonustates}= Create List omci-flows-deleted
TorstenThieme440b7c02020-12-18 15:42:57 +0000481 Current State Test All Onus tech-profile-config-delete-success
TorstenThiemec3c23232021-01-13 13:06:31 +0000482 ... ENABLED DISCOVERED UNREACHABLE alternativeonustate=${alternativeonustates}
TorstenThieme440b7c02020-12-18 15:42:57 +0000483 Power On ONU Device ${namespace}
484 Current State Test All Onus ${state2test}
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000485
TorstenThieme1fbe8082020-10-21 13:27:59 +0000486Do Soft Reboot Onu Device
487 [Documentation] This keyword reboots softly all onus and checks the states.
TorstenThiemef78a9d82021-03-05 13:42:09 +0000488 ${device_list}= Set Variable ${EMPTY}
TorstenThiemefd7e7ba2020-11-06 13:57:57 +0000489 FOR ${I} IN RANGE 0 ${num_all_onus}
TorstenThieme1fbe8082020-10-21 13:27:59 +0000490 ${src}= Set Variable ${hosts.src[${I}]}
491 ${onu_device_id}= Get Device ID From SN ${src['onu']}
TorstenThiemef78a9d82021-03-05 13:42:09 +0000492 ${device_list}= Catenate ${device_list} ${onu_device_id}
TorstenThieme1fbe8082020-10-21 13:27:59 +0000493 END
TorstenThiemef78a9d82021-03-05 13:42:09 +0000494 Reboot ONU ${device_list} False
TorstenThieme6cc43762021-03-03 10:20:16 +0000495 ${alternativeonustates}= Create List stopping-openomci
496 Current State Test All Onus omci-flows-deleted
Matteo Scandoloc14525a2021-02-02 08:34:43 -0800497 ... ENABLED DISCOVERED UNREACHABLE alternativeonustate=${alternativeonustates}
TorstenThieme73850052020-12-10 12:43:28 +0000498 Sleep 5s
TorstenThieme6cc43762021-03-03 10:20:16 +0000499 Current State Test All Onus omci-flows-pushed
TorstenThiemed4f48962020-12-08 12:17:19 +0000500 Do Onu Port Check