blob: f16beb2113e4f21cda0cb18ed9af39afcd4b6a11 [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 Windlass4288c6a2021-09-28 07:22:06 +000044${INFRA_NAMESPACE} default
Suchitra Vemurife309412020-12-01 19:19:52 -080045# 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
Matteo Scandoloda1c64b2021-07-20 10:14:49 -070058# logging flag to enable Collect Logs, can be passed via the command line too
59# example: -v logging:False
60${logging} True
61
Suchitra Vemurife309412020-12-01 19:19:52 -080062*** Test Cases ***
63Verify OLT after rebooting physically - MultipleOLT
64 [Documentation] Test the physical reboot of the OLT
65 ... Prerequisite : Subscriber are authenticated/DHCP/pingable state
66 ... Test performs a physical reboot on one of the OLTs, performs "reboot" from the OLT CLI
67 ... Validates that ONU on other OLTs are still functional
Hardik Windlass5ceb84e2021-02-11 11:17:08 +000068 [Tags] functional MultiOLTPhysicalReboot
Suchitra Vemurife309412020-12-01 19:19:52 -080069 [Setup] Start Logging MultipleOlt-PhysicalOLTReboot
70 [Teardown] Run Keywords Collect Logs
71 ... AND Stop Logging MultipleOlt-PhysicalOLTReboot
Suchitra Vemurife309412020-12-01 19:19:52 -080072 # Execute the test when the number of OLTs are greater than one
73 Pass Execution If ${olt_count} == 1 Skipping test: just one OLT
Hardik Windlassa119a102021-02-15 14:52:07 +053074 Clear All Devices Then Perform Setup And Sanity
Suchitra Vemurife309412020-12-01 19:19:52 -080075 # Reboot the first OLT from the list of olts - rebooting from the OLT CLI
76 ${olt_user}= Get From Dictionary ${list_olts}[0] user
77 ${olt_pass}= Get From Dictionary ${list_olts}[0] pass
78 ${olt_ssh_ip}= Get From Dictionary ${list_olts}[0] sship
79 ${olt_serial_number}= Get From Dictionary ${list_olts}[0] sn
80 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
81 Run Keyword If ${has_dataplane} Login And Run Command On Remote System
Andrea Campanella5ef88142021-02-02 14:34:50 +010082 ... reboot ${olt_ssh_ip} ${olt_user} ${olt_pass} prompt=#
Suchitra Vemurife309412020-12-01 19:19:52 -080083 # validate that the ONUs on the other OLTs are still functional
84 Verify ping is successful for ONUs not on this OLT ${num_all_onus} ${olt_device_id}
Suchitra Vemurife309412020-12-01 19:19:52 -080085 # Validate that the ONUs on the rebooted OLT are not pingable
86 FOR ${I} IN RANGE 0 ${num_all_onus}
87 ${src}= Set Variable ${hosts.src[${I}]}
88 ${dst}= Set Variable ${hosts.dst[${I}]}
89 ${olt_serial_number}= Get From Dictionary ${list_olts}[0] sn
90 Continue For Loop If "${olt_serial_number}"!="${src['olt']}"
91 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
92 ... Wait Until Keyword Succeeds 60s 2s
93 ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
94 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
95 END
96 # Wait for the rebooted OLT to come back up
97 ${olt_serial_number}= Get From Dictionary ${olt_ids}[0] sn
98 ${olt_user}= Get From Dictionary ${list_olts}[0] user
99 ${olt_pass}= Get From Dictionary ${list_olts}[0] pass
100 ${olt_ssh_ip}= Get From Dictionary ${list_olts}[0] sship
101 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
102 Run Keyword If ${has_dataplane} Wait Until Keyword Succeeds 120s 10s
103 ... Check Remote System Reachability True ${olt_ssh_ip}
104 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 360s 5s
105 ... Validate OLT Device ENABLED ACTIVE
106 ... REACHABLE ${olt_serial_number}
107 # Waiting extra time for the ONUs to come up
108 Sleep 60s
Suchitra Vemurife309412020-12-01 19:19:52 -0800109 Run Keyword If ${has_dataplane} Clean Up Linux
Matteo Scandolo7e519fb2021-08-13 11:35:16 -0700110 FOR ${J} IN RANGE 0 ${num_olts}
111 ${olt_serial_number}= Set Variable ${list_olts}[${J}][sn]
112 ${onu_count}= Set Variable ${list_olts}[${J}][onucount]
113 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS
114 ... ${olt_serial_number}
115 Set Global Variable ${of_id}
116 ${nni_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
117 ... Get NNI Port in ONOS ${of_id}
118 Set Global Variable ${nni_port}
119 ${suppressaddsubscriber}= Set Variable If '${J}'=='0' False True
120 Perform Sanity Test Per OLT ${of_id} ${nni_port} ${olt_serial_number} ${onu_count}
121 ... ${suppressaddsubscriber}
122 END
Suchitra Vemurife309412020-12-01 19:19:52 -0800123 # Deleting OLT after test completes
124 #Run Keyword If ${has_dataplane} Delete All Devices and Verify
Suchitra Vemurife309412020-12-01 19:19:52 -0800125
126Verify OLT Soft Reboot - MultipleOLT
127 [Documentation] Test soft reboot of the OLT using voltctl command
128 ... Verifies that when one OLT is rebooted other ONUs on other OLTs are
129 ... still functional
Hardik Windlass5ceb84e2021-02-11 11:17:08 +0000130 [Tags] MultiOLTSoftReboot functional
Suchitra Vemurife309412020-12-01 19:19:52 -0800131 [Setup] Start Logging MultiOlt-OLTSoftReboot
132 [Teardown] Run Keywords Collect Logs
Suchitra Vemuri6971c392020-12-08 10:41:33 -0800133 ... AND Delete All Devices and Verify
Girish Gowdraf244d5b2021-09-01 17:16:16 -0700134 ... AND Run Keyword If ${logging} Collect Logs
135 ... AND Stop Logging MultiOlt-OLTSoftReboot
Suchitra Vemurife309412020-12-01 19:19:52 -0800136 # Execute the test when the number of OLTs are greater than one
137 Pass Execution If ${olt_count} == 1 Skipping test: just one OLT
Hardik Windlassa119a102021-02-15 14:52:07 +0530138 Clear All Devices Then Perform Setup And Sanity
Suchitra Vemurife309412020-12-01 19:19:52 -0800139 # Reboot the first OLT
140 ${olt_user}= Get From Dictionary ${list_olts}[0] user
141 ${olt_pass}= Get From Dictionary ${list_olts}[0] pass
142 ${olt_ssh_ip}= Get From Dictionary ${list_olts}[0] sship
143 ${olt_serial_number}= Get From Dictionary ${list_olts}[0] sn
144 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
145 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 360s 5s
146 ... Validate OLT Device ENABLED ACTIVE
147 ... REACHABLE ${olt_serial_number}
148 # Reboot the OLT using "voltctl device reboot" command
149 Reboot Device ${olt_device_id}
Andrea Campanella9d8d3a52021-06-17 12:18:23 +0200150 # Wait for the OLT to actually go down
151 Wait Until Keyword Succeeds 360s 5s Validate OLT Device ENABLED UNKNOWN UNREACHABLE
152 ... ${olt_serial_number}
Suchitra Vemurife309412020-12-01 19:19:52 -0800153 # validate that the ONUs on the other OLTs are still functional
154 Verify ping is successful for ONUs not on this OLT ${num_all_onus} ${olt_device_id}
155 #Verify that ping fails for the ONUs where the OLT has been rebooted
156 FOR ${I} IN RANGE 0 ${num_all_onus}
157 ${src}= Set Variable ${hosts.src[${I}]}
158 ${dst}= Set Variable ${hosts.dst[${I}]}
159 ${olt_serial_number}= Get From Dictionary ${list_olts}[0] sn
160 Continue For Loop If "${olt_serial_number}"!="${src['olt']}"
161 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
162 ... Wait Until Keyword Succeeds 60s 2s
163 ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
164 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
165 END
166 # Check OLT state of the rebooted OLT
167 ${olt_serial_number}= Get From Dictionary ${list_olts}[0] sn
168 ${olt_ssh_ip}= Get From Dictionary ${list_olts}[0] sship
169 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
170 # Wait for the OLT to come back up
171 Run Keyword If ${has_dataplane} Wait Until Keyword Succeeds 120s 10s
172 ... Check Remote System Reachability True ${olt_ssh_ip}
173 # Check OLT states
174 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 360s 5s
175 ... Validate OLT Device ENABLED ACTIVE
176 ... REACHABLE ${olt_serial_number}
177 # Waiting extra time for the ONUs to come up
178 Sleep 60s
Suchitra Vemurife309412020-12-01 19:19:52 -0800179 #Check after reboot that ONUs are active, authenticated/DHCP/pingable
180 Run Keyword If ${has_dataplane} Clean Up Linux
Matteo Scandolo7e519fb2021-08-13 11:35:16 -0700181 FOR ${J} IN RANGE 0 ${num_olts}
182 ${olt_serial_number}= Set Variable ${list_olts}[${J}][sn]
183 ${onu_count}= Set Variable ${list_olts}[${J}][onucount]
184 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS
185 ... ${olt_serial_number}
186 Set Global Variable ${of_id}
187 ${nni_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
188 ... Get NNI Port in ONOS ${of_id}
189 Set Global Variable ${nni_port}
190 ${suppressaddsubscriber}= Set Variable If '${J}'=='0' False True
191 Perform Sanity Test Per OLT ${of_id} ${nni_port} ${olt_serial_number} ${onu_count}
192 ... ${suppressaddsubscriber}
193 END
Suchitra Vemurife309412020-12-01 19:19:52 -0800194
195
196*** Keywords ***
197Setup Suite
198 [Documentation] Set up the test suite
199 Common Test Suite Setup
200 #power_switch.robot needs it to support different vendor's power switch
201 ${switch_type}= Get Variable Value ${web_power_switch.type}
202 Run Keyword If "${switch_type}"!="" Set Global Variable ${powerswitch_type} ${switch_type}
203
Hardik Windlassa119a102021-02-15 14:52:07 +0530204Clear All Devices Then Perform Setup And Sanity
205 [Documentation] Remove any devices from VOLTHA and Verify in ONOS
206 ... Create New Device through Setup and Perform Sanity
207 # Remove all devices from voltha and onos
208 Run Keyword and Ignore Error Delete All Devices and Verify
Suchitra Vemurife309412020-12-01 19:19:52 -0800209 # Execute normal test Setup Keyword
210 Setup
Hardik Windlassa119a102021-02-15 14:52:07 +0530211 # Performing Sanity Test to make sure subscribers are all AUTH+DHCP and pingable
212 Run Keyword If ${has_dataplane} Clean Up Linux
213 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test
TorstenThieme4e2168e2021-06-22 14:01:47 +0000214
215Teardown Suite
216 [Documentation] Clean up ONOS SSH connections
217 Close All ONOS SSH Connections