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 *** |
| 16 | Documentation Test Template handling of ONU Go adapter with BBSIM controlledActivation: only-onu only! |
| 17 | ... Values.yaml must contain 'onu: 2' and 'controlledActivation: only-onu' under BBSIM! |
| 18 | ... Run robot with bbsim-kind-2x2.yaml |
| 19 | Suite Setup Setup Suite |
| 20 | Suite Teardown Teardown Suite |
| 21 | Test Setup Setup |
| 22 | Test Teardown Teardown |
| 23 | Library Collections |
| 24 | Library String |
| 25 | Library OperatingSystem |
| 26 | Library XML |
| 27 | Library RequestsLibrary |
| 28 | Library ../../libraries/DependencyLibrary.py |
| 29 | Resource ../../libraries/onos.robot |
| 30 | Resource ../../libraries/voltctl.robot |
| 31 | Resource ../../libraries/voltha.robot |
| 32 | Resource ../../libraries/utils.robot |
| 33 | Resource ../../libraries/k8s.robot |
| 34 | Resource ../../variables/variables.robot |
Matteo Scandolo | 5d9efae | 2020-12-14 09:37:41 -1000 | [diff] [blame] | 35 | Resource ../../libraries/Voltha_ONUUtilities.robot |
TorstenThieme | 840380b | 2020-10-02 09:31:56 +0000 | [diff] [blame] | 36 | |
| 37 | *** Variables *** |
| 38 | ${NAMESPACE} voltha |
TorstenThieme | d4f4896 | 2020-12-08 12:17:19 +0000 | [diff] [blame] | 39 | ${timeout} 60s |
TorstenThieme | 840380b | 2020-10-02 09:31:56 +0000 | [diff] [blame] | 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 | |
| 49 | # flag debugmode is used, if true timeout calculation various, can be passed via the command line too |
| 50 | # example: -v debugmode:True |
| 51 | ${debugmode} False |
| 52 | # logging flag to enable Collect Logs, can be passed via the command line too |
| 53 | # example: -v logging:True |
| 54 | ${logging} False |
| 55 | # if True execution will be paused before clean up |
| 56 | # example: -v pausebeforecleanup:True |
| 57 | ${pausebeforecleanup} False |
| 58 | ${data_dir} ../data |
| 59 | |
| 60 | |
| 61 | *** Test Cases *** |
| 62 | ONU MIB Template Data Test |
| 63 | [Documentation] Validates ONU Go adapter storage of MIB Template Data in etcd and checks the usage |
| 64 | ... - setup one ONU |
| 65 | ... - request MIB-Upload-Data by ONU via OMCI |
| 66 | ... - storage MIB-Upload-Data in etcd |
| 67 | ... - store setup duration of ONU |
TorstenThieme | d4f4896 | 2020-12-08 12:17:19 +0000 | [diff] [blame] | 68 | ... - check Template-Data in etcd stored (service/%{NAME}/omci_mibs/go_templates/) |
TorstenThieme | 840380b | 2020-10-02 09:31:56 +0000 | [diff] [blame] | 69 | ... - setup second ONU |
| 70 | ... - collect setup durationof second ONU |
| 71 | ... - compare both duration |
| 72 | ... - duration of second ONU should be at least 10 times faster than the first one |
| 73 | ... - MIB-Upload-Data should not requested via OMCI by second ONU |
| 74 | ... - MIB-Upload-Data should read from etcd |
TorstenThieme | 66c91a8 | 2020-10-19 13:37:53 +0000 | [diff] [blame] | 75 | [Tags] functionalOnuGo MibTemplateOnuGo |
TorstenThieme | 840380b | 2020-10-02 09:31:56 +0000 | [diff] [blame] | 76 | [Setup] Run Keywords Start Logging ONUMibTemplateTest |
| 77 | ... AND Setup |
| 78 | Perform ONU MIB Template Data Test |
| 79 | [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs |
| 80 | ... AND Stop Logging ONUMibTemplateTest |
| 81 | |
| 82 | |
| 83 | *** Keywords *** |
| 84 | Setup Suite |
| 85 | [Documentation] Set up the test suite |
| 86 | ${LogInfo}= Catenate |
| 87 | ... \r\nPassed arguments: |
| 88 | ... debugmode:${debugmode}, logging:${logging}, pausebeforecleanup:${pausebeforecleanup}, |
| 89 | Log ${LogInfo} console=yes |
| 90 | Common Test Suite Setup |
| 91 | ${onos_ssh_connection} Open ONOS SSH Connection ${ONOS_SSH_IP} ${ONOS_SSH_PORT} |
| 92 | Set Suite Variable ${onos_ssh_connection} |
| 93 | # delete etcd MIB Template Data |
| 94 | Delete MIB Template Data |
| 95 | |
| 96 | Teardown Suite |
| 97 | [Documentation] Replaces the Suite Teardown in utils.robot. |
| 98 | ... Cleans up and checks all ONU ports disabled in ONOS. |
| 99 | ... Furthermore gives the possibility to pause the execution. |
| 100 | Run Keyword If ${pausebeforecleanup} Import Library Dialogs |
| 101 | Run Keyword If ${pausebeforecleanup} Pause Execution Press OK to continue with clean up! |
| 102 | Run Keyword If ${pausebeforecleanup} Log Teardown will be continued... console=yes |
| 103 | Run Keyword If ${teardown_device} Delete All Devices and Verify |
TorstenThieme | 7385005 | 2020-12-10 12:43:28 +0000 | [diff] [blame] | 104 | # Re-open ssh connection to onos since no keep alive is implemented in SSH library |
| 105 | Close ONOS SSH Connection ${onos_ssh_connection} |
| 106 | ${onos_ssh_connection} Open ONOS SSH Connection ${ONOS_SSH_IP} ${ONOS_SSH_PORT} |
| 107 | Set Suite Variable ${onos_ssh_connection} |
TorstenThieme | d4f4896 | 2020-12-08 12:17:19 +0000 | [diff] [blame] | 108 | Wait for Ports in ONOS for all OLTs ${onos_ssh_connection} 0 BBSM |
TorstenThieme | 840380b | 2020-10-02 09:31:56 +0000 | [diff] [blame] | 109 | # delete etcd MIB Template Data (for repeating test) |
| 110 | Delete MIB Template Data |
| 111 | Close ONOS SSH Connection ${onos_ssh_connection} |
| 112 | |
| 113 | Perform ONU MIB Template Data Test |
| 114 | [Documentation] This keyword performs ONU MIB Template Data Test |
TorstenThieme | 66c91a8 | 2020-10-19 13:37:53 +0000 | [diff] [blame] | 115 | ${firstonu}= Set Variable 0 |
| 116 | ${secondonu}= Set Variable 1 |
| 117 | ${state2test}= Set Variable omci-flows-pushed |
TorstenThieme | 840380b | 2020-10-02 09:31:56 +0000 | [diff] [blame] | 118 | Set Global Variable ${state2test} |
| 119 | Run Keyword If ${has_dataplane} Clean Up Linux |
| 120 | # Start first Onu |
TorstenThieme | 66c91a8 | 2020-10-19 13:37:53 +0000 | [diff] [blame] | 121 | ${src}= Set Variable ${hosts.src[${0}]} |
| 122 | Log \r\nONU ${src['onu']}: startup with MIB upload cycle and storage of template data to etcd. console=yes |
Holger Hildebrandt | 2314774 | 2020-11-16 10:13:21 +0000 | [diff] [blame] | 123 | ${result}= Exec Pod In Kube ${NAMESPACE} bbsim bbsimctl onu poweron ${src['onu']} |
TorstenThieme | 66c91a8 | 2020-10-19 13:37:53 +0000 | [diff] [blame] | 124 | Should Contain ${result} successfully msg=Can not poweron ${src['onu']} values=False |
TorstenThieme | 840380b | 2020-10-02 09:31:56 +0000 | [diff] [blame] | 125 | ${timeStart}= Get Current Date |
| 126 | ${firstonustartup}= Get ONU Startup Duration ${firstonu} ${timeStart} |
| 127 | # check MIB Template data stored in etcd |
| 128 | Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 3s |
| 129 | ... Verify MIB Template Data Available |
| 130 | # Start second Onu |
TorstenThieme | 66c91a8 | 2020-10-19 13:37:53 +0000 | [diff] [blame] | 131 | ${src}= Set Variable ${hosts.src[${1}]} |
| 132 | Log ONU ${src['onu']}: startup without MIB upload cycle by using of template data of etcd. console=yes |
Holger Hildebrandt | 2314774 | 2020-11-16 10:13:21 +0000 | [diff] [blame] | 133 | ${result}= Exec Pod In Kube ${NAMESPACE} bbsim bbsimctl onu poweron ${src['onu']} |
TorstenThieme | 66c91a8 | 2020-10-19 13:37:53 +0000 | [diff] [blame] | 134 | Should Contain ${result} successfully msg=Can not poweron ${src['onu']} values=False |
TorstenThieme | 840380b | 2020-10-02 09:31:56 +0000 | [diff] [blame] | 135 | ${timeStart}= Get Current Date |
| 136 | ${secondonustartup}= Get ONU Startup Duration ${secondonu} ${timeStart} |
| 137 | # compare both durations, second onu should be at least 3 times faster |
| 138 | ${status} Evaluate ${firstonustartup}>=${secondonustartup}*3 |
| 139 | Should Be True ${status} |
| 140 | ... Startup durations (${firstonustartup} and ${secondonustartup}) do not full fill the requirements of 1/10. |
| 141 | |
| 142 | Get ONU Startup Duration |
| 143 | [Documentation] This keyword delivers startup duration of onu |
| 144 | [Arguments] ${onu} ${starttime} |
| 145 | ${src}= Set Variable ${hosts.src[${onu}]} |
TorstenThieme | 66c91a8 | 2020-10-19 13:37:53 +0000 | [diff] [blame] | 146 | ${admin_state} ${oper_status} ${connect_status} ${onu_state_nb} ${onu_state}= |
| 147 | ... Map State ${state2test} |
TorstenThieme | 840380b | 2020-10-02 09:31:56 +0000 | [diff] [blame] | 148 | Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms |
| 149 | ... Validate Device ${admin_state} ${oper_status} ${connect_status} |
| 150 | ... ${src['onu']} onu=True onu_reason=${onu_state} |
| 151 | ${timeCurrent} = Get Current Date |
| 152 | ${timeTotalMs} = Subtract Date From Date ${timeCurrent} ${startTime} result_format=number |
| 153 | Log ONU ${src['onu']}: reached the state ${onu_state} after ${timeTotalMs} sec. console=yes |
| 154 | [Return] ${timeTotalMs} |