TorstenThieme | 700ccbf | 2022-02-11 10:24:05 +0000 | [diff] [blame] | 1 | # 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 *** |
| 16 | Documentation Test of try to catch memory leak in voltha components. |
| 17 | Suite Setup Setup Suite |
| 18 | Suite Teardown Teardown Suite |
| 19 | Test Setup Setup |
| 20 | Test Teardown Teardown |
| 21 | Library Collections |
| 22 | Library String |
| 23 | Library OperatingSystem |
| 24 | Library XML |
| 25 | Library RequestsLibrary |
| 26 | Library ../../libraries/DependencyLibrary.py |
| 27 | Resource ../../libraries/onos.robot |
| 28 | Resource ../../libraries/voltctl.robot |
| 29 | Resource ../../libraries/voltha.robot |
| 30 | Resource ../../libraries/utils.robot |
| 31 | Resource ../../libraries/k8s.robot |
| 32 | Resource ../../libraries/onu_utilities.robot |
| 33 | Resource ../../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 *** |
| 80 | Memory 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 |
TorstenThieme | 1208ab5 | 2022-04-11 14:24:27 +0000 | [diff] [blame] | 94 | Run Keyword If "${workflow}"=="DT" Perform Sanity Test DT |
| 95 | ... ELSE IF "${workflow}"=="TT" Perform Sanity Tests TT |
| 96 | ... ELSE Perform Sanity Test |
| 97 | Sleep 5s |
TorstenThieme | 700ccbf | 2022-02-11 10:24:05 +0000 | [diff] [blame] | 98 | Run Keyword If ${print2console} Log Remove Flows. console=yes |
| 99 | Remove Flows all ONUs |
| 100 | Run Keyword If ${print2console} Log Check Flows removed. console=yes |
| 101 | Check All Flows Removed |
TorstenThieme | 1208ab5 | 2022-04-11 14:24:27 +0000 | [diff] [blame] | 102 | Run Keyword If ${print2console} Log Get ONU Device IDs. console=yes |
| 103 | ${onu_device_id_list}= Get ONUs Device IDs from Voltha |
TorstenThieme | 700ccbf | 2022-02-11 10:24:05 +0000 | [diff] [blame] | 104 | Run Keyword If ${print2console} Log Delete ONUs. console=yes |
| 105 | Delete Devices In Voltha Type=brcm_openomci_onu |
| 106 | Run Keyword If ${print2console} Log Wait for ONUs come back. console=yes |
TorstenThieme | 1208ab5 | 2022-04-11 14:24:27 +0000 | [diff] [blame] | 107 | Wait Until Keyword Succeeds ${timeout} 1s Check for new ONU Device IDs ${onu_device_id_list} |
TorstenThieme | 700ccbf | 2022-02-11 10:24:05 +0000 | [diff] [blame] | 108 | ${list_onus} Create List |
| 109 | Build ONU SN List ${list_onus} |
| 110 | Wait Until Keyword Succeeds ${timeout} 1s Check all ONU OperStatus ${list_onus} ACTIVE |
TorstenThieme | 1208ab5 | 2022-04-11 14:24:27 +0000 | [diff] [blame] | 111 | Build ONU SN List ${list_onus} |
| 112 | ${onu_reason}= Set Variable If "${workflow}"=="DT" initial-mib-downloaded |
| 113 | ... "${workflow}"=="TT" initial-mib-downloaded |
| 114 | ... "${workflow}"=="ATT" omci-flows-pushed |
| 115 | Wait Until Keyword Succeeds ${timeout} 1s Validate ONU Devices ENABLED ACTIVE REACHABLE |
| 116 | ... ${list_onus} onu_reason=${onu_reason} |
TorstenThieme | 700ccbf | 2022-02-11 10:24:05 +0000 | [diff] [blame] | 117 | Run Keyword If ${print2console} Log End iteration ${I} of ${iterations}. console=yes |
| 118 | END |
| 119 | [Teardown] Run Keywords Printout ONU Serial Number and Device Id print2console=${print2console} |
| 120 | ... AND Run Keyword If ${logging} Get Logical Id of OLT |
| 121 | ... AND Run Keyword If ${logging} Collect Logs |
| 122 | ... AND Teardown Test |
| 123 | ... AND Stop Logging MemoryLeakTestOnuGo |
| 124 | |
| 125 | *** Keywords *** |
| 126 | Setup Suite |
| 127 | [Documentation] Set up the test suite |
| 128 | Start Logging Setup or Teardown Setup-${SUITE NAME} |
| 129 | ${LogInfo}= Catenate |
| 130 | ... \r\nPassed arguments: |
| 131 | ... debugmode:${debugmode}, logging:${logging}, pausebeforecleanup:${pausebeforecleanup}, |
| 132 | ... print2console:${print2console}, workflow:${workflow}, kvstoreprefix:${kvstoreprefix}, |
| 133 | ... iterations:${iterations} |
| 134 | Log ${LogInfo} console=yes |
| 135 | Common Test Suite Setup |
| 136 | # set tech profiles |
| 137 | ${preload_tech_profile}= Set Variable If ${unitag_sub} and "${workflow}"=="TT" and not ${has_dataplane} True False |
| 138 | Set Suite Variable ${preload_tech_profile} |
| 139 | Run Keyword If ${preload_tech_profile} Set Tech Profile TT-HSIA ${INFRA_NAMESPACE} 64 |
| 140 | Run Keyword If ${preload_tech_profile} Set Tech Profile TT-VoIP ${INFRA_NAMESPACE} 65 |
| 141 | Run Keyword If ${preload_tech_profile} Set Tech Profile TT-multi-uni-MCAST-AdditionalBW-None ${INFRA_NAMESPACE} 66 |
| 142 | # delete etcd MIB Template Data |
| 143 | Delete MIB Template Data ${INFRA_NAMESPACE} |
| 144 | # delete etcd onu data |
| 145 | Delete ONU Go Adapter ETCD Data namespace=${INFRA_NAMESPACE} validate=True |
| 146 | Run Keyword If ${logging} Collect Logs |
| 147 | Stop Logging Setup or Teardown Setup-${SUITE NAME} |
| 148 | |
| 149 | |
| 150 | Teardown Suite |
| 151 | [Documentation] Replaces the Suite Teardown in utils.robot. |
| 152 | ... Cleans up and checks all ONU ports disabled in ONOS. |
| 153 | ... Furthermore gives the possibility to pause the execution. |
| 154 | Start Logging Setup or Teardown Teardown-${SUITE NAME} |
| 155 | Run Keyword If ${pausebeforecleanup} Import Library Dialogs |
| 156 | Run Keyword If ${pausebeforecleanup} Pause Execution Press OK to continue with clean up! |
| 157 | Run Keyword If ${pausebeforecleanup} Log Teardown will be continued... console=yes |
| 158 | Run Keyword If ${teardown_device} Delete All Devices and Verify |
| 159 | Run Keyword Unless ${etcdcheckintestteardown} Wait Until Keyword Succeeds ${timeout} 1s |
| 160 | ... Validate Onu Data In Etcd ${INFRA_NAMESPACE} 0 ${kvstoreprefix} without_pm_data=False |
| 161 | Wait for Ports in ONOS for all OLTs ${ONOS_SSH_IP} ${ONOS_SSH_PORT} 0 BBSM ${timeout} |
| 162 | Run Keyword If ${logging} Collect Logs |
| 163 | Stop Logging Setup or Teardown Teardown-${SUITE NAME} |
| 164 | Close All ONOS SSH Connections |
| 165 | Set Suite Variable ${TechProfile} ${EMPTY} |
| 166 | Run Keyword If ${preload_tech_profile} Remove Tech Profile ${INFRA_NAMESPACE} 64 |
| 167 | Run Keyword If ${preload_tech_profile} Remove Tech Profile ${INFRA_NAMESPACE} 65 |
| 168 | Run Keyword If ${preload_tech_profile} Remove Tech Profile ${INFRA_NAMESPACE} 66 |
| 169 | |
| 170 | Teardown Test |
| 171 | [Documentation] Post-test Teardown |
TorstenThieme | 22491b7 | 2022-03-31 13:12:27 +0000 | [diff] [blame] | 172 | # log ONOS flows after remove check |
| 173 | ${flow}= Run Keyword If "${TEST STATUS}"=="FAIL" Execute ONOS CLI Command use single connection |
| 174 | ... ${ONOS_SSH_IP} ${ONOS_SSH_PORT} flows -s any ${of_id} |
| 175 | Run Keyword If "${TEST STATUS}"=="FAIL" Log ${flow} |
TorstenThieme | 700ccbf | 2022-02-11 10:24:05 +0000 | [diff] [blame] | 176 | Run Keyword If ${pausebeforecleanup} Import Library Dialogs |
| 177 | Run Keyword If ${pausebeforecleanup} Pause Execution Press OK to continue with clean up! |
| 178 | Run Keyword If ${pausebeforecleanup} Log Teardown will be continued... console=yes |
| 179 | Run Keyword If ${teardown_device} Delete All Devices and Verify |
| 180 | # delete etcd MIB Template Data |
| 181 | Delete MIB Template Data ${INFRA_NAMESPACE} |
| 182 | # check etcd data are empty |
| 183 | Run Keyword If ${etcdcheckintestteardown} Wait Until Keyword Succeeds ${timeout} 1s |
| 184 | ... Validate Onu Data In Etcd ${INFRA_NAMESPACE} 0 ${kvstoreprefix} without_pm_data=False |
| 185 | Sleep 5s |
TorstenThieme | 1208ab5 | 2022-04-11 14:24:27 +0000 | [diff] [blame] | 186 | |
| 187 | Check for new ONU Device IDs |
| 188 | [Documentation] Checks that no old onu device ids stay |
| 189 | [Arguments] ${old_device_ids} |
| 190 | ${new_device_ids}= Get ONUs Device IDs from Voltha |
| 191 | Should Not Be Empty ${new_device_ids} No new ONU device IDs |
| 192 | FOR ${item} IN @{old_device_ids} |
| 193 | List Should Not Contain Value ${new_device_ids} ${item} Old device id ${item} still present. |
| 194 | END |