Gayathri.Selvan | 283a63c | 2020-01-23 04:09:18 +0000 | [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 | # FIXME Can we use the same test against BBSim and Hardware? |
| 15 | |
| 16 | *** Settings *** |
HungWei Chiu | 87edb1f | 2020-01-28 00:10:58 +0000 | [diff] [blame] | 17 | Documentation Test various failure scenarios |
Gayathri.Selvan | 283a63c | 2020-01-23 04:09:18 +0000 | [diff] [blame] | 18 | Suite Setup Common Test Suite Setup |
| 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 |
HungWei Chiu | 87edb1f | 2020-01-28 00:10:58 +0000 | [diff] [blame] | 34 | Resource ../../libraries/power_switch.robot |
Gayathri.Selvan | 283a63c | 2020-01-23 04:09:18 +0000 | [diff] [blame] | 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 |
Suchitra Vemuri | 109feb1 | 2020-01-23 16:25:02 -0800 | [diff] [blame] | 51 | ${has_dataplane} True |
Gayathri.Selvan | 283a63c | 2020-01-23 04:09:18 +0000 | [diff] [blame] | 52 | ${external_libs} True |
| 53 | ${teardown_device} False |
| 54 | ${scripts} ../../scripts |
| 55 | |
Andy Bavier | abeba26 | 2020-02-07 16:22:16 -0700 | [diff] [blame] | 56 | # Per-test logging on failure is turned off by default; set this variable to enable |
| 57 | ${container_log_dir} ${None} |
| 58 | |
Gayathri.Selvan | 283a63c | 2020-01-23 04:09:18 +0000 | [diff] [blame] | 59 | *** Test Cases *** |
Gayathri.Selvan | b6a2b54 | 2020-01-24 07:24:23 +0000 | [diff] [blame] | 60 | Verify restart ofagent container after VOLTHA is operational |
| 61 | [Documentation] Restart ofagent container after VOLTHA is operational. |
| 62 | ... Please note this test case should be run before the restart of other containers. |
| 63 | ... Prerequisite : ONUs are authenticated and pingable. |
Suchitra Vemuri | d151c33 | 2020-01-28 17:48:45 -0800 | [diff] [blame] | 64 | [Tags] functional VOL-2409 ofagentRestart notready |
Andy Bavier | abeba26 | 2020-02-07 16:22:16 -0700 | [diff] [blame] | 65 | [Setup] Run Keywords Announce Message START TEST ofagentRestart |
| 66 | ... AND Start Logging ofagentRestart |
Andy Bavier | 4a8450e | 2020-02-04 08:58:37 -0700 | [diff] [blame] | 67 | [Teardown] Run Keywords Collect Logs |
Andy Bavier | abeba26 | 2020-02-07 16:22:16 -0700 | [diff] [blame] | 68 | ... AND Stop Logging ofagentRestart |
Andy Bavier | 4a8450e | 2020-02-04 08:58:37 -0700 | [diff] [blame] | 69 | ... AND Announce Message END TEST ofagentRestart |
Suchitra Vemuri | b661bf3 | 2020-01-30 22:46:14 -0800 | [diff] [blame] | 70 | # Performing Sanity Test to make sure subscribers are all AUTH+DHCP and pingable |
| 71 | Run Keyword If ${has_dataplane} Clean Up Linux |
| 72 | Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test |
Gayathri.Selvan | b6a2b54 | 2020-01-24 07:24:23 +0000 | [diff] [blame] | 73 | ${waitforRestart} Set Variable 120s |
Andy Bavier | 4a8450e | 2020-02-04 08:58:37 -0700 | [diff] [blame] | 74 | ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE} |
Gayathri.Selvan | b6a2b54 | 2020-01-24 07:24:23 +0000 | [diff] [blame] | 75 | Log ${podStatusOutput} |
Andy Bavier | 4a8450e | 2020-02-04 08:58:37 -0700 | [diff] [blame] | 76 | ${countBforRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l |
Gayathri.Selvan | b6a2b54 | 2020-01-24 07:24:23 +0000 | [diff] [blame] | 77 | Restart Pod ${NAMESPACE} ofagent |
| 78 | Sleep 60s |
| 79 | Wait Until Keyword Succeeds ${waitforRestart} 2s Validate Pod Status ofagent ${NAMESPACE} |
| 80 | ... Running |
| 81 | Repeat Sanity Test |
Andy Bavier | 4a8450e | 2020-02-04 08:58:37 -0700 | [diff] [blame] | 82 | ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE} |
Gayathri.Selvan | b6a2b54 | 2020-01-24 07:24:23 +0000 | [diff] [blame] | 83 | Log ${podStatusOutput} |
Andy Bavier | 4a8450e | 2020-02-04 08:58:37 -0700 | [diff] [blame] | 84 | ${countAfterRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l |
Gayathri.Selvan | b6a2b54 | 2020-01-24 07:24:23 +0000 | [diff] [blame] | 85 | Should Be Equal As Strings ${countAfterRestart} ${countBforRestart} |
Gayathri.Selvan | b6a2b54 | 2020-01-24 07:24:23 +0000 | [diff] [blame] | 86 | |
Suchitra Vemuri | c420369 | 2020-01-30 20:29:46 -0800 | [diff] [blame] | 87 | Verify restart openolt-adapter container after VOLTHA is operational |
| 88 | [Documentation] Restart openolt-adapter container after VOLTHA is operational. |
Gayathri.Selvan | 283a63c | 2020-01-23 04:09:18 +0000 | [diff] [blame] | 89 | ... Prerequisite : ONUs are authenticated and pingable. |
Suchitra Vemuri | 109feb1 | 2020-01-23 16:25:02 -0800 | [diff] [blame] | 90 | [Tags] functional VOL-1958 RestartPods |
Andy Bavier | abeba26 | 2020-02-07 16:22:16 -0700 | [diff] [blame] | 91 | [Setup] Run Keywords Announce Message START TEST RestartPods |
| 92 | ... AND Start Logging RestartPods |
Andy Bavier | 4a8450e | 2020-02-04 08:58:37 -0700 | [diff] [blame] | 93 | [Teardown] Run Keywords Collect Logs |
Andy Bavier | abeba26 | 2020-02-07 16:22:16 -0700 | [diff] [blame] | 94 | ... AND Stop Logging RestartPods |
Andy Bavier | 4a8450e | 2020-02-04 08:58:37 -0700 | [diff] [blame] | 95 | ... AND Announce Message END TEST RestartPods |
Gayathri.Selvan | 283a63c | 2020-01-23 04:09:18 +0000 | [diff] [blame] | 96 | ${waitforRestart} Set Variable 120s |
Suchitra Vemuri | 7559606 | 2020-02-08 21:47:36 -0800 | [diff] [blame^] | 97 | # Remove the Sanity Check after enabling first failure test (OLT Adapter Test) |
| 98 | Run Keyword If ${has_dataplane} Clean Up Linux |
| 99 | Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test |
Andy Bavier | 4a8450e | 2020-02-04 08:58:37 -0700 | [diff] [blame] | 100 | ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE} |
Gayathri.Selvan | 283a63c | 2020-01-23 04:09:18 +0000 | [diff] [blame] | 101 | Log ${podStatusOutput} |
Andy Bavier | 4a8450e | 2020-02-04 08:58:37 -0700 | [diff] [blame] | 102 | ${countBforRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l |
Gayathri.Selvan | 283a63c | 2020-01-23 04:09:18 +0000 | [diff] [blame] | 103 | ${podName} Set Variable adapter-open-olt |
| 104 | Restart Pod ${NAMESPACE} ${podName} |
| 105 | Wait Until Keyword Succeeds ${waitforRestart} 2s Validate Pod Status ${podName} ${NAMESPACE} |
| 106 | ... Running |
| 107 | Repeat Sanity Test |
Andy Bavier | 4a8450e | 2020-02-04 08:58:37 -0700 | [diff] [blame] | 108 | ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE} |
Gayathri.Selvan | 283a63c | 2020-01-23 04:09:18 +0000 | [diff] [blame] | 109 | Log ${podStatusOutput} |
Andy Bavier | 4a8450e | 2020-02-04 08:58:37 -0700 | [diff] [blame] | 110 | ${countAfterRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l |
Gayathri.Selvan | 283a63c | 2020-01-23 04:09:18 +0000 | [diff] [blame] | 111 | Should Be Equal As Strings ${countAfterRestart} ${countBforRestart} |
| 112 | Log to console Pod ${podName} restarted and sanity checks passed successfully |
Gayathri.Selvan | b6a2b54 | 2020-01-24 07:24:23 +0000 | [diff] [blame] | 113 | |
Gayathri.Selvan | c0b3702 | 2020-02-06 05:17:00 +0000 | [diff] [blame] | 114 | Check ONU adapter crash not forcing authentication again |
| 115 | [Documentation] After ONU adapter restart, checks wpa log for 'authentication started' |
| 116 | ... message count to make sure auth not started again and validates EAP status and ping. |
| 117 | ... Assuming that test1 or sanity was executed where all the ONUs are authenticated/DHCP/pingable |
| 118 | [Tags] functional ONUAdaptCrash notready |
Andy Bavier | abeba26 | 2020-02-07 16:22:16 -0700 | [diff] [blame] | 119 | [Setup] Run Keywords Announce Message START TEST ONUAdaptCrash |
| 120 | ... AND Start Logging ONUAdaptCrash |
| 121 | [Teardown] Run Keywords Collect Logs |
| 122 | ... AND Stop Logging ONUAdaptCrash |
| 123 | ... AND Announce Message END TEST ONUAdaptCrash |
Gayathri.Selvan | c0b3702 | 2020-02-06 05:17:00 +0000 | [diff] [blame] | 124 | @{before_list}= Create List |
| 125 | @{after_list}= Create List |
| 126 | FOR ${I} IN RANGE 0 ${num_onus} |
| 127 | ${src}= Set Variable ${hosts.src[${I}]} |
| 128 | ${dst}= Set Variable ${hosts.dst[${I}]} |
| 129 | ${onu_device_id}= Get Device ID From SN ${src['onu']} |
| 130 | ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']} |
| 131 | ... ${of_id} |
| 132 | ${before}= Run Keyword If ${has_dataplane} Check Remote File Contents For WPA Logs |
| 133 | ... True /tmp/wpa.log authentication started ${src['ip']} ${src['user']} ${src['pass']} |
| 134 | ... ${src['container_type']} ${src['container_name']} |
| 135 | Append To List ${before_list} ${before} |
| 136 | END |
| 137 | Wait Until Keyword Succeeds ${timeout} 15s Restart Pod ${NAMESPACE} adapter-open-onu |
| 138 | Wait Until Keyword Succeeds ${timeout} 2s Validate Pod Status ${podName} ${NAMESPACE} |
| 139 | ... Running |
| 140 | FOR ${I} IN RANGE 0 ${num_onus} |
| 141 | ${src}= Set Variable ${hosts.src[${I}]} |
| 142 | ${dst}= Set Variable ${hosts.dst[${I}]} |
| 143 | ${onu_device_id}= Get Device ID From SN ${src['onu']} |
| 144 | ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']} |
| 145 | ... ${of_id} |
| 146 | ${after}= Run Keyword If ${has_dataplane} Check Remote File Contents For WPA Logs |
| 147 | ... True /tmp/wpa.log authentication started ${src['ip']} ${src['user']} ${src['pass']} |
| 148 | ... ${src['container_type']} ${src['container_name']} |
| 149 | Append To List ${after_list} ${after} |
| 150 | ${output}= Run Keyword If ${has_dataplane} Login And Run Command On Remote System |
| 151 | ... wpa_cli status | grep SUCCESS ${src['ip']} ${src['user']} ${src['pass']} |
| 152 | ... ${src['container_type']} ${src['container_name']} |
| 153 | Run Keyword If ${has_dataplane} Should Contain ${output} SUCCESS |
| 154 | Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure |
| 155 | ... Wait Until Keyword Succeeds 60s 2s Check Ping |
| 156 | ... True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']} ${src['ip']} ${src['user']} |
| 157 | ... ${src['pass']} ${src['container_type']} ${src['container_name']} |
| 158 | END |
| 159 | Lists Should Be Equal ${after_list} ${before_list} |
| 160 | Log ${after_list} |
| 161 | Log ${before_list} |
| 162 | Run Keyword and Ignore Error Collect Logs |
| 163 | |
HungWei Chiu | 87edb1f | 2020-01-28 00:10:58 +0000 | [diff] [blame] | 164 | Verify ONU after rebooting physically |
| 165 | [Documentation] Test the ONU funcaionality by physically turning on/off ONU. |
| 166 | ... Prerequisite : Subscriber are authenticated/DHCP/pingable state |
| 167 | [Tags] functional VOL-2488 PowerSwitch notready |
Andy Bavier | abeba26 | 2020-02-07 16:22:16 -0700 | [diff] [blame] | 168 | [Setup] Run Keywords Announce Message START TEST PowerSwitch |
| 169 | ... AND Start Logging PowerSwitch |
Andy Bavier | 4a8450e | 2020-02-04 08:58:37 -0700 | [diff] [blame] | 170 | [Teardown] Run Keywords Collect Logs |
Andy Bavier | abeba26 | 2020-02-07 16:22:16 -0700 | [diff] [blame] | 171 | ... AND Stop Logging PowerSwitch |
Andy Bavier | 4a8450e | 2020-02-04 08:58:37 -0700 | [diff] [blame] | 172 | ... AND Announce Message END TEST PowerSwitch |
| 173 | Start Log Capture PowerSwitch ${container_log_dir} |
HungWei Chiu | 87edb1f | 2020-01-28 00:10:58 +0000 | [diff] [blame] | 174 | Power Switch Connection Suite ${web_power_switch.ip} ${web_power_switch.user} ${web_power_switch.password} |
| 175 | FOR ${I} IN RANGE 0 ${num_onus} |
| 176 | ${src}= Set Variable ${hosts.src[${I}]} |
| 177 | ${dst}= Set Variable ${hosts.dst[${I}]} |
| 178 | Disable Switch Outlet ${src['power_switch_port']} |
| 179 | Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure |
| 180 | ... Wait Until Keyword Succeeds 60s 2s |
| 181 | ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']} |
| 182 | ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']} |
| 183 | |
hwchiu | b7139c1 | 2020-01-28 21:51:28 +0000 | [diff] [blame] | 184 | Enable Switch Outlet ${src['power_switch_port']} |
HungWei Chiu | 87edb1f | 2020-01-28 00:10:58 +0000 | [diff] [blame] | 185 | Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device |
| 186 | ... ENABLED ACTIVE REACHABLE ${src['onu']} |
HungWei Chiu | 87edb1f | 2020-01-28 00:10:58 +0000 | [diff] [blame] | 187 | Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure |
| 188 | ... Wait Until Keyword Succeeds 60s 2s |
| 189 | ... Check Ping True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']} |
| 190 | ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']} |
| 191 | END |
Gayathri.Selvan | f68ea4b | 2020-02-03 07:36:39 +0000 | [diff] [blame] | 192 | |
| 193 | ONU Reboot |
| 194 | [Documentation] Reboot ONU and verify that ONU comes up properly |
| 195 | [Tags] VOL-1957 RebootONU notready |
Andy Bavier | abeba26 | 2020-02-07 16:22:16 -0700 | [diff] [blame] | 196 | [Setup] Run Keywords Announce Message START TEST RebootONU |
| 197 | ... AND Start Logging RebootONU |
Andy Bavier | 4a8450e | 2020-02-04 08:58:37 -0700 | [diff] [blame] | 198 | [Teardown] Run Keywords Collect Logs |
Andy Bavier | abeba26 | 2020-02-07 16:22:16 -0700 | [diff] [blame] | 199 | ... AND Stop Logging RebootONU |
Andy Bavier | 4a8450e | 2020-02-04 08:58:37 -0700 | [diff] [blame] | 200 | ... AND Announce Message END TEST RebootONU |
Gayathri.Selvan | f68ea4b | 2020-02-03 07:36:39 +0000 | [diff] [blame] | 201 | FOR ${I} IN RANGE 0 ${num_onus} |
| 202 | ${src}= Set Variable ${hosts.src[${I}]} |
| 203 | ${dst}= Set Variable ${hosts.dst[${I}]} |
| 204 | ${onu_device_id}= Get Device ID From SN ${src['onu']} |
| 205 | Reboot ONU ${onu_device_id} ${src} ${dst} |
| 206 | Verify ping is succesful except for given device ${num_onus} ${onu_device_id} |
| 207 | Run Keyword If ${has_dataplane} Clean Up Linux |
| 208 | #Check after reboot that ONUs are active, authenticated/DHCP/pingable |
| 209 | Perform Sanity Test |
| 210 | END |