Joey Armstrong | 9fadcbe | 2024-01-17 19:00:37 -0500 | [diff] [blame] | 1 | # Copyright 2021-2024 Open Networking Foundation (ONF) and the ONF Contributors |
Hardik Windlass | dd1a9a1 | 2021-02-23 15:34:50 +0000 | [diff] [blame] | 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 |
Hardik Windlass | 4288c6a | 2021-09-28 07:22:06 +0000 | [diff] [blame] | 44 | ${INFRA_NAMESPACE} default |
Hardik Windlass | dd1a9a1 | 2021-02-23 15:34:50 +0000 | [diff] [blame] | 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 | ${uprate} 0 |
| 52 | ${dnrate} 0 |
| 53 | ${has_dataplane} True |
| 54 | ${teardown_device} False |
| 55 | ${scripts} ../../scripts |
| 56 | |
| 57 | # Per-test logging on failure is turned off by default; set this variable to enable |
| 58 | ${container_log_dir} ${None} |
| 59 | |
Matteo Scandolo | da1c64b | 2021-07-20 10:14:49 -0700 | [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 | dd1a9a1 | 2021-02-23 15:34:50 +0000 | [diff] [blame] | 64 | # ONOS Apps to Test for Software Upgrade need to be passed in the following variable in format: |
Hardik Windlass | dc2610f | 2021-03-09 07:33:51 +0000 | [diff] [blame] | 65 | # <app-name>,<version>,<oar-url>*<app-name>,<version>,<oar-url>* |
Hardik Windlass | dd1a9a1 | 2021-02-23 15:34:50 +0000 | [diff] [blame] | 66 | # Example: org.opencord.aaa,2.3.0.SNAPSHOT, |
Hardik Windlass | dc2610f | 2021-03-09 07:33:51 +0000 | [diff] [blame] | 67 | # https://oss.sonatype.org/content/groups/public/org/opencord/aaa-app/2.3.0-SNAPSHOT/aaa-app-2.3.0-20201210.223737-1.oar* |
Hardik Windlass | dd1a9a1 | 2021-02-23 15:34:50 +0000 | [diff] [blame] | 68 | ${onos_apps_under_test} ${EMPTY} |
| 69 | |
| 70 | *** Test Cases *** |
| 71 | Test ONOS App Minor Version Upgrade |
| 72 | [Documentation] Validates the ONOS App Minor Version Upgrade doesn't affect the system functionality |
| 73 | ... Performs the sanity and verifies all the ONUs are authenticated/DHCP/pingable |
| 74 | ... Requirement: Apps to test needs to be passed in robot command variable 'onos_apps_under_test' in the format: |
Hardik Windlass | dc2610f | 2021-03-09 07:33:51 +0000 | [diff] [blame] | 75 | ... <app-name>,<version>,<oar-url>*<app-name>,<version>,<oar-url>* |
Hardik Windlass | dd1a9a1 | 2021-02-23 15:34:50 +0000 | [diff] [blame] | 76 | ... Check [VOL-3844] for more details |
| 77 | [Tags] functional ONOSAppMinorVerUpgrade |
| 78 | [Setup] Run Keywords Start Logging ONOSAppMinorVerUpgrade |
| 79 | ... AND Setup |
| 80 | [Teardown] Run Keywords Collect Logs |
| 81 | ... AND Stop Logging ONOSAppMinorVerUpgrade |
| 82 | ... AND Delete All Devices and Verify |
| 83 | Run Keyword If ${has_dataplane} Clean Up Linux |
| 84 | Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test |
| 85 | ${onos_url}= Set Variable http://karaf:karaf@${ONOS_REST_IP}:${ONOS_REST_PORT} |
| 86 | ${num_apps_under_test}= Get Length ${list_onos_apps_under_test} |
Hardik Windlass | f7a7b1e | 2021-03-16 07:55:20 +0000 | [diff] [blame] | 87 | # Set log level to DEBUG for all apps under test |
| 88 | FOR ${J} IN RANGE 0 ${num_apps_under_test} |
| 89 | ${app_ut}= Set Variable ${list_onos_apps_under_test}[${J}][app] |
| 90 | Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s |
TorstenThieme | 731a759 | 2021-07-01 14:26:54 +0000 | [diff] [blame] | 91 | ... Execute ONOS CLI Command use single connection ${ONOS_SSH_IP} ${ONOS_SSH_PORT} |
Hardik Windlass | f7a7b1e | 2021-03-16 07:55:20 +0000 | [diff] [blame] | 92 | ... log:set DEBUG ${app_ut} |
| 93 | END |
Hardik Windlass | dd1a9a1 | 2021-02-23 15:34:50 +0000 | [diff] [blame] | 94 | FOR ${I} IN RANGE 0 ${num_apps_under_test} |
| 95 | ${app}= Set Variable ${list_onos_apps_under_test}[${I}][app] |
| 96 | ${version}= Set Variable ${list_onos_apps_under_test}[${I}][version] |
| 97 | ${url}= Set Variable ${list_onos_apps_under_test}[${I}][url] |
| 98 | ${oar_file}= Set Variable ${CURDIR}/../../tests/data/onos-files/${app}-${version}.oar |
| 99 | Download App OAR File ${url} ${oar_file} |
Hardik Windlass | dc2610f | 2021-03-09 07:33:51 +0000 | [diff] [blame] | 100 | ${app_details} Get ONOS App Details ${onos_url} ${app} |
| 101 | Log ${app}: before upgrade: ${app_details} |
Hardik Windlass | dd1a9a1 | 2021-02-23 15:34:50 +0000 | [diff] [blame] | 102 | Delete ONOS App ${onos_url} ${app} |
Andrea Campanella | 01d40cb | 2021-03-24 20:19:58 +0100 | [diff] [blame] | 103 | Sleep 10s |
Hardik Windlass | dd1a9a1 | 2021-02-23 15:34:50 +0000 | [diff] [blame] | 104 | Verify ONOS Apps Active Except App Under Test ${onos_url} ${app} |
| 105 | Install And Activate ONOS App ${onos_url} ${oar_file} |
| 106 | Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s |
| 107 | ... Verify ONOS App Active ${onos_url} ${app} ${version} |
Hardik Windlass | dc2610f | 2021-03-09 07:33:51 +0000 | [diff] [blame] | 108 | ${app_details_1} Get ONOS App Details ${onos_url} ${app} |
| 109 | Log ${app}: after upgrade: ${app_details_1} |
Hardik Windlass | dd1a9a1 | 2021-02-23 15:34:50 +0000 | [diff] [blame] | 110 | Verify ONOS Pod Restart False |
| 111 | Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test True |
| 112 | END |
| 113 | # Additional Verification |
| 114 | Wait Until Keyword Succeeds ${timeout} 2s Delete All Devices and Verify |
| 115 | Setup |
| 116 | Run Keyword If ${has_dataplane} Clean Up Linux |
| 117 | Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test |
| 118 | |
| 119 | *** Keywords *** |
| 120 | Setup Suite |
| 121 | [Documentation] Set up the test suite |
| 122 | Common Test Suite Setup |
| 123 | Create ONOS Apps Under Test List |
Hardik Windlass | f7a7b1e | 2021-03-16 07:55:20 +0000 | [diff] [blame] | 124 | |
| 125 | Teardown Suite |
| 126 | [Documentation] Replaces the Suite Teardown in utils.robot. |
| 127 | ... Cleans up and checks all ONU ports disabled in ONOS. |
| 128 | Close All ONOS SSH Connections |
Hardik Windlass | dd1a9a1 | 2021-02-23 15:34:50 +0000 | [diff] [blame] | 129 | |
| 130 | Verify ONOS Apps Active Except App Under Test |
| 131 | [Documentation] Verifies all the apps defined in input yaml are active except for the app under test |
| 132 | [Arguments] ${onos_url} ${app_under_test} |
| 133 | ${num_onos_apps}= Get Length ${onos_apps} |
| 134 | FOR ${I} IN RANGE 0 ${num_onos_apps} |
| 135 | Continue For Loop If '${app_under_test}'=='${onos_apps}[${I}]' |
| 136 | Verify ONOS App Active ${onos_url} ${onos_apps}[${I}] |
| 137 | END |
| 138 | |
| 139 | Download App OAR File |
| 140 | [Documentation] This keyword downloads the app oar file from the given url to the specified location |
| 141 | [Arguments] ${oar_url} ${oar_file} |
Matteo Scandolo | 2769d2b | 2021-04-14 10:29:24 -0700 | [diff] [blame] | 142 | ${rc} Run And Return Rc curl --fail -sSL ${oar_url} > ${oar_file} |
| 143 | Should Be Equal As Integers ${rc} 0 Can't download ONOS app from ${oar_url} |
Hardik Windlass | dd1a9a1 | 2021-02-23 15:34:50 +0000 | [diff] [blame] | 144 | |
| 145 | Create ONOS Apps Under Test List |
| 146 | [Documentation] Creates a list of ONOS Apps to Test from the input variable string |
| 147 | ... The input string is expected to be in format: |
Hardik Windlass | dc2610f | 2021-03-09 07:33:51 +0000 | [diff] [blame] | 148 | ... <app-name>,<version>,<oar-url>*<app-name>,<version>,<oar-url>* |
Hardik Windlass | dd1a9a1 | 2021-02-23 15:34:50 +0000 | [diff] [blame] | 149 | ${list_onos_apps_under_test} Create List |
| 150 | @{apps_under_test_arr}= Split String ${onos_apps_under_test} * |
| 151 | ${num_apps_under_test}= Get Length ${apps_under_test_arr} |
Hardik Windlass | dc2610f | 2021-03-09 07:33:51 +0000 | [diff] [blame] | 152 | FOR ${I} IN RANGE 0 ${num_apps_under_test}-1 |
Hardik Windlass | dd1a9a1 | 2021-02-23 15:34:50 +0000 | [diff] [blame] | 153 | @{app_under_test_arr}= Split String ${apps_under_test_arr[${I}]} , |
| 154 | ${app}= Set Variable ${app_under_test_arr[0]} |
| 155 | ${version}= Set Variable ${app_under_test_arr[1]} |
| 156 | ${url}= Set Variable ${app_under_test_arr[2]} |
| 157 | ${app_under_test} Create Dictionary app ${app} version ${version} url ${url} |
| 158 | Append To List ${list_onos_apps_under_test} ${app_under_test} |
| 159 | END |
Hardik Windlass | dc2610f | 2021-03-09 07:33:51 +0000 | [diff] [blame] | 160 | Log ${list_onos_apps_under_test} |
Hardik Windlass | dd1a9a1 | 2021-02-23 15:34:50 +0000 | [diff] [blame] | 161 | Set Suite Variable ${list_onos_apps_under_test} |