blob: 2fa442c49643818b6544424a3301896ea1e2d64f [file] [log] [blame]
Hardik Windlass17bd1142021-03-12 08:15:25 +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# FIXME Can we use the same test against BBSim and Hardware?
15
16*** Settings ***
17Documentation Tests ONU Software Upgrade
18Suite Setup Setup Suite
19Test Setup Setup
20Test Teardown Teardown
21Suite Teardown Teardown Suite
22Library Collections
23Library String
24Library OperatingSystem
25Library XML
26Library RequestsLibrary
27Library ../../libraries/DependencyLibrary.py
28Resource ../../libraries/onos.robot
29Resource ../../libraries/voltctl.robot
30Resource ../../libraries/voltha.robot
31Resource ../../libraries/utils.robot
32Resource ../../libraries/k8s.robot
Hardik Windlassc310c7c2021-03-25 13:16:59 +000033Resource ../../libraries/bbsim.robot
Hardik Windlass17bd1142021-03-12 08:15:25 +000034Resource ../../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:
Hardik Windlassba1bd272021-06-22 08:29:33 +000061${image_version} ${EMPTY}
62# Example value: BBSM_IMG_00002
63${image_url} ${EMPTY}
Hardik Windlass17bd1142021-03-12 08:15:25 +000064# Example value: http://bbsim0:50074/images/software-image.img
Hardik Windlassba1bd272021-06-22 08:29:33 +000065${image_vendor} ${EMPTY}
66# Example value: BBSM
67${image_activate_on_success} ${EMPTY}
68# Example value: false
69${image_commit_on_success} ${EMPTY}
70# Example value: false
71${image_crc} ${EMPTY}
Hardik Windlass17bd1142021-03-12 08:15:25 +000072# Example value: 0
Hardik Windlass17bd1142021-03-12 08:15:25 +000073
74*** Test Cases ***
75Test ONU Upgrade
76 [Documentation] Validates the ONU Upgrade doesn't affect the system functionality
77 ... Performs the sanity and verifies all the ONUs are authenticated/DHCP/pingable
78 ... Requirement: Pass image details in following parameters in the robot command
79 ... onu_image_name, onu_image_url, onu_image_version, onu_image_crc, onu_image_local_dir
Hardik Windlassc310c7c2021-03-25 13:16:59 +000080 ... Note: The TC expects the image url and other parameters to be common for all ONUs on all BBSim
Hardik Windlass17bd1142021-03-12 08:15:25 +000081 ... Check [VOL-3903] for more details
82 [Tags] functional ONUUpgrade
83 [Setup] Start Logging ONUUpgrade
84 [Teardown] Run Keywords Collect Logs
85 ... AND Stop Logging ONUUpgrade
86 ... AND Delete All Devices and Verify
87 # Add OLT device
88 Setup
89 # Performing Sanity Test to make sure subscribers are all DHCP and pingable
90 Run Keyword If ${has_dataplane} Clean Up Linux
91 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test
Hardik Windlassc310c7c2021-03-25 13:16:59 +000092 FOR ${J} IN RANGE 0 ${num_olts}
93 ${olt_serial_number}= Set Variable ${list_olts}[${J}][sn]
94 ${bbsim_rel}= Catenate SEPARATOR= bbsim ${J}
95 ${bbsim_pod}= Get Pod Name By Label ${NAMESPACE} release ${bbsim_rel}
96 Test ONU Upgrade Per OLT ${bbsim_pod} ${olt_serial_number}
97 List ONUs ${NAMESPACE} ${bbsim_pod}
98 END
99 # Additional Verification
100 Wait Until Keyword Succeeds ${timeout} 2s Delete All Devices and Verify
101 Setup
102 Run Keyword If ${has_dataplane} Clean Up Linux
103 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test
104
TorstenThiemeeb2440e2021-07-20 10:45:05 +0000105Test ONU Upgrade Correct Indication of Download Failure
106 [Documentation] Validates the ONU Upgrade download failure will be indicated correctly and
107 ... doesn't affect the system functionality
108 ... Performs the sanity and verifies all the ONUs are authenticated/DHCP/pingable
109 ... Requirement: Pass image details in following parameters in the robot command
110 ... onu_image_name, onu_image_url, onu_image_version, onu_image_crc, onu_image_local_dir
111 ... Note: The TC expects the image url and other parameters to be common for all ONUs on all BBSim
112 ... Check [VOL-3903] for more details
113 [Tags] functional ONUUpgradeDownloadFailure notready
114 [Setup] Start Logging ONUUpgradeDownloadFailure
115 [Teardown] Run Keywords Collect Logs
116 ... AND Stop Logging ONUUpgradeDownloadFailure
117 ... AND Delete All Devices and Verify
118 # Add OLT device
119 Setup
120 # Performing Sanity Test to make sure subscribers are all DHCP and pingable
121 Run Keyword If ${has_dataplane} Clean Up Linux
122 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test
123 FOR ${J} IN RANGE 0 ${num_olts}
124 ${olt_serial_number}= Set Variable ${list_olts}[${J}][sn]
125 ${bbsim_rel}= Catenate SEPARATOR= bbsim ${J}
126 ${bbsim_pod}= Get Pod Name By Label ${NAMESPACE} release ${bbsim_rel}
127 Test ONU Upgrade Download Failure Per OLT ${bbsim_pod} ${olt_serial_number}
128 List ONUs ${NAMESPACE} ${bbsim_pod}
129 END
130 # Additional Verification
131 Wait Until Keyword Succeeds ${timeout} 2s Delete All Devices and Verify
132 Setup
133 Run Keyword If ${has_dataplane} Clean Up Linux
134 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test
135
136
137
Hardik Windlassc310c7c2021-03-25 13:16:59 +0000138*** Keywords ***
139Test ONU Upgrade Per OLT
140 [Documentation] This keyword performs the ONU Upgrade test on single OLT
141 [Arguments] ${bbsim_pod} ${olt_serial_number}
Hardik Windlass17bd1142021-03-12 08:15:25 +0000142 FOR ${I} IN RANGE 0 ${num_all_onus}
143 ${src}= Set Variable ${hosts.src[${I}]}
144 ${dst}= Set Variable ${hosts.dst[${I}]}
Hardik Windlassc310c7c2021-03-25 13:16:59 +0000145 Continue For Loop If "${olt_serial_number}"!="${src['olt']}"
Hardik Windlass17bd1142021-03-12 08:15:25 +0000146 ${onu_device_id}= Get Device ID From SN ${src['onu']}
Hardik Windlassba1bd272021-06-22 08:29:33 +0000147 # Download Image
148 Download ONU Device Image ${image_version} ${image_url} ${image_vendor}
149 ... ${image_activate_on_success} ${image_commit_on_success}
150 ... ${image_crc} ${onu_device_id}
TorstenThiemeeb2440e2021-07-20 10:45:05 +0000151 ${imageState}= Run Keyword If '${image_activate_on_success}'=='true' and '${image_commit_on_success}'=='false'
152 ... Set Variable IMAGE_ACTIVE
Hardik Windlassba1bd272021-06-22 08:29:33 +0000153 ... ELSE IF '${image_activate_on_success}'=='true' and '${image_commit_on_success}'=='true'
154 ... Set Variable IMAGE_COMMITTED
155 ... ELSE Set Variable IMAGE_INACTIVE
156 ${activated}= Set Variable If '${image_activate_on_success}'=='true' True False
157 ${committed}= Set Variable If '${image_activate_on_success}'=='true' and '${image_commit_on_success}'=='true'
158 ... True False
159 Wait Until Keyword Succeeds ${timeout} 2s Verify ONU Device Image Status ${image_version}
160 ... ${onu_device_id} DOWNLOAD_SUCCEEDED NO_ERROR ${imageState}
161 Wait Until Keyword Succeeds ${timeout} 2s Verify ONU Device Image List ${onu_device_id}
162 ... ${image_version} ${committed} ${activated} True
163 # Activate Image
164 ${imageState}= Set Variable If '${image_commit_on_success}'=='true' IMAGE_COMMITTED IMAGE_ACTIVE
165 ${committed}= Set Variable If '${image_commit_on_success}'=='true' True False
166 Run Keyword If '${image_activate_on_success}'=='false' Run Keywords
167 ... Activate ONU Device Image ${image_version} ${image_commit_on_success} ${onu_device_id}
168 ... AND Wait Until Keyword Succeeds ${timeout} 2s Verify ONU Device Image Status ${image_version}
169 ... ${onu_device_id} DOWNLOAD_SUCCEEDED NO_ERROR ${imageState}
170 ... AND Wait Until Keyword Succeeds ${timeout} 2s Verify ONU Device Image List ${onu_device_id}
171 ... ${image_version} ${committed} True True
172 # Commit Image
173 Run Keyword If '${image_commit_on_success}'=='false' Run Keywords
174 ... Commit ONU Device Image ${image_version} ${onu_device_id}
175 ... AND Wait Until Keyword Succeeds ${timeout} 2s Verify ONU Device Image Status ${image_version}
176 ... ${onu_device_id} DOWNLOAD_SUCCEEDED NO_ERROR IMAGE_COMMITTED
177 ... AND Wait Until Keyword Succeeds ${timeout} 2s Verify ONU Device Image List ${onu_device_id}
178 ... ${image_version} True True True
Hardik Windlassc310c7c2021-03-25 13:16:59 +0000179 Wait Until Keyword Succeeds ${timeout} 2s Verify ONU Device Image On BBSim ${NAMESPACE} ${bbsim_pod}
180 ... ${src['onu']} software_image_committed
Hardik Windlass17bd1142021-03-12 08:15:25 +0000181 Wait Until Keyword Succeeds ${timeout} 5s Perform Sanity Test ${suppressaddsubscriber}
182 END
Hardik Windlass17bd1142021-03-12 08:15:25 +0000183
TorstenThiemeeb2440e2021-07-20 10:45:05 +0000184Test ONU Upgrade Download Failure Per OLT
185 [Documentation] This keyword performs the ONU Upgrade Dowload Failure test on single OLT
186 [Arguments] ${bbsim_pod} ${olt_serial_number}
187 FOR ${I} IN RANGE 0 ${num_all_onus}
188 ${src}= Set Variable ${hosts.src[${I}]}
189 ${dst}= Set Variable ${hosts.dst[${I}]}
190 Continue For Loop If "${olt_serial_number}"!="${src['olt']}"
191 ${onu_device_id}= Get Device ID From SN ${src['onu']}
192 # Download Image
193 Download ONU Device Image INVALID_IMAGE ${image_url} ${image_vendor}
194 ... ${image_activate_on_success} ${image_commit_on_success}
195 ... ${image_crc} ${onu_device_id}
196 Wait Until Keyword Succeeds ${timeout} 2s Verify ONU Device Image Status INVALID_IMAGE
197 ... ${onu_device_id} DOWNLOAD_SUCCEEDED NO_ERROR IMAGE_INACTIVE
198 Wait Until Keyword Succeeds ${timeout} 5s Perform Sanity Test ${suppressaddsubscriber}
199 END
200
Hardik Windlass17bd1142021-03-12 08:15:25 +0000201Setup Suite
202 [Documentation] Set up the test suite
203 Common Test Suite Setup
204
205Teardown Suite
206 [Documentation] Tear down steps for the suite
207 Run Keyword If ${has_dataplane} Clean Up Linux
TorstenThieme4e2168e2021-06-22 14:01:47 +0000208 Close All ONOS SSH Connections