Hardik Windlass | 17bd114 | 2021-03-12 08:15:25 +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 Tests ONU Software Upgrade |
| 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 |
Hardik Windlass | c310c7c | 2021-03-25 13:16:59 +0000 | [diff] [blame] | 33 | Resource ../../libraries/bbsim.robot |
Hardik Windlass | 17bd114 | 2021-03-12 08:15:25 +0000 | [diff] [blame] | 34 | Resource ../../variables/variables.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 |
| 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 | |
| 58 | ${suppressaddsubscriber} True |
| 59 | |
Hardik Windlass | f0ce206 | 2021-07-23 11:04:39 +0000 | [diff] [blame] | 60 | # logging flag to enable Collect Logs, can be passed via the command line too |
| 61 | # example: -v logging:False |
| 62 | ${logging} True |
| 63 | |
Hardik Windlass | 17bd114 | 2021-03-12 08:15:25 +0000 | [diff] [blame] | 64 | # ONU Image to test for Upgrade needs to be passed in the following format: |
Hardik Windlass | ba1bd27 | 2021-06-22 08:29:33 +0000 | [diff] [blame] | 65 | ${image_version} ${EMPTY} |
| 66 | # Example value: BBSM_IMG_00002 |
| 67 | ${image_url} ${EMPTY} |
Hardik Windlass | 17bd114 | 2021-03-12 08:15:25 +0000 | [diff] [blame] | 68 | # Example value: http://bbsim0:50074/images/software-image.img |
Hardik Windlass | ba1bd27 | 2021-06-22 08:29:33 +0000 | [diff] [blame] | 69 | ${image_vendor} ${EMPTY} |
| 70 | # Example value: BBSM |
| 71 | ${image_activate_on_success} ${EMPTY} |
| 72 | # Example value: false |
| 73 | ${image_commit_on_success} ${EMPTY} |
| 74 | # Example value: false |
| 75 | ${image_crc} ${EMPTY} |
Hardik Windlass | 17bd114 | 2021-03-12 08:15:25 +0000 | [diff] [blame] | 76 | # Example value: 0 |
Hardik Windlass | 17bd114 | 2021-03-12 08:15:25 +0000 | [diff] [blame] | 77 | |
| 78 | *** Test Cases *** |
| 79 | Test ONU Upgrade |
| 80 | [Documentation] Validates the ONU Upgrade doesn't affect the system functionality |
| 81 | ... Performs the sanity and verifies all the ONUs are authenticated/DHCP/pingable |
| 82 | ... Requirement: Pass image details in following parameters in the robot command |
| 83 | ... onu_image_name, onu_image_url, onu_image_version, onu_image_crc, onu_image_local_dir |
Hardik Windlass | c310c7c | 2021-03-25 13:16:59 +0000 | [diff] [blame] | 84 | ... Note: The TC expects the image url and other parameters to be common for all ONUs on all BBSim |
Hardik Windlass | 17bd114 | 2021-03-12 08:15:25 +0000 | [diff] [blame] | 85 | ... Check [VOL-3903] for more details |
| 86 | [Tags] functional ONUUpgrade |
| 87 | [Setup] Start Logging ONUUpgrade |
| 88 | [Teardown] Run Keywords Collect Logs |
| 89 | ... AND Stop Logging ONUUpgrade |
| 90 | ... AND Delete All Devices and Verify |
TorstenThieme | 9cf8bd5 | 2021-07-29 10:53:55 +0000 | [diff] [blame] | 91 | Test ONU Upgrade All OLTs |
| 92 | |
| 93 | Test ONU Upgrade All Activate and Commit Combinations |
| 94 | [Documentation] Validates the ONU Upgrade doesn't affect the system functionality by use all combinations of |
| 95 | ... flags activate_on_success and commit_on_success |
| 96 | ... Performs the sanity and verifies all the ONUs are authenticated/DHCP/pingable |
| 97 | ... Requirement: Pass image details in following parameters in the robot command |
| 98 | ... onu_image_name, onu_image_url, onu_image_version, onu_image_crc, onu_image_local_dir |
| 99 | ... Note: The TC expects the image url and other parameters to be common for all ONUs on all BBSim |
| 100 | ... Check [VOL-4250] for more details |
| 101 | [Tags] functional ONUUpgradeAllCombies notready |
| 102 | [Setup] Start Logging ONUUpgradeAllCombies |
| 103 | [Teardown] Run Keywords Collect Logs |
| 104 | ... AND Stop Logging ONUUpgradeAllCombies |
| 105 | ... AND Delete All Devices and Verify |
| 106 | ${false_false}= Create Dictionary activate false commit false |
| 107 | ${true_false}= Create Dictionary activate true commit false |
| 108 | ${false_true}= Create Dictionary activate false commit true |
| 109 | ${true_true}= Create Dictionary activate true commit true |
| 110 | ${flag_list}= Create List ${false_false} ${true_false} ${false_true} ${true_true} |
| 111 | FOR ${item} IN @{flag_list} |
| 112 | Test ONU Upgrade All OLTs ${item['activate']} ${item['commit']} |
| 113 | Delete All Devices and Verify |
Hardik Windlass | c310c7c | 2021-03-25 13:16:59 +0000 | [diff] [blame] | 114 | END |
Hardik Windlass | c310c7c | 2021-03-25 13:16:59 +0000 | [diff] [blame] | 115 | |
TorstenThieme | eb2440e | 2021-07-20 10:45:05 +0000 | [diff] [blame] | 116 | Test ONU Upgrade Correct Indication of Download Failure |
| 117 | [Documentation] Validates the ONU Upgrade download failure will be indicated correctly and |
| 118 | ... doesn't affect the system functionality |
| 119 | ... Performs the sanity and verifies all the ONUs are authenticated/DHCP/pingable |
TorstenThieme | 9cf8bd5 | 2021-07-29 10:53:55 +0000 | [diff] [blame] | 120 | ... Check [VOL-3935] for more details |
TorstenThieme | eb2440e | 2021-07-20 10:45:05 +0000 | [diff] [blame] | 121 | [Tags] functional ONUUpgradeDownloadFailure notready |
| 122 | [Setup] Start Logging ONUUpgradeDownloadFailure |
| 123 | [Teardown] Run Keywords Collect Logs |
| 124 | ... AND Stop Logging ONUUpgradeDownloadFailure |
| 125 | ... AND Delete All Devices and Verify |
| 126 | # Add OLT device |
| 127 | Setup |
| 128 | # Performing Sanity Test to make sure subscribers are all DHCP and pingable |
| 129 | Run Keyword If ${has_dataplane} Clean Up Linux |
| 130 | Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test |
| 131 | FOR ${J} IN RANGE 0 ${num_olts} |
| 132 | ${olt_serial_number}= Set Variable ${list_olts}[${J}][sn] |
| 133 | ${bbsim_rel}= Catenate SEPARATOR= bbsim ${J} |
| 134 | ${bbsim_pod}= Get Pod Name By Label ${NAMESPACE} release ${bbsim_rel} |
| 135 | Test ONU Upgrade Download Failure Per OLT ${bbsim_pod} ${olt_serial_number} |
| 136 | List ONUs ${NAMESPACE} ${bbsim_pod} |
| 137 | END |
| 138 | # Additional Verification |
| 139 | Wait Until Keyword Succeeds ${timeout} 2s Delete All Devices and Verify |
| 140 | Setup |
| 141 | Run Keyword If ${has_dataplane} Clean Up Linux |
| 142 | Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test |
| 143 | |
TorstenThieme | 9cf8bd5 | 2021-07-29 10:53:55 +0000 | [diff] [blame] | 144 | Test ONU Upgrade Correct Indication of Download Wrong Url |
| 145 | [Documentation] Validates the ONU Upgrade download from wrong URL failure will be indicated correctly |
| 146 | ... and doesn't affect the system functionality |
| 147 | ... Performs the sanity and verifies all the ONUs are authenticated/DHCP/pingable |
| 148 | ... Check [VOL-4257] for more details |
| 149 | [Tags] functional ONUUpgradeDownloadWrongUrl notready |
| 150 | [Setup] Start Logging ONUUpgradeDownloadWrongUrl |
| 151 | [Teardown] Run Keywords Collect Logs |
| 152 | ... AND Stop Logging ONUUpgradeDownloadWrongUrl |
| 153 | ... AND Delete All Devices and Verify |
| 154 | # Add OLT device |
| 155 | Setup |
| 156 | # Performing Sanity Test to make sure subscribers are all DHCP and pingable |
| 157 | Run Keyword If ${has_dataplane} Clean Up Linux |
| 158 | Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test |
| 159 | FOR ${J} IN RANGE 0 ${num_olts} |
| 160 | ${olt_serial_number}= Set Variable ${list_olts}[${J}][sn] |
| 161 | ${bbsim_rel}= Catenate SEPARATOR= bbsim ${J} |
| 162 | ${bbsim_pod}= Get Pod Name By Label ${NAMESPACE} release ${bbsim_rel} |
| 163 | Test ONU Upgrade Download Failure Per OLT ${bbsim_pod} ${olt_serial_number} |
| 164 | ... url=http://bbsim0:50074/images/wrong-image.img$ dwlstate=DOWNLOAD_UNKNOWN imgstate=IMAGE_UNKNOWN |
| 165 | List ONUs ${NAMESPACE} ${bbsim_pod} |
| 166 | END |
| 167 | # Additional Verification |
| 168 | Wait Until Keyword Succeeds ${timeout} 2s Delete All Devices and Verify |
| 169 | Setup |
| 170 | Run Keyword If ${has_dataplane} Clean Up Linux |
| 171 | Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test |
| 172 | |
TorstenThieme | eb2440e | 2021-07-20 10:45:05 +0000 | [diff] [blame] | 173 | |
| 174 | |
Hardik Windlass | c310c7c | 2021-03-25 13:16:59 +0000 | [diff] [blame] | 175 | *** Keywords *** |
TorstenThieme | 9cf8bd5 | 2021-07-29 10:53:55 +0000 | [diff] [blame] | 176 | Test ONU Upgrade All OLTs |
| 177 | [Documentation] This keyword performs the ONU Upgrade test on all OLTs |
| 178 | [Arguments] ${activate_on_success}=${image_activate_on_success} ${commit_on_success}=${image_commit_on_success} |
| 179 | # Add OLT device |
| 180 | Setup |
| 181 | # Performing Sanity Test to make sure subscribers are all DHCP and pingable |
| 182 | Run Keyword If ${has_dataplane} Clean Up Linux |
| 183 | Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test |
| 184 | FOR ${J} IN RANGE 0 ${num_olts} |
| 185 | ${olt_serial_number}= Set Variable ${list_olts}[${J}][sn] |
| 186 | ${bbsim_rel}= Catenate SEPARATOR= bbsim ${J} |
| 187 | ${bbsim_pod}= Get Pod Name By Label ${NAMESPACE} release ${bbsim_rel} |
| 188 | Test ONU Upgrade Per OLT ${bbsim_pod} ${olt_serial_number} ${activate_on_success} ${commit_on_success} |
| 189 | List ONUs ${NAMESPACE} ${bbsim_pod} |
| 190 | END |
| 191 | # Additional Verification |
| 192 | Wait Until Keyword Succeeds ${timeout} 2s Delete All Devices and Verify |
| 193 | Setup |
| 194 | Run Keyword If ${has_dataplane} Clean Up Linux |
| 195 | Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test |
| 196 | |
Hardik Windlass | c310c7c | 2021-03-25 13:16:59 +0000 | [diff] [blame] | 197 | Test ONU Upgrade Per OLT |
| 198 | [Documentation] This keyword performs the ONU Upgrade test on single OLT |
TorstenThieme | 9cf8bd5 | 2021-07-29 10:53:55 +0000 | [diff] [blame] | 199 | [Arguments] ${bbsim_pod} ${olt_serial_number} ${activate_on_success}=${image_activate_on_success} |
| 200 | ... ${commit_on_success}=${image_commit_on_success} |
Hardik Windlass | 17bd114 | 2021-03-12 08:15:25 +0000 | [diff] [blame] | 201 | FOR ${I} IN RANGE 0 ${num_all_onus} |
| 202 | ${src}= Set Variable ${hosts.src[${I}]} |
| 203 | ${dst}= Set Variable ${hosts.dst[${I}]} |
Hardik Windlass | c310c7c | 2021-03-25 13:16:59 +0000 | [diff] [blame] | 204 | Continue For Loop If "${olt_serial_number}"!="${src['olt']}" |
Hardik Windlass | 17bd114 | 2021-03-12 08:15:25 +0000 | [diff] [blame] | 205 | ${onu_device_id}= Get Device ID From SN ${src['onu']} |
Hardik Windlass | ba1bd27 | 2021-06-22 08:29:33 +0000 | [diff] [blame] | 206 | # Download Image |
| 207 | Download ONU Device Image ${image_version} ${image_url} ${image_vendor} |
TorstenThieme | 9cf8bd5 | 2021-07-29 10:53:55 +0000 | [diff] [blame] | 208 | ... ${activate_on_success} ${commit_on_success} |
Hardik Windlass | ba1bd27 | 2021-06-22 08:29:33 +0000 | [diff] [blame] | 209 | ... ${image_crc} ${onu_device_id} |
TorstenThieme | 9cf8bd5 | 2021-07-29 10:53:55 +0000 | [diff] [blame] | 210 | ${imageState}= Run Keyword If '${activate_on_success}'=='true' and '${commit_on_success}'=='false' |
TorstenThieme | eb2440e | 2021-07-20 10:45:05 +0000 | [diff] [blame] | 211 | ... Set Variable IMAGE_ACTIVE |
TorstenThieme | 9cf8bd5 | 2021-07-29 10:53:55 +0000 | [diff] [blame] | 212 | ... ELSE IF '${activate_on_success}'=='true' and '${commit_on_success}'=='true' |
Hardik Windlass | ba1bd27 | 2021-06-22 08:29:33 +0000 | [diff] [blame] | 213 | ... Set Variable IMAGE_COMMITTED |
| 214 | ... ELSE Set Variable IMAGE_INACTIVE |
TorstenThieme | 9cf8bd5 | 2021-07-29 10:53:55 +0000 | [diff] [blame] | 215 | ${activated}= Set Variable If '${activate_on_success}'=='true' True False |
| 216 | ${committed}= Set Variable If '${activate_on_success}'=='true' and '${commit_on_success}'=='true' |
Hardik Windlass | ba1bd27 | 2021-06-22 08:29:33 +0000 | [diff] [blame] | 217 | ... True False |
| 218 | Wait Until Keyword Succeeds ${timeout} 2s Verify ONU Device Image Status ${image_version} |
| 219 | ... ${onu_device_id} DOWNLOAD_SUCCEEDED NO_ERROR ${imageState} |
| 220 | Wait Until Keyword Succeeds ${timeout} 2s Verify ONU Device Image List ${onu_device_id} |
| 221 | ... ${image_version} ${committed} ${activated} True |
| 222 | # Activate Image |
TorstenThieme | 9cf8bd5 | 2021-07-29 10:53:55 +0000 | [diff] [blame] | 223 | ${imageState}= Set Variable If '${commit_on_success}'=='true' IMAGE_COMMITTED IMAGE_ACTIVE |
| 224 | ${committed}= Set Variable If '${commit_on_success}'=='true' True False |
| 225 | Run Keyword If '${activate_on_success}'=='false' Run Keywords |
| 226 | ... Activate ONU Device Image ${image_version} ${commit_on_success} ${onu_device_id} |
Hardik Windlass | ba1bd27 | 2021-06-22 08:29:33 +0000 | [diff] [blame] | 227 | ... AND Wait Until Keyword Succeeds ${timeout} 2s Verify ONU Device Image Status ${image_version} |
| 228 | ... ${onu_device_id} DOWNLOAD_SUCCEEDED NO_ERROR ${imageState} |
| 229 | ... AND Wait Until Keyword Succeeds ${timeout} 2s Verify ONU Device Image List ${onu_device_id} |
| 230 | ... ${image_version} ${committed} True True |
| 231 | # Commit Image |
TorstenThieme | 9cf8bd5 | 2021-07-29 10:53:55 +0000 | [diff] [blame] | 232 | Run Keyword If '${commit_on_success}'=='false' Run Keywords |
Hardik Windlass | ba1bd27 | 2021-06-22 08:29:33 +0000 | [diff] [blame] | 233 | ... Commit ONU Device Image ${image_version} ${onu_device_id} |
| 234 | ... AND Wait Until Keyword Succeeds ${timeout} 2s Verify ONU Device Image Status ${image_version} |
| 235 | ... ${onu_device_id} DOWNLOAD_SUCCEEDED NO_ERROR IMAGE_COMMITTED |
| 236 | ... AND Wait Until Keyword Succeeds ${timeout} 2s Verify ONU Device Image List ${onu_device_id} |
| 237 | ... ${image_version} True True True |
Hardik Windlass | c310c7c | 2021-03-25 13:16:59 +0000 | [diff] [blame] | 238 | Wait Until Keyword Succeeds ${timeout} 2s Verify ONU Device Image On BBSim ${NAMESPACE} ${bbsim_pod} |
| 239 | ... ${src['onu']} software_image_committed |
Hardik Windlass | 17bd114 | 2021-03-12 08:15:25 +0000 | [diff] [blame] | 240 | Wait Until Keyword Succeeds ${timeout} 5s Perform Sanity Test ${suppressaddsubscriber} |
| 241 | END |
Hardik Windlass | 17bd114 | 2021-03-12 08:15:25 +0000 | [diff] [blame] | 242 | |
TorstenThieme | eb2440e | 2021-07-20 10:45:05 +0000 | [diff] [blame] | 243 | Test ONU Upgrade Download Failure Per OLT |
| 244 | [Documentation] This keyword performs the ONU Upgrade Dowload Failure test on single OLT |
TorstenThieme | 9cf8bd5 | 2021-07-29 10:53:55 +0000 | [diff] [blame] | 245 | [Arguments] ${bbsim_pod} ${olt_serial_number} ${url}=${image_url} ${dwlstate}=DOWNLOAD_SUCCEEDED |
| 246 | ... ${imgstate}=IMAGE_INACTIVE |
TorstenThieme | eb2440e | 2021-07-20 10:45:05 +0000 | [diff] [blame] | 247 | FOR ${I} IN RANGE 0 ${num_all_onus} |
| 248 | ${src}= Set Variable ${hosts.src[${I}]} |
| 249 | ${dst}= Set Variable ${hosts.dst[${I}]} |
| 250 | Continue For Loop If "${olt_serial_number}"!="${src['olt']}" |
| 251 | ${onu_device_id}= Get Device ID From SN ${src['onu']} |
| 252 | # Download Image |
TorstenThieme | 9cf8bd5 | 2021-07-29 10:53:55 +0000 | [diff] [blame] | 253 | Download ONU Device Image INVALID_IMAGE ${url} ${image_vendor} |
TorstenThieme | eb2440e | 2021-07-20 10:45:05 +0000 | [diff] [blame] | 254 | ... ${image_activate_on_success} ${image_commit_on_success} |
| 255 | ... ${image_crc} ${onu_device_id} |
| 256 | Wait Until Keyword Succeeds ${timeout} 2s Verify ONU Device Image Status INVALID_IMAGE |
TorstenThieme | 9cf8bd5 | 2021-07-29 10:53:55 +0000 | [diff] [blame] | 257 | ... ${onu_device_id} ${dwlstate} NO_ERROR ${imgstate} |
TorstenThieme | eb2440e | 2021-07-20 10:45:05 +0000 | [diff] [blame] | 258 | Wait Until Keyword Succeeds ${timeout} 5s Perform Sanity Test ${suppressaddsubscriber} |
| 259 | END |
| 260 | |
Hardik Windlass | 17bd114 | 2021-03-12 08:15:25 +0000 | [diff] [blame] | 261 | Setup Suite |
| 262 | [Documentation] Set up the test suite |
| 263 | Common Test Suite Setup |
| 264 | |
| 265 | Teardown Suite |
| 266 | [Documentation] Tear down steps for the suite |
| 267 | Run Keyword If ${has_dataplane} Clean Up Linux |
TorstenThieme | 4e2168e | 2021-06-22 14:01:47 +0000 | [diff] [blame] | 268 | Close All ONOS SSH Connections |