blob: 1c6816db82c80bd96c5a745d7049c1b77f0b459a [file] [log] [blame]
Suchitra Vemuri3f8b0f62019-09-12 13:25:16 -07001#Copyright 2017-present Open Networking Foundation
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -07002#
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
Matteo Scandolo1294aeb2019-09-24 16:20:32 -070015# FIXME Can we use the same test against BBSim and Hardware?
16
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -070017*** Settings ***
Zack Williamsec53a1b2019-09-16 15:50:52 -070018Documentation Test various end-to-end scenarios
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -070019Suite Setup Setup Suite
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -070020Test Setup Setup
21Test Teardown Teardown
Andy Bavierba9866b2019-10-11 07:11:53 -070022Suite Teardown Teardown Suite
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -070023Library Collections
24Library String
25Library OperatingSystem
26Library XML
27Library RequestsLibrary
Andy Bavierba9866b2019-10-11 07:11:53 -070028Library ../../libraries/DependencyLibrary.py
Suchitra Vemurib8ed2d52019-09-30 13:22:51 -070029Resource ../../libraries/onos.robot
30Resource ../../libraries/voltctl.robot
31Resource ../../libraries/utils.robot
Andy Bavierba9866b2019-10-11 07:11:53 -070032Resource ../../libraries/k8s.robot
Suchitra Vemurib8ed2d52019-09-30 13:22:51 -070033Resource ../../variables/variables.robot
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -070034
35*** Variables ***
Zack Williamsec53a1b2019-09-16 15:50:52 -070036${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
Andy Bavierba9866b2019-10-11 07:11:53 -070043${timeout} 60s
Zack Williamsec53a1b2019-09-16 15:50:52 -070044${num_onus} 1
45${of_id} 0
46${logical_id} 0
Andy Bavierba9866b2019-10-11 07:11:53 -070047${ports_per_onu} 5
48${has_dataplane} True
49${external_libs} True
50${teardown_device} False
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -070051
52*** Test Cases ***
53Sanity E2E Test for OLT/ONU on POD
54 [Documentation] Validates E2E Ping Connectivity and object states for the given scenario:
55 ... Validate successful authentication/DHCP/E2E ping for the tech profile that is used
Andy Bavierba9866b2019-10-11 07:11:53 -070056 [Tags] sanity test1
Zack Williamsec53a1b2019-09-16 15:50:52 -070057 #[Setup] Clean Up Linux
Andy Bavierba9866b2019-10-11 07:11:53 -070058 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${olt_serial_number}
59 Set Global Variable ${of_id}
Suchitra Vemuri3dd2f832019-10-18 13:14:54 -070060 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${onu_serial_number} ${of_id}
61 Wait Until Keyword Succeeds ${timeout} 2s Verify Eapol Flows Added For ONU ${k8s_node_ip} ${ONOS_SSH_PORT} ${onu_port}
Andy Bavierba9866b2019-10-11 07:11:53 -070062 Run Keyword If ${has_dataplane} Validate Authentication True ${src0['dp_iface_name']}
63 ... wpa_supplicant.conf ${src0['ip']} ${src0['user']} ${src0['pass']}
Zack Williamsec53a1b2019-09-16 15:50:52 -070064 ... ${src0['container_type']} ${src0['container_name']}
Andy Bavierba9866b2019-10-11 07:11:53 -070065 Wait Until Keyword Succeeds ${timeout} 2s Verify Number of AAA-Users ${k8s_node_ip} ${ONOS_SSH_PORT} ${num_onus}
Andy Bavierba9866b2019-10-11 07:11:53 -070066 Wait Until Keyword Succeeds ${timeout} 2s Execute ONOS CLI Command ${k8s_node_ip} ${ONOS_SSH_PORT}
67 ... volt-add-subscriber-access ${of_id} ${onu_port}
68 Run Keyword If ${has_dataplane} Validate DHCP and Ping True True ${src0['dp_iface_name']}
69 ... ${src0['s_tag']} ${src0['c_tag']} ${dst0['dp_iface_ip_qinq']} ${src0['ip']} ${src0['user']}
70 ... ${src0['pass']} ${src0['container_type']} ${src0['container_name']} ${dst0['dp_iface_name']}
Zack Williamsec53a1b2019-09-16 15:50:52 -070071 ... ${dst0['ip']} ${dst0['user']} ${dst0['pass']} ${dst0['container_type']} ${dst0['container_name']}
Andy Bavierba9866b2019-10-11 07:11:53 -070072 Wait Until Keyword Succeeds ${timeout} 2s Validate DHCP Allocations ${k8s_node_ip} ${ONOS_SSH_PORT} ${num_onus}
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -070073
74*** Keywords ***
75Setup Suite
Zack Williamsec53a1b2019-09-16 15:50:52 -070076 [Documentation] Setup the whole test suite
Andy Bavierba9866b2019-10-11 07:11:53 -070077 # BBSim sanity test doesn't need these imports from other repositories
78 Run Keyword If ${external_libs} Import Library ${CURDIR}/../../../voltha/tests/atests/common/testCaseUtils.py
79 Run Keyword If ${external_libs} Import Resource ${CURDIR}/../../../cord-tester/src/test/cord-api/Framework/Subscriber.robot
80 Run Keyword If ${external_libs} Import Resource ${CURDIR}/../../../cord-tester/src/test/cord-api/Framework/OLT.robot
81 Run Keyword If ${external_libs} Import Resource ${CURDIR}/../../../cord-tester/src/test/cord-api/Framework/DHCP.robot
82 Run Keyword If ${external_libs} Import Resource ${CURDIR}/../../../cord-tester/src/test/cord-api/Framework/Kubernetes.robot
Suchitra Vemuri2adc07e2019-09-05 17:25:31 -070083 Set Global Variable ${KUBECTL_CONFIG} export KUBECONFIG=%{KUBECONFIG}
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -070084 Set Global Variable ${export_kubeconfig} export KUBECONFIG=${KUBERNETES_CONF}
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -070085 Set Global Variable ${VOLTCTL_CONFIG} export VOLTCONFIG=%{VOLTCONFIG}
86 ${k8s_node_ip}= Evaluate ${nodes}[0].get("ip")
87 ${k8s_node_user}= Evaluate ${nodes}[0].get("user")
88 ${k8s_node_pass}= Evaluate ${nodes}[0].get("pass")
89 Check CLI Tools Configured
90 ${onos_auth}= Create List karaf karaf
91 ${HEADERS} Create Dictionary Content-Type=application/json
Suchitra Vemuri9c24d2b2019-09-30 10:28:25 -070092 Create Session ONOS http://${k8s_node_ip}:${ONOS_REST_PORT} auth=${ONOS_AUTH}
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -070093 Set Global Variable ${export_kubeconfig} export KUBECONFIG=${KUBERNETES_CONF}
94 ${olt_ip}= Evaluate ${olts}[0].get("ip")
95 ${olt_user}= Evaluate ${olts}[0].get("user")
96 ${olt_pass}= Evaluate ${olts}[0].get("pass")
97 ${olt_serial_number}= Evaluate ${olts}[0].get("serial")
98 ${onu_serial_number}= Evaluate ${onus}[0].get("serial")
Suchitra Vemuri2adc07e2019-09-05 17:25:31 -070099 Set Suite Variable ${olt_serial_number}
100 Set Suite Variable ${onu_serial_number}
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -0700101 Set Suite Variable ${olt_ip}
102 Set Suite Variable ${olt_user}
103 Set Suite Variable ${olt_pass}
104 Set Suite Variable ${k8s_node_ip}
105 Set Suite Variable ${k8s_node_user}
106 Set Suite Variable ${k8s_node_pass}
107 @{container_list}= Create List
108 Append To List ${container_list} adapter-open-olt
109 Append To List ${container_list} adapter-open-onu
110 Append To List ${container_list} voltha-api-server
111 Append To List ${container_list} voltha-ro-core
112 Append To List ${container_list} voltha-rw-core-11
113 Append To List ${container_list} voltha-rw-core-12
114 Append To List ${container_list} voltha-ofagent
115 Set Suite Variable ${container_list}
Andy Bavierba9866b2019-10-11 07:11:53 -0700116 # Set Deployment Config Variables seems like a candidate for refactoring.
117 # BBSim doesn't need it right now.
118 Run Keyword If ${external_libs} Set Deployment Config Variables
119 ${datetime}= Get Current Date
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -0700120 Set Suite Variable ${datetime}
121
Andy Bavierba9866b2019-10-11 07:11:53 -0700122
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -0700123Setup
Zack Williamsec53a1b2019-09-16 15:50:52 -0700124 [Documentation] Pre-test Setup
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -0700125 #create/preprovision device
Suchitra Vemuric59eb272019-09-18 17:59:33 -0700126 ${olt_device_id}= Create Device ${olt_ip} ${OLT_PORT}
127 Set Suite Variable ${olt_device_id}
Suchitra Vemuric59eb272019-09-18 17:59:33 -0700128 Enable Device ${olt_device_id}
Andy Bavierba9866b2019-10-11 07:11:53 -0700129 Wait Until Keyword Succeeds ${timeout} 5s Validate Device ${olt_serial_number} ENABLED ACTIVE
Zack Williamsec53a1b2019-09-16 15:50:52 -0700130 ... REACHABLE
Andy Bavierba9866b2019-10-11 07:11:53 -0700131 Wait Until Keyword Succeeds ${timeout} 5s Validate Device ${onu_serial_number} ENABLED ACTIVE
Zack Williamsec53a1b2019-09-16 15:50:52 -0700132 ... REACHABLE onu=True onu_reason=tech-profile-config-download-success
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -0700133 ${onu_device_id}= Get Device ID From SN ${onu_serial_number}
134 Set Suite Variable ${onu_device_id}
Suchitra Vemuri00d147d2019-09-13 13:07:32 -0700135 ${logical_id}= Get Logical Device ID From SN ${olt_serial_number}
136 Set Suite Variable ${logical_id}
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -0700137
138Teardown
139 [Documentation] kills processes and cleans up interfaces on src+dst servers
Suchitra Vemuri65e5fbb2019-09-27 15:23:52 -0700140 Get Device Output from Voltha ${olt_device_id}
141 #Get Logical Device Output from Voltha ${logical_id}
Andy Bavierba9866b2019-10-11 07:11:53 -0700142 Run Keyword If ${external_libs} Get ONOS Status ${k8s_node_ip}
143 Run Keyword If ${has_dataplane} Clean Up Linux
144 Run Keyword If ${external_libs} Log Kubernetes Containers Logs Since Time ${datetime} ${container_list}
145
146Teardown Suite
147 [Documentation] Clean up device if desired
148 Run Keyword If ${teardown_device} Delete Device and Verify
149 Run Keyword If ${teardown_device} Execute ONOS CLI Command ${k8s_node_ip} ${ONOS_SSH_PORT}
150 ... device-remove ${of_id}
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -0700151
152Clean Up Linux
153 [Documentation] Kill processes and clean up interfaces on src+dst servers
Andy Bavierba9866b2019-10-11 07:11:53 -0700154 Run Keyword And Ignore Error Kill Linux Process [w]pa_supplicant ${src0['ip']}
155 ... ${src0['user']} ${src0['pass']} ${src0['container_type']} ${src0['container_name']}
156 Run Keyword And Ignore Error Kill Linux Process [d]hclient ${src0['ip']}
157 ... ${src0['user']} ${src0['pass']} ${src0['container_type']} ${src0['container_name']}
158 Run Keyword If '${dst0['ip']}' != '${None}' Run Keyword And Ignore Error
159 ... Kill Linux Process [d]hcpd ${dst0['ip']} ${dst0['user']}
Zack Williamsec53a1b2019-09-16 15:50:52 -0700160 ... ${dst0['pass']} ${dst0['container_type']} ${dst0['container_name']}
Andy Bavierba9866b2019-10-11 07:11:53 -0700161 Delete IP Addresses from Interface on Remote Host ${src0['dp_iface_name']} ${src0['ip']}
162 ... ${src0['user']} ${src0['pass']} ${src0['container_type']} ${src0['container_name']}
163 Run Keyword If '${dst0['ip']}' != '${None}' Delete Interface on Remote Host
164 ... ${dst0['dp_iface_name']}.${src0['s_tag']} ${dst0['ip']} ${dst0['user']} ${dst0['pass']}
Zack Williamsec53a1b2019-09-16 15:50:52 -0700165 ... ${dst0['container_type']} ${dst0['container_name']}
Andy Bavierba9866b2019-10-11 07:11:53 -0700166
167Delete Device and Verify
168 [Documentation] Disable -> Delete devices via voltctl and verify its removed
169 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device disable ${onu_device_id}
170 Should Be Equal As Integers ${rc} 0
171 Wait Until Keyword Succeeds ${timeout} 5s Validate Device ${onu_serial_number} DISABLED UNKNOWN
172 ... REACHABLE
173 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device delete ${onu_device_id}
174 Should Be Equal As Integers ${rc} 0
175 Wait Until Keyword Succeeds ${timeout} 5s Validate Device Removed ${onu_device_id}
176 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device disable ${olt_device_id}
177 Should Be Equal As Integers ${rc} 0
178 Wait Until Keyword Succeeds ${timeout} 5s Validate Device ${olt_serial_number} DISABLED UNKNOWN
179 ... REACHABLE
180 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device delete ${olt_device_id}
181 Should Be Equal As Integers ${rc} 0
182 Wait Until Keyword Succeeds ${timeout} 5s Validate Device Removed ${olt_device_id}