TorstenThieme | 136ebf7 | 2021-02-26 14:27:07 +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 | # FIXME Can we use the same test against BBSim and Hardware? |
| 15 | |
| 16 | *** Settings *** |
| 17 | Documentation Test various functional end-to-end scenarios for TT workflow |
| 18 | Suite Setup Setup Suite |
| 19 | Test Setup Setup |
| 20 | Test Teardown Teardown |
| 21 | Suite Teardown Teardown Suite |
| 22 | Library Collections |
| 23 | Library String |
| 24 | Library OperatingSystem |
| 25 | Library XML |
| 26 | Library RequestsLibrary |
| 27 | Library ../../libraries/DependencyLibrary.py |
| 28 | Resource ../../libraries/onos.robot |
| 29 | Resource ../../libraries/voltctl.robot |
| 30 | Resource ../../libraries/voltha.robot |
| 31 | Resource ../../libraries/utils.robot |
| 32 | Resource ../../libraries/k8s.robot |
| 33 | Resource ../../variables/variables.robot |
| 34 | Resource ../../libraries/power_switch.robot |
| 35 | |
| 36 | *** Variables *** |
| 37 | ${POD_NAME} flex-ocp-cord |
| 38 | ${KUBERNETES_CONF} ${KUBERNETES_CONFIGS_DIR}/${POD_NAME}.conf |
| 39 | ${KUBERNETES_CONFIGS_DIR} ~/pod-configs/kubernetes-configs |
| 40 | #${KUBERNETES_CONFIGS_DIR} ${KUBERNETES_CONFIGS_DIR}/${POD_NAME}.conf |
| 41 | ${KUBERNETES_YAML} ${KUBERNETES_CONFIGS_DIR}/${POD_NAME}.yml |
| 42 | ${HELM_CHARTS_DIR} ~/helm-charts |
| 43 | ${VOLTHA_POD_NUM} 8 |
| 44 | ${NAMESPACE} voltha |
| 45 | # For below variable value, using deployment name as using grep for |
| 46 | # parsing radius pod name, we can also use full radius pod name |
| 47 | ${RESTART_POD_NAME} radius |
| 48 | ${timeout} 60s |
| 49 | ${of_id} 0 |
| 50 | ${logical_id} 0 |
| 51 | ${has_dataplane} True |
Hardik Windlass | 04896f6 | 2021-03-05 16:15:11 +0530 | [diff] [blame] | 52 | ${teardown_device} True |
TorstenThieme | 136ebf7 | 2021-02-26 14:27:07 +0000 | [diff] [blame] | 53 | ${scripts} ../../scripts |
| 54 | |
| 55 | # Per-test logging on failure is turned off by default; set this variable to enable |
| 56 | ${container_log_dir} ${None} |
| 57 | |
| 58 | ${suppressaddsubscriber} True |
| 59 | |
| 60 | *** Test Cases *** |
| 61 | Verify restart openonu-adapter container after subscriber provisioning for TT |
| 62 | [Documentation] Restart openonu-adapter container after VOLTHA is operational. |
| 63 | ... Prerequisite : ONUs are authenticated and pingable. |
Hardik Windlass | 04896f6 | 2021-03-05 16:15:11 +0530 | [diff] [blame] | 64 | [Tags] functionalTT Restart-OpenOnu-TT |
TorstenThieme | 136ebf7 | 2021-02-26 14:27:07 +0000 | [diff] [blame] | 65 | [Setup] Start Logging Restart-OpenOnu-TT |
| 66 | [Teardown] Run Keywords Collect Logs |
| 67 | ... AND Stop Logging Restart-OpenOnu-TT |
| 68 | ... AND Delete All Devices and Verify |
| 69 | # Add OLT device |
| 70 | Setup |
| 71 | # Performing Sanity Test to make sure subscribers are all DHCP and pingable |
| 72 | Run Keyword If ${has_dataplane} Clean Up Linux |
| 73 | Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Tests TT |
| 74 | ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE} |
| 75 | Log ${podStatusOutput} |
| 76 | ${countBeforeRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l |
| 77 | ${podName} Set Variable adapter-open-onu |
| 78 | Wait Until Keyword Succeeds ${timeout} 15s Delete K8s Pods By Label ${NAMESPACE} app ${podName} |
| 79 | Sleep 5s |
| 80 | Wait Until Keyword Succeeds ${timeout} 2s Validate Pods Status By Label ${NAMESPACE} |
| 81 | ... app ${podName} Running |
| 82 | Wait Until Keyword Succeeds ${timeout} 3s Pods Are Ready By Label ${NAMESPACE} app ${podName} |
| 83 | Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Tests TT ${suppressaddsubscriber} |
| 84 | ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE} |
| 85 | Log ${podStatusOutput} |
| 86 | ${countAfterRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l |
| 87 | Should Be Equal As Strings ${countAfterRestart} ${countBeforeRestart} |
| 88 | Log to console Pod ${podName} restarted and sanity checks passed successfully |
| 89 | |
Hardik Windlass | d3f6389 | 2021-03-25 08:28:02 +0000 | [diff] [blame] | 90 | Verify restart openolt-adapter container after subscriber provisioning for TT |
| 91 | [Documentation] Restart openolt-adapter container after VOLTHA is operational. |
| 92 | [Tags] functionalTT Restart-OpenOlt-TT |
| 93 | [Setup] Start Logging Restart-OpenOlt-TT |
| 94 | [Teardown] Run Keywords Collect Logs |
| 95 | ... AND Stop Logging Restart-OpenOlt-TT |
| 96 | Setup |
| 97 | Run Keyword If ${has_dataplane} Clean Up Linux |
| 98 | Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Tests TT |
| 99 | ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE} |
| 100 | Log ${podStatusOutput} |
| 101 | ${countBforRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l |
| 102 | ${podName} Set Variable ${OLT_ADAPTER_APP_LABEL} |
| 103 | Wait Until Keyword Succeeds ${timeout} 15s Delete K8s Pods By Label ${NAMESPACE} app ${podName} |
| 104 | Sleep 5s |
| 105 | Wait Until Keyword Succeeds ${timeout} 2s Validate Pods Status By Label ${NAMESPACE} |
| 106 | ... app ${podName} Running |
| 107 | Wait Until Keyword Succeeds ${timeout} 3s Pods Are Ready By Label ${NAMESPACE} app ${podName} |
| 108 | Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Tests TT ${suppressaddsubscriber} |
| 109 | ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE} |
| 110 | Log ${podStatusOutput} |
| 111 | ${countAfterRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l |
| 112 | Should Be Equal As Strings ${countAfterRestart} ${countBforRestart} |
| 113 | Log to console Pod ${podName} restarted and sanity checks passed successfully |
| 114 | |
| 115 | Verify restart ofagent container after subscriber is provisioned for TT |
| 116 | [Documentation] Restart ofagent container after VOLTHA is operational. |
| 117 | [Tags] functionalTT ofagentRestart-TT notready |
| 118 | [Setup] Start Logging ofagentRestart-TT |
| 119 | [Teardown] Run Keywords Collect Logs |
| 120 | ... AND Stop Logging ofagentRestart-TT |
| 121 | ... AND Scale K8s Deployment ${NAMESPACE} voltha-voltha-ofagent 1 |
| 122 | # set timeout value |
| 123 | ${waitforRestart} Set Variable 120s |
| 124 | ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE} |
| 125 | Log ${podStatusOutput} |
| 126 | ${countBforRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l |
| 127 | ${podName} Set Variable ofagent |
| 128 | Wait Until Keyword Succeeds ${timeout} 15s Delete K8s Pods By Label ${NAMESPACE} app ${podName} |
| 129 | Wait Until Keyword Succeeds ${timeout} 2s Validate Pods Status By Label ${NAMESPACE} |
| 130 | ... app ${podName} Running |
| 131 | Wait Until Keyword Succeeds ${timeout} 3s Pods Are Ready By Label ${NAMESPACE} app ${podName} |
| 132 | Run Keyword If ${has_dataplane} Clean Up Linux |
| 133 | Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Tests TT ${suppressaddsubscriber} |
| 134 | ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE} |
| 135 | Log ${podStatusOutput} |
| 136 | ${countAfterRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l |
| 137 | Should Be Equal As Strings ${countAfterRestart} ${countBforRestart} |
| 138 | # Scale Down the Of-Agent Deployment |
| 139 | Scale K8s Deployment ${NAMESPACE} voltha-voltha-ofagent 0 |
| 140 | Sleep 30s |
| 141 | FOR ${I} IN RANGE 0 ${num_all_onus} |
| 142 | ${src}= Set Variable ${hosts.src[${I}]} |
| 143 | ${dst}= Set Variable ${hosts.dst[${I}]} |
| 144 | ${of_id}= Get ofID From OLT List ${src['olt']} |
| 145 | ${onu_device_id}= Get Device ID From SN ${src['onu']} |
| 146 | ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s |
| 147 | ... Get ONU Port in ONOS ${src['onu']} ${of_id} |
| 148 | # Verify ONU state in voltha |
| 149 | Run Keyword And Continue On Failure Wait Until Keyword Succeeds 360s 5s Validate Device |
| 150 | ... ENABLED ACTIVE REACHABLE |
| 151 | ... ${src['onu']} onu=True onu_reason=omci-flows-pushed |
| 152 | # Check ONU port is Disabled in ONOS |
| 153 | Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s |
| 154 | ... Verify ONU Port Is Disabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']} |
| 155 | # Verify Ping |
| 156 | Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Check Ping True |
| 157 | ... ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']} ${src['ip']} |
| 158 | ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']} |
| 159 | END |
| 160 | # Scale Up the Of-Agent Deployment |
| 161 | Scale K8s Deployment ${NAMESPACE} voltha-voltha-ofagent 1 |
| 162 | Wait Until Keyword Succeeds ${waitforRestart} 2s Validate Pod Status ofagent ${NAMESPACE} |
| 163 | ... Running |
| 164 | Run Keyword If ${has_dataplane} Clean Up Linux |
| 165 | Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Tests TT ${suppressaddsubscriber} |
| 166 | Log to console Pod ${podName} restarted and sanity checks passed successfully |
| 167 | |
| 168 | Sanity E2E Test for OLT/ONU on POD With Core Fail and Restart for TT |
| 169 | [Documentation] Deploys an device instance. After that rw-core deployment is scaled to 0 instances to |
| 170 | ... simulate a POD crash. The test then scales the rw-core back to a single instance |
| 171 | ... and configures ONOS for access. The test succeeds if the device is able to |
| 172 | ... complete the DHCP sequence. |
Hardik Windlass | 3e3c994 | 2021-04-09 11:37:15 +0000 | [diff] [blame] | 173 | [Tags] functionalTT rwcore-restart-TT |
Hardik Windlass | d3f6389 | 2021-03-25 08:28:02 +0000 | [diff] [blame] | 174 | [Setup] Run Keywords Start Logging RwCoreFailAndRestart-TT |
| 175 | ... AND Clear All Devices Then Create New Device |
| 176 | [Teardown] Run Keywords Collect Logs |
| 177 | ... AND Stop Logging RwCoreFailAndRestart-TT |
| 178 | Run Keyword If ${has_dataplane} Clean Up Linux |
| 179 | FOR ${I} IN RANGE 0 ${olt_count} |
| 180 | ${olt_serial_number}= Get From Dictionary ${olt_ids}[${I}] sn |
| 181 | ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number} |
| 182 | ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS |
| 183 | ... ${olt_serial_number} |
| 184 | ${nni_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s |
| 185 | ... Get NNI Port in ONOS ${of_id} |
| 186 | END |
| 187 | FOR ${I} IN RANGE 0 ${num_all_onus} |
| 188 | ${src}= Set Variable ${hosts.src[${I}]} |
| 189 | ${dst}= Set Variable ${hosts.dst[${I}]} |
| 190 | ${of_id}= Get ofID From OLT List ${src['olt']} |
| 191 | ${onu_device_id}= Get Device ID From SN ${src['onu']} |
| 192 | ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']} |
| 193 | ... ${of_id} |
| 194 | # Bring up the device and verify it authenticates |
| 195 | Wait Until Keyword Succeeds 360s 5s Validate Device ENABLED ACTIVE REACHABLE |
| 196 | ... ${onu_device_id} onu=True onu_reason=initial-mib-downloaded |
| 197 | END |
| 198 | |
| 199 | # Scale down the rw-core deployment to 0 PODs and once confirmed, scale it back to 1 |
| 200 | Scale K8s Deployment voltha voltha-voltha-rw-core 0 |
| 201 | Wait Until Keyword Succeeds ${timeout} 2s Pod Does Not Exist voltha voltha-voltha-rw-core |
| 202 | # Ensure the ofagent POD goes "not-ready" as expected |
| 203 | Wait Until keyword Succeeds ${timeout} 2s |
| 204 | ... Check Expected Available Deployment Replicas voltha voltha-voltha-ofagent 0 |
| 205 | # Scale up the core deployment and make sure both it and the ofagent deployment are back |
| 206 | Scale K8s Deployment voltha voltha-voltha-rw-core 1 |
| 207 | Wait Until Keyword Succeeds ${timeout} 2s |
| 208 | ... Check Expected Available Deployment Replicas voltha voltha-voltha-rw-core 1 |
| 209 | Wait Until Keyword Succeeds ${timeout} 2s |
| 210 | ... Check Expected Available Deployment Replicas voltha voltha-voltha-ofagent 1 |
| 211 | # For some reason scaling down and up the POD behind a service causes the port forward to stop working, |
| 212 | # so restart the port forwarding for the API service |
| 213 | Restart VOLTHA Port Forward voltha-api |
| 214 | # Ensure that the ofagent pod is up and ready and the device is available in ONOS, this |
| 215 | # represents system connectivity being restored |
| 216 | FOR ${I} IN RANGE 0 ${olt_count} |
| 217 | ${olt_serial_number}= Get From Dictionary ${olt_ids}[${I}] sn |
| 218 | ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number} |
| 219 | ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS |
| 220 | ... ${olt_serial_number} |
| 221 | Wait Until Keyword Succeeds 120s 2s Device Is Available In ONOS |
| 222 | ... http://karaf:karaf@${ONOS_REST_IP}:${ONOS_REST_PORT} ${of_id} |
| 223 | END |
Hardik Windlass | 3e3c994 | 2021-04-09 11:37:15 +0000 | [diff] [blame] | 224 | Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Tests TT |
TorstenThieme | 136ebf7 | 2021-02-26 14:27:07 +0000 | [diff] [blame] | 225 | |
| 226 | *** Keywords *** |
| 227 | Setup Suite |
| 228 | [Documentation] Set up the test suite |
| 229 | Common Test Suite Setup |
| 230 | ${switch_type}= Get Variable Value ${web_power_switch.type} |
| 231 | Run Keyword If "${switch_type}"!="" Set Global Variable ${powerswitch_type} ${switch_type} |
| 232 | |
TorstenThieme | 136ebf7 | 2021-02-26 14:27:07 +0000 | [diff] [blame] | 233 | Teardown Suite |
| 234 | [Documentation] Tear down steps for the suite |
| 235 | Run Keyword If ${has_dataplane} Clean Up Linux |
Hardik Windlass | 04896f6 | 2021-03-05 16:15:11 +0530 | [diff] [blame] | 236 | Run Keyword If ${teardown_device} Delete All Devices and Verify |
Hardik Windlass | d3f6389 | 2021-03-25 08:28:02 +0000 | [diff] [blame] | 237 | |
| 238 | Clear All Devices Then Create New Device |
| 239 | [Documentation] Remove any devices from VOLTHA and ONOS & then Create new devices |
| 240 | # Remove all devices from voltha and onos |
| 241 | Delete All Devices and Verify |
| 242 | # Execute normal test Setup Keyword |
| 243 | Setup |