blob: 67ed6b324e8b7acbcbe3a0a48eb47d09c22b00e2 [file] [log] [blame]
Joey Armstrong9fadcbe2024-01-17 19:00:37 -05001# Copyright 2020-2024 Open Networking Foundation (ONF) and the ONF Contributors
Suchitra Vemurife309412020-12-01 19:19:52 -08002#
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 end-to-end scenarios involing Multiple OLTs
17Suite Setup Setup Suite
18Test Setup Setup
19Test Teardown Teardown
20Suite 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
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 for DT - Multiple OLT
64 [Documentation] Test the physical reboot of the OLT
65 ... Assuming that all the ONUs are DHCP/pingable (i.e. assuming sanityDt test was executed)
66 ... Test performs a physical reboot, performs "reboot" from the OLT CLI
67 ... Test runs when more than one OLT exists
68 ... Only one OLT is rebooted in the test, while verifying if the ONUs on the
Hardik Windlassa119a102021-02-15 14:52:07 +053069 ... other OLT are still functional
Hardik Windlass5ceb84e2021-02-11 11:17:08 +000070 [Tags] functionalDt MultiOLTPhysicalRebootDt
Suchitra Vemurife309412020-12-01 19:19:52 -080071 [Setup] Start Logging MultiOlt_Physical_Dt
72 [Teardown] Run Keywords Collect Logs
73 ... AND Stop Logging MultiOlt_Physical_Dt
Suchitra Vemurife309412020-12-01 19:19:52 -080074 # Execute the test when the number of OLTs are greater than one
75 Pass Execution If ${olt_count} == 1 Skipping test: just one OLT
Hardik Windlassa119a102021-02-15 14:52:07 +053076 Clear All Devices Then Perform Setup And Sanity
Suchitra Vemurife309412020-12-01 19:19:52 -080077 # Reboot the first OLT from the list of olts - rebooting from the OLT CLI
78 ${olt_user}= Get From Dictionary ${list_olts}[0] user
79 ${olt_pass}= Get From Dictionary ${list_olts}[0] pass
80 ${olt_ssh_ip}= Get From Dictionary ${list_olts}[0] sship
81 ${olt_serial_number}= Get From Dictionary ${list_olts}[0] sn
82 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
83 Run Keyword If ${has_dataplane} Login And Run Command On Remote System
Andrea Campanella5ef88142021-02-02 14:34:50 +010084 ... reboot ${olt_ssh_ip} ${olt_user} ${olt_pass} prompt=#
Suchitra Vemurife309412020-12-01 19:19:52 -080085 # validate that the ONUs on the other OLTs are still functional
86 Verify ping is successful for ONUs not on this OLT ${num_all_onus} ${olt_device_id}
Suchitra Vemurife309412020-12-01 19:19:52 -080087
88 # validate that the ONUs on the rebooted OLT are not pingable
89 FOR ${I} IN RANGE 0 ${num_all_onus}
90 ${src}= Set Variable ${hosts.src[${I}]}
91 ${dst}= Set Variable ${hosts.dst[${I}]}
92 ${olt_serial_number}= Get From Dictionary ${list_olts}[0] sn
93 Continue For Loop If "${olt_serial_number}"!="${src['olt']}"
94 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
Hardik Windlass5d537ad2021-11-16 06:01:54 +000095 ... Wait Until Keyword Succeeds ${timeout} 2s
Suchitra Vemurife309412020-12-01 19:19:52 -080096 ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
97 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
98 END
99 # Wait for the rebooted OLT to come back up
100 ${olt_user}= Get From Dictionary ${list_olts}[0] user
101 ${olt_pass}= Get From Dictionary ${list_olts}[0] pass
102 ${olt_ssh_ip}= Get From Dictionary ${list_olts}[0] sship
103 ${olt_serial_number}= Get From Dictionary ${list_olts}[0] sn
104 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
105 Run Keyword If ${has_dataplane} Wait Until Keyword Succeeds 120s 10s
106 ... Check Remote System Reachability True ${olt_ssh_ip}
Hardik Windlass5d537ad2021-11-16 06:01:54 +0000107 Wait Until Keyword Succeeds 360s 5s
Suchitra Vemurife309412020-12-01 19:19:52 -0800108 ... Validate OLT Device ENABLED ACTIVE
109 ... REACHABLE ${olt_serial_number}
110 # Waiting extra time for the ONUs to come up
111 Sleep 60s
Suchitra Vemurife309412020-12-01 19:19:52 -0800112 Run Keyword If ${has_dataplane} Clean Up Linux
Hardik Windlass5d537ad2021-11-16 06:01:54 +0000113 Perform Sanity Test DT
Suchitra Vemurife309412020-12-01 19:19:52 -0800114
115Verify OLT Soft Reboot for DT - Multiple OLT
116 [Documentation] Test soft reboot of the OLT using voltctl command
117 ... Test runs when more than one OLT exists
118 ... Only one OLT is rebooted in the test, while verifying if the ONUs on the
Hardik Windlassa119a102021-02-15 14:52:07 +0530119 ... other OLT are still functional
Suchitra Vemurife309412020-12-01 19:19:52 -0800120 [Tags] MultiOLTSoftRebootDt functionalDt
121 [Setup] Start Logging MultiOLTSoftRebootDt
Suchitra Vemurife309412020-12-01 19:19:52 -0800122 [Teardown] Run Keywords Collect Logs
Suchitra Vemuri6971c392020-12-08 10:41:33 -0800123 ... AND Delete All Devices and Verify
Girish Gowdraf244d5b2021-09-01 17:16:16 -0700124 ... AND Run Keyword If ${logging} Collect Logs
125 ... AND Stop Logging MultiOLTSoftRebootDt
Suchitra Vemurife309412020-12-01 19:19:52 -0800126 Pass Execution If ${olt_count} == 1 Skipping test: just one OLT
Hardik Windlassa119a102021-02-15 14:52:07 +0530127 Clear All Devices Then Perform Setup And Sanity
Suchitra Vemurife309412020-12-01 19:19:52 -0800128 # Reboot the first OLT
129 ${olt_user}= Get From Dictionary ${list_olts}[0] user
130 ${olt_pass}= Get From Dictionary ${list_olts}[0] pass
131 ${olt_ssh_ip}= Get From Dictionary ${list_olts}[0] sship
132 ${olt_serial_number}= Get From Dictionary ${list_olts}[0] sn
133 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
134 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 360s 5s
135 ... Validate OLT Device ENABLED ACTIVE
136 ... REACHABLE ${olt_serial_number}
137 # Reboot the OLT using "voltctl device reboot" command
138 Reboot Device ${olt_device_id}
Andrea Campanella9d8d3a52021-06-17 12:18:23 +0200139 # Wait for the OLT to actually go down
140 Wait Until Keyword Succeeds 360s 5s Validate OLT Device ENABLED UNKNOWN UNREACHABLE
141 ... ${olt_serial_number}
Suchitra Vemurife309412020-12-01 19:19:52 -0800142 # validate that the ONUs on the other OLTs are still functional
143 Verify ping is successful for ONUs not on this OLT ${num_all_onus} ${olt_device_id}
144 #Verify that ping fails for the ONUs where the OLT has been rebooted
145 FOR ${I} IN RANGE 0 ${num_all_onus}
146 ${src}= Set Variable ${hosts.src[${I}]}
147 ${dst}= Set Variable ${hosts.dst[${I}]}
148 ${olt_serial_number}= Get From Dictionary ${list_olts}[0] sn
149 Continue For Loop If "${olt_serial_number}"!="${src['olt']}"
150 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
Hardik Windlass5d537ad2021-11-16 06:01:54 +0000151 ... Wait Until Keyword Succeeds ${timeout} 2s
Suchitra Vemurife309412020-12-01 19:19:52 -0800152 ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
153 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
154 END
155 # Check OLT state
156 ${olt_serial_number}= Get From Dictionary ${list_olts}[0] sn
157 ${olt_ssh_ip}= Get From Dictionary ${list_olts}[0] sship
158 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
159 # Wait for the OLT to come back up
160 Run Keyword If ${has_dataplane} Wait Until Keyword Succeeds 120s 10s
161 ... Check Remote System Reachability True ${olt_ssh_ip}
162 # Check OLT states
Hardik Windlass5d537ad2021-11-16 06:01:54 +0000163 Wait Until Keyword Succeeds 360s 5s
Suchitra Vemurife309412020-12-01 19:19:52 -0800164 ... Validate OLT Device ENABLED ACTIVE
165 ... REACHABLE ${olt_serial_number}
166 # Waiting extra time for the ONUs to come up
167 Sleep 60s
Suchitra Vemurife309412020-12-01 19:19:52 -0800168 #Check after reboot that ONUs are active, DHCP and pingable
169 Run Keyword If ${has_dataplane} Clean Up Linux
Hardik Windlass5d537ad2021-11-16 06:01:54 +0000170 Perform Sanity Test DT
Suchitra Vemurife309412020-12-01 19:19:52 -0800171
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
Suchitra Vemurife309412020-12-01 19:19:52 -0800183 # Remove all devices from voltha and nos
Hardik Windlass5d537ad2021-11-16 06:01:54 +0000184 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 DHCP and pingable
188 Run Keyword If ${has_dataplane} Clean Up Linux
Hardik Windlass5d537ad2021-11-16 06:01:54 +0000189 Perform Sanity Test DT