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 | |
| 60 | # ONU Image to test for Upgrade needs to be passed in the following format: |
| 61 | ${onu_image_name} ${EMPTY} |
| 62 | # Example value: twsh.img |
| 63 | ${onu_image_url} ${EMPTY} |
| 64 | # Example value: http://bbsim0:50074/images/software-image.img |
| 65 | ${onu_image_version} ${EMPTY} |
| 66 | # Example value: v1.0.0 |
| 67 | ${onu_image_crc} ${EMPTY} |
| 68 | # Example value: 0 |
| 69 | ${onu_image_local_dir} ${EMPTY} |
| 70 | # Example value: /tmp |
| 71 | |
| 72 | *** Test Cases *** |
| 73 | Test ONU Upgrade |
| 74 | [Documentation] Validates the ONU Upgrade doesn't affect the system functionality |
| 75 | ... Performs the sanity and verifies all the ONUs are authenticated/DHCP/pingable |
| 76 | ... Requirement: Pass image details in following parameters in the robot command |
| 77 | ... 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] | 78 | ... 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] | 79 | ... Check [VOL-3903] for more details |
| 80 | [Tags] functional ONUUpgrade |
| 81 | [Setup] Start Logging ONUUpgrade |
| 82 | [Teardown] Run Keywords Collect Logs |
| 83 | ... AND Stop Logging ONUUpgrade |
| 84 | ... AND Delete All Devices and Verify |
| 85 | # Add OLT device |
| 86 | Setup |
| 87 | # Performing Sanity Test to make sure subscribers are all DHCP and pingable |
| 88 | Run Keyword If ${has_dataplane} Clean Up Linux |
| 89 | Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test |
Hardik Windlass | c310c7c | 2021-03-25 13:16:59 +0000 | [diff] [blame] | 90 | FOR ${J} IN RANGE 0 ${num_olts} |
| 91 | ${olt_serial_number}= Set Variable ${list_olts}[${J}][sn] |
| 92 | ${bbsim_rel}= Catenate SEPARATOR= bbsim ${J} |
| 93 | ${bbsim_pod}= Get Pod Name By Label ${NAMESPACE} release ${bbsim_rel} |
| 94 | Test ONU Upgrade Per OLT ${bbsim_pod} ${olt_serial_number} |
| 95 | List ONUs ${NAMESPACE} ${bbsim_pod} |
| 96 | END |
| 97 | # Additional Verification |
| 98 | Wait Until Keyword Succeeds ${timeout} 2s Delete All Devices and Verify |
| 99 | Setup |
| 100 | Run Keyword If ${has_dataplane} Clean Up Linux |
| 101 | Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test |
| 102 | |
| 103 | *** Keywords *** |
| 104 | Test ONU Upgrade Per OLT |
| 105 | [Documentation] This keyword performs the ONU Upgrade test on single OLT |
| 106 | [Arguments] ${bbsim_pod} ${olt_serial_number} |
Hardik Windlass | 17bd114 | 2021-03-12 08:15:25 +0000 | [diff] [blame] | 107 | FOR ${I} IN RANGE 0 ${num_all_onus} |
| 108 | ${src}= Set Variable ${hosts.src[${I}]} |
| 109 | ${dst}= Set Variable ${hosts.dst[${I}]} |
Hardik Windlass | c310c7c | 2021-03-25 13:16:59 +0000 | [diff] [blame] | 110 | Continue For Loop If "${olt_serial_number}"!="${src['olt']}" |
Hardik Windlass | 17bd114 | 2021-03-12 08:15:25 +0000 | [diff] [blame] | 111 | ${onu_device_id}= Get Device ID From SN ${src['onu']} |
| 112 | Download ONU Device Image ${onu_device_id} ${onu_image_name} ${onu_image_url} ${onu_image_version} |
| 113 | ... ${onu_image_crc} ${onu_image_local_dir} |
| 114 | # This additional pause to let image download finish on the OLT adapter |
| 115 | # as the DOWNLOADED_SUCCEEDED below only indicates that the command is accepted. |
| 116 | Run Keyword If ${has_dataplane} Sleep 12s |
| 117 | ... ELSE Sleep 2s |
| 118 | Wait Until Keyword Succeeds ${timeout} 2s Verify ONU Device Image ${onu_device_id} |
| 119 | ... DOWNLOAD_SUCCEEDED IMAGE_UNKNOWN NO_ERROR |
| 120 | Activate ONU Device Image ${onu_device_id} ${onu_image_name} ${onu_image_version} |
| 121 | ... ${onu_image_crc} ${onu_image_local_dir} |
| 122 | # This additional pause to let image download and finish activate on the ONU (BBSim) |
| 123 | # as the IMAGE_ACTIVE below is only an indication that the image is accepted for the download to the ONU (BBSim). |
| 124 | Run Keyword If ${has_dataplane} Sleep 600s |
| 125 | ... ELSE Sleep 180s |
| 126 | Wait Until Keyword Succeeds ${timeout} 2s Verify ONU Device Image ${onu_device_id} |
| 127 | ... DOWNLOAD_SUCCEEDED IMAGE_ACTIVE NO_ERROR |
Hardik Windlass | c310c7c | 2021-03-25 13:16:59 +0000 | [diff] [blame] | 128 | Wait Until Keyword Succeeds ${timeout} 2s Verify ONU Device Image On BBSim ${NAMESPACE} ${bbsim_pod} |
| 129 | ... ${src['onu']} software_image_committed |
Hardik Windlass | 17bd114 | 2021-03-12 08:15:25 +0000 | [diff] [blame] | 130 | Wait Until Keyword Succeeds ${timeout} 5s Perform Sanity Test ${suppressaddsubscriber} |
| 131 | END |
Hardik Windlass | 17bd114 | 2021-03-12 08:15:25 +0000 | [diff] [blame] | 132 | |
Hardik Windlass | 17bd114 | 2021-03-12 08:15:25 +0000 | [diff] [blame] | 133 | Setup Suite |
| 134 | [Documentation] Set up the test suite |
| 135 | Common Test Suite Setup |
| 136 | |
| 137 | Teardown Suite |
| 138 | [Documentation] Tear down steps for the suite |
| 139 | Run Keyword If ${has_dataplane} Clean Up Linux |