blob: b4e3596527e470ec8e63f2b571f05eabd91e5fee [file] [log] [blame]
Hardik Windlassdd1a9a12021-02-23 15:34:50 +00001# 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 ***
16Documentation Test ONOS Apps Software Upgrade
17Suite Setup Setup Suite
18Test Setup Setup
19Test Teardown Teardown
20Suite Teardown Teardown Suite
21Library Collections
22Library String
23Library OperatingSystem
24Library XML
25Library RequestsLibrary
26Library ../../libraries/DependencyLibrary.py
27Resource ../../libraries/onos.robot
28Resource ../../libraries/voltctl.robot
29Resource ../../libraries/voltha.robot
30Resource ../../libraries/utils.robot
31Resource ../../libraries/k8s.robot
32Resource ../../variables/variables.robot
33Resource ../../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
Matteo Scandoloda1c64b2021-07-20 10:14:49 -070059# logging flag to enable Collect Logs, can be passed via the command line too
60# example: -v logging:False
61${logging} True
62
Hardik Windlassdd1a9a12021-02-23 15:34:50 +000063# ONOS Apps to Test for Software Upgrade need to be passed in the following variable in format:
Hardik Windlassdc2610f2021-03-09 07:33:51 +000064# <app-name>,<version>,<oar-url>*<app-name>,<version>,<oar-url>*
Hardik Windlassdd1a9a12021-02-23 15:34:50 +000065# Example: org.opencord.aaa,2.3.0.SNAPSHOT,
Hardik Windlassdc2610f2021-03-09 07:33:51 +000066# 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 Windlassdd1a9a12021-02-23 15:34:50 +000067${onos_apps_under_test} ${EMPTY}
68
69*** Test Cases ***
70Test ONOS App Minor Version Upgrade
71 [Documentation] Validates the ONOS App Minor Version Upgrade doesn't affect the system functionality
72 ... Performs the sanity and verifies all the ONUs are authenticated/DHCP/pingable
73 ... Requirement: Apps to test needs to be passed in robot command variable 'onos_apps_under_test' in the format:
Hardik Windlassdc2610f2021-03-09 07:33:51 +000074 ... <app-name>,<version>,<oar-url>*<app-name>,<version>,<oar-url>*
Hardik Windlassdd1a9a12021-02-23 15:34:50 +000075 ... Check [VOL-3844] for more details
76 [Tags] functional ONOSAppMinorVerUpgrade
77 [Setup] Run Keywords Start Logging ONOSAppMinorVerUpgrade
78 ... AND Setup
79 [Teardown] Run Keywords Collect Logs
80 ... AND Stop Logging ONOSAppMinorVerUpgrade
81 ... AND Delete All Devices and Verify
82 Run Keyword If ${has_dataplane} Clean Up Linux
83 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test
84 ${onos_url}= Set Variable http://karaf:karaf@${ONOS_REST_IP}:${ONOS_REST_PORT}
85 ${num_apps_under_test}= Get Length ${list_onos_apps_under_test}
Hardik Windlassf7a7b1e2021-03-16 07:55:20 +000086 # Set log level to DEBUG for all apps under test
87 FOR ${J} IN RANGE 0 ${num_apps_under_test}
88 ${app_ut}= Set Variable ${list_onos_apps_under_test}[${J}][app]
89 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
TorstenThieme731a7592021-07-01 14:26:54 +000090 ... Execute ONOS CLI Command use single connection ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
Hardik Windlassf7a7b1e2021-03-16 07:55:20 +000091 ... log:set DEBUG ${app_ut}
92 END
Hardik Windlassdd1a9a12021-02-23 15:34:50 +000093 FOR ${I} IN RANGE 0 ${num_apps_under_test}
94 ${app}= Set Variable ${list_onos_apps_under_test}[${I}][app]
95 ${version}= Set Variable ${list_onos_apps_under_test}[${I}][version]
96 ${url}= Set Variable ${list_onos_apps_under_test}[${I}][url]
97 ${oar_file}= Set Variable ${CURDIR}/../../tests/data/onos-files/${app}-${version}.oar
98 Download App OAR File ${url} ${oar_file}
Hardik Windlassdc2610f2021-03-09 07:33:51 +000099 ${app_details} Get ONOS App Details ${onos_url} ${app}
100 Log ${app}: before upgrade: ${app_details}
Hardik Windlassdd1a9a12021-02-23 15:34:50 +0000101 Delete ONOS App ${onos_url} ${app}
Andrea Campanella01d40cb2021-03-24 20:19:58 +0100102 Sleep 10s
Hardik Windlassdd1a9a12021-02-23 15:34:50 +0000103 Verify ONOS Apps Active Except App Under Test ${onos_url} ${app}
104 Install And Activate ONOS App ${onos_url} ${oar_file}
105 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
106 ... Verify ONOS App Active ${onos_url} ${app} ${version}
Hardik Windlassdc2610f2021-03-09 07:33:51 +0000107 ${app_details_1} Get ONOS App Details ${onos_url} ${app}
108 Log ${app}: after upgrade: ${app_details_1}
Hardik Windlassdd1a9a12021-02-23 15:34:50 +0000109 Verify ONOS Pod Restart False
110 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test True
111 END
112 # Additional Verification
113 Wait Until Keyword Succeeds ${timeout} 2s Delete All Devices and Verify
114 Setup
115 Run Keyword If ${has_dataplane} Clean Up Linux
116 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test
117
118*** Keywords ***
119Setup Suite
120 [Documentation] Set up the test suite
121 Common Test Suite Setup
122 Create ONOS Apps Under Test List
Hardik Windlassf7a7b1e2021-03-16 07:55:20 +0000123
124Teardown Suite
125 [Documentation] Replaces the Suite Teardown in utils.robot.
126 ... Cleans up and checks all ONU ports disabled in ONOS.
127 Close All ONOS SSH Connections
Hardik Windlassdd1a9a12021-02-23 15:34:50 +0000128
129Verify ONOS Apps Active Except App Under Test
130 [Documentation] Verifies all the apps defined in input yaml are active except for the app under test
131 [Arguments] ${onos_url} ${app_under_test}
132 ${num_onos_apps}= Get Length ${onos_apps}
133 FOR ${I} IN RANGE 0 ${num_onos_apps}
134 Continue For Loop If '${app_under_test}'=='${onos_apps}[${I}]'
135 Verify ONOS App Active ${onos_url} ${onos_apps}[${I}]
136 END
137
138Download App OAR File
139 [Documentation] This keyword downloads the app oar file from the given url to the specified location
140 [Arguments] ${oar_url} ${oar_file}
Matteo Scandolo2769d2b2021-04-14 10:29:24 -0700141 ${rc} Run And Return Rc curl --fail -sSL ${oar_url} > ${oar_file}
142 Should Be Equal As Integers ${rc} 0 Can't download ONOS app from ${oar_url}
Hardik Windlassdd1a9a12021-02-23 15:34:50 +0000143
144Create ONOS Apps Under Test List
145 [Documentation] Creates a list of ONOS Apps to Test from the input variable string
146 ... The input string is expected to be in format:
Hardik Windlassdc2610f2021-03-09 07:33:51 +0000147 ... <app-name>,<version>,<oar-url>*<app-name>,<version>,<oar-url>*
Hardik Windlassdd1a9a12021-02-23 15:34:50 +0000148 ${list_onos_apps_under_test} Create List
149 @{apps_under_test_arr}= Split String ${onos_apps_under_test} *
150 ${num_apps_under_test}= Get Length ${apps_under_test_arr}
Hardik Windlassdc2610f2021-03-09 07:33:51 +0000151 FOR ${I} IN RANGE 0 ${num_apps_under_test}-1
Hardik Windlassdd1a9a12021-02-23 15:34:50 +0000152 @{app_under_test_arr}= Split String ${apps_under_test_arr[${I}]} ,
153 ${app}= Set Variable ${app_under_test_arr[0]}
154 ${version}= Set Variable ${app_under_test_arr[1]}
155 ${url}= Set Variable ${app_under_test_arr[2]}
156 ${app_under_test} Create Dictionary app ${app} version ${version} url ${url}
157 Append To List ${list_onos_apps_under_test} ${app_under_test}
158 END
Hardik Windlassdc2610f2021-03-09 07:33:51 +0000159 Log ${list_onos_apps_under_test}
Hardik Windlassdd1a9a12021-02-23 15:34:50 +0000160 Set Suite Variable ${list_onos_apps_under_test}