Hema | df00368 | 2020-04-28 21:22:22 +0530 | [diff] [blame] | 1 | # Copyright 2017 - 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 Test various failure scenarios |
| 17 | Suite Setup Setup Suite |
| 18 | Test Setup Setup |
| 19 | Test Teardown Teardown |
TorstenThieme | 4e2168e | 2021-06-22 14:01:47 +0000 | [diff] [blame] | 20 | Suite Teardown Teardown Suite |
Hema | df00368 | 2020-04-28 21:22:22 +0530 | [diff] [blame] | 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 ../../variables/variables.robot |
| 33 | Resource ../../libraries/power_switch.robot |
| 34 | |
| 35 | *** Variables *** |
| 36 | ${POD_NAME} flex-ocp-cord |
| 37 | ${KUBERNETES_CONF} ${KUBERNETES_CONFIGS_DIR}/${POD_NAME}.conf |
| 38 | ${KUBERNETES_CONFIGS_DIR} ~/pod-configs/kubernetes-configs |
| 39 | #${KUBERNETES_CONFIGS_DIR} ${KUBERNETES_CONFIGS_DIR}/${POD_NAME}.conf |
| 40 | ${KUBERNETES_YAML} ${KUBERNETES_CONFIGS_DIR}/${POD_NAME}.yml |
| 41 | ${HELM_CHARTS_DIR} ~/helm-charts |
| 42 | ${VOLTHA_POD_NUM} 8 |
| 43 | ${NAMESPACE} voltha |
| 44 | ${DEFAULTSPACE} default |
| 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 |
| 52 | ${teardown_device} False |
| 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 | |
Matteo Scandolo | da1c64b | 2021-07-20 10:14:49 -0700 | [diff] [blame] | 58 | # logging flag to enable Collect Logs, can be passed via the command line too |
| 59 | # example: -v logging:False |
| 60 | ${logging} True |
| 61 | |
Hema | df00368 | 2020-04-28 21:22:22 +0530 | [diff] [blame] | 62 | *** Test Cases *** |
| 63 | Verify OLT Soft Reboot |
| 64 | [Documentation] Test soft reboot of the OLT using voltctl command |
Suchitra Vemuri | 4e6ff3c | 2020-08-04 21:52:17 -0700 | [diff] [blame] | 65 | [Tags] VOL-2745 OLTSoftReboot functional |
Hema | df00368 | 2020-04-28 21:22:22 +0530 | [diff] [blame] | 66 | [Setup] Start Logging OLTSoftReboot |
Hema | df00368 | 2020-04-28 21:22:22 +0530 | [diff] [blame] | 67 | [Teardown] Run Keywords Collect Logs |
| 68 | ... AND Stop Logging OLTSoftReboot |
Suchitra Vemuri | dee90b1 | 2020-08-11 16:11:41 -0700 | [diff] [blame] | 69 | Delete All Devices and Verify |
Suchitra Vemuri | 4e6ff3c | 2020-08-04 21:52:17 -0700 | [diff] [blame] | 70 | Setup |
Hema | df00368 | 2020-04-28 21:22:22 +0530 | [diff] [blame] | 71 | ## Performing Sanity Test to make sure subscribers are all AUTH+DHCP and pingable |
Suchitra Vemuri | 4e6ff3c | 2020-08-04 21:52:17 -0700 | [diff] [blame] | 72 | Run Keyword If ${has_dataplane} Clean Up Linux |
| 73 | Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test |
Hema | df00368 | 2020-04-28 21:22:22 +0530 | [diff] [blame] | 74 | # Reboot the OLT using "voltctl device reboot" command |
| 75 | Reboot Device ${olt_device_id} |
Andrea Campanella | 9d8d3a5 | 2021-06-17 12:18:23 +0200 | [diff] [blame] | 76 | # Wait for the OLT to actually go down |
| 77 | Wait Until Keyword Succeeds 360s 5s Validate OLT Device ENABLED UNKNOWN UNREACHABLE |
| 78 | ... ${olt_serial_number} |
Hema | df00368 | 2020-04-28 21:22:22 +0530 | [diff] [blame] | 79 | #Verify that ping fails |
| 80 | FOR ${I} IN RANGE 0 ${num_onus} |
| 81 | ${src}= Set Variable ${hosts.src[${I}]} |
| 82 | ${dst}= Set Variable ${hosts.dst[${I}]} |
| 83 | Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure |
| 84 | ... Wait Until Keyword Succeeds 60s 2s |
| 85 | ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']} |
| 86 | ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']} |
| 87 | END |
Hema | df00368 | 2020-04-28 21:22:22 +0530 | [diff] [blame] | 88 | Run Keyword If ${has_dataplane} Wait Until Keyword Succeeds 120s 10s |
Suchitra Vemuri | b7253a5 | 2020-07-14 22:35:17 -0700 | [diff] [blame] | 89 | ... Check Remote System Reachability True ${olt_ssh_ip} |
Hema | df00368 | 2020-04-28 21:22:22 +0530 | [diff] [blame] | 90 | # Waiting extra time for the ONUs to come up |
Hema | df00368 | 2020-04-28 21:22:22 +0530 | [diff] [blame] | 91 | # Check OLT states |
Suchitra Vemuri | 4e6ff3c | 2020-08-04 21:52:17 -0700 | [diff] [blame] | 92 | Wait Until Keyword Succeeds 360s 5s Validate OLT Device ENABLED ACTIVE REACHABLE |
Hema | df00368 | 2020-04-28 21:22:22 +0530 | [diff] [blame] | 93 | ... ${olt_serial_number} |
Hema | df00368 | 2020-04-28 21:22:22 +0530 | [diff] [blame] | 94 | #Check after reboot that ONUs are active, authenticated/DHCP/pingable |
| 95 | Run Keyword If ${has_dataplane} Clean Up Linux |
| 96 | Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test |
| 97 | |
dmohapatro | 2166a44 | 2020-06-05 15:11:40 +0000 | [diff] [blame] | 98 | Verify restart ofagent container before subscriber is provisioned |
| 99 | [Documentation] Restart ofagent container before subscriber is provisioned. |
| 100 | [Tags] functional VOL-2962 ofagentRestart |
| 101 | [Setup] Start Logging ofagentRestart |
| 102 | [Teardown] Run Keywords Collect Logs |
| 103 | ... AND Stop Logging ofagentRestart |
| 104 | ... AND Scale K8s Deployment ${NAMESPACE} voltha-ofagent 1 |
| 105 | setup |
| 106 | Run Keyword If ${has_dataplane} Clean Up Linux |
| 107 | ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${olt_serial_number} |
| 108 | Set Global Variable ${of_id} |
| 109 | FOR ${I} IN RANGE 0 ${num_onus} |
| 110 | ${src}= Set Variable ${hosts.src[${I}]} |
| 111 | ${dst}= Set Variable ${hosts.dst[${I}]} |
| 112 | ${onu_device_id}= Get Device ID From SN ${src['onu']} |
| 113 | ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']} |
| 114 | ... ${of_id} |
| 115 | # Bring up the device and verify it authenticates |
| 116 | Wait Until Keyword Succeeds ${timeout} 5s Validate Device ENABLED ACTIVE REACHABLE |
Hardik Windlass | 8b44649 | 2021-06-10 06:25:23 +0000 | [diff] [blame] | 117 | ... ${onu_device_id} onu=True onu_reason=omci-flows-pushed by_dev_id=True |
dmohapatro | 2166a44 | 2020-06-05 15:11:40 +0000 | [diff] [blame] | 118 | Wait Until Keyword Succeeds ${timeout} 2s Verify Eapol Flows Added For ONU ${ONOS_SSH_IP} |
| 119 | ... ${ONOS_SSH_PORT} ${onu_port} |
| 120 | ${wpa_log}= Run Keyword If ${has_dataplane} Catenate SEPARATOR=. |
| 121 | ... /tmp/wpa ${src['dp_iface_name']} log |
| 122 | Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate Authentication True |
| 123 | ... ${src['dp_iface_name']} wpa_supplicant.conf ${src['ip']} ${src['user']} ${src['pass']} |
| 124 | ... ${src['container_type']} ${src['container_name']} ${wpa_log} |
| 125 | Wait Until Keyword Succeeds ${timeout} 2s Verify ONU in AAA-Users ${ONOS_SSH_IP} |
| 126 | ... ${ONOS_SSH_PORT} ${onu_port} |
| 127 | END |
| 128 | # Restart POD ofagent |
| 129 | ${waitforRestart} Set Variable 120s |
| 130 | ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE} |
| 131 | Log ${podStatusOutput} |
| 132 | ${countBforRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l |
| 133 | ${podName} Set Variable ofagent |
| 134 | Restart Pod ${NAMESPACE} ${podName} |
| 135 | Sleep 60s |
| 136 | Wait Until Keyword Succeeds ${waitforRestart} 2s Validate Pod Status ofagent ${NAMESPACE} |
| 137 | ... Running |
| 138 | FOR ${I} IN RANGE 0 ${num_onus} |
| 139 | # Add subscriber access and verify that DHCP completes to ensure system is still functioning properly |
TorstenThieme | 4e2168e | 2021-06-22 14:01:47 +0000 | [diff] [blame] | 140 | #Wait Until Keyword Succeeds ${timeout} 2s Execute ONOS CLI Command use single connection ${ONOS_SSH_IP} |
Suchitra Vemuri | 4e6ff3c | 2020-08-04 21:52:17 -0700 | [diff] [blame] | 141 | #... ${ONOS_SSH_PORT} volt-add-subscriber-access ${of_id} ${onu_port} |
dmohapatro | 2166a44 | 2020-06-05 15:11:40 +0000 | [diff] [blame] | 142 | ${src}= Set Variable ${hosts.src[${I}]} |
| 143 | ${dst}= Set Variable ${hosts.dst[${I}]} |
dmohapatro | 2166a44 | 2020-06-05 15:11:40 +0000 | [diff] [blame] | 144 | ${onu_device_id}= Get Device ID From SN ${src['onu']} |
| 145 | ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s |
| 146 | ... Get ONU Port in ONOS ${src['onu']} ${of_id} |
Suchitra Vemuri | 4e6ff3c | 2020-08-04 21:52:17 -0700 | [diff] [blame] | 147 | # Add subscriber access and verify that DHCP completes to ensure system is still functioning properly |
TorstenThieme | 4e2168e | 2021-06-22 14:01:47 +0000 | [diff] [blame] | 148 | Wait Until Keyword Succeeds ${timeout} 2s Execute ONOS CLI Command use single connection ${ONOS_SSH_IP} |
Suchitra Vemuri | 4e6ff3c | 2020-08-04 21:52:17 -0700 | [diff] [blame] | 149 | ... ${ONOS_SSH_PORT} volt-add-subscriber-access ${of_id} ${onu_port} |
dmohapatro | 2166a44 | 2020-06-05 15:11:40 +0000 | [diff] [blame] | 150 | # Verify DHCP-Allocations |
| 151 | Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s |
| 152 | ... Validate Subscriber DHCP Allocation ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port} |
| 153 | # Verify Ping |
| 154 | Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Check Ping True |
| 155 | ... ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']} ${src['ip']} |
| 156 | ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']} |
dmohapatro | 2166a44 | 2020-06-05 15:11:40 +0000 | [diff] [blame] | 157 | END |
Hema | df00368 | 2020-04-28 21:22:22 +0530 | [diff] [blame] | 158 | |
| 159 | *** Keywords *** |
| 160 | Setup Suite |
| 161 | [Documentation] Set up the test suite |
| 162 | Common Test Suite Setup |
TorstenThieme | 4e2168e | 2021-06-22 14:01:47 +0000 | [diff] [blame] | 163 | |
| 164 | Teardown Suite |
| 165 | [Documentation] Clean up ONOS SSH connections |
| 166 | Close All ONOS SSH Connections |