Joey Armstrong | 9fadcbe | 2024-01-17 19:00:37 -0500 | [diff] [blame] | 1 | # Copyright 2021-2024 Open Networking Foundation (ONF) and the ONF Contributors |
TorstenThieme | ff9c914 | 2021-04-08 07:21:34 +0000 | [diff] [blame] | 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 open ONU go adapter PM data |
| 17 | ... in case of kafka pod runs in k8s cluster - kafka has to deploy with following EXTRA_HELM_FLAGS |
| 18 | ... --set externalAccess.enabled=true, |
| 19 | ... --set externalAccess.service.type=NodePort, |
| 20 | ... --set externalAccess.service.nodePorts[0]=${KAFKA_PORT}, |
| 21 | ... --set externalAccess.service.domain=${KAFKA_IP} |
| 22 | ... with e.g. service.domain=10.0.02.15 or 127.0.0.1 and service.nodePorts[0]=30201! |
TorstenThieme | d81c104 | 2021-05-27 14:19:49 +0000 | [diff] [blame] | 23 | ... For voltha-infra prefix kafka. is needed e.g.: --set kafka.externalAccess.enabled=true |
TorstenThieme | ff9c914 | 2021-04-08 07:21:34 +0000 | [diff] [blame] | 24 | Suite Setup Setup Suite |
| 25 | Suite Teardown Teardown Suite |
| 26 | Test Setup Setup |
| 27 | Test Teardown Teardown |
| 28 | Library Collections |
| 29 | Library String |
| 30 | Library OperatingSystem |
| 31 | Library XML |
| 32 | Library RequestsLibrary |
| 33 | Library ../../libraries/DependencyLibrary.py |
| 34 | Resource ../../libraries/onos.robot |
| 35 | Resource ../../libraries/voltctl.robot |
| 36 | Resource ../../libraries/voltha.robot |
| 37 | Resource ../../libraries/utils.robot |
| 38 | Resource ../../libraries/k8s.robot |
| 39 | Resource ../../libraries/onu_utilities.robot |
| 40 | Resource ../../libraries/bbsim.robot |
| 41 | Resource ../../libraries/pm_utilities.robot |
| 42 | Resource ../../variables/variables.robot |
| 43 | |
| 44 | Library kafka_robot.KafkaClient log_level=DEBUG WITH NAME kafka |
TorstenThieme | ff9c914 | 2021-04-08 07:21:34 +0000 | [diff] [blame] | 45 | |
| 46 | |
| 47 | *** Variables *** |
Hardik Windlass | 4288c6a | 2021-09-28 07:22:06 +0000 | [diff] [blame] | 48 | ${NAMESPACE} voltha |
| 49 | ${INFRA_NAMESPACE} default |
TorstenThieme | ff9c914 | 2021-04-08 07:21:34 +0000 | [diff] [blame] | 50 | ${timeout} 60s |
| 51 | ${of_id} 0 |
| 52 | ${logical_id} 0 |
| 53 | ${has_dataplane} True |
| 54 | ${external_libs} True |
| 55 | ${teardown_device} True |
| 56 | ${scripts} ../../scripts |
| 57 | # Per-test logging on failure is turned off by default; set this variable to enable |
| 58 | ${container_log_dir} ${None} |
| 59 | |
| 60 | # logging flag to enable Collect Logs, can be passed via the command line too |
| 61 | # example: -v logging:True |
| 62 | ${logging} False |
| 63 | # determines the environment workflow: DT, TT or ATT (default) |
| 64 | # example: -v workflow:DT |
| 65 | ${workflow} ATT |
| 66 | # when voltha is running in k8s port forwarding is needed |
| 67 | # example: -v PORT_FORWARDING:False |
| 68 | ${PORT_FORWARDING} True |
| 69 | # kafka ip e.g. ip of master host where k8s is running |
| 70 | # example: -v KAFKA_IP:10.0.2.15 |
| 71 | ${KAFKA_IP} 127.0.0.1 |
| 72 | # kafka port: port of kafka nodeport |
| 73 | # example: -v KAFKA_PORT:30201 |
| 74 | ${KAFKA_PORT} 30201 |
| 75 | # kafka service port: service port of kafka nodeport |
| 76 | # example: -v KAFKA_SVC_PORT:9094 |
| 77 | ${KAFKA_SVC_PORT} 9094 |
| 78 | # onu pm data default interval |
| 79 | # example: -v ONU_DEFAULT_INTERVAL:50s |
| 80 | ${ONU_DEFAULT_INTERVAL} 300s |
| 81 | # onu pm data group PON_Optical interval |
| 82 | # example: -v ONU_PON_OPTICAL_INTERVAL:50s |
| 83 | ${ONU_PON_OPTICAL_INTERVAL} 35s |
| 84 | # onu pm data group UNI_Status interval |
| 85 | # example: -v ONU_UNI_STATUS_INTERVAL:50s |
| 86 | ${ONU_UNI_STATUS_INTERVAL} 20s |
| 87 | |
Hardik Windlass | b1bda36 | 2021-11-24 11:54:36 +0000 | [diff] [blame] | 88 | # flag to choose the subscriber provisioning command type in ONOS |
| 89 | # TT often provision a single services for a subscriber (eg: hsia, voip, ...) one after the other. |
| 90 | # if set to True, command used is "volt-add-subscriber-unitag" |
| 91 | # if set to False, comand used is "volt-add-subscriber-access" |
| 92 | ${unitag_sub} False |
| 93 | |
TorstenThieme | ff9c914 | 2021-04-08 07:21:34 +0000 | [diff] [blame] | 94 | *** Test Cases *** |
| 95 | Check Default Metrics All ONUs |
| 96 | [Documentation] Validates the ONU Go adapter pm date resp. Metrics with dafault values |
| 97 | [Tags] functional CheckDefaultMetricsAllOnus |
| 98 | [Setup] Start Logging CheckDefaultMetricsAllOnus |
| 99 | ${collect_interval}= Determine Collection Interval |
| 100 | Collect and Validate PM Data ${collect_interval} |
| 101 | [Teardown] Run Keywords Clean Metric Dictionary |
| 102 | ... AND Run Keyword If ${logging} Collect Logs |
| 103 | ... AND Stop Logging CheckDefaultMetricsAllOnus |
| 104 | |
| 105 | Check User Onu Metrics |
| 106 | [Documentation] Validates the ONU Go adapter pm date resp. Metrics with user values |
| 107 | ... Currently only the intvals of metric groups UNI_Status and PON_Optical will be set to user values. |
| 108 | [Tags] functional CheckUserOnuMetrics |
| 109 | [Setup] Start Logging CheckUserOnuMetrics |
| 110 | # set user values for intervals |
| 111 | Set Group Interval All Onu UNI_Status ${ONU_UNI_STATUS_INTERVAL} |
| 112 | Set Group Interval All Onu PON_Optical ${ONU_PON_OPTICAL_INTERVAL} |
| 113 | ${collect_interval}= Determine Collection Interval user=True |
| 114 | # activate user interval values |
| 115 | Activate And Validate Interval All Onu user=True |
| 116 | Collect and Validate PM Data ${collect_interval} user=True |
| 117 | # (re-)activate default interval values |
| 118 | Set Group Interval All Onu UNI_Status -1 |
| 119 | Set Group Interval All Onu PON_Optical -1 |
| 120 | Activate And Validate Interval All Onu |
| 121 | [Teardown] Run Keywords Clean Metric Dictionary |
| 122 | ... AND Run Keyword If ${logging} Collect Logs |
| 123 | ... AND Stop Logging CheckUserOnuMetrics |
| 124 | |
| 125 | Check User Onu Metrics Disabled Device |
| 126 | [Documentation] Validates the ONU Go adapter pm date resp. Metrics with user values for disabled device |
| 127 | ... Currently only the intvals of metric groups UNI_Status will be set to user values and validated. |
| 128 | ... First enable status will be validated, then all devices will be disabled and status will be validated. |
| 129 | [Tags] functional CheckUserOnuMetricsDisabledDevice |
| 130 | [Setup] Start Logging CheckUserOnuMetricsDisabledDevice |
| 131 | # set user values for intervals |
| 132 | Set Group Interval All Onu UNI_Status ${ONU_UNI_STATUS_INTERVAL} |
| 133 | ${collect_interval}= Determine Collection Interval user=True |
| 134 | # activate user interval values |
| 135 | Activate And Validate Interval All Onu user=True |
| 136 | # read and store currents validation data |
| 137 | ${group}= Set Variable UNI_Status |
| 138 | ${oper_state}= Set Variable oper_status |
| 139 | ${admin_state}= Set Variable uni_admin_state |
| 140 | ${prev_validation_data_oper_state}= Get Validation Operation All Onu ${group} ${oper_state} |
| 141 | ${prev_validation_data_admin_state}= Get Validation Operation All Onu ${group} ${admin_state} |
| 142 | # change the validation data for oper_status and uni_admin_state of metric group UNI_Status |
| 143 | ${enable}= Set Variable 0 |
| 144 | ${disable}= Set Variable 1 |
| 145 | ${enabled_check}= Create Dictionary operator=${eq} operand=${enable} |
| 146 | ${disabled_check}= Create Dictionary operator=${eq} operand=${disable} |
| 147 | ${ValidationEnabled}= Create Dictionary first=${enabled_check} successor=${enabled_check} |
| 148 | ${ValidationDisabled}= Create Dictionary first=${disabled_check} successor=${disabled_check} |
| 149 | # validate enabled status |
| 150 | Set Validation Operation All Onu ${group} ${oper_state} ${ValidationEnabled} |
| 151 | Set Validation Operation All Onu ${group} ${admin_state} ${ValidationEnabled} |
| 152 | Collect and Validate PM Data ${collect_interval} user=True |
| 153 | Clean Metric Dictionary |
| 154 | # validate disabled status |
| 155 | Set Validation Operation All Onu ${group} ${oper_state} ${ValidationDisabled} |
| 156 | Set Validation Operation All Onu ${group} ${admin_state} ${ValidationDisabled} |
| 157 | # disable (all) onu devices |
| 158 | Disable Onu Device |
| 159 | ${alternativeonustates}= Create List omci-flows-deleted tech-profile-config-delete-success |
| 160 | Current State Test All Onus omci-admin-lock alternativeonustate=${alternativeonustates} |
| 161 | Log Ports |
| 162 | #check no port is enabled in ONOS |
TorstenThieme | 731a759 | 2021-07-01 14:26:54 +0000 | [diff] [blame] | 163 | Wait for Ports in ONOS for all OLTs ${ONOS_SSH_IP} ${ONOS_SSH_PORT} 0 BBSM |
TorstenThieme | ff9c914 | 2021-04-08 07:21:34 +0000 | [diff] [blame] | 164 | Collect and Validate PM Data ${collect_interval} user=True |
| 165 | Clean Metric Dictionary |
| 166 | # enable (all) onu devices |
| 167 | Enable Onu Device |
| 168 | ${alternativeonustates}= Create List onu-reenabled |
| 169 | Current State Test All Onus omci-flows-pushed alternativeonustate=${alternativeonustates} |
| 170 | Log Ports onlyenabled=True |
| 171 | #check that all the UNI ports show up in ONOS again |
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} ${num_all_onus} BBSM determine_number=True |
TorstenThieme | ff9c914 | 2021-04-08 07:21:34 +0000 | [diff] [blame] | 173 | # validate enabled status (again) |
| 174 | Set Validation Operation All Onu ${group} ${oper_state} ${ValidationEnabled} |
| 175 | Set Validation Operation All Onu ${group} ${admin_state} ${ValidationEnabled} |
| 176 | Collect and Validate PM Data ${collect_interval} user=True |
| 177 | # (re-)set previous validation data |
| 178 | Set Validation Operation Passed Onu ${group} ${oper_state} ${prev_validation_data_oper_state} |
| 179 | Set Validation Operation Passed Onu ${group} ${admin_state} ${prev_validation_data_admin_state} |
| 180 | # (re-)activate default interval values |
| 181 | Set Group Interval All Onu UNI_Status -1 |
| 182 | Activate And Validate Interval All Onu |
| 183 | [Teardown] Run Keywords Clean Metric Dictionary |
| 184 | ... AND Run Keyword If ${logging} Collect Logs |
| 185 | ... AND Stop Logging CheckUserOnuMetricsDisabledDevice |
| 186 | |
| 187 | |
| 188 | *** Keywords *** |
| 189 | Setup Suite |
| 190 | [Documentation] Set up the test suite |
| 191 | Common Test Suite Setup |
TorstenThieme | ff9c914 | 2021-04-08 07:21:34 +0000 | [diff] [blame] | 192 | ${switch_type}= Get Variable Value ${web_power_switch.type} |
| 193 | Run Keyword If "${switch_type}"!="" Set Global Variable ${powerswitch_type} ${switch_type} |
TorstenThieme | d81c104 | 2021-05-27 14:19:49 +0000 | [diff] [blame] | 194 | # set ${kafka} depending on environment in case of port-forward is needed |
| 195 | ${rc} ${kafka}= Run Keyword If ${PORT_FORWARDING} Run and Return Rc and Output |
Matteo Scandolo | 6b52412 | 2021-10-22 14:34:29 -0700 | [diff] [blame] | 196 | ... kubectl get svc -n ${INFRA_NAMESPACE} | grep kafka-0-external | awk '{print $1}' |
TorstenThieme | d81c104 | 2021-05-27 14:19:49 +0000 | [diff] [blame] | 197 | Run Keyword If ${PORT_FORWARDING} Should Not Be Empty ${kafka} Service kafka-0-external not found |
TorstenThieme | ff9c914 | 2021-04-08 07:21:34 +0000 | [diff] [blame] | 198 | # start port forwarding if needed (when voltha runs in k8s) |
| 199 | ${portFwdHandle} = Run Keyword If ${PORT_FORWARDING} Start Process |
TorstenThieme | fc26b3b | 2021-05-12 14:42:13 +0000 | [diff] [blame] | 200 | ... kubectl port-forward --address 0.0.0.0 --namespace default svc/${kafka} ${KAFKA_PORT}:${KAFKA_SVC_PORT} & |
TorstenThieme | ff9c914 | 2021-04-08 07:21:34 +0000 | [diff] [blame] | 201 | ... shell=true |
| 202 | Set Suite Variable ${portFwdHandle} |
| 203 | Sleep 5s |
| 204 | # open connection to read kafka bus |
| 205 | Wait Until Keyword Succeeds 3x 5s |
| 206 | ... kafka.Connection Open ${KAFKA_IP} ${KAFKA_PORT} voltha.events timestamp_from=0 |
| 207 | # enable OLT(s) and bring up ONU(s) |
| 208 | Setup |
| 209 | Run Keyword If "${workflow}"=="DT" Perform Sanity Test DT |
| 210 | ... ELSE IF "${workflow}"=="TT" Perform Sanity Tests TT |
| 211 | ... ELSE Perform Sanity Test |
| 212 | # prepare pm data matrix for validation |
| 213 | ${METRIC_DICT}= Create Metric Dictionary |
| 214 | Set Suite Variable ${METRIC_DICT} |
| 215 | |
| 216 | Teardown Suite |
| 217 | [Documentation] tear down the test suite |
| 218 | # close connection to kafka |
| 219 | kafka.Connection Close |
| 220 | # stop port forwarding if started |
| 221 | Run Keyword If ${PORT_FORWARDING} Terminate Process ${portFwdHandle} kill=true |
| 222 | # call common suite teardown |
| 223 | utils.Teardown Suite |
| 224 | Close All ONOS SSH Connections |