blob: 7e6f61b7df0bec4fd8b4b85752a3d2a66fbc8679 [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
87 [Tags] functionalMemoryLeak MemoryLeakTestOnuGo
88 [Setup] Run Keywords Start Logging MemoryLeakTestOnuGo
89 ... AND Setup
90 Run Keyword If ${has_dataplane} Clean Up Linux
91 Run Keyword If ${print2console} Log \r\nStart ${iterations} iterations. console=yes
92 FOR ${I} IN RANGE 1 ${iterations} + 1
93 Run Keyword If ${print2console} Log \r\nStart iteration ${I} of ${iterations}. console=yes
94 Run Keyword If "${workflow}"=="DT" Run Keyword And Ignore Error Perform Sanity Test DT
95 ... ELSE IF "${workflow}"=="TT" Run Keyword And Ignore Error Perform Sanity Tests TT
96 ... ELSE Run Keyword And Ignore Error Perform Sanity Test
97 Run Keyword If ${print2console} Log Remove Flows. console=yes
98 Remove Flows all ONUs
99 Run Keyword If ${print2console} Log Check Flows removed. console=yes
100 Check All Flows Removed
101 Run Keyword If ${print2console} Log Delete ONUs. console=yes
102 Delete Devices In Voltha Type=brcm_openomci_onu
103 Run Keyword If ${print2console} Log Wait for ONUs come back. console=yes
104 ${list_onus} Create List
105 Build ONU SN List ${list_onus}
106 Wait Until Keyword Succeeds ${timeout} 1s Check all ONU OperStatus ${list_onus} ACTIVE
107 Run Keyword If ${print2console} Log End iteration ${I} of ${iterations}. console=yes
108 END
109 [Teardown] Run Keywords Printout ONU Serial Number and Device Id print2console=${print2console}
110 ... AND Run Keyword If ${logging} Get Logical Id of OLT
111 ... AND Run Keyword If ${logging} Collect Logs
112 ... AND Teardown Test
113 ... AND Stop Logging MemoryLeakTestOnuGo
114
115*** Keywords ***
116Setup Suite
117 [Documentation] Set up the test suite
118 Start Logging Setup or Teardown Setup-${SUITE NAME}
119 ${LogInfo}= Catenate
120 ... \r\nPassed arguments:
121 ... debugmode:${debugmode}, logging:${logging}, pausebeforecleanup:${pausebeforecleanup},
122 ... print2console:${print2console}, workflow:${workflow}, kvstoreprefix:${kvstoreprefix},
123 ... iterations:${iterations}
124 Log ${LogInfo} console=yes
125 Common Test Suite Setup
126 # set tech profiles
127 ${preload_tech_profile}= Set Variable If ${unitag_sub} and "${workflow}"=="TT" and not ${has_dataplane} True False
128 Set Suite Variable ${preload_tech_profile}
129 Run Keyword If ${preload_tech_profile} Set Tech Profile TT-HSIA ${INFRA_NAMESPACE} 64
130 Run Keyword If ${preload_tech_profile} Set Tech Profile TT-VoIP ${INFRA_NAMESPACE} 65
131 Run Keyword If ${preload_tech_profile} Set Tech Profile TT-multi-uni-MCAST-AdditionalBW-None ${INFRA_NAMESPACE} 66
132 # delete etcd MIB Template Data
133 Delete MIB Template Data ${INFRA_NAMESPACE}
134 # delete etcd onu data
135 Delete ONU Go Adapter ETCD Data namespace=${INFRA_NAMESPACE} validate=True
136 Run Keyword If ${logging} Collect Logs
137 Stop Logging Setup or Teardown Setup-${SUITE NAME}
138
139
140Teardown Suite
141 [Documentation] Replaces the Suite Teardown in utils.robot.
142 ... Cleans up and checks all ONU ports disabled in ONOS.
143 ... Furthermore gives the possibility to pause the execution.
144 Start Logging Setup or Teardown Teardown-${SUITE NAME}
145 Run Keyword If ${pausebeforecleanup} Import Library Dialogs
146 Run Keyword If ${pausebeforecleanup} Pause Execution Press OK to continue with clean up!
147 Run Keyword If ${pausebeforecleanup} Log Teardown will be continued... console=yes
148 Run Keyword If ${teardown_device} Delete All Devices and Verify
149 Run Keyword Unless ${etcdcheckintestteardown} Wait Until Keyword Succeeds ${timeout} 1s
150 ... Validate Onu Data In Etcd ${INFRA_NAMESPACE} 0 ${kvstoreprefix} without_pm_data=False
151 Wait for Ports in ONOS for all OLTs ${ONOS_SSH_IP} ${ONOS_SSH_PORT} 0 BBSM ${timeout}
152 Run Keyword If ${logging} Collect Logs
153 Stop Logging Setup or Teardown Teardown-${SUITE NAME}
154 Close All ONOS SSH Connections
155 Set Suite Variable ${TechProfile} ${EMPTY}
156 Run Keyword If ${preload_tech_profile} Remove Tech Profile ${INFRA_NAMESPACE} 64
157 Run Keyword If ${preload_tech_profile} Remove Tech Profile ${INFRA_NAMESPACE} 65
158 Run Keyword If ${preload_tech_profile} Remove Tech Profile ${INFRA_NAMESPACE} 66
159
160Teardown Test
161 [Documentation] Post-test Teardown
TorstenThieme22491b72022-03-31 13:12:27 +0000162 # log ONOS flows after remove check
163 ${flow}= Run Keyword If "${TEST STATUS}"=="FAIL" Execute ONOS CLI Command use single connection
164 ... ${ONOS_SSH_IP} ${ONOS_SSH_PORT} flows -s any ${of_id}
165 Run Keyword If "${TEST STATUS}"=="FAIL" Log ${flow}
TorstenThieme700ccbf2022-02-11 10:24:05 +0000166 Run Keyword If ${pausebeforecleanup} Import Library Dialogs
167 Run Keyword If ${pausebeforecleanup} Pause Execution Press OK to continue with clean up!
168 Run Keyword If ${pausebeforecleanup} Log Teardown will be continued... console=yes
169 Run Keyword If ${teardown_device} Delete All Devices and Verify
170 # delete etcd MIB Template Data
171 Delete MIB Template Data ${INFRA_NAMESPACE}
172 # check etcd data are empty
173 Run Keyword If ${etcdcheckintestteardown} Wait Until Keyword Succeeds ${timeout} 1s
174 ... Validate Onu Data In Etcd ${INFRA_NAMESPACE} 0 ${kvstoreprefix} without_pm_data=False
175 Sleep 5s