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 |
| 91 | # Add OLT device |
| 92 | Setup |
| 93 | # Performing Sanity Test to make sure subscribers are all DHCP and pingable |
| 94 | Run Keyword If ${has_dataplane} Clean Up Linux |
| 95 | Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test |
Hardik Windlass | c310c7c | 2021-03-25 13:16:59 +0000 | [diff] [blame] | 96 | FOR ${J} IN RANGE 0 ${num_olts} |
| 97 | ${olt_serial_number}= Set Variable ${list_olts}[${J}][sn] |
| 98 | ${bbsim_rel}= Catenate SEPARATOR= bbsim ${J} |
| 99 | ${bbsim_pod}= Get Pod Name By Label ${NAMESPACE} release ${bbsim_rel} |
| 100 | Test ONU Upgrade Per OLT ${bbsim_pod} ${olt_serial_number} |
| 101 | List ONUs ${NAMESPACE} ${bbsim_pod} |
| 102 | END |
| 103 | # Additional Verification |
| 104 | Wait Until Keyword Succeeds ${timeout} 2s Delete All Devices and Verify |
| 105 | Setup |
| 106 | Run Keyword If ${has_dataplane} Clean Up Linux |
| 107 | Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test |
| 108 | |
TorstenThieme | eb2440e | 2021-07-20 10:45:05 +0000 | [diff] [blame] | 109 | Test ONU Upgrade Correct Indication of Download Failure |
| 110 | [Documentation] Validates the ONU Upgrade download failure will be indicated correctly and |
| 111 | ... doesn't affect the system functionality |
| 112 | ... Performs the sanity and verifies all the ONUs are authenticated/DHCP/pingable |
| 113 | ... Requirement: Pass image details in following parameters in the robot command |
| 114 | ... onu_image_name, onu_image_url, onu_image_version, onu_image_crc, onu_image_local_dir |
| 115 | ... Note: The TC expects the image url and other parameters to be common for all ONUs on all BBSim |
| 116 | ... Check [VOL-3903] for more details |
| 117 | [Tags] functional ONUUpgradeDownloadFailure notready |
| 118 | [Setup] Start Logging ONUUpgradeDownloadFailure |
| 119 | [Teardown] Run Keywords Collect Logs |
| 120 | ... AND Stop Logging ONUUpgradeDownloadFailure |
| 121 | ... AND Delete All Devices and Verify |
| 122 | # Add OLT device |
| 123 | Setup |
| 124 | # Performing Sanity Test to make sure subscribers are all DHCP and pingable |
| 125 | Run Keyword If ${has_dataplane} Clean Up Linux |
| 126 | Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test |
| 127 | FOR ${J} IN RANGE 0 ${num_olts} |
| 128 | ${olt_serial_number}= Set Variable ${list_olts}[${J}][sn] |
| 129 | ${bbsim_rel}= Catenate SEPARATOR= bbsim ${J} |
| 130 | ${bbsim_pod}= Get Pod Name By Label ${NAMESPACE} release ${bbsim_rel} |
| 131 | Test ONU Upgrade Download Failure Per OLT ${bbsim_pod} ${olt_serial_number} |
| 132 | List ONUs ${NAMESPACE} ${bbsim_pod} |
| 133 | END |
| 134 | # Additional Verification |
| 135 | Wait Until Keyword Succeeds ${timeout} 2s Delete All Devices and Verify |
| 136 | Setup |
| 137 | Run Keyword If ${has_dataplane} Clean Up Linux |
| 138 | Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test |
| 139 | |
| 140 | |
| 141 | |
Hardik Windlass | c310c7c | 2021-03-25 13:16:59 +0000 | [diff] [blame] | 142 | *** Keywords *** |
| 143 | Test ONU Upgrade Per OLT |
| 144 | [Documentation] This keyword performs the ONU Upgrade test on single OLT |
| 145 | [Arguments] ${bbsim_pod} ${olt_serial_number} |
Hardik Windlass | 17bd114 | 2021-03-12 08:15:25 +0000 | [diff] [blame] | 146 | FOR ${I} IN RANGE 0 ${num_all_onus} |
| 147 | ${src}= Set Variable ${hosts.src[${I}]} |
| 148 | ${dst}= Set Variable ${hosts.dst[${I}]} |
Hardik Windlass | c310c7c | 2021-03-25 13:16:59 +0000 | [diff] [blame] | 149 | Continue For Loop If "${olt_serial_number}"!="${src['olt']}" |
Hardik Windlass | 17bd114 | 2021-03-12 08:15:25 +0000 | [diff] [blame] | 150 | ${onu_device_id}= Get Device ID From SN ${src['onu']} |
Hardik Windlass | ba1bd27 | 2021-06-22 08:29:33 +0000 | [diff] [blame] | 151 | # Download Image |
| 152 | Download ONU Device Image ${image_version} ${image_url} ${image_vendor} |
| 153 | ... ${image_activate_on_success} ${image_commit_on_success} |
| 154 | ... ${image_crc} ${onu_device_id} |
TorstenThieme | eb2440e | 2021-07-20 10:45:05 +0000 | [diff] [blame] | 155 | ${imageState}= Run Keyword If '${image_activate_on_success}'=='true' and '${image_commit_on_success}'=='false' |
| 156 | ... Set Variable IMAGE_ACTIVE |
Hardik Windlass | ba1bd27 | 2021-06-22 08:29:33 +0000 | [diff] [blame] | 157 | ... ELSE IF '${image_activate_on_success}'=='true' and '${image_commit_on_success}'=='true' |
| 158 | ... Set Variable IMAGE_COMMITTED |
| 159 | ... ELSE Set Variable IMAGE_INACTIVE |
| 160 | ${activated}= Set Variable If '${image_activate_on_success}'=='true' True False |
| 161 | ${committed}= Set Variable If '${image_activate_on_success}'=='true' and '${image_commit_on_success}'=='true' |
| 162 | ... True False |
| 163 | Wait Until Keyword Succeeds ${timeout} 2s Verify ONU Device Image Status ${image_version} |
| 164 | ... ${onu_device_id} DOWNLOAD_SUCCEEDED NO_ERROR ${imageState} |
| 165 | Wait Until Keyword Succeeds ${timeout} 2s Verify ONU Device Image List ${onu_device_id} |
| 166 | ... ${image_version} ${committed} ${activated} True |
| 167 | # Activate Image |
| 168 | ${imageState}= Set Variable If '${image_commit_on_success}'=='true' IMAGE_COMMITTED IMAGE_ACTIVE |
| 169 | ${committed}= Set Variable If '${image_commit_on_success}'=='true' True False |
| 170 | Run Keyword If '${image_activate_on_success}'=='false' Run Keywords |
| 171 | ... Activate ONU Device Image ${image_version} ${image_commit_on_success} ${onu_device_id} |
| 172 | ... AND Wait Until Keyword Succeeds ${timeout} 2s Verify ONU Device Image Status ${image_version} |
| 173 | ... ${onu_device_id} DOWNLOAD_SUCCEEDED NO_ERROR ${imageState} |
| 174 | ... AND Wait Until Keyword Succeeds ${timeout} 2s Verify ONU Device Image List ${onu_device_id} |
| 175 | ... ${image_version} ${committed} True True |
| 176 | # Commit Image |
| 177 | Run Keyword If '${image_commit_on_success}'=='false' Run Keywords |
| 178 | ... Commit ONU Device Image ${image_version} ${onu_device_id} |
| 179 | ... AND Wait Until Keyword Succeeds ${timeout} 2s Verify ONU Device Image Status ${image_version} |
| 180 | ... ${onu_device_id} DOWNLOAD_SUCCEEDED NO_ERROR IMAGE_COMMITTED |
| 181 | ... AND Wait Until Keyword Succeeds ${timeout} 2s Verify ONU Device Image List ${onu_device_id} |
| 182 | ... ${image_version} True True True |
Hardik Windlass | c310c7c | 2021-03-25 13:16:59 +0000 | [diff] [blame] | 183 | Wait Until Keyword Succeeds ${timeout} 2s Verify ONU Device Image On BBSim ${NAMESPACE} ${bbsim_pod} |
| 184 | ... ${src['onu']} software_image_committed |
Hardik Windlass | 17bd114 | 2021-03-12 08:15:25 +0000 | [diff] [blame] | 185 | Wait Until Keyword Succeeds ${timeout} 5s Perform Sanity Test ${suppressaddsubscriber} |
| 186 | END |
Hardik Windlass | 17bd114 | 2021-03-12 08:15:25 +0000 | [diff] [blame] | 187 | |
TorstenThieme | eb2440e | 2021-07-20 10:45:05 +0000 | [diff] [blame] | 188 | Test ONU Upgrade Download Failure Per OLT |
| 189 | [Documentation] This keyword performs the ONU Upgrade Dowload Failure test on single OLT |
| 190 | [Arguments] ${bbsim_pod} ${olt_serial_number} |
| 191 | FOR ${I} IN RANGE 0 ${num_all_onus} |
| 192 | ${src}= Set Variable ${hosts.src[${I}]} |
| 193 | ${dst}= Set Variable ${hosts.dst[${I}]} |
| 194 | Continue For Loop If "${olt_serial_number}"!="${src['olt']}" |
| 195 | ${onu_device_id}= Get Device ID From SN ${src['onu']} |
| 196 | # Download Image |
| 197 | Download ONU Device Image INVALID_IMAGE ${image_url} ${image_vendor} |
| 198 | ... ${image_activate_on_success} ${image_commit_on_success} |
| 199 | ... ${image_crc} ${onu_device_id} |
| 200 | Wait Until Keyword Succeeds ${timeout} 2s Verify ONU Device Image Status INVALID_IMAGE |
| 201 | ... ${onu_device_id} DOWNLOAD_SUCCEEDED NO_ERROR IMAGE_INACTIVE |
| 202 | Wait Until Keyword Succeeds ${timeout} 5s Perform Sanity Test ${suppressaddsubscriber} |
| 203 | END |
| 204 | |
Hardik Windlass | 17bd114 | 2021-03-12 08:15:25 +0000 | [diff] [blame] | 205 | Setup Suite |
| 206 | [Documentation] Set up the test suite |
| 207 | Common Test Suite Setup |
| 208 | |
| 209 | Teardown Suite |
| 210 | [Documentation] Tear down steps for the suite |
| 211 | Run Keyword If ${has_dataplane} Clean Up Linux |
TorstenThieme | 4e2168e | 2021-06-22 14:01:47 +0000 | [diff] [blame] | 212 | Close All ONOS SSH Connections |