blob: 5bc59616f07ce6ad389b9c40a9448305d8cd492a [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
Hardik Windlassa9b38262021-10-27 08:14:22 +000045${INFRA_NAMESPACE} default
Hardik Windlass17bd1142021-03-12 08:15:25 +000046# For below variable value, using deployment name as using grep for
47# parsing radius pod name, we can also use full radius pod name
48${RESTART_POD_NAME} radius
49${timeout} 60s
50${of_id} 0
51${logical_id} 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${suppressaddsubscriber} True
60
Hardik Windlassd8ecbef2021-10-19 06:12:16 +000061# logging flag to enable Voltha Components Logging, can be passed via the command line too
62# example: -v logging:False
63${logging} True
64
Hardik Windlass17bd1142021-03-12 08:15:25 +000065# ONU Image to test for Upgrade needs to be passed in the following format:
Hardik Windlassba1bd272021-06-22 08:29:33 +000066${image_version} ${EMPTY}
67# Example value: BBSM_IMG_00002
68${image_url} ${EMPTY}
Hardik Windlass17bd1142021-03-12 08:15:25 +000069# Example value: http://bbsim0:50074/images/software-image.img
Hardik Windlassba1bd272021-06-22 08:29:33 +000070${image_vendor} ${EMPTY}
71# Example value: BBSM
72${image_activate_on_success} ${EMPTY}
73# Example value: false
74${image_commit_on_success} ${EMPTY}
75# Example value: false
76${image_crc} ${EMPTY}
Hardik Windlass17bd1142021-03-12 08:15:25 +000077# Example value: 0
Hardik Windlass17bd1142021-03-12 08:15:25 +000078
79*** Test Cases ***
80Test ONU Upgrade
81 [Documentation] Validates the ONU Upgrade doesn't affect the system functionality
82 ... Performs the sanity and verifies all the ONUs are authenticated/DHCP/pingable
83 ... Requirement: Pass image details in following parameters in the robot command
84 ... onu_image_name, onu_image_url, onu_image_version, onu_image_crc, onu_image_local_dir
Hardik Windlassc310c7c2021-03-25 13:16:59 +000085 ... 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 +000086 ... Check [VOL-3903] for more details
87 [Tags] functional ONUUpgrade
88 [Setup] Start Logging ONUUpgrade
89 [Teardown] Run Keywords Collect Logs
90 ... AND Stop Logging ONUUpgrade
91 ... AND Delete All Devices and Verify
92 # Add OLT device
93 Setup
94 # Performing Sanity Test to make sure subscribers are all DHCP and pingable
95 Run Keyword If ${has_dataplane} Clean Up Linux
96 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test
Hardik Windlassc310c7c2021-03-25 13:16:59 +000097 FOR ${J} IN RANGE 0 ${num_olts}
98 ${olt_serial_number}= Set Variable ${list_olts}[${J}][sn]
99 ${bbsim_rel}= Catenate SEPARATOR= bbsim ${J}
100 ${bbsim_pod}= Get Pod Name By Label ${NAMESPACE} release ${bbsim_rel}
101 Test ONU Upgrade Per OLT ${bbsim_pod} ${olt_serial_number}
102 List ONUs ${NAMESPACE} ${bbsim_pod}
103 END
104 # Additional Verification
105 Wait Until Keyword Succeeds ${timeout} 2s Delete All Devices and Verify
106 Setup
107 Run Keyword If ${has_dataplane} Clean Up Linux
108 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test
109
110*** Keywords ***
111Test ONU Upgrade Per OLT
112 [Documentation] This keyword performs the ONU Upgrade test on single OLT
113 [Arguments] ${bbsim_pod} ${olt_serial_number}
Hardik Windlass17bd1142021-03-12 08:15:25 +0000114 FOR ${I} IN RANGE 0 ${num_all_onus}
115 ${src}= Set Variable ${hosts.src[${I}]}
116 ${dst}= Set Variable ${hosts.dst[${I}]}
Hardik Windlassc310c7c2021-03-25 13:16:59 +0000117 Continue For Loop If "${olt_serial_number}"!="${src['olt']}"
Hardik Windlass17bd1142021-03-12 08:15:25 +0000118 ${onu_device_id}= Get Device ID From SN ${src['onu']}
Hardik Windlassba1bd272021-06-22 08:29:33 +0000119 # Download Image
120 Download ONU Device Image ${image_version} ${image_url} ${image_vendor}
121 ... ${image_activate_on_success} ${image_commit_on_success}
122 ... ${image_crc} ${onu_device_id}
123 ${imageState}= Run Keyword If '${image_activate_on_success}'=='true' Set Variable IMAGE_ACTIVE
124 ... ELSE IF '${image_activate_on_success}'=='true' and '${image_commit_on_success}'=='true'
125 ... Set Variable IMAGE_COMMITTED
126 ... ELSE Set Variable IMAGE_INACTIVE
127 ${activated}= Set Variable If '${image_activate_on_success}'=='true' True False
128 ${committed}= Set Variable If '${image_activate_on_success}'=='true' and '${image_commit_on_success}'=='true'
129 ... True False
130 Wait Until Keyword Succeeds ${timeout} 2s Verify ONU Device Image Status ${image_version}
131 ... ${onu_device_id} DOWNLOAD_SUCCEEDED NO_ERROR ${imageState}
132 Wait Until Keyword Succeeds ${timeout} 2s Verify ONU Device Image List ${onu_device_id}
133 ... ${image_version} ${committed} ${activated} True
134 # Activate Image
135 ${imageState}= Set Variable If '${image_commit_on_success}'=='true' IMAGE_COMMITTED IMAGE_ACTIVE
136 ${committed}= Set Variable If '${image_commit_on_success}'=='true' True False
137 Run Keyword If '${image_activate_on_success}'=='false' Run Keywords
138 ... Activate ONU Device Image ${image_version} ${image_commit_on_success} ${onu_device_id}
139 ... AND Wait Until Keyword Succeeds ${timeout} 2s Verify ONU Device Image Status ${image_version}
140 ... ${onu_device_id} DOWNLOAD_SUCCEEDED NO_ERROR ${imageState}
141 ... AND Wait Until Keyword Succeeds ${timeout} 2s Verify ONU Device Image List ${onu_device_id}
142 ... ${image_version} ${committed} True True
143 # Commit Image
144 Run Keyword If '${image_commit_on_success}'=='false' Run Keywords
145 ... Commit ONU Device Image ${image_version} ${onu_device_id}
146 ... AND Wait Until Keyword Succeeds ${timeout} 2s Verify ONU Device Image Status ${image_version}
147 ... ${onu_device_id} DOWNLOAD_SUCCEEDED NO_ERROR IMAGE_COMMITTED
148 ... AND Wait Until Keyword Succeeds ${timeout} 2s Verify ONU Device Image List ${onu_device_id}
149 ... ${image_version} True True True
Hardik Windlassc310c7c2021-03-25 13:16:59 +0000150 Wait Until Keyword Succeeds ${timeout} 2s Verify ONU Device Image On BBSim ${NAMESPACE} ${bbsim_pod}
151 ... ${src['onu']} software_image_committed
Hardik Windlass17bd1142021-03-12 08:15:25 +0000152 Wait Until Keyword Succeeds ${timeout} 5s Perform Sanity Test ${suppressaddsubscriber}
153 END
Hardik Windlass17bd1142021-03-12 08:15:25 +0000154
Hardik Windlass17bd1142021-03-12 08:15:25 +0000155Setup Suite
156 [Documentation] Set up the test suite
157 Common Test Suite Setup
158
159Teardown Suite
160 [Documentation] Tear down steps for the suite
161 Run Keyword If ${has_dataplane} Clean Up Linux
TorstenThieme4e2168e2021-06-22 14:01:47 +0000162 Close All ONOS SSH Connections