TorstenThieme | 53450ff | 2021-05-11 09:44:33 +0000 | [diff] [blame] | 1 | # Copyright 2021 - 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 Negative test states of ONU Go adapter with ATT workflows only (not for DT/TT workflow!) |
| 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 ../../libraries/bbsim.robot |
| 34 | Resource ../../variables/variables.robot |
| 35 | |
| 36 | *** Variables *** |
| 37 | ${namespace} voltha |
| 38 | ${timeout} 300s |
| 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 | # KV Store Prefix |
| 48 | # example: -v kvstoreprefix:voltha_voltha |
| 49 | ${kvstoreprefix} voltha_voltha |
| 50 | # used tech profile, can be passed via the command line too, valid values: default (=1T1GEM), 1T4GEM, 1T8GEM |
| 51 | # example: -v techprofile:1T4GEM |
| 52 | ${techprofile} default |
| 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 | ${data_dir} ../data |
| 66 | |
| 67 | |
| 68 | *** Test Cases *** |
| 69 | ONU Negative State Test |
| 70 | [Documentation] Validates the ONU Go adapter states will never leave starting-openomci |
| 71 | ... Due to a 'omci-response-rate' lower than 8 more OMCI messages will be through away by BBSIM than |
| 72 | ... repeated by openonu-go-adapter. So ONU will never leave starting-openomci state. |
| 73 | ... Timeout has to set at least to 300s (or more) |
| 74 | [Tags] NegativeStateTestOnuGo |
| 75 | [Setup] Run Keywords Start Logging ONUNegativeStateTest |
| 76 | ... AND Setup |
| 77 | # Suite Variable will be overwritten by Teardown of Current State Test All Onus |
| 78 | Set Suite Variable ${StateTestAllONUs} True |
| 79 | ${seconds}= Convert Time ${timeout} |
| 80 | ${seconds}= Convert To String ${seconds} |
| 81 | ${seconds}= Get Substring ${seconds} 0 -2 |
| 82 | FOR ${I} IN RANGE ${seconds} |
| 83 | Sleep 1s |
| 84 | Current State Test All Onus starting-openomci timeout=1x |
| 85 | Exit For Loop If not ${StateTestAllONUs} |
| 86 | END |
| 87 | [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs |
| 88 | ... AND Stop Logging ONUStateTest |
| 89 | |
| 90 | |
| 91 | *** Keywords *** |
| 92 | Setup Suite |
| 93 | [Documentation] Set up the test suite |
| 94 | ${LogInfo}= Catenate |
| 95 | ... \r\nPassed arguments: |
| 96 | ... techprofile:${techprofile}, |
| 97 | ... debugmode:${debugmode}, logging:${logging}, pausebeforecleanup:${pausebeforecleanup}, |
| 98 | ... print2console:${print2console} |
| 99 | Log ${LogInfo} console=yes |
| 100 | Common Test Suite Setup |
| 101 | ${techprofile}= Set Variable If "${techprofile}"=="1T1GEM" default ${techprofile} |
| 102 | Set Suite Variable ${techprofile} |
| 103 | Run Keyword If "${techprofile}"=="default" Log To Console \nTechProfile:default (1T1GEM) |
| 104 | ... ELSE IF "${techprofile}"=="1T4GEM" Set Tech Profile 1T4GEM |
| 105 | ... ELSE IF "${techprofile}"=="1T8GEM" Set Tech Profile 1T8GEM |
| 106 | ... ELSE Fail The TechProfile (${techprofile}) is not valid! |
| 107 | ${onos_ssh_connection} Open ONOS SSH Connection ${ONOS_SSH_IP} ${ONOS_SSH_PORT} |
| 108 | Set Suite Variable ${onos_ssh_connection} |
| 109 | # delete etcd MIB Template Data |
| 110 | Delete MIB Template Data |
| 111 | # delete etcd onu data |
| 112 | Delete ONU Go Adapter ETCD Data validate=True |
| 113 | |
| 114 | Teardown Suite |
| 115 | [Documentation] Replaces the Suite Teardown in utils.robot. |
| 116 | ... Cleans up and checks all ONU ports disabled in ONOS. |
| 117 | ... Furthermore gives the possibility to pause the execution. |
| 118 | Run Keyword If ${pausebeforecleanup} Import Library Dialogs |
| 119 | Run Keyword If ${pausebeforecleanup} Pause Execution Press OK to continue with clean up! |
| 120 | Run Keyword If ${pausebeforecleanup} Log Teardown will be continued... console=yes |
| 121 | Run Keyword If ${teardown_device} Delete All Devices and Verify |
| 122 | Wait Until Keyword Succeeds ${timeout} 1s Validate Onu Data In Etcd 0 ${kvstoreprefix} without_pm_data=False |
| 123 | Wait for Ports in ONOS for all OLTs ${onos_ssh_connection} 0 BBSM ${timeout} |
| 124 | Close All ONOS SSH Connections |
| 125 | Remove Tech Profile |