Hardik Windlass | dd1a9a1 | 2021-02-23 15:34:50 +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 | |
| 15 | *** Settings *** |
| 16 | Documentation Test ONOS Apps Software Upgrade |
| 17 | Suite Setup Setup Suite |
| 18 | Test Setup Setup |
| 19 | Test Teardown Teardown |
| 20 | Suite Teardown Teardown Suite |
| 21 | Library Collections |
| 22 | Library String |
| 23 | Library OperatingSystem |
| 24 | Library XML |
| 25 | Library RequestsLibrary |
| 26 | Library ../../libraries/DependencyLibrary.py |
| 27 | Resource ../../libraries/onos.robot |
| 28 | Resource ../../libraries/voltctl.robot |
| 29 | Resource ../../libraries/voltha.robot |
| 30 | Resource ../../libraries/utils.robot |
| 31 | Resource ../../libraries/k8s.robot |
| 32 | Resource ../../variables/variables.robot |
| 33 | Resource ../../libraries/power_switch.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 | ${uprate} 0 |
| 51 | ${dnrate} 0 |
| 52 | ${has_dataplane} True |
| 53 | ${teardown_device} False |
| 54 | ${scripts} ../../scripts |
| 55 | |
| 56 | # Per-test logging on failure is turned off by default; set this variable to enable |
| 57 | ${container_log_dir} ${None} |
| 58 | |
| 59 | # ONOS Apps to Test for Software Upgrade need to be passed in the following variable in format: |
| 60 | # <app-name>,<version>,<oar-url>*<app-name>,<version>,<oar-url> |
| 61 | # Example: org.opencord.aaa,2.3.0.SNAPSHOT, |
| 62 | # https://oss.sonatype.org/content/groups/public/org/opencord/aaa-app/2.3.0-SNAPSHOT/aaa-app-2.3.0-20201210.223737-1.oar |
| 63 | ${onos_apps_under_test} ${EMPTY} |
| 64 | |
| 65 | *** Test Cases *** |
| 66 | Test ONOS App Minor Version Upgrade |
| 67 | [Documentation] Validates the ONOS App Minor Version Upgrade doesn't affect the system functionality |
| 68 | ... Performs the sanity and verifies all the ONUs are authenticated/DHCP/pingable |
| 69 | ... Requirement: Apps to test needs to be passed in robot command variable 'onos_apps_under_test' in the format: |
| 70 | ... <app-name>,<version>,<oar-url>*<app-name>,<version>,<oar-url> |
| 71 | ... Check [VOL-3844] for more details |
| 72 | [Tags] functional ONOSAppMinorVerUpgrade |
| 73 | [Setup] Run Keywords Start Logging ONOSAppMinorVerUpgrade |
| 74 | ... AND Setup |
| 75 | [Teardown] Run Keywords Collect Logs |
| 76 | ... AND Stop Logging ONOSAppMinorVerUpgrade |
| 77 | ... AND Delete All Devices and Verify |
| 78 | Run Keyword If ${has_dataplane} Clean Up Linux |
| 79 | Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test |
| 80 | ${onos_url}= Set Variable http://karaf:karaf@${ONOS_REST_IP}:${ONOS_REST_PORT} |
| 81 | ${num_apps_under_test}= Get Length ${list_onos_apps_under_test} |
| 82 | FOR ${I} IN RANGE 0 ${num_apps_under_test} |
| 83 | ${app}= Set Variable ${list_onos_apps_under_test}[${I}][app] |
| 84 | ${version}= Set Variable ${list_onos_apps_under_test}[${I}][version] |
| 85 | ${url}= Set Variable ${list_onos_apps_under_test}[${I}][url] |
| 86 | ${oar_file}= Set Variable ${CURDIR}/../../tests/data/onos-files/${app}-${version}.oar |
| 87 | Download App OAR File ${url} ${oar_file} |
| 88 | Delete ONOS App ${onos_url} ${app} |
| 89 | Verify ONOS Apps Active Except App Under Test ${onos_url} ${app} |
| 90 | Install And Activate ONOS App ${onos_url} ${oar_file} |
| 91 | Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s |
| 92 | ... Verify ONOS App Active ${onos_url} ${app} ${version} |
| 93 | Verify ONOS Pod Restart False |
| 94 | Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test True |
| 95 | END |
| 96 | # Additional Verification |
| 97 | Wait Until Keyword Succeeds ${timeout} 2s Delete All Devices and Verify |
| 98 | Setup |
| 99 | Run Keyword If ${has_dataplane} Clean Up Linux |
| 100 | Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test |
| 101 | |
| 102 | *** Keywords *** |
| 103 | Setup Suite |
| 104 | [Documentation] Set up the test suite |
| 105 | Common Test Suite Setup |
| 106 | Create ONOS Apps Under Test List |
| 107 | |
| 108 | Verify ONOS Apps Active Except App Under Test |
| 109 | [Documentation] Verifies all the apps defined in input yaml are active except for the app under test |
| 110 | [Arguments] ${onos_url} ${app_under_test} |
| 111 | ${num_onos_apps}= Get Length ${onos_apps} |
| 112 | FOR ${I} IN RANGE 0 ${num_onos_apps} |
| 113 | Continue For Loop If '${app_under_test}'=='${onos_apps}[${I}]' |
| 114 | Verify ONOS App Active ${onos_url} ${onos_apps}[${I}] |
| 115 | END |
| 116 | |
| 117 | Download App OAR File |
| 118 | [Documentation] This keyword downloads the app oar file from the given url to the specified location |
| 119 | [Arguments] ${oar_url} ${oar_file} |
| 120 | ${rc} Run And Return Rc curl -L ${oar_url} > ${oar_file} |
| 121 | Should Be Equal As Integers ${rc} 0 |
| 122 | |
| 123 | Create ONOS Apps Under Test List |
| 124 | [Documentation] Creates a list of ONOS Apps to Test from the input variable string |
| 125 | ... The input string is expected to be in format: |
| 126 | ... <app-name>,<version>,<oar-url>*<app-name>,<version>,<oar-url> |
| 127 | ${list_onos_apps_under_test} Create List |
| 128 | @{apps_under_test_arr}= Split String ${onos_apps_under_test} * |
| 129 | ${num_apps_under_test}= Get Length ${apps_under_test_arr} |
| 130 | FOR ${I} IN RANGE 0 ${num_apps_under_test} |
| 131 | @{app_under_test_arr}= Split String ${apps_under_test_arr[${I}]} , |
| 132 | ${app}= Set Variable ${app_under_test_arr[0]} |
| 133 | ${version}= Set Variable ${app_under_test_arr[1]} |
| 134 | ${url}= Set Variable ${app_under_test_arr[2]} |
| 135 | ${app_under_test} Create Dictionary app ${app} version ${version} url ${url} |
| 136 | Append To List ${list_onos_apps_under_test} ${app_under_test} |
| 137 | END |
| 138 | Set Suite Variable ${list_onos_apps_under_test} |