blob: c92ba70b2db94ff27db8fdaa1ef2a16b020b979f [file] [log] [blame]
Suchitra Vemurife309412020-12-01 19:19:52 -08001# Copyright 2020 - 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 various failure scenarios
17Suite Setup Setup Suite
18Test Setup Setup
19Test Teardown Teardown
TorstenThieme4e2168e2021-06-22 14:01:47 +000020Suite Teardown Teardown Suite
Suchitra Vemurife309412020-12-01 19:19:52 -080021Library 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
Hardik Windlassa9b38262021-10-27 08:14:22 +000044${INFRA_NAMESPACE} default
Suchitra Vemurife309412020-12-01 19:19:52 -080045${DEFAULTSPACE} default
46# 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
Hardik Windlassd8ecbef2021-10-19 06:12:16 +000059# logging flag to enable Voltha Components Logging, can be passed via the command line too
60# example: -v logging:False
61${logging} True
62
Suchitra Vemurife309412020-12-01 19:19:52 -080063*** Test Cases ***
64Verify OLT after rebooting physically - MultipleOLT
65 [Documentation] Test the physical reboot of the OLT
66 ... Prerequisite : Subscriber are authenticated/DHCP/pingable state
67 ... Test performs a physical reboot on one of the OLTs, performs "reboot" from the OLT CLI
68 ... Validates that ONU on other OLTs are still functional
Hardik Windlass5ceb84e2021-02-11 11:17:08 +000069 [Tags] functional MultiOLTPhysicalReboot
Suchitra Vemurife309412020-12-01 19:19:52 -080070 [Setup] Start Logging MultipleOlt-PhysicalOLTReboot
71 [Teardown] Run Keywords Collect Logs
72 ... AND Stop Logging MultipleOlt-PhysicalOLTReboot
Suchitra Vemurife309412020-12-01 19:19:52 -080073 # Execute the test when the number of OLTs are greater than one
74 Pass Execution If ${olt_count} == 1 Skipping test: just one OLT
Hardik Windlassa119a102021-02-15 14:52:07 +053075 Clear All Devices Then Perform Setup And Sanity
Suchitra Vemurife309412020-12-01 19:19:52 -080076 # Reboot the first OLT from the list of olts - rebooting from the OLT CLI
77 ${olt_user}= Get From Dictionary ${list_olts}[0] user
78 ${olt_pass}= Get From Dictionary ${list_olts}[0] pass
79 ${olt_ssh_ip}= Get From Dictionary ${list_olts}[0] sship
80 ${olt_serial_number}= Get From Dictionary ${list_olts}[0] sn
81 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
82 Run Keyword If ${has_dataplane} Login And Run Command On Remote System
Andrea Campanella5ef88142021-02-02 14:34:50 +010083 ... reboot ${olt_ssh_ip} ${olt_user} ${olt_pass} prompt=#
Suchitra Vemurife309412020-12-01 19:19:52 -080084 # validate that the ONUs on the other OLTs are still functional
85 Verify ping is successful for ONUs not on this OLT ${num_all_onus} ${olt_device_id}
Suchitra Vemurife309412020-12-01 19:19:52 -080086 # Validate that the ONUs on the rebooted OLT are not pingable
87 FOR ${I} IN RANGE 0 ${num_all_onus}
88 ${src}= Set Variable ${hosts.src[${I}]}
89 ${dst}= Set Variable ${hosts.dst[${I}]}
90 ${olt_serial_number}= Get From Dictionary ${list_olts}[0] sn
91 Continue For Loop If "${olt_serial_number}"!="${src['olt']}"
92 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
93 ... Wait Until Keyword Succeeds 60s 2s
94 ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
95 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
96 END
97 # Wait for the rebooted OLT to come back up
98 ${olt_serial_number}= Get From Dictionary ${olt_ids}[0] sn
99 ${olt_user}= Get From Dictionary ${list_olts}[0] user
100 ${olt_pass}= Get From Dictionary ${list_olts}[0] pass
101 ${olt_ssh_ip}= Get From Dictionary ${list_olts}[0] sship
102 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
103 Run Keyword If ${has_dataplane} Wait Until Keyword Succeeds 120s 10s
104 ... Check Remote System Reachability True ${olt_ssh_ip}
105 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 360s 5s
106 ... Validate OLT Device ENABLED ACTIVE
107 ... REACHABLE ${olt_serial_number}
108 # Waiting extra time for the ONUs to come up
109 Sleep 60s
Suchitra Vemurife309412020-12-01 19:19:52 -0800110 Run Keyword If ${has_dataplane} Clean Up Linux
111 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test
112 # Deleting OLT after test completes
113 #Run Keyword If ${has_dataplane} Delete All Devices and Verify
Suchitra Vemurife309412020-12-01 19:19:52 -0800114
115Verify OLT Soft Reboot - MultipleOLT
116 [Documentation] Test soft reboot of the OLT using voltctl command
117 ... Verifies that when one OLT is rebooted other ONUs on other OLTs are
118 ... still functional
Hardik Windlass5ceb84e2021-02-11 11:17:08 +0000119 [Tags] MultiOLTSoftReboot functional
Suchitra Vemurife309412020-12-01 19:19:52 -0800120 [Setup] Start Logging MultiOlt-OLTSoftReboot
121 [Teardown] Run Keywords Collect Logs
122 ... AND Stop Logging MultiOlt-OLTSoftReboot
Suchitra Vemuri6971c392020-12-08 10:41:33 -0800123 ... AND Delete All Devices and Verify
Suchitra Vemurife309412020-12-01 19:19:52 -0800124 # Execute the test when the number of OLTs are greater than one
125 Pass Execution If ${olt_count} == 1 Skipping test: just one OLT
Hardik Windlassa119a102021-02-15 14:52:07 +0530126 Clear All Devices Then Perform Setup And Sanity
Suchitra Vemurife309412020-12-01 19:19:52 -0800127 # Reboot the first OLT
128 ${olt_user}= Get From Dictionary ${list_olts}[0] user
129 ${olt_pass}= Get From Dictionary ${list_olts}[0] pass
130 ${olt_ssh_ip}= Get From Dictionary ${list_olts}[0] sship
131 ${olt_serial_number}= Get From Dictionary ${list_olts}[0] sn
132 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
133 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 360s 5s
134 ... Validate OLT Device ENABLED ACTIVE
135 ... REACHABLE ${olt_serial_number}
136 # Reboot the OLT using "voltctl device reboot" command
137 Reboot Device ${olt_device_id}
Andrea Campanella9d8d3a52021-06-17 12:18:23 +0200138 # Wait for the OLT to actually go down
139 Wait Until Keyword Succeeds 360s 5s Validate OLT Device ENABLED UNKNOWN UNREACHABLE
140 ... ${olt_serial_number}
Suchitra Vemurife309412020-12-01 19:19:52 -0800141 # validate that the ONUs on the other OLTs are still functional
142 Verify ping is successful for ONUs not on this OLT ${num_all_onus} ${olt_device_id}
143 #Verify that ping fails for the ONUs where the OLT has been rebooted
144 FOR ${I} IN RANGE 0 ${num_all_onus}
145 ${src}= Set Variable ${hosts.src[${I}]}
146 ${dst}= Set Variable ${hosts.dst[${I}]}
147 ${olt_serial_number}= Get From Dictionary ${list_olts}[0] sn
148 Continue For Loop If "${olt_serial_number}"!="${src['olt']}"
149 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
150 ... Wait Until Keyword Succeeds 60s 2s
151 ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
152 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
153 END
154 # Check OLT state of the rebooted OLT
155 ${olt_serial_number}= Get From Dictionary ${list_olts}[0] sn
156 ${olt_ssh_ip}= Get From Dictionary ${list_olts}[0] sship
157 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
158 # Wait for the OLT to come back up
159 Run Keyword If ${has_dataplane} Wait Until Keyword Succeeds 120s 10s
160 ... Check Remote System Reachability True ${olt_ssh_ip}
161 # Check OLT states
162 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 360s 5s
163 ... Validate OLT Device ENABLED ACTIVE
164 ... REACHABLE ${olt_serial_number}
165 # Waiting extra time for the ONUs to come up
166 Sleep 60s
Suchitra Vemurife309412020-12-01 19:19:52 -0800167 #Check after reboot that ONUs are active, authenticated/DHCP/pingable
168 Run Keyword If ${has_dataplane} Clean Up Linux
169 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test
170
171
172*** Keywords ***
173Setup Suite
174 [Documentation] Set up the test suite
175 Common Test Suite Setup
176 #power_switch.robot needs it to support different vendor's power switch
177 ${switch_type}= Get Variable Value ${web_power_switch.type}
178 Run Keyword If "${switch_type}"!="" Set Global Variable ${powerswitch_type} ${switch_type}
179
Hardik Windlassa119a102021-02-15 14:52:07 +0530180Clear All Devices Then Perform Setup And Sanity
181 [Documentation] Remove any devices from VOLTHA and Verify in ONOS
182 ... Create New Device through Setup and Perform Sanity
183 # Remove all devices from voltha and onos
184 Run Keyword and Ignore Error Delete All Devices and Verify
Suchitra Vemurife309412020-12-01 19:19:52 -0800185 # Execute normal test Setup Keyword
186 Setup
Hardik Windlassa119a102021-02-15 14:52:07 +0530187 # Performing Sanity Test to make sure subscribers are all AUTH+DHCP and pingable
188 Run Keyword If ${has_dataplane} Clean Up Linux
189 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test
TorstenThieme4e2168e2021-06-22 14:01:47 +0000190
191Teardown Suite
192 [Documentation] Clean up ONOS SSH connections
193 Close All ONOS SSH Connections