blob: c55a8cc4486daa4be5c1df0b17d08001a655af72 [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
20#Suite 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${DEFAULTSPACE} default
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*** Test Cases ***
59Verify OLT after rebooting physically - MultipleOLT
60 [Documentation] Test the physical reboot of the OLT
61 ... Prerequisite : Subscriber are authenticated/DHCP/pingable state
62 ... Test performs a physical reboot on one of the OLTs, performs "reboot" from the OLT CLI
63 ... Validates that ONU on other OLTs are still functional
Hardik Windlass5ceb84e2021-02-11 11:17:08 +000064 [Tags] functional MultiOLTPhysicalReboot
Suchitra Vemurife309412020-12-01 19:19:52 -080065 [Setup] Start Logging MultipleOlt-PhysicalOLTReboot
66 [Teardown] Run Keywords Collect Logs
67 ... AND Stop Logging MultipleOlt-PhysicalOLTReboot
Suchitra Vemurife309412020-12-01 19:19:52 -080068 # Execute the test when the number of OLTs are greater than one
69 Pass Execution If ${olt_count} == 1 Skipping test: just one OLT
Hardik Windlassa119a102021-02-15 14:52:07 +053070 Clear All Devices Then Perform Setup And Sanity
Suchitra Vemurife309412020-12-01 19:19:52 -080071 # Reboot the first OLT from the list of olts - rebooting from the OLT CLI
72 ${olt_user}= Get From Dictionary ${list_olts}[0] user
73 ${olt_pass}= Get From Dictionary ${list_olts}[0] pass
74 ${olt_ssh_ip}= Get From Dictionary ${list_olts}[0] sship
75 ${olt_serial_number}= Get From Dictionary ${list_olts}[0] sn
76 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
77 Run Keyword If ${has_dataplane} Login And Run Command On Remote System
Andrea Campanella5ef88142021-02-02 14:34:50 +010078 ... reboot ${olt_ssh_ip} ${olt_user} ${olt_pass} prompt=#
Suchitra Vemurife309412020-12-01 19:19:52 -080079 # validate that the ONUs on the other OLTs are still functional
80 Verify ping is successful for ONUs not on this OLT ${num_all_onus} ${olt_device_id}
Suchitra Vemurife309412020-12-01 19:19:52 -080081 # Validate that the ONUs on the rebooted OLT are not pingable
82 FOR ${I} IN RANGE 0 ${num_all_onus}
83 ${src}= Set Variable ${hosts.src[${I}]}
84 ${dst}= Set Variable ${hosts.dst[${I}]}
85 ${olt_serial_number}= Get From Dictionary ${list_olts}[0] sn
86 Continue For Loop If "${olt_serial_number}"!="${src['olt']}"
87 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
88 ... Wait Until Keyword Succeeds 60s 2s
89 ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
90 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
91 END
92 # Wait for the rebooted OLT to come back up
93 ${olt_serial_number}= Get From Dictionary ${olt_ids}[0] sn
94 ${olt_user}= Get From Dictionary ${list_olts}[0] user
95 ${olt_pass}= Get From Dictionary ${list_olts}[0] pass
96 ${olt_ssh_ip}= Get From Dictionary ${list_olts}[0] sship
97 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
98 Run Keyword If ${has_dataplane} Wait Until Keyword Succeeds 120s 10s
99 ... Check Remote System Reachability True ${olt_ssh_ip}
100 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 360s 5s
101 ... Validate OLT Device ENABLED ACTIVE
102 ... REACHABLE ${olt_serial_number}
103 # Waiting extra time for the ONUs to come up
104 Sleep 60s
Suchitra Vemurife309412020-12-01 19:19:52 -0800105 Run Keyword If ${has_dataplane} Clean Up Linux
106 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test
107 # Deleting OLT after test completes
108 #Run Keyword If ${has_dataplane} Delete All Devices and Verify
Suchitra Vemurife309412020-12-01 19:19:52 -0800109
110Verify OLT Soft Reboot - MultipleOLT
111 [Documentation] Test soft reboot of the OLT using voltctl command
112 ... Verifies that when one OLT is rebooted other ONUs on other OLTs are
113 ... still functional
Hardik Windlass5ceb84e2021-02-11 11:17:08 +0000114 [Tags] MultiOLTSoftReboot functional
Suchitra Vemurife309412020-12-01 19:19:52 -0800115 [Setup] Start Logging MultiOlt-OLTSoftReboot
116 [Teardown] Run Keywords Collect Logs
117 ... AND Stop Logging MultiOlt-OLTSoftReboot
Suchitra Vemuri6971c392020-12-08 10:41:33 -0800118 ... AND Delete All Devices and Verify
Suchitra Vemurife309412020-12-01 19:19:52 -0800119 # Execute the test when the number of OLTs are greater than one
120 Pass Execution If ${olt_count} == 1 Skipping test: just one OLT
Hardik Windlassa119a102021-02-15 14:52:07 +0530121 Clear All Devices Then Perform Setup And Sanity
Suchitra Vemurife309412020-12-01 19:19:52 -0800122 # Reboot the first OLT
123 ${olt_user}= Get From Dictionary ${list_olts}[0] user
124 ${olt_pass}= Get From Dictionary ${list_olts}[0] pass
125 ${olt_ssh_ip}= Get From Dictionary ${list_olts}[0] sship
126 ${olt_serial_number}= Get From Dictionary ${list_olts}[0] sn
127 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
128 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 360s 5s
129 ... Validate OLT Device ENABLED ACTIVE
130 ... REACHABLE ${olt_serial_number}
131 # Reboot the OLT using "voltctl device reboot" command
132 Reboot Device ${olt_device_id}
Andrea Campanella9d8d3a52021-06-17 12:18:23 +0200133 # Wait for the OLT to actually go down
134 Wait Until Keyword Succeeds 360s 5s Validate OLT Device ENABLED UNKNOWN UNREACHABLE
135 ... ${olt_serial_number}
Suchitra Vemurife309412020-12-01 19:19:52 -0800136 # validate that the ONUs on the other OLTs are still functional
137 Verify ping is successful for ONUs not on this OLT ${num_all_onus} ${olt_device_id}
138 #Verify that ping fails for the ONUs where the OLT has been rebooted
139 FOR ${I} IN RANGE 0 ${num_all_onus}
140 ${src}= Set Variable ${hosts.src[${I}]}
141 ${dst}= Set Variable ${hosts.dst[${I}]}
142 ${olt_serial_number}= Get From Dictionary ${list_olts}[0] sn
143 Continue For Loop If "${olt_serial_number}"!="${src['olt']}"
144 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
145 ... Wait Until Keyword Succeeds 60s 2s
146 ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
147 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
148 END
149 # Check OLT state of the rebooted OLT
150 ${olt_serial_number}= Get From Dictionary ${list_olts}[0] sn
151 ${olt_ssh_ip}= Get From Dictionary ${list_olts}[0] sship
152 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
153 # Wait for the OLT to come back up
154 Run Keyword If ${has_dataplane} Wait Until Keyword Succeeds 120s 10s
155 ... Check Remote System Reachability True ${olt_ssh_ip}
156 # Check OLT states
157 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 360s 5s
158 ... Validate OLT Device ENABLED ACTIVE
159 ... REACHABLE ${olt_serial_number}
160 # Waiting extra time for the ONUs to come up
161 Sleep 60s
Suchitra Vemurife309412020-12-01 19:19:52 -0800162 #Check after reboot that ONUs are active, authenticated/DHCP/pingable
163 Run Keyword If ${has_dataplane} Clean Up Linux
164 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test
165
166
167*** Keywords ***
168Setup Suite
169 [Documentation] Set up the test suite
170 Common Test Suite Setup
171 #power_switch.robot needs it to support different vendor's power switch
172 ${switch_type}= Get Variable Value ${web_power_switch.type}
173 Run Keyword If "${switch_type}"!="" Set Global Variable ${powerswitch_type} ${switch_type}
174
Hardik Windlassa119a102021-02-15 14:52:07 +0530175Clear All Devices Then Perform Setup And Sanity
176 [Documentation] Remove any devices from VOLTHA and Verify in ONOS
177 ... Create New Device through Setup and Perform Sanity
178 # Remove all devices from voltha and onos
179 Run Keyword and Ignore Error Delete All Devices and Verify
Suchitra Vemurife309412020-12-01 19:19:52 -0800180 # Execute normal test Setup Keyword
181 Setup
Hardik Windlassa119a102021-02-15 14:52:07 +0530182 # Performing Sanity Test to make sure subscribers are all AUTH+DHCP and pingable
183 Run Keyword If ${has_dataplane} Clean Up Linux
184 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test