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 |
| 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 |
| 47 | ${timeout} 60s |
| 48 | ${of_id} 0 |
| 49 | ${logical_id} 0 |
| 50 | ${has_dataplane} True |
| 51 | ${teardown_device} False |
| 52 | ${scripts} ../../scripts |
| 53 | |
| 54 | # Per-test logging on failure is turned off by default; set this variable to enable |
| 55 | ${container_log_dir} ${None} |
| 56 | |
| 57 | ${suppressaddsubscriber} True |
| 58 | |
| 59 | # ONU Image to test for Upgrade needs to be passed in the following format: |
| 60 | ${onu_image_name} ${EMPTY} |
| 61 | # Example value: twsh.img |
| 62 | ${onu_image_url} ${EMPTY} |
| 63 | # Example value: http://bbsim0:50074/images/software-image.img |
| 64 | ${onu_image_version} ${EMPTY} |
| 65 | # Example value: v1.0.0 |
| 66 | ${onu_image_crc} ${EMPTY} |
| 67 | # Example value: 0 |
| 68 | ${onu_image_local_dir} ${EMPTY} |
| 69 | # Example value: /tmp |
| 70 | |
| 71 | *** Test Cases *** |
| 72 | Test ONU Upgrade |
| 73 | [Documentation] Validates the ONU Upgrade doesn't affect the system functionality |
| 74 | ... Performs the sanity and verifies all the ONUs are authenticated/DHCP/pingable |
| 75 | ... Requirement: Pass image details in following parameters in the robot command |
| 76 | ... onu_image_name, onu_image_url, onu_image_version, onu_image_crc, onu_image_local_dir |
| 77 | ... Check [VOL-3903] for more details |
| 78 | [Tags] functional ONUUpgrade |
| 79 | [Setup] Start Logging ONUUpgrade |
| 80 | [Teardown] Run Keywords Collect Logs |
| 81 | ... AND Stop Logging ONUUpgrade |
| 82 | ... AND Delete All Devices and Verify |
| 83 | # Add OLT device |
| 84 | Setup |
| 85 | # Performing Sanity Test to make sure subscribers are all DHCP and pingable |
| 86 | Run Keyword If ${has_dataplane} Clean Up Linux |
| 87 | Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test |
| 88 | FOR ${I} IN RANGE 0 ${num_all_onus} |
| 89 | ${src}= Set Variable ${hosts.src[${I}]} |
| 90 | ${dst}= Set Variable ${hosts.dst[${I}]} |
| 91 | ${onu_device_id}= Get Device ID From SN ${src['onu']} |
| 92 | Download ONU Device Image ${onu_device_id} ${onu_image_name} ${onu_image_url} ${onu_image_version} |
| 93 | ... ${onu_image_crc} ${onu_image_local_dir} |
| 94 | # This additional pause to let image download finish on the OLT adapter |
| 95 | # as the DOWNLOADED_SUCCEEDED below only indicates that the command is accepted. |
| 96 | Run Keyword If ${has_dataplane} Sleep 12s |
| 97 | ... ELSE Sleep 2s |
| 98 | Wait Until Keyword Succeeds ${timeout} 2s Verify ONU Device Image ${onu_device_id} |
| 99 | ... DOWNLOAD_SUCCEEDED IMAGE_UNKNOWN NO_ERROR |
| 100 | Activate ONU Device Image ${onu_device_id} ${onu_image_name} ${onu_image_version} |
| 101 | ... ${onu_image_crc} ${onu_image_local_dir} |
| 102 | # This additional pause to let image download and finish activate on the ONU (BBSim) |
| 103 | # as the IMAGE_ACTIVE below is only an indication that the image is accepted for the download to the ONU (BBSim). |
| 104 | Run Keyword If ${has_dataplane} Sleep 600s |
| 105 | ... ELSE Sleep 180s |
| 106 | Wait Until Keyword Succeeds ${timeout} 2s Verify ONU Device Image ${onu_device_id} |
| 107 | ... DOWNLOAD_SUCCEEDED IMAGE_ACTIVE NO_ERROR |
| 108 | Wait Until Keyword Succeeds ${timeout} 5s Perform Sanity Test ${suppressaddsubscriber} |
| 109 | END |
| 110 | # Additional Verification |
| 111 | Wait Until Keyword Succeeds ${timeout} 2s Delete All Devices and Verify |
| 112 | Setup |
| 113 | Run Keyword If ${has_dataplane} Clean Up Linux |
| 114 | Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test |
| 115 | |
| 116 | *** Keywords *** |
| 117 | Setup Suite |
| 118 | [Documentation] Set up the test suite |
| 119 | Common Test Suite Setup |
| 120 | |
| 121 | Teardown Suite |
| 122 | [Documentation] Tear down steps for the suite |
| 123 | Run Keyword If ${has_dataplane} Clean Up Linux |