blob: 83d2d360855ef5bfc621c994d2b2b57c9c1050a7 [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 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
44# For below variable value, using deployment name as using grep for
45# parsing radius pod name, we can also use full radius pod name
46${RESTART_POD_NAME} radius
47${timeout} 60s
48${of_id} 0
49${logical_id} 0
50${has_dataplane} True
51${teardown_device} False
52${scripts} ../../scripts
53
54# Per-test logging on failure is turned off by default; set this variable to enable
55${container_log_dir} ${None}
56
57*** Test Cases ***
58Verify OLT after Rebooting Physically for DT - Multiple OLT
59 [Documentation] Test the physical reboot of the OLT
60 ... Assuming that all the ONUs are DHCP/pingable (i.e. assuming sanityDt test was executed)
61 ... Test performs a physical reboot, performs "reboot" from the OLT CLI
62 ... Test runs when more than one OLT exists
63 ... Only one OLT is rebooted in the test, while verifying if the ONUs on the
64 ... the other ONUs are still functional
65 [Tags] functionalDt MultiOltRebootDt
66 [Setup] Start Logging MultiOlt_Physical_Dt
67 [Teardown] Run Keywords Collect Logs
68 ... AND Stop Logging MultiOlt_Physical_Dt
69 ... AND Delete All Devices and Verify
70 # Add OLT device
71 Setup
72 # Performing Sanity Test to make sure subscribers are all DHCP and pingable
73 Run Keyword If ${has_dataplane} Clean Up Linux
74 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test DT
75 # Execute the test when the number of OLTs are greater than one
76 Pass Execution If ${olt_count} == 1 Skipping test: just one OLT
77 # 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
84 ... sudo reboot ${olt_ssh_ip} ${olt_user} ${olt_pass} prompt=#
85 # 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}
87 Run Keyword And Ignore Error Collect Logs
88
89 # validate that the ONUs on the rebooted OLT are not pingable
90 FOR ${I} IN RANGE 0 ${num_all_onus}
91 ${src}= Set Variable ${hosts.src[${I}]}
92 ${dst}= Set Variable ${hosts.dst[${I}]}
93 ${olt_serial_number}= Get From Dictionary ${list_olts}[0] sn
94 Continue For Loop If "${olt_serial_number}"!="${src['olt']}"
95 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
96 ... Wait Until Keyword Succeeds 60s 2s
97 ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
98 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
99 END
100 # Wait for the rebooted OLT to come back up
101 ${olt_user}= Get From Dictionary ${list_olts}[0] user
102 ${olt_pass}= Get From Dictionary ${list_olts}[0] pass
103 ${olt_ssh_ip}= Get From Dictionary ${list_olts}[0] sship
104 ${olt_serial_number}= Get From Dictionary ${list_olts}[0] sn
105 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
106 Run Keyword If ${has_dataplane} Wait Until Keyword Succeeds 120s 10s
107 ... Check Remote System Reachability True ${olt_ssh_ip}
108 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 360s 5s
109 ... Validate OLT Device ENABLED ACTIVE
110 ... REACHABLE ${olt_serial_number}
111 # Waiting extra time for the ONUs to come up
112 Sleep 60s
113 Run Keyword And Ignore Error Collect Logs
114 Run Keyword If ${has_dataplane} Clean Up Linux
115 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test DT
116
117Verify OLT Soft Reboot for DT - Multiple OLT
118 [Documentation] Test soft reboot of the OLT using voltctl command
119 ... Test runs when more than one OLT exists
120 ... Only one OLT is rebooted in the test, while verifying if the ONUs on the
121 ... the other ONUs are still functional
122 [Tags] MultiOLTSoftRebootDt functionalDt
123 [Setup] Start Logging MultiOLTSoftRebootDt
124 #... AND Setup
125 [Teardown] Run Keywords Collect Logs
126 ... AND Stop Logging MultiOLTSoftRebootDt
127 #... AND Delete Device and Verify
128 Pass Execution If ${olt_count} == 1 Skipping test: just one OLT
129 # Reboot the first OLT
130 ${olt_user}= Get From Dictionary ${list_olts}[0] user
131 ${olt_pass}= Get From Dictionary ${list_olts}[0] pass
132 ${olt_ssh_ip}= Get From Dictionary ${list_olts}[0] sship
133 ${olt_serial_number}= Get From Dictionary ${list_olts}[0] sn
134 ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number}
135 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 360s 5s
136 ... Validate OLT Device ENABLED ACTIVE
137 ... REACHABLE ${olt_serial_number}
138 # Reboot the OLT using "voltctl device reboot" command
139 Reboot Device ${olt_device_id}
140 Run Keyword And Ignore Error Collect Logs
141 # 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
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
167 Run Keyword And Ignore Error Collect Logs
168 #Check after reboot that ONUs are active, DHCP and pingable
169 Run Keyword If ${has_dataplane} Clean Up Linux
170 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test DT
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
180Clear All Devices Then Create New Device
181 [Documentation] Remove any devices from VOLTHA and ONOS
182 # Remove all devices from voltha and nos
183 Delete All Devices and Verify
184 # Execute normal test Setup Keyword
185 Setup
186