blob: df4bde8c73c03aed36037f0a9ab3963b1e4e66b1 [file] [log] [blame]
Gayathri.Selvan283a63c2020-01-23 04:09:18 +00001# Copyright 2017 - 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# FIXME Can we use the same test against BBSim and Hardware?
15
16*** Settings ***
HungWei Chiu87edb1f2020-01-28 00:10:58 +000017Documentation Test various failure scenarios
Gayathri.Selvan283a63c2020-01-23 04:09:18 +000018Suite Setup Common Test Suite Setup
19Test Setup Setup
20Test Teardown Teardown
21#Suite Teardown Teardown Suite
22Library Collections
23Library String
24Library OperatingSystem
25Library XML
26Library RequestsLibrary
27Library ../../libraries/DependencyLibrary.py
28Resource ../../libraries/onos.robot
29Resource ../../libraries/voltctl.robot
30Resource ../../libraries/voltha.robot
31Resource ../../libraries/utils.robot
32Resource ../../libraries/k8s.robot
33Resource ../../variables/variables.robot
HungWei Chiu87edb1f2020-01-28 00:10:58 +000034Resource ../../libraries/power_switch.robot
Gayathri.Selvan283a63c2020-01-23 04:09:18 +000035
36*** Variables ***
37${POD_NAME} flex-ocp-cord
38${KUBERNETES_CONF} ${KUBERNETES_CONFIGS_DIR}/${POD_NAME}.conf
39${KUBERNETES_CONFIGS_DIR} ~/pod-configs/kubernetes-configs
40#${KUBERNETES_CONFIGS_DIR} ${KUBERNETES_CONFIGS_DIR}/${POD_NAME}.conf
41${KUBERNETES_YAML} ${KUBERNETES_CONFIGS_DIR}/${POD_NAME}.yml
42${HELM_CHARTS_DIR} ~/helm-charts
43${VOLTHA_POD_NUM} 8
44${NAMESPACE} voltha
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
Suchitra Vemuri109feb12020-01-23 16:25:02 -080051${has_dataplane} True
Gayathri.Selvan283a63c2020-01-23 04:09:18 +000052${external_libs} True
53${teardown_device} False
54${scripts} ../../scripts
55
56*** Test Cases ***
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +000057Verify restart ofagent container after VOLTHA is operational
58 [Documentation] Restart ofagent container after VOLTHA is operational.
59 ... Please note this test case should be run before the restart of other containers.
60 ... Prerequisite : ONUs are authenticated and pingable.
Suchitra Vemurid151c332020-01-28 17:48:45 -080061 [Tags] functional VOL-2409 ofagentRestart notready
Andy Bavier4a8450e2020-02-04 08:58:37 -070062 [Setup] Announce Message START TEST ofagentRestart
63 [Teardown] Run Keywords Collect Logs
64 ... AND Announce Message END TEST ofagentRestart
Suchitra Vemurib661bf32020-01-30 22:46:14 -080065 # Performing Sanity Test to make sure subscribers are all AUTH+DHCP and pingable
66 Run Keyword If ${has_dataplane} Clean Up Linux
67 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +000068 ${waitforRestart} Set Variable 120s
Andy Bavier4a8450e2020-02-04 08:58:37 -070069 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +000070 Log ${podStatusOutput}
Andy Bavier4a8450e2020-02-04 08:58:37 -070071 ${countBforRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +000072 Restart Pod ${NAMESPACE} ofagent
73 Sleep 60s
74 Wait Until Keyword Succeeds ${waitforRestart} 2s Validate Pod Status ofagent ${NAMESPACE}
75 ... Running
76 Repeat Sanity Test
Andy Bavier4a8450e2020-02-04 08:58:37 -070077 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +000078 Log ${podStatusOutput}
Andy Bavier4a8450e2020-02-04 08:58:37 -070079 ${countAfterRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +000080 Should Be Equal As Strings ${countAfterRestart} ${countBforRestart}
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +000081
Suchitra Vemuric4203692020-01-30 20:29:46 -080082Verify restart openolt-adapter container after VOLTHA is operational
83 [Documentation] Restart openolt-adapter container after VOLTHA is operational.
Gayathri.Selvan283a63c2020-01-23 04:09:18 +000084 ... Prerequisite : ONUs are authenticated and pingable.
Suchitra Vemuri109feb12020-01-23 16:25:02 -080085 [Tags] functional VOL-1958 RestartPods
Andy Bavier4a8450e2020-02-04 08:58:37 -070086 [Setup] Announce Message START TEST RestartPods
87 [Teardown] Run Keywords Collect Logs
88 ... AND Announce Message END TEST RestartPods
Gayathri.Selvan283a63c2020-01-23 04:09:18 +000089 ${waitforRestart} Set Variable 120s
Andy Bavier4a8450e2020-02-04 08:58:37 -070090 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
Gayathri.Selvan283a63c2020-01-23 04:09:18 +000091 Log ${podStatusOutput}
Andy Bavier4a8450e2020-02-04 08:58:37 -070092 ${countBforRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
Gayathri.Selvan283a63c2020-01-23 04:09:18 +000093 ${podName} Set Variable adapter-open-olt
94 Restart Pod ${NAMESPACE} ${podName}
95 Wait Until Keyword Succeeds ${waitforRestart} 2s Validate Pod Status ${podName} ${NAMESPACE}
96 ... Running
97 Repeat Sanity Test
Andy Bavier4a8450e2020-02-04 08:58:37 -070098 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
Gayathri.Selvan283a63c2020-01-23 04:09:18 +000099 Log ${podStatusOutput}
Andy Bavier4a8450e2020-02-04 08:58:37 -0700100 ${countAfterRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
Gayathri.Selvan283a63c2020-01-23 04:09:18 +0000101 Should Be Equal As Strings ${countAfterRestart} ${countBforRestart}
102 Log to console Pod ${podName} restarted and sanity checks passed successfully
Gayathri.Selvanb6a2b542020-01-24 07:24:23 +0000103
Gayathri.Selvanc0b37022020-02-06 05:17:00 +0000104Check ONU adapter crash not forcing authentication again
105 [Documentation] After ONU adapter restart, checks wpa log for 'authentication started'
106 ... message count to make sure auth not started again and validates EAP status and ping.
107 ... Assuming that test1 or sanity was executed where all the ONUs are authenticated/DHCP/pingable
108 [Tags] functional ONUAdaptCrash notready
109 [Setup] None
110 [Teardown] None
111 @{before_list}= Create List
112 @{after_list}= Create List
113 FOR ${I} IN RANGE 0 ${num_onus}
114 ${src}= Set Variable ${hosts.src[${I}]}
115 ${dst}= Set Variable ${hosts.dst[${I}]}
116 ${onu_device_id}= Get Device ID From SN ${src['onu']}
117 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
118 ... ${of_id}
119 ${before}= Run Keyword If ${has_dataplane} Check Remote File Contents For WPA Logs
120 ... True /tmp/wpa.log authentication started ${src['ip']} ${src['user']} ${src['pass']}
121 ... ${src['container_type']} ${src['container_name']}
122 Append To List ${before_list} ${before}
123 END
124 Wait Until Keyword Succeeds ${timeout} 15s Restart Pod ${NAMESPACE} adapter-open-onu
125 Wait Until Keyword Succeeds ${timeout} 2s Validate Pod Status ${podName} ${NAMESPACE}
126 ... Running
127 FOR ${I} IN RANGE 0 ${num_onus}
128 ${src}= Set Variable ${hosts.src[${I}]}
129 ${dst}= Set Variable ${hosts.dst[${I}]}
130 ${onu_device_id}= Get Device ID From SN ${src['onu']}
131 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
132 ... ${of_id}
133 ${after}= Run Keyword If ${has_dataplane} Check Remote File Contents For WPA Logs
134 ... True /tmp/wpa.log authentication started ${src['ip']} ${src['user']} ${src['pass']}
135 ... ${src['container_type']} ${src['container_name']}
136 Append To List ${after_list} ${after}
137 ${output}= Run Keyword If ${has_dataplane} Login And Run Command On Remote System
138 ... wpa_cli status | grep SUCCESS ${src['ip']} ${src['user']} ${src['pass']}
139 ... ${src['container_type']} ${src['container_name']}
140 Run Keyword If ${has_dataplane} Should Contain ${output} SUCCESS
141 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
142 ... Wait Until Keyword Succeeds 60s 2s Check Ping
143 ... True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']} ${src['ip']} ${src['user']}
144 ... ${src['pass']} ${src['container_type']} ${src['container_name']}
145 END
146 Lists Should Be Equal ${after_list} ${before_list}
147 Log ${after_list}
148 Log ${before_list}
149 Run Keyword and Ignore Error Collect Logs
150
HungWei Chiu87edb1f2020-01-28 00:10:58 +0000151Verify ONU after rebooting physically
152 [Documentation] Test the ONU funcaionality by physically turning on/off ONU.
153 ... Prerequisite : Subscriber are authenticated/DHCP/pingable state
154 [Tags] functional VOL-2488 PowerSwitch notready
Andy Bavier4a8450e2020-02-04 08:58:37 -0700155 [Setup] Announce Message START TEST PowerSwitch
156 [Teardown] Run Keywords Collect Logs
157 ... AND Announce Message END TEST PowerSwitch
158 Start Log Capture PowerSwitch ${container_log_dir}
HungWei Chiu87edb1f2020-01-28 00:10:58 +0000159 Power Switch Connection Suite ${web_power_switch.ip} ${web_power_switch.user} ${web_power_switch.password}
160 FOR ${I} IN RANGE 0 ${num_onus}
161 ${src}= Set Variable ${hosts.src[${I}]}
162 ${dst}= Set Variable ${hosts.dst[${I}]}
163 Disable Switch Outlet ${src['power_switch_port']}
164 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
165 ... Wait Until Keyword Succeeds 60s 2s
166 ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
167 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
168
hwchiub7139c12020-01-28 21:51:28 +0000169 Enable Switch Outlet ${src['power_switch_port']}
HungWei Chiu87edb1f2020-01-28 00:10:58 +0000170 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
171 ... ENABLED ACTIVE REACHABLE ${src['onu']}
HungWei Chiu87edb1f2020-01-28 00:10:58 +0000172 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
173 ... Wait Until Keyword Succeeds 60s 2s
174 ... Check Ping True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
175 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
176 END
Gayathri.Selvanf68ea4b2020-02-03 07:36:39 +0000177
178ONU Reboot
179 [Documentation] Reboot ONU and verify that ONU comes up properly
180 [Tags] VOL-1957 RebootONU notready
Andy Bavier4a8450e2020-02-04 08:58:37 -0700181 [Setup] Announce Message START TEST RebootONU
182 [Teardown] Run Keywords Collect Logs
183 ... AND Announce Message END TEST RebootONU
Gayathri.Selvanf68ea4b2020-02-03 07:36:39 +0000184 FOR ${I} IN RANGE 0 ${num_onus}
185 ${src}= Set Variable ${hosts.src[${I}]}
186 ${dst}= Set Variable ${hosts.dst[${I}]}
187 ${onu_device_id}= Get Device ID From SN ${src['onu']}
188 Reboot ONU ${onu_device_id} ${src} ${dst}
189 Verify ping is succesful except for given device ${num_onus} ${onu_device_id}
190 Run Keyword If ${has_dataplane} Clean Up Linux
191 #Check after reboot that ONUs are active, authenticated/DHCP/pingable
192 Perform Sanity Test
193 END