Gayathri.Selvan | ee4a91b | 2020-01-17 06:49:53 +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 *** |
| 17 | Documentation Test various end-to-end scenarios |
| 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 |
| 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 | # For below variable value, using deployment name as using grep for |
| 45 | # parsing radius pod name, we can also use full radius pod name |
| 46 | ${RESTART_POD_NAME} radius |
Suchitra Vemuri | bc5e316 | 2020-01-23 11:21:10 -0800 | [diff] [blame] | 47 | ${timeout} 90s |
Gayathri.Selvan | ee4a91b | 2020-01-17 06:49:53 +0000 | [diff] [blame] | 48 | ${of_id} 0 |
| 49 | ${logical_id} 0 |
Suchitra Vemuri | 2fa9bba | 2020-01-22 17:38:48 -0800 | [diff] [blame] | 50 | ${has_dataplane} True |
Gayathri.Selvan | ee4a91b | 2020-01-17 06:49:53 +0000 | [diff] [blame] | 51 | ${external_libs} True |
| 52 | ${teardown_device} False |
| 53 | ${scripts} ../../scripts |
| 54 | |
Andy Bavier | abeba26 | 2020-02-07 16:22:16 -0700 | [diff] [blame] | 55 | # Per-test logging on failure is turned off by default; set this variable to enable |
| 56 | ${container_log_dir} ${None} |
| 57 | |
Gayathri.Selvan | ee4a91b | 2020-01-17 06:49:53 +0000 | [diff] [blame] | 58 | *** Test Cases *** |
| 59 | Adding the same OLT before and after enabling the device |
| 60 | [Documentation] Create OLT, Create the same OLT again and Check for the Error message |
Suchitra Vemuri | 2fa9bba | 2020-01-22 17:38:48 -0800 | [diff] [blame] | 61 | [Tags] VOL-2405 VOL-2406 AddSameOLT functional |
Andy Bavier | abeba26 | 2020-02-07 16:22:16 -0700 | [diff] [blame] | 62 | [Setup] Run Keywords Announce Message START TEST AddSameOLT |
| 63 | ... AND Start Logging AddSameOLT |
Andy Bavier | 4a8450e | 2020-02-04 08:58:37 -0700 | [diff] [blame] | 64 | [Teardown] Run Keywords Collect Logs |
Andy Bavier | abeba26 | 2020-02-07 16:22:16 -0700 | [diff] [blame] | 65 | ... AND Stop Logging AddSameOLT |
Andy Bavier | 4a8450e | 2020-02-04 08:58:37 -0700 | [diff] [blame] | 66 | ... AND Announce Message END TEST AddSameOLT |
Suchitra Vemuri | bd7fcd2 | 2020-01-22 19:08:32 -0800 | [diff] [blame] | 67 | Run Keyword If ${has_dataplane} Delete Device and Verify |
Gayathri.Selvan | ee4a91b | 2020-01-17 06:49:53 +0000 | [diff] [blame] | 68 | ${olt_device_id}= Create Device ${olt_ip} ${OLT_PORT} |
| 69 | Set Suite Variable ${olt_device_id} |
Suchitra Vemuri | 1d0d022 | 2020-02-12 17:17:19 -0800 | [diff] [blame] | 70 | ${timeout} Set Variable 180s |
Gayathri.Selvan | ee4a91b | 2020-01-17 06:49:53 +0000 | [diff] [blame] | 71 | Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device PREPROVISIONED UNKNOWN UNKNOWN |
| 72 | ... ${EMPTY} ${olt_device_id} |
| 73 | ${rc} ${output}= Run and Return Rc and Output |
| 74 | ... ${VOLTCTL_CONFIG}; voltctl device create -t openolt -H ${olt_ip}:${OLT_PORT} |
| 75 | Should Not Be Equal As Integers ${rc} 0 |
| 76 | Should Contain ${output} Device is already pre-provisioned |
| 77 | #Enable the created OLT device |
| 78 | Enable Device ${olt_device_id} |
| 79 | Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device ENABLED ACTIVE REACHABLE |
| 80 | ... ${olt_serial_number} |
| 81 | ${rc} ${output}= Run and Return Rc and Output |
| 82 | ... ${VOLTCTL_CONFIG}; voltctl device create -t openolt -H ${olt_ip}:${OLT_PORT} |
| 83 | Should Not Be Equal As Integers ${rc} 0 |
| 84 | Log ${output} |
| 85 | Should Contain ${output} Device is already pre-provisioned |
| 86 | Log "This OLT is added already and enabled" |
Gayathri.Selvan | 3dfe6c2 | 2020-01-27 13:08:55 +0000 | [diff] [blame] | 87 | |
Gayathri.Selvan | 967f5a5 | 2020-02-12 06:58:38 +0000 | [diff] [blame] | 88 | Test Disable or Enable different device id which is not in the device list |
| 89 | [Documentation] Disable or Enable a device id which is not listed in the voltctl device list |
Gayathri.Selvan | 3dfe6c2 | 2020-01-27 13:08:55 +0000 | [diff] [blame] | 90 | ... command and ensure that error message is shown. |
Gayathri.Selvan | 967f5a5 | 2020-02-12 06:58:38 +0000 | [diff] [blame] | 91 | [Tags] functional DisableEnableInvalidDevice VOL-2412-2413 |
Andy Bavier | abeba26 | 2020-02-07 16:22:16 -0700 | [diff] [blame] | 92 | [Setup] Run Keywords Announce Message START TEST DisableInvalidDevice |
| 93 | ... AND Start Logging DisableInvalidDevice |
Andy Bavier | 4a8450e | 2020-02-04 08:58:37 -0700 | [diff] [blame] | 94 | [Teardown] Run Keywords Collect Logs |
Andy Bavier | abeba26 | 2020-02-07 16:22:16 -0700 | [diff] [blame] | 95 | ... AND Stop Logging DisableInvalidDevice |
Andy Bavier | 4a8450e | 2020-02-04 08:58:37 -0700 | [diff] [blame] | 96 | ... AND Announce Message END TEST DisableInvalidDevice |
Gayathri.Selvan | 3dfe6c2 | 2020-01-27 13:08:55 +0000 | [diff] [blame] | 97 | ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device list -o json |
| 98 | Should Be Equal As Integers ${rc} 0 |
| 99 | ${jsondata}= To Json ${output} |
| 100 | Log ${jsondata} |
| 101 | ${length}= Get Length ${jsondata} |
| 102 | @{ids}= Create List |
| 103 | FOR ${INDEX} IN RANGE 0 ${length} |
| 104 | ${value}= Get From List ${jsondata} ${INDEX} |
| 105 | ${device_id}= Get From Dictionary ${value} id |
| 106 | Append To List ${ids} ${device_id} |
| 107 | END |
| 108 | #Create a new fake device id |
| 109 | ${fakeDeviceId} Replace String Using Regexp ${device_id} \\d\\d xx count=1 |
| 110 | Log ${fakeDeviceId} |
| 111 | #Ensure that the new id created is not in the device id list |
| 112 | List Should Not Contain Value ${ids} ${fakeDeviceId} |
| 113 | #Disable fake device id |
| 114 | ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device disable ${fakeDeviceId} |
Suchitra Vemuri | a7e8ad2 | 2020-02-11 18:02:40 -0800 | [diff] [blame] | 115 | Should Contain ${output} Error while disabling '${fakeDeviceId}' |
Gayathri.Selvan | 967f5a5 | 2020-02-12 06:58:38 +0000 | [diff] [blame] | 116 | #Disable device for VOL-2413 |
| 117 | Disable Device ${device_id} |
| 118 | #Enable fake device id |
| 119 | ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device enable ${fakeDeviceId} |
| 120 | Should Contain ${output} Error while enabling '${fakeDeviceId}' |
suraj gour | baee2c6 | 2020-02-03 10:21:32 +0000 | [diff] [blame] | 121 | |
| 122 | Check deletion of OLT/ONU before disabling |
| 123 | [Documentation] Try deleting OL/ONU before disabling and check error message |
| 124 | ... Assuming devices are already created, up and running fine; test1 or sanity was |
| 125 | ... executed where all the ONUs are authenticated/DHCP/pingable |
| 126 | [Tags] VOL-2411 DeleteBeforeDisableCheck notready |
Andy Bavier | abeba26 | 2020-02-07 16:22:16 -0700 | [diff] [blame] | 127 | [Setup] Run Keywords Announce Message START TEST DeleteBeforeDisableCheck |
| 128 | ... AND Start Logging DeleteBeforeDisableCheck |
Andy Bavier | 4a8450e | 2020-02-04 08:58:37 -0700 | [diff] [blame] | 129 | [Teardown] Run Keywords Collect Logs |
Andy Bavier | abeba26 | 2020-02-07 16:22:16 -0700 | [diff] [blame] | 130 | ... AND Stop Logging DeleteBeforeDisableCheck |
Andy Bavier | 4a8450e | 2020-02-04 08:58:37 -0700 | [diff] [blame] | 131 | ... AND Announce Message END TEST DeleteBeforeDisableCheck |
suraj gour | baee2c6 | 2020-02-03 10:21:32 +0000 | [diff] [blame] | 132 | #validate olt states |
| 133 | Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device ENABLED ACTIVE REACHABLE |
| 134 | ... ${olt_serial_number} |
| 135 | ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device delete ${olt_device_id} |
| 136 | Log ${output} |
| 137 | Should Contain ${output} expected-admin-state:DISABLED |
| 138 | Wait Until Keyword Succeeds ${timeout} 5s |
| 139 | ... Validate OLT Device ENABLED ACTIVE REACHABLE ${olt_serial_number} |
| 140 | ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${olt_serial_number} |
| 141 | Set Global Variable ${of_id} |
| 142 | FOR ${I} IN RANGE 0 ${num_onus} |
| 143 | ${src}= Set Variable ${hosts.src[${I}]} |
| 144 | ${dst}= Set Variable ${hosts.dst[${I}]} |
| 145 | ${onu_device_id}= Get Device ID From SN ${src['onu']} |
| 146 | Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device |
| 147 | ... ENABLED ACTIVE REACHABLE |
| 148 | ... ${src['onu']} onu=True onu_reason=omci-flows-pushed |
| 149 | ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device delete ${onu_device_id} |
| 150 | Log ${output} |
| 151 | Should Contain ${output} expected-admin-state:DISABLED |
| 152 | Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device |
| 153 | ... ENABLED ACTIVE REACHABLE |
| 154 | ... ${src['onu']} onu=True onu_reason=omci-flows-pushed |
| 155 | END |
| 156 | Run Keyword and Ignore Error Collect Logs |
suraj gour | b316041 | 2020-02-04 06:11:31 +0000 | [diff] [blame] | 157 | |
| 158 | Check disabling of pre-provisioned OLT before enabling |
| 159 | [Documentation] Create OLT, disable same OLT, check error message and validates ONU |
| 160 | [Tags] VOL-2414 DisablePreprovisionedOLTCheck notready |
Andy Bavier | 4a8450e | 2020-02-04 08:58:37 -0700 | [diff] [blame] | 161 | [Setup] Run Keywords Announce Message START TEST DisablePreprovisionedOLTCheck |
Andy Bavier | abeba26 | 2020-02-07 16:22:16 -0700 | [diff] [blame] | 162 | ... AND Start Logging DisablePreprovisionedOLTCheck |
Andy Bavier | 4a8450e | 2020-02-04 08:58:37 -0700 | [diff] [blame] | 163 | ... AND Delete Device and Verify |
| 164 | [Teardown] Run Keywords Collect Logs |
Andy Bavier | abeba26 | 2020-02-07 16:22:16 -0700 | [diff] [blame] | 165 | ... AND Stop Logging DisablePreprovisionedOLTCheck |
Andy Bavier | 4a8450e | 2020-02-04 08:58:37 -0700 | [diff] [blame] | 166 | ... AND Announce Message END TEST DisablePreprovisionedOLTCheck |
suraj gour | b316041 | 2020-02-04 06:11:31 +0000 | [diff] [blame] | 167 | Run Keyword If ${has_dataplane} Sleep 180s |
| 168 | #create/preprovision device |
| 169 | ${olt_device_id}= Create Device ${olt_ip} ${OLT_PORT} |
| 170 | Set Suite Variable ${olt_device_id} |
| 171 | #validate olt states |
| 172 | Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device PREPROVISIONED UNKNOWN UNKNOWN |
| 173 | ... ${EMPTY} ${olt_device_id} |
| 174 | #Try disabling pre-provisioned OLT |
| 175 | ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device disable ${olt_device_id} |
| 176 | Should Be Equal As Integers ${rc} 0 |
| 177 | Log ${output} |
| 178 | Should Contain ${output} invalid-admin-state:PREPROVISIONED |
| 179 | #Enable OLT |
| 180 | Enable Device ${olt_device_id} |
| 181 | Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device ENABLED ACTIVE REACHABLE |
| 182 | ... ${olt_serial_number} |
| 183 | ${logical_id}= Get Logical Device ID From SN ${olt_serial_number} |
| 184 | Set Suite Variable ${logical_id} |
| 185 | FOR ${I} IN RANGE 0 ${num_onus} |
| 186 | ${src}= Set Variable ${hosts.src[${I}]} |
| 187 | ${dst}= Set Variable ${hosts.dst[${I}]} |
| 188 | Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device |
| 189 | ... ENABLED ACTIVE REACHABLE |
| 190 | ... ${src['onu']} onu=True onu_reason=omci-flows-pushed |
| 191 | END |
| 192 | Run Keyword and Ignore Error Collect Logs |
Hema | 526eceb | 2020-02-04 13:11:40 +0530 | [diff] [blame] | 193 | |
| 194 | Disable and Delete the logical device directly |
| 195 | [Documentation] Disable and delete the logical device directly is not possible |
| 196 | ... since it is allowed only through OLT device deletion. |
| 197 | [Tags] VOL-2418 DisableDelete_LogicalDevice notready |
Andy Bavier | 4a8450e | 2020-02-04 08:58:37 -0700 | [diff] [blame] | 198 | [Setup] Run Keywords Announce Message START TEST DisableDelete_LogicalDevice |
Andy Bavier | abeba26 | 2020-02-07 16:22:16 -0700 | [diff] [blame] | 199 | ... AND Start Logging DisableDelete_LogicalDevice |
Andy Bavier | 4a8450e | 2020-02-04 08:58:37 -0700 | [diff] [blame] | 200 | ... AND Delete Device and Verify |
| 201 | [Teardown] Run Keywords Collect Logs |
Andy Bavier | abeba26 | 2020-02-07 16:22:16 -0700 | [diff] [blame] | 202 | ... AND Stop Logging DisableDelete_LogicalDevice |
Andy Bavier | 4a8450e | 2020-02-04 08:58:37 -0700 | [diff] [blame] | 203 | ... AND Announce Message END TEST DisableDelete_LogicalDevice |
Hema | 526eceb | 2020-02-04 13:11:40 +0530 | [diff] [blame] | 204 | Run Keyword If ${has_dataplane} Sleep 180s |
| 205 | #create/preprovision OLT device |
| 206 | ${olt_device_id}= Create Device ${olt_ip} ${OLT_PORT} |
| 207 | Set Suite Variable ${olt_device_id} |
| 208 | #validate olt states |
| 209 | Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device PREPROVISIONED UNKNOWN UNKNOWN |
| 210 | ... ${EMPTY} ${olt_device_id} |
| 211 | #Enable the created OLT device |
| 212 | Enable Device ${olt_device_id} |
| 213 | Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device ENABLED ACTIVE REACHABLE |
| 214 | ... ${olt_serial_number} |
| 215 | #Check whether logical devices are also created |
| 216 | ${rc} ${output}= Run and Return Rc and Output |
| 217 | ... ${VOLTCTL_CONFIG}; voltctl logicaldevice list |
| 218 | Should Be Equal As Integers ${rc} 0 |
| 219 | Log ${output} |
| 220 | ${logical_id}= Get Logical Device ID From SN ${olt_serial_number} |
| 221 | Should Not Be Empty ${logical_id} |
| 222 | ${rc} ${output}= Run and Return Rc and Output |
| 223 | ... ${VOLTCTL_CONFIG}; voltctl logicaldevice disable ${logical_id} |
| 224 | Should Be Equal As Integers ${rc} 0 |
| 225 | Log ${output} |
| 226 | Should Contain '${output}' Unknown command |
| 227 | ${rc} ${output1}= Run and Return Rc and Output |
| 228 | ... ${VOLTCTL_CONFIG}; voltctl logicaldevice delete ${logical_id} |
| 229 | Should Be Equal As Integers ${rc} 0 |
| 230 | Log ${output1} |
| 231 | Should Contain '${output1}' Unknown command |
suraj gour | a416622 | 2020-02-03 12:09:11 +0000 | [diff] [blame] | 232 | |
| 233 | Check logical device creation and deletion |
| 234 | [Documentation] Deletes all devices, checks logical device, creates devices again and checks |
| 235 | ... logical device, flows, ports |
| 236 | [Tags] VOL-2416 VOL-2417 LogicalDeviceCheck notready |
Andy Bavier | abeba26 | 2020-02-07 16:22:16 -0700 | [diff] [blame] | 237 | [Setup] Run Keywords Announce Message START TEST LogicalDeviceCheck |
| 238 | ... AND Start Logging LogicalDeviceCheck |
Andy Bavier | 4a8450e | 2020-02-04 08:58:37 -0700 | [diff] [blame] | 239 | [Teardown] Run Keywords Collect Logs |
Andy Bavier | abeba26 | 2020-02-07 16:22:16 -0700 | [diff] [blame] | 240 | ... AND Stop Logging LogicalDeviceCheck |
Andy Bavier | 4a8450e | 2020-02-04 08:58:37 -0700 | [diff] [blame] | 241 | ... AND Announce Message END TEST LogicalDeviceCheck |
suraj gour | a416622 | 2020-02-03 12:09:11 +0000 | [diff] [blame] | 242 | Delete Device and Verify |
| 243 | ${logical_id}= Get Logical Device ID From SN ${olt_serial_number} |
| 244 | Should Be Empty ${logical_id} |
| 245 | Run Keyword If ${has_dataplane} Sleep 180s |
| 246 | ${olt_device_id}= Create Device ${olt_ip} ${OLT_PORT} |
| 247 | Set Suite Variable ${olt_device_id} |
| 248 | Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device PREPROVISIONED UNKNOWN UNKNOWN |
| 249 | ... ${EMPTY} ${olt_device_id} |
| 250 | Enable Device ${olt_device_id} |
| 251 | Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device ENABLED ACTIVE REACHABLE |
| 252 | ... ${olt_serial_number} |
| 253 | ${logical_id}= Get Logical Device ID From SN ${olt_serial_number} |
| 254 | Should Not Be Empty ${logical_id} |
| 255 | ${rc} ${output}= Run and Return Rc and Output |
| 256 | ... ${VOLTCTL_CONFIG}; voltctl logicaldevice list |
| 257 | Should Be Equal As Integers ${rc} 0 |
| 258 | Log ${output} |
| 259 | Should Contain ${output} ${olt_device_id} |
| 260 | Set Suite Variable ${logical_id} |
| 261 | Wait Until Keyword Succeeds ${timeout} 5s Validate Logical Device Ports ${logical_id} |
| 262 | Wait Until Keyword Succeeds ${timeout} 5s Validate Logical Device Flows ${logical_id} |
| 263 | Run Keyword and Ignore Error Collect Logs |