blob: 50bb473dd4668f957b893a9258f97f96a1f5c8d1 [file] [log] [blame]
TorstenThieme53450ff2021-05-11 09:44:33 +00001# Copyright 2021 - 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
15*** Settings ***
16Documentation Negative test states of ONU Go adapter with ATT workflows only (not for DT/TT workflow!)
17Suite 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
32Resource ../../libraries/onu_utilities.robot
33Resource ../../libraries/bbsim.robot
34Resource ../../variables/variables.robot
35
36*** Variables ***
37${namespace} voltha
Hardik Windlassa9b38262021-10-27 08:14:22 +000038${INFRA_NAMESPACE} default
TorstenThieme53450ff2021-05-11 09:44:33 +000039${timeout} 300s
40${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}
48# KV Store Prefix
49# example: -v kvstoreprefix:voltha_voltha
50${kvstoreprefix} voltha_voltha
51# used tech profile, can be passed via the command line too, valid values: default (=1T1GEM), 1T4GEM, 1T8GEM
52# example: -v techprofile:1T4GEM
53${techprofile} default
54# flag debugmode is used, if true timeout calculation various, can be passed via the command line too
55# example: -v debugmode:True
56${debugmode} False
57# logging flag to enable Collect Logs, can be passed via the command line too
58# example: -v logging:True
59${logging} False
60# if True execution will be paused before clean up, only use in case of manual testing, do not use in ci pipeline!
61# example: -v pausebeforecleanup:True
62${pausebeforecleanup} False
63# if True some outputs to console are done during running tests e.g. long duration flow test
64# example: -v print2console:True
65${print2console} False
66${data_dir} ../data
67
68
69*** Test Cases ***
70ONU Negative State Test
71 [Documentation] Validates the ONU Go adapter states will never leave starting-openomci
72 ... Due to a 'omci-response-rate' lower than 8 more OMCI messages will be through away by BBSIM than
73 ... repeated by openonu-go-adapter. So ONU will never leave starting-openomci state.
74 ... Timeout has to set at least to 300s (or more)
75 [Tags] NegativeStateTestOnuGo
76 [Setup] Run Keywords Start Logging ONUNegativeStateTest
77 ... AND Setup
78 # Suite Variable will be overwritten by Teardown of Current State Test All Onus
79 Set Suite Variable ${StateTestAllONUs} True
80 ${seconds}= Convert Time ${timeout}
81 ${seconds}= Convert To String ${seconds}
82 ${seconds}= Get Substring ${seconds} 0 -2
83 FOR ${I} IN RANGE ${seconds}
84 Sleep 1s
85 Current State Test All Onus starting-openomci timeout=1x
86 Exit For Loop If not ${StateTestAllONUs}
87 END
88 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
89 ... AND Stop Logging ONUStateTest
90
91
92*** Keywords ***
93Setup Suite
94 [Documentation] Set up the test suite
Andrea Campanellade6ee322021-11-05 12:01:15 +010095 Start Logging Setup or Teardown Setup-${SUITE NAME}
TorstenThieme53450ff2021-05-11 09:44:33 +000096 ${LogInfo}= Catenate
97 ... \r\nPassed arguments:
98 ... techprofile:${techprofile},
99 ... debugmode:${debugmode}, logging:${logging}, pausebeforecleanup:${pausebeforecleanup},
100 ... print2console:${print2console}
101 Log ${LogInfo} console=yes
102 Common Test Suite Setup
103 ${techprofile}= Set Variable If "${techprofile}"=="1T1GEM" default ${techprofile}
104 Set Suite Variable ${techprofile}
105 Run Keyword If "${techprofile}"=="default" Log To Console \nTechProfile:default (1T1GEM)
106 ... ELSE IF "${techprofile}"=="1T4GEM" Set Tech Profile 1T4GEM
107 ... ELSE IF "${techprofile}"=="1T8GEM" Set Tech Profile 1T8GEM
108 ... ELSE Fail The TechProfile (${techprofile}) is not valid!
TorstenThieme53450ff2021-05-11 09:44:33 +0000109 # delete etcd MIB Template Data
110 Delete MIB Template Data
111 # delete etcd onu data
112 Delete ONU Go Adapter ETCD Data validate=True
Andrea Campanellade6ee322021-11-05 12:01:15 +0100113 Run Keyword If ${logging} Collect Logs
114 Stop Logging Setup or Teardown Setup-${SUITE NAME}
TorstenThieme53450ff2021-05-11 09:44:33 +0000115
116Teardown Suite
117 [Documentation] Replaces the Suite Teardown in utils.robot.
118 ... Cleans up and checks all ONU ports disabled in ONOS.
119 ... Furthermore gives the possibility to pause the execution.
Andrea Campanellade6ee322021-11-05 12:01:15 +0100120 Start Logging Setup or Teardown Teardown-${SUITE NAME}
TorstenThieme53450ff2021-05-11 09:44:33 +0000121 Run Keyword If ${pausebeforecleanup} Import Library Dialogs
122 Run Keyword If ${pausebeforecleanup} Pause Execution Press OK to continue with clean up!
123 Run Keyword If ${pausebeforecleanup} Log Teardown will be continued... console=yes
124 Run Keyword If ${teardown_device} Delete All Devices and Verify
125 Wait Until Keyword Succeeds ${timeout} 1s Validate Onu Data In Etcd 0 ${kvstoreprefix} without_pm_data=False
TorstenThieme731a7592021-07-01 14:26:54 +0000126 Wait for Ports in ONOS for all OLTs ${ONOS_SSH_IP} ${ONOS_SSH_PORT} 0 BBSM ${timeout}
Andrea Campanellade6ee322021-11-05 12:01:15 +0100127 Run Keyword If ${logging} Collect Logs
TorstenThieme53450ff2021-05-11 09:44:33 +0000128 Close All ONOS SSH Connections
129 Remove Tech Profile
Andrea Campanellade6ee322021-11-05 12:01:15 +0100130 Stop Logging Setup or Teardown Teardown-${SUITE NAME}