blob: 1326304f21bec64e31cd3cbfd8094869a6eaeeb8 [file] [log] [blame]
Hardik Windlassb9bdd502020-04-17 14:46:21 +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# FIXME Can we use the same test against BBSim and Hardware?
15
16*** Settings ***
17Documentation Test various end-to-end scenarios
18Suite Setup Setup Suite
19Test Setup Setup
20Test Teardown Teardown
21Suite 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
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 ONU after Rebooting Physically for DT
59 [Documentation] Test the ONU functionality by physically turning on/off ONU.
60 ... Assuming that all the ONUs are DHCP/pingable (i.e. assuming sanityDt test was executed)
61 ... Test case runs only on the PODs that are configured with PowerSwitch that
62 ... controls the power off/on ONUs/OLT remotely (simulating a physical reboot)
63 [Tags] functionalDt PowerSwitchOnuRebootDt VOL-2819 PowerSwitch
64 [Setup] Run Keywords Start Logging RebootOnu_PowerSwitch_Dt
65 [Teardown] Run Keywords Collect Logs
66 ... AND Stop Logging RebootOnu_PowerSwitch_Dt
67 ... AND Delete Device and Verify
68 # Add OLT device
69 Setup
70 # Performing Sanity Test to make sure subscribers are all DHCP and pingable
71 Run Keyword If ${has_dataplane} Clean Up Linux
72 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test DT
73 Power Switch Connection Suite ${web_power_switch.ip} ${web_power_switch.user} ${web_power_switch.password}
74 FOR ${I} IN RANGE 0 ${num_onus}
75 ${src}= Set Variable ${hosts.src[${I}]}
76 ${dst}= Set Variable ${hosts.dst[${I}]}
77 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
78 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
79 Disable Switch Outlet ${src['power_switch_port']}
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
85 Enable Switch Outlet ${src['power_switch_port']}
86 # Check ONU port is Enabled in ONOS
87 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
88 ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
89 # Verify ONU state in voltha
90 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
91 ... ENABLED ACTIVE REACHABLE
92 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
93 # Verify subscriber access flows are added for the ONU port
94 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
95 ... Verify Subscriber Access Flows Added For ONU DT ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
96 ... ${onu_port} ${nni_port} ${src['s_tag']}
97 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
98 ... Wait Until Keyword Succeeds 60s 2s
99 ... Check Ping True ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
100 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
101 Run Keyword And Ignore Error Collect Logs
102 END
103 # Verify ONOS Flows
104 # Number of Access Flows on ONOS equals 4 * the Number of Active ONUs (2 for each downstream and upstream)
105 ${onos_flows_count}= Evaluate 4 * ${num_onus}
106 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
107 ... Verify Subscriber Access Flows Added Count DT ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
108 ... ${of_id} ${onos_flows_count}
109 # Verify VOLTHA Flows
110 # Number of per OLT Flows equals Twice the Number of Active ONUs (each for downstream and upstream) + 1 for LLDP
111 ${olt_flows}= Evaluate 2 * ${num_onus} + 1
112 # Number of per ONU Flows equals 2 (one each for downstream and upstream)
113 ${onu_flows}= Set Variable 2
114 Run Keyword Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Flows ${olt_flows}
115 ${List_ONU_Serial} Create List
116 Set Suite Variable ${List_ONU_Serial}
117 Build ONU SN List ${List_ONU_Serial}
118 Log ${List_ONU_Serial}
119 Run Keyword Wait Until Keyword Succeeds ${timeout} 5s Validate ONU Flows
120 ... ${List_ONU_Serial} ${onu_flows}
121
122Verify OLT after Rebooting Physically for DT
123 [Documentation] Test the physical reboot of the OLT
124 ... Assuming that all the ONUs are DHCP/pingable (i.e. assuming sanityDt test was executed)
125 ... Test performs a physical reboot, performs "reboot" from the OLT CLI
126 [Tags] functionalDt PhysicalOltRebootDt VOL-2817
127 [Setup] Run Keywords Start Logging RebootOlt_Physical_Dt
128 [Teardown] Run Keywords Collect Logs
129 ... AND Stop Logging RebootOlt_Physical_Dt
130 ... AND Delete Device and Verify
131 # Add OLT device
132 Setup
133 # Performing Sanity Test to make sure subscribers are all DHCP and pingable
134 Run Keyword If ${has_dataplane} Clean Up Linux
135 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test DT
136 # Reboot the OLT from the OLT CLI
137 Run Keyword If ${has_dataplane} Login And Run Command On Remote System
138 ... sudo reboot ${olt_ip} ${olt_user} ${olt_pass} prompt=#
139 Run Keyword And Ignore Error Collect Logs
140 FOR ${I} IN RANGE 0 ${num_onus}
141 ${src}= Set Variable ${hosts.src[${I}]}
142 ${dst}= Set Variable ${hosts.dst[${I}]}
143 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
144 ... Wait Until Keyword Succeeds 60s 2s
145 ... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
146 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
147 END
148 # Wait for the OLT to come back up
149 Run Keyword If ${has_dataplane} Wait Until Keyword Succeeds 120s 10s
150 ... Check Remote System Reachability True ${olt_ip}
151 # Waiting extra time for the ONUs to come up
152 Sleep 60s
153 Run Keyword And Ignore Error Collect Logs
154 Run Keyword If ${has_dataplane} Clean Up Linux
155 Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test DT
156
157*** Keywords ***
158Setup Suite
159 [Documentation] Set up the test suite
160 Common Test Suite Setup
161
162Clear All Devices Then Create New Device
163 [Documentation] Remove any devices from VOLTHA and ONOS
164 # Remove all devices from voltha and nos
165 Delete All Devices and Verify
166 # Execute normal test Setup Keyword
167 Setup
168