TorstenThieme | d4f4896 | 2020-12-08 12:17:19 +0000 | [diff] [blame] | 1 | # 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 | |
TorstenThieme | 840380b | 2020-10-02 09:31:56 +0000 | [diff] [blame] | 15 | *** Settings *** |
TorstenThieme | 2d8327b | 2022-03-15 08:42:27 +0000 | [diff] [blame] | 16 | Documentation Test MIB Template handling of ONU Go adapter |
| 17 | ... with BBSIM controlledActivation: only-onu only! |
| 18 | ... Set up BBSIM with 'onu=2' (as well as 'pon=2') and 'controlledActivation=only-onu' e.g. with Extra Helm Flags! |
| 19 | ... Run robot with bbsim-kind-2x2.yaml (needed for test case ONU MIB Template Data Test) |
| 20 | ... For test cases Unknown ME/Attribute bbsim-kind.yaml would work too. |
| 21 | ... For Unknown ME set up BBSIM with injectOmciUnknownME=true e.g. with Extra Helm Flags! |
| 22 | ... For Unknown Attribute set up BBSIM with injectOmciUnknownAttributes=true e.g. with Extra Helm Flags! |
TorstenThieme | 840380b | 2020-10-02 09:31:56 +0000 | [diff] [blame] | 23 | Suite Setup Setup Suite |
| 24 | Suite Teardown Teardown Suite |
| 25 | Test Setup Setup |
| 26 | Test Teardown Teardown |
| 27 | Library Collections |
| 28 | Library String |
| 29 | Library OperatingSystem |
| 30 | Library XML |
| 31 | Library RequestsLibrary |
| 32 | Library ../../libraries/DependencyLibrary.py |
| 33 | Resource ../../libraries/onos.robot |
| 34 | Resource ../../libraries/voltctl.robot |
| 35 | Resource ../../libraries/voltha.robot |
| 36 | Resource ../../libraries/utils.robot |
| 37 | Resource ../../libraries/k8s.robot |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 38 | Resource ../../libraries/onu_utilities.robot |
TorstenThieme | fe7099e | 2021-01-29 08:41:04 +0000 | [diff] [blame] | 39 | Resource ../../libraries/bbsim.robot |
TorstenThieme | 840380b | 2020-10-02 09:31:56 +0000 | [diff] [blame] | 40 | Resource ../../variables/variables.robot |
| 41 | |
| 42 | *** Variables *** |
TorstenThieme | 2d8327b | 2022-03-15 08:42:27 +0000 | [diff] [blame] | 43 | ${NAMESPACE} voltha |
| 44 | ${INFRA_NAMESPACE} default |
| 45 | ${timeout} 60s |
| 46 | ${of_id} 0 |
| 47 | ${logical_id} 0 |
| 48 | ${has_dataplane} True |
| 49 | ${external_libs} True |
TorstenThieme | 840380b | 2020-10-02 09:31:56 +0000 | [diff] [blame] | 50 | ${teardown_device} True |
| 51 | ${scripts} ../../scripts |
| 52 | # Per-test logging on failure is turned off by default; set this variable to enable |
| 53 | ${container_log_dir} ${None} |
| 54 | |
| 55 | # flag debugmode is used, if true timeout calculation various, can be passed via the command line too |
| 56 | # example: -v debugmode:True |
| 57 | ${debugmode} False |
| 58 | # logging flag to enable Collect Logs, can be passed via the command line too |
| 59 | # example: -v logging:True |
| 60 | ${logging} False |
| 61 | # if True execution will be paused before clean up |
| 62 | # example: -v pausebeforecleanup:True |
| 63 | ${pausebeforecleanup} False |
| 64 | ${data_dir} ../data |
| 65 | |
Hardik Windlass | b1bda36 | 2021-11-24 11:54:36 +0000 | [diff] [blame] | 66 | # flag to choose the subscriber provisioning command type in ONOS |
| 67 | # TT often provision a single services for a subscriber (eg: hsia, voip, ...) one after the other. |
| 68 | # if set to True, command used is "volt-add-subscriber-unitag" |
| 69 | # if set to False, comand used is "volt-add-subscriber-access" |
| 70 | ${unitag_sub} False |
TorstenThieme | 840380b | 2020-10-02 09:31:56 +0000 | [diff] [blame] | 71 | |
| 72 | *** Test Cases *** |
| 73 | ONU MIB Template Data Test |
| 74 | [Documentation] Validates ONU Go adapter storage of MIB Template Data in etcd and checks the usage |
| 75 | ... - setup one ONU |
| 76 | ... - request MIB-Upload-Data by ONU via OMCI |
| 77 | ... - storage MIB-Upload-Data in etcd |
| 78 | ... - store setup duration of ONU |
TorstenThieme | d4f4896 | 2020-12-08 12:17:19 +0000 | [diff] [blame] | 79 | ... - check Template-Data in etcd stored (service/%{NAME}/omci_mibs/go_templates/) |
TorstenThieme | 840380b | 2020-10-02 09:31:56 +0000 | [diff] [blame] | 80 | ... - setup second ONU |
| 81 | ... - collect setup durationof second ONU |
| 82 | ... - compare both duration |
| 83 | ... - duration of second ONU should be at least 10 times faster than the first one |
| 84 | ... - MIB-Upload-Data should not requested via OMCI by second ONU |
| 85 | ... - MIB-Upload-Data should read from etcd |
TorstenThieme | 66c91a8 | 2020-10-19 13:37:53 +0000 | [diff] [blame] | 86 | [Tags] functionalOnuGo MibTemplateOnuGo |
TorstenThieme | 840380b | 2020-10-02 09:31:56 +0000 | [diff] [blame] | 87 | [Setup] Run Keywords Start Logging ONUMibTemplateTest |
| 88 | ... AND Setup |
| 89 | Perform ONU MIB Template Data Test |
TorstenThieme | 373adfe | 2021-12-16 13:03:04 +0000 | [diff] [blame] | 90 | [Teardown] Run Keywords Printout ONU Serial Number and Device Id |
| 91 | ... AND Run Keyword If ${logging} Collect Logs |
TorstenThieme | 2d8327b | 2022-03-15 08:42:27 +0000 | [diff] [blame] | 92 | ... AND Teardown Test |
TorstenThieme | 840380b | 2020-10-02 09:31:56 +0000 | [diff] [blame] | 93 | ... AND Stop Logging ONUMibTemplateTest |
| 94 | |
TorstenThieme | 2d8327b | 2022-03-15 08:42:27 +0000 | [diff] [blame] | 95 | ONU MIB Template Unknown ME Test |
| 96 | [Documentation] Validates ONU Go adapter storage of MIB Template Data in etcd in case of unknown ME |
| 97 | ... - setup one ONU |
| 98 | ... - request MIB-Upload-Data by ONU via OMCI |
| 99 | ... - storage MIB-Upload-Data in etcd |
| 100 | ... - check Template-Data in etcd stored (service/voltha/omci_mibs/go_templates/) |
| 101 | ... - Template-Data in etcd stored should contain "UnknownItuG988ManagedEntity" |
| 102 | [Tags] functionalOnuGo UnknownMeOnuGo |
| 103 | [Setup] Run Keywords Start Logging UnknownMeOnuGo |
| 104 | ... AND Setup |
| 105 | Bring Up ONU |
| 106 | ${MibTemplateData}= Get ONU MIB Template Data ${INFRA_NAMESPACE} |
| 107 | ${MibTemplatePrep}= Prepare ONU Go Adapter ETCD Data For Json ${MibTemplateData} |
| 108 | ${MibTemplateJson}= To Json ${MibTemplatePrep} |
| 109 | Dictionary Should Contain Key ${MibTemplateJson[0]} UnknownItuG988ManagedEntity |
| 110 | ${UnknownME}= Get From Dictionary ${MibTemplateJson[0]} UnknownItuG988ManagedEntity |
| 111 | Dictionary Should Contain Key ${UnknownME} 37 |
| 112 | ${Attributes}= Get From Dictionary ${UnknownME['37']} 1 |
| 113 | ${AttributeMask}= Get From Dictionary ${Attributes} AttributeMask |
| 114 | ${AttributeBytes}= Get From Dictionary ${Attributes} AttributeBytes |
TorstenThieme | 368e9b6 | 2022-03-18 10:33:05 +0000 | [diff] [blame] | 115 | Should be Equal ${AttributeMask} 0x8000 |
| 116 | Should be Equal ${AttributeBytes} 0102030405060708090a0b0c0d0e0f101112131415161718191a |
TorstenThieme | 2d8327b | 2022-03-15 08:42:27 +0000 | [diff] [blame] | 117 | [Teardown] Run Keywords Printout ONU Serial Number and Device Id |
| 118 | ... AND Run Keyword If ${logging} Collect Logs |
| 119 | ... AND Teardown Test |
| 120 | ... AND Stop Logging UnknownMeOnuGo |
TorstenThieme | 840380b | 2020-10-02 09:31:56 +0000 | [diff] [blame] | 121 | |
TorstenThieme | 368e9b6 | 2022-03-18 10:33:05 +0000 | [diff] [blame] | 122 | ONU MIB Template Unknown Attribute Test |
| 123 | [Documentation] Validates ONU Go adapter storage of MIB Template Data in etcd in case of unknown Attribute |
| 124 | ... - setup one ONU |
| 125 | ... - request MIB-Upload-Data by ONU via OMCI |
| 126 | ... - storage MIB-Upload-Data in etcd |
| 127 | ... - check Template-Data in etcd stored (service/voltha/omci_mibs/go_templates/) |
| 128 | ... - Template-Data in etcd stored should contain "UnknownAttributesManagedEntity" |
| 129 | [Tags] functionalOnuGo UnknownAttributeOnuGo |
| 130 | [Setup] Run Keywords Start Logging UnknownAttributeOnuGo |
| 131 | ... AND Setup |
| 132 | Bring Up ONU |
| 133 | ${MibTemplateData}= Get ONU MIB Template Data ${INFRA_NAMESPACE} |
| 134 | ${MibTemplatePrep}= Prepare ONU Go Adapter ETCD Data For Json ${MibTemplateData} |
| 135 | ${MibTemplateJson}= To Json ${MibTemplatePrep} |
| 136 | Dictionary Should Contain Key ${MibTemplateJson[0]} UnknownAttributesManagedEntity |
| 137 | ${UnknownME}= Get From Dictionary ${MibTemplateJson[0]} UnknownAttributesManagedEntity |
| 138 | Dictionary Should Contain Key ${UnknownME} 257 |
| 139 | ${Attributes}= Get From Dictionary ${UnknownME['257']} 0 |
| 140 | ${AttributeMask}= Get From Dictionary ${Attributes} AttributeMask |
| 141 | ${AttributeBytes}= Get From Dictionary ${Attributes} AttributeBytes |
| 142 | Should be Equal ${AttributeMask} 0x0001 |
| 143 | Should be Equal ${AttributeBytes} 000100010001000000 |
| 144 | [Teardown] Run Keywords Printout ONU Serial Number and Device Id |
| 145 | ... AND Run Keyword If ${logging} Collect Logs |
| 146 | ... AND Teardown Test |
| 147 | ... AND Stop Logging UnknownAttributeOnuGo |
| 148 | |
TorstenThieme | 840380b | 2020-10-02 09:31:56 +0000 | [diff] [blame] | 149 | *** Keywords *** |
| 150 | Setup Suite |
| 151 | [Documentation] Set up the test suite |
Andrea Campanella | 82add37 | 2021-11-05 12:01:15 +0100 | [diff] [blame] | 152 | Start Logging Setup or Teardown Setup-${SUITE NAME} |
TorstenThieme | 840380b | 2020-10-02 09:31:56 +0000 | [diff] [blame] | 153 | ${LogInfo}= Catenate |
| 154 | ... \r\nPassed arguments: |
| 155 | ... debugmode:${debugmode}, logging:${logging}, pausebeforecleanup:${pausebeforecleanup}, |
| 156 | Log ${LogInfo} console=yes |
| 157 | Common Test Suite Setup |
TorstenThieme | 840380b | 2020-10-02 09:31:56 +0000 | [diff] [blame] | 158 | # delete etcd MIB Template Data |
Hardik Windlass | 4288c6a | 2021-09-28 07:22:06 +0000 | [diff] [blame] | 159 | Delete MIB Template Data ${INFRA_NAMESPACE} |
Andrea Campanella | 82add37 | 2021-11-05 12:01:15 +0100 | [diff] [blame] | 160 | Run Keyword If ${logging} Collect Logs |
| 161 | Stop Logging Setup or Teardown Setup-${SUITE NAME} |
TorstenThieme | 840380b | 2020-10-02 09:31:56 +0000 | [diff] [blame] | 162 | |
| 163 | Teardown Suite |
| 164 | [Documentation] Replaces the Suite Teardown in utils.robot. |
| 165 | ... Cleans up and checks all ONU ports disabled in ONOS. |
| 166 | ... Furthermore gives the possibility to pause the execution. |
Andrea Campanella | 82add37 | 2021-11-05 12:01:15 +0100 | [diff] [blame] | 167 | Start Logging Setup or Teardown Teardown-${SUITE NAME} |
TorstenThieme | 840380b | 2020-10-02 09:31:56 +0000 | [diff] [blame] | 168 | Run Keyword If ${pausebeforecleanup} Import Library Dialogs |
| 169 | Run Keyword If ${pausebeforecleanup} Pause Execution Press OK to continue with clean up! |
| 170 | Run Keyword If ${pausebeforecleanup} Log Teardown will be continued... console=yes |
| 171 | Run Keyword If ${teardown_device} Delete All Devices and Verify |
TorstenThieme | 731a759 | 2021-07-01 14:26:54 +0000 | [diff] [blame] | 172 | Wait for Ports in ONOS for all OLTs ${ONOS_SSH_IP} ${ONOS_SSH_PORT} 0 BBSM |
TorstenThieme | 840380b | 2020-10-02 09:31:56 +0000 | [diff] [blame] | 173 | # delete etcd MIB Template Data (for repeating test) |
Hardik Windlass | 4288c6a | 2021-09-28 07:22:06 +0000 | [diff] [blame] | 174 | Delete MIB Template Data ${INFRA_NAMESPACE} |
Andrea Campanella | 82add37 | 2021-11-05 12:01:15 +0100 | [diff] [blame] | 175 | Run Keyword If ${logging} Collect Logs |
| 176 | Stop Logging Setup or Teardown Teardown-${SUITE NAME} |
TorstenThieme | 440b7c0 | 2020-12-18 15:42:57 +0000 | [diff] [blame] | 177 | Close All ONOS SSH Connections |
TorstenThieme | 840380b | 2020-10-02 09:31:56 +0000 | [diff] [blame] | 178 | |
TorstenThieme | 2d8327b | 2022-03-15 08:42:27 +0000 | [diff] [blame] | 179 | Teardown Test |
| 180 | [Documentation] Post-test Teardown |
| 181 | Run Keyword If ${pausebeforecleanup} Import Library Dialogs |
| 182 | Run Keyword If ${pausebeforecleanup} Pause Execution Press OK to continue with clean up! |
| 183 | Run Keyword If ${pausebeforecleanup} Log Teardown will be continued... console=yes |
| 184 | Run Keyword If ${teardown_device} Delete All Devices and Verify |
| 185 | # delete etcd MIB Template Data |
| 186 | Delete MIB Template Data ${INFRA_NAMESPACE} |
| 187 | Sleep 5s |
| 188 | |
TorstenThieme | 840380b | 2020-10-02 09:31:56 +0000 | [diff] [blame] | 189 | Perform ONU MIB Template Data Test |
| 190 | [Documentation] This keyword performs ONU MIB Template Data Test |
TorstenThieme | 66c91a8 | 2020-10-19 13:37:53 +0000 | [diff] [blame] | 191 | ${firstonu}= Set Variable 0 |
| 192 | ${secondonu}= Set Variable 1 |
| 193 | ${state2test}= Set Variable omci-flows-pushed |
TorstenThieme | 840380b | 2020-10-02 09:31:56 +0000 | [diff] [blame] | 194 | Set Global Variable ${state2test} |
| 195 | Run Keyword If ${has_dataplane} Clean Up Linux |
| 196 | # Start first Onu |
TorstenThieme | 66c91a8 | 2020-10-19 13:37:53 +0000 | [diff] [blame] | 197 | ${src}= Set Variable ${hosts.src[${0}]} |
| 198 | Log \r\nONU ${src['onu']}: startup with MIB upload cycle and storage of template data to etcd. console=yes |
Hardik Windlass | 4288c6a | 2021-09-28 07:22:06 +0000 | [diff] [blame] | 199 | ${bbsim_pod}= Get Pod Name By Label ${NAMESPACE} release bbsim0 |
| 200 | Power On ONU ${NAMESPACE} ${bbsim_pod} ${src['onu']} |
TorstenThieme | 840380b | 2020-10-02 09:31:56 +0000 | [diff] [blame] | 201 | ${timeStart}= Get Current Date |
| 202 | ${firstonustartup}= Get ONU Startup Duration ${firstonu} ${timeStart} |
| 203 | # check MIB Template data stored in etcd |
| 204 | Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 3s |
Hardik Windlass | 4288c6a | 2021-09-28 07:22:06 +0000 | [diff] [blame] | 205 | ... Verify MIB Template Data Available ${INFRA_NAMESPACE} |
TorstenThieme | 840380b | 2020-10-02 09:31:56 +0000 | [diff] [blame] | 206 | # Start second Onu |
TorstenThieme | 66c91a8 | 2020-10-19 13:37:53 +0000 | [diff] [blame] | 207 | ${src}= Set Variable ${hosts.src[${1}]} |
| 208 | Log ONU ${src['onu']}: startup without MIB upload cycle by using of template data of etcd. console=yes |
Hardik Windlass | 4288c6a | 2021-09-28 07:22:06 +0000 | [diff] [blame] | 209 | ${bbsim_pod}= Get Pod Name By Label ${NAMESPACE} release bbsim0 |
| 210 | Power On ONU ${NAMESPACE} ${bbsim_pod} ${src['onu']} |
TorstenThieme | 840380b | 2020-10-02 09:31:56 +0000 | [diff] [blame] | 211 | ${timeStart}= Get Current Date |
| 212 | ${secondonustartup}= Get ONU Startup Duration ${secondonu} ${timeStart} |
| 213 | # compare both durations, second onu should be at least 3 times faster |
| 214 | ${status} Evaluate ${firstonustartup}>=${secondonustartup}*3 |
| 215 | Should Be True ${status} |
| 216 | ... Startup durations (${firstonustartup} and ${secondonustartup}) do not full fill the requirements of 1/10. |
| 217 | |
| 218 | Get ONU Startup Duration |
| 219 | [Documentation] This keyword delivers startup duration of onu |
| 220 | [Arguments] ${onu} ${starttime} |
| 221 | ${src}= Set Variable ${hosts.src[${onu}]} |
TorstenThieme | 66c91a8 | 2020-10-19 13:37:53 +0000 | [diff] [blame] | 222 | ${admin_state} ${oper_status} ${connect_status} ${onu_state_nb} ${onu_state}= |
| 223 | ... Map State ${state2test} |
TorstenThieme | 840380b | 2020-10-02 09:31:56 +0000 | [diff] [blame] | 224 | Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms |
| 225 | ... Validate Device ${admin_state} ${oper_status} ${connect_status} |
| 226 | ... ${src['onu']} onu=True onu_reason=${onu_state} |
| 227 | ${timeCurrent} = Get Current Date |
| 228 | ${timeTotalMs} = Subtract Date From Date ${timeCurrent} ${startTime} result_format=number |
| 229 | Log ONU ${src['onu']}: reached the state ${onu_state} after ${timeTotalMs} sec. console=yes |
| 230 | [Return] ${timeTotalMs} |
TorstenThieme | 2d8327b | 2022-03-15 08:42:27 +0000 | [diff] [blame] | 231 | |
| 232 | Bring Up ONU |
| 233 | [Documentation] This keyword brings up onu |
| 234 | [Arguments] ${onu}=0 ${state2reach}=omci-flows-pushed |
| 235 | ${src}= Set Variable ${hosts.src[${onu}]} |
| 236 | ${admin_state} ${oper_status} ${connect_status} ${onu_state_nb} ${onu_state}= |
| 237 | ... Map State ${state2reach} |
| 238 | ${bbsim_pod}= Get Pod Name By Label ${NAMESPACE} release bbsim0 |
| 239 | Power On ONU ${NAMESPACE} ${bbsim_pod} ${src['onu']} |
| 240 | Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 1s |
| 241 | ... Validate Device ${admin_state} ${oper_status} ${connect_status} |
| 242 | ... ${src['onu']} onu=True onu_reason=${onu_state} |