blob: fb444c6866fe2cd2cc20034ed0b139e7f92b7952 [file] [log] [blame]
Hemadf003682020-04-28 21:22:22 +05301# 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
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
Hemadf003682020-04-28 21:22:22 +053021Library 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 Windlassa9b38262021-10-27 08:14:22 +000044${INFRA_NAMESPACE} default
Hemadf003682020-04-28 21:22:22 +053045${DEFAULTSPACE} default
46# For below variable value, using deployment name as using grep for
47# parsing radius pod name, we can also use full radius pod name
48${RESTART_POD_NAME} radius
49${timeout} 60s
50${of_id} 0
51${logical_id} 0
52${has_dataplane} True
53${teardown_device} False
54${scripts} ../../scripts
55
56# Per-test logging on failure is turned off by default; set this variable to enable
57${container_log_dir} ${None}
58
59*** Test Cases ***
60Verify OLT Soft Reboot
61 [Documentation] Test soft reboot of the OLT using voltctl command
Suchitra Vemuri4e6ff3c2020-08-04 21:52:17 -070062 [Tags] VOL-2745 OLTSoftReboot functional
Hemadf003682020-04-28 21:22:22 +053063 [Setup] Start Logging OLTSoftReboot
Hemadf003682020-04-28 21:22:22 +053064 [Teardown] Run Keywords Collect Logs
65 ... AND Stop Logging OLTSoftReboot
Suchitra Vemuridee90b12020-08-11 16:11:41 -070066 Delete All Devices and Verify
Suchitra Vemuri4e6ff3c2020-08-04 21:52:17 -070067 Setup
Hemadf003682020-04-28 21:22:22 +053068 ## Performing Sanity Test to make sure subscribers are all AUTH+DHCP and pingable
Suchitra Vemuri4e6ff3c2020-08-04 21:52:17 -070069 Run Keyword If ${has_dataplane} Clean Up Linux
70 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test
Hemadf003682020-04-28 21:22:22 +053071 # Reboot the OLT using "voltctl device reboot" command
72 Reboot Device ${olt_device_id}
Andrea Campanella9d8d3a52021-06-17 12:18:23 +020073 # Wait for the OLT to actually go down
74 Wait Until Keyword Succeeds 360s 5s Validate OLT Device ENABLED UNKNOWN UNREACHABLE
75 ... ${olt_serial_number}
Hemadf003682020-04-28 21:22:22 +053076 #Verify that ping fails
77 FOR ${I} IN RANGE 0 ${num_onus}
78 ${src}= Set Variable ${hosts.src[${I}]}
79 ${dst}= Set Variable ${hosts.dst[${I}]}
80 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
81 ... Wait Until Keyword Succeeds 60s 2s
82 ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
83 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
84 END
Hemadf003682020-04-28 21:22:22 +053085 Run Keyword If ${has_dataplane} Wait Until Keyword Succeeds 120s 10s
Suchitra Vemurib7253a52020-07-14 22:35:17 -070086 ... Check Remote System Reachability True ${olt_ssh_ip}
Hemadf003682020-04-28 21:22:22 +053087 # Waiting extra time for the ONUs to come up
Hemadf003682020-04-28 21:22:22 +053088 # Check OLT states
Suchitra Vemuri4e6ff3c2020-08-04 21:52:17 -070089 Wait Until Keyword Succeeds 360s 5s Validate OLT Device ENABLED ACTIVE REACHABLE
Hemadf003682020-04-28 21:22:22 +053090 ... ${olt_serial_number}
Hemadf003682020-04-28 21:22:22 +053091 #Check after reboot that ONUs are active, authenticated/DHCP/pingable
92 Run Keyword If ${has_dataplane} Clean Up Linux
93 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test
94
dmohapatro2166a442020-06-05 15:11:40 +000095Verify restart ofagent container before subscriber is provisioned
96 [Documentation] Restart ofagent container before subscriber is provisioned.
97 [Tags] functional VOL-2962 ofagentRestart
98 [Setup] Start Logging ofagentRestart
99 [Teardown] Run Keywords Collect Logs
100 ... AND Stop Logging ofagentRestart
101 ... AND Scale K8s Deployment ${NAMESPACE} voltha-ofagent 1
102 setup
103 Run Keyword If ${has_dataplane} Clean Up Linux
104 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${olt_serial_number}
105 Set Global Variable ${of_id}
106 FOR ${I} IN RANGE 0 ${num_onus}
107 ${src}= Set Variable ${hosts.src[${I}]}
108 ${dst}= Set Variable ${hosts.dst[${I}]}
109 ${onu_device_id}= Get Device ID From SN ${src['onu']}
110 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
111 ... ${of_id}
112 # Bring up the device and verify it authenticates
113 Wait Until Keyword Succeeds ${timeout} 5s Validate Device ENABLED ACTIVE REACHABLE
Hardik Windlass8b446492021-06-10 06:25:23 +0000114 ... ${onu_device_id} onu=True onu_reason=omci-flows-pushed by_dev_id=True
dmohapatro2166a442020-06-05 15:11:40 +0000115 Wait Until Keyword Succeeds ${timeout} 2s Verify Eapol Flows Added For ONU ${ONOS_SSH_IP}
116 ... ${ONOS_SSH_PORT} ${onu_port}
117 ${wpa_log}= Run Keyword If ${has_dataplane} Catenate SEPARATOR=.
118 ... /tmp/wpa ${src['dp_iface_name']} log
119 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate Authentication True
120 ... ${src['dp_iface_name']} wpa_supplicant.conf ${src['ip']} ${src['user']} ${src['pass']}
121 ... ${src['container_type']} ${src['container_name']} ${wpa_log}
122 Wait Until Keyword Succeeds ${timeout} 2s Verify ONU in AAA-Users ${ONOS_SSH_IP}
123 ... ${ONOS_SSH_PORT} ${onu_port}
124 END
125 # Restart POD ofagent
126 ${waitforRestart} Set Variable 120s
127 ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
128 Log ${podStatusOutput}
129 ${countBforRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
130 ${podName} Set Variable ofagent
131 Restart Pod ${NAMESPACE} ${podName}
132 Sleep 60s
133 Wait Until Keyword Succeeds ${waitforRestart} 2s Validate Pod Status ofagent ${NAMESPACE}
134 ... Running
135 FOR ${I} IN RANGE 0 ${num_onus}
136 # Add subscriber access and verify that DHCP completes to ensure system is still functioning properly
TorstenThieme4e2168e2021-06-22 14:01:47 +0000137 #Wait Until Keyword Succeeds ${timeout} 2s Execute ONOS CLI Command use single connection ${ONOS_SSH_IP}
Suchitra Vemuri4e6ff3c2020-08-04 21:52:17 -0700138 #... ${ONOS_SSH_PORT} volt-add-subscriber-access ${of_id} ${onu_port}
dmohapatro2166a442020-06-05 15:11:40 +0000139 ${src}= Set Variable ${hosts.src[${I}]}
140 ${dst}= Set Variable ${hosts.dst[${I}]}
dmohapatro2166a442020-06-05 15:11:40 +0000141 ${onu_device_id}= Get Device ID From SN ${src['onu']}
142 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
143 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
Suchitra Vemuri4e6ff3c2020-08-04 21:52:17 -0700144 # Add subscriber access and verify that DHCP completes to ensure system is still functioning properly
TorstenThieme4e2168e2021-06-22 14:01:47 +0000145 Wait Until Keyword Succeeds ${timeout} 2s Execute ONOS CLI Command use single connection ${ONOS_SSH_IP}
Suchitra Vemuri4e6ff3c2020-08-04 21:52:17 -0700146 ... ${ONOS_SSH_PORT} volt-add-subscriber-access ${of_id} ${onu_port}
dmohapatro2166a442020-06-05 15:11:40 +0000147 # Verify DHCP-Allocations
148 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
149 ... Validate Subscriber DHCP Allocation ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
150 # Verify Ping
151 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Check Ping True
152 ... ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']} ${src['ip']}
153 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
dmohapatro2166a442020-06-05 15:11:40 +0000154 END
Hemadf003682020-04-28 21:22:22 +0530155
156*** Keywords ***
157Setup Suite
158 [Documentation] Set up the test suite
159 Common Test Suite Setup
TorstenThieme4e2168e2021-06-22 14:01:47 +0000160
161Teardown Suite
162 [Documentation] Clean up ONOS SSH connections
163 Close All ONOS SSH Connections