blob: 043f653e3bed167ca5d9a2798f51a1c52cf9f826 [file] [log] [blame]
TorstenThieme700ccbf2022-02-11 10:24:05 +00001# Copyright 2022 - 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 Test of try to catch memory leak in voltha components.
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 ../../variables/variables.robot
34
35*** Variables ***
36${NAMESPACE} voltha
37${INFRA_NAMESPACE} default
38${timeout} 60s
39${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}
47# determines the environment workflow: DT, TT or ATT (default)
48# example: -v workflow:DT
49${workflow} ATT
50# KV Store Prefix
51# example: -v kvstoreprefix:voltha/voltha_voltha
52${kvstoreprefix} voltha/voltha_voltha
53# flag debugmode is used, if true timeout calculation various, can be passed via the command line too
54# example: -v debugmode:True
55${debugmode} False
56# logging flag to enable Collect Logs, can be passed via the command line too
57# example: -v logging:True
58${logging} False
59# if True execution will be paused before clean up, only use in case of manual testing, do not use in ci pipeline!
60# example: -v pausebeforecleanup:True
61${pausebeforecleanup} False
62# if True some outputs to console are done during running tests e.g. long duration flow test
63# example: -v print2console:True
64${print2console} False
65# if True etcd check will be executed in test case teardown, if False etcd check will be executed in suite teardown
66# example: -v etcdcheckintestteardown:False
67${etcdcheckintestteardown} True
68${data_dir} ../data
69# number of iterations
70# example: -v iterations:10
71${iterations} 200
72
73# flag to choose the subscriber provisioning command type in ONOS
74# TT often provision a single services for a subscriber (eg: hsia, voip, ...) one after the other.
75# if set to True, command used is "volt-add-subscriber-unitag"
76# if set to False, comand used is "volt-add-subscriber-access"
77${unitag_sub} False
78
79*** Test Cases ***
80Memory Leak Test Openonu Go Adapter
81 [Documentation] Test of try to catch memory leak in Openonu Go Adapter for all three workflows, ATT, DT and TT
82 ... Multiple run of Flow and ONU setup and teardown to try to catch memory leak.
83 ... - do workflow related sanity test (bring up onu to omci flows pushed and setup flows)
84 ... - remove flows
85 ... - delete ONU devices
86 ... - wait for onu auto detect
TorstenThieme2445db22022-09-09 11:23:47 +000087 ... Attention: Due VOL-4703 is not corrected errors in Sanity Test as well as Check Flows Removed will be ignored!
88 ... This is a temporaly workaround only! Has to be checked after introduction of voltha-go-controller.
TorstenThieme700ccbf2022-02-11 10:24:05 +000089 [Tags] functionalMemoryLeak MemoryLeakTestOnuGo
90 [Setup] Run Keywords Start Logging MemoryLeakTestOnuGo
91 ... AND Setup
92 Run Keyword If ${has_dataplane} Clean Up Linux
93 Run Keyword If ${print2console} Log \r\nStart ${iterations} iterations. console=yes
94 FOR ${I} IN RANGE 1 ${iterations} + 1
95 Run Keyword If ${print2console} Log \r\nStart iteration ${I} of ${iterations}. console=yes
TorstenThieme2445db22022-09-09 11:23:47 +000096 Run Keyword If "${workflow}"=="DT" Run Keyword And Ignore Error Perform Sanity Test DT
97 ... ELSE IF "${workflow}"=="TT" Run Keyword And Ignore Error Perform Sanity Tests TT
98 ... ELSE Run Keyword And Ignore Error Perform Sanity Test
TorstenThieme1208ab52022-04-11 14:24:27 +000099 Sleep 5s
TorstenThieme700ccbf2022-02-11 10:24:05 +0000100 Run Keyword If ${print2console} Log Remove Flows. console=yes
101 Remove Flows all ONUs
102 Run Keyword If ${print2console} Log Check Flows removed. console=yes
TorstenThieme2445db22022-09-09 11:23:47 +0000103 Run Keyword And Ignore Error Check All Flows Removed
TorstenThieme1208ab52022-04-11 14:24:27 +0000104 Run Keyword If ${print2console} Log Get ONU Device IDs. console=yes
105 ${onu_device_id_list}= Get ONUs Device IDs from Voltha
TorstenThieme700ccbf2022-02-11 10:24:05 +0000106 Run Keyword If ${print2console} Log Delete ONUs. console=yes
107 Delete Devices In Voltha Type=brcm_openomci_onu
108 Run Keyword If ${print2console} Log Wait for ONUs come back. console=yes
TorstenThieme1208ab52022-04-11 14:24:27 +0000109 Wait Until Keyword Succeeds ${timeout} 1s Check for new ONU Device IDs ${onu_device_id_list}
TorstenThieme700ccbf2022-02-11 10:24:05 +0000110 ${list_onus} Create List
111 Build ONU SN List ${list_onus}
112 Wait Until Keyword Succeeds ${timeout} 1s Check all ONU OperStatus ${list_onus} ACTIVE
TorstenThieme1208ab52022-04-11 14:24:27 +0000113 Build ONU SN List ${list_onus}
114 ${onu_reason}= Set Variable If "${workflow}"=="DT" initial-mib-downloaded
115 ... "${workflow}"=="TT" initial-mib-downloaded
116 ... "${workflow}"=="ATT" omci-flows-pushed
TorstenThieme2445db22022-09-09 11:23:47 +0000117 Run Keyword And Ignore Error Wait Until Keyword Succeeds ${timeout} 1s
118 ... Validate ONU Devices ENABLED ACTIVE REACHABLE ${list_onus} onu_reason=${onu_reason}
TorstenThieme700ccbf2022-02-11 10:24:05 +0000119 Run Keyword If ${print2console} Log End iteration ${I} of ${iterations}. console=yes
120 END
121 [Teardown] Run Keywords Printout ONU Serial Number and Device Id print2console=${print2console}
122 ... AND Run Keyword If ${logging} Get Logical Id of OLT
123 ... AND Run Keyword If ${logging} Collect Logs
124 ... AND Teardown Test
125 ... AND Stop Logging MemoryLeakTestOnuGo
126
127*** Keywords ***
128Setup Suite
129 [Documentation] Set up the test suite
130 Start Logging Setup or Teardown Setup-${SUITE NAME}
131 ${LogInfo}= Catenate
132 ... \r\nPassed arguments:
133 ... debugmode:${debugmode}, logging:${logging}, pausebeforecleanup:${pausebeforecleanup},
134 ... print2console:${print2console}, workflow:${workflow}, kvstoreprefix:${kvstoreprefix},
135 ... iterations:${iterations}
136 Log ${LogInfo} console=yes
137 Common Test Suite Setup
138 # set tech profiles
139 ${preload_tech_profile}= Set Variable If ${unitag_sub} and "${workflow}"=="TT" and not ${has_dataplane} True False
140 Set Suite Variable ${preload_tech_profile}
141 Run Keyword If ${preload_tech_profile} Set Tech Profile TT-HSIA ${INFRA_NAMESPACE} 64
142 Run Keyword If ${preload_tech_profile} Set Tech Profile TT-VoIP ${INFRA_NAMESPACE} 65
143 Run Keyword If ${preload_tech_profile} Set Tech Profile TT-multi-uni-MCAST-AdditionalBW-None ${INFRA_NAMESPACE} 66
144 # delete etcd MIB Template Data
145 Delete MIB Template Data ${INFRA_NAMESPACE}
146 # delete etcd onu data
147 Delete ONU Go Adapter ETCD Data namespace=${INFRA_NAMESPACE} validate=True
148 Run Keyword If ${logging} Collect Logs
149 Stop Logging Setup or Teardown Setup-${SUITE NAME}
150
151
152Teardown Suite
153 [Documentation] Replaces the Suite Teardown in utils.robot.
154 ... Cleans up and checks all ONU ports disabled in ONOS.
155 ... Furthermore gives the possibility to pause the execution.
156 Start Logging Setup or Teardown Teardown-${SUITE NAME}
157 Run Keyword If ${pausebeforecleanup} Import Library Dialogs
158 Run Keyword If ${pausebeforecleanup} Pause Execution Press OK to continue with clean up!
159 Run Keyword If ${pausebeforecleanup} Log Teardown will be continued... console=yes
160 Run Keyword If ${teardown_device} Delete All Devices and Verify
161 Run Keyword Unless ${etcdcheckintestteardown} Wait Until Keyword Succeeds ${timeout} 1s
162 ... Validate Onu Data In Etcd ${INFRA_NAMESPACE} 0 ${kvstoreprefix} without_pm_data=False
163 Wait for Ports in ONOS for all OLTs ${ONOS_SSH_IP} ${ONOS_SSH_PORT} 0 BBSM ${timeout}
164 Run Keyword If ${logging} Collect Logs
165 Stop Logging Setup or Teardown Teardown-${SUITE NAME}
166 Close All ONOS SSH Connections
167 Set Suite Variable ${TechProfile} ${EMPTY}
168 Run Keyword If ${preload_tech_profile} Remove Tech Profile ${INFRA_NAMESPACE} 64
169 Run Keyword If ${preload_tech_profile} Remove Tech Profile ${INFRA_NAMESPACE} 65
170 Run Keyword If ${preload_tech_profile} Remove Tech Profile ${INFRA_NAMESPACE} 66
171
172Teardown Test
173 [Documentation] Post-test Teardown
TorstenThieme22491b72022-03-31 13:12:27 +0000174 # log ONOS flows after remove check
175 ${flow}= Run Keyword If "${TEST STATUS}"=="FAIL" Execute ONOS CLI Command use single connection
176 ... ${ONOS_SSH_IP} ${ONOS_SSH_PORT} flows -s any ${of_id}
177 Run Keyword If "${TEST STATUS}"=="FAIL" Log ${flow}
TorstenThieme700ccbf2022-02-11 10:24:05 +0000178 Run Keyword If ${pausebeforecleanup} Import Library Dialogs
179 Run Keyword If ${pausebeforecleanup} Pause Execution Press OK to continue with clean up!
180 Run Keyword If ${pausebeforecleanup} Log Teardown will be continued... console=yes
181 Run Keyword If ${teardown_device} Delete All Devices and Verify
182 # delete etcd MIB Template Data
183 Delete MIB Template Data ${INFRA_NAMESPACE}
184 # check etcd data are empty
185 Run Keyword If ${etcdcheckintestteardown} Wait Until Keyword Succeeds ${timeout} 1s
186 ... Validate Onu Data In Etcd ${INFRA_NAMESPACE} 0 ${kvstoreprefix} without_pm_data=False
187 Sleep 5s
TorstenThieme1208ab52022-04-11 14:24:27 +0000188
189Check for new ONU Device IDs
190 [Documentation] Checks that no old onu device ids stay
191 [Arguments] ${old_device_ids}
192 ${new_device_ids}= Get ONUs Device IDs from Voltha
193 Should Not Be Empty ${new_device_ids} No new ONU device IDs
194 FOR ${item} IN @{old_device_ids}
195 List Should Not Contain Value ${new_device_ids} ${item} Old device id ${item} still present.
196 END