blob: 70c08c8ffa3b4f773c233a69fefd1636841ace7c [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${of_id} 0
45${logical_id} 0
Andy Bavierba9866b2019-10-11 07:11:53 -070046${has_dataplane} True
47${external_libs} True
48${teardown_device} False
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -070049
50*** Test Cases ***
51Sanity E2E Test for OLT/ONU on POD
52 [Documentation] Validates E2E Ping Connectivity and object states for the given scenario:
53 ... Validate successful authentication/DHCP/E2E ping for the tech profile that is used
Andy Bavierba9866b2019-10-11 07:11:53 -070054 [Tags] sanity test1
Zack Williamsec53a1b2019-09-16 15:50:52 -070055 #[Setup] Clean Up Linux
Andy Bavierba9866b2019-10-11 07:11:53 -070056 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${olt_serial_number}
57 Set Global Variable ${of_id}
Suchitra Vemuri8a9c3782019-10-23 12:43:01 -070058
59 FOR ${I} IN RANGE 0 ${num_onus}
60 ${src}= Set Variable ${hosts.src[${I}]}
61 ${dst}= Set Variable ${hosts.dst[${I}]}
62
63 ${onu_reasons}= Create List tech-profile-config-download-success omci-flows-pushed
64 Wait Until Keyword Succeeds ${timeout} 5s Validate Device ${src['onu']} ENABLED ACTIVE
65 ... REACHABLE onu=True onu_reasons=${onu_reasons}
66
67 ${onu_device_id}= Get Device ID From SN ${src['onu']}
Gilles Depatie675a2062019-10-22 12:44:42 -040068 ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
69 ... ${of_id}
70 Wait Until Keyword Succeeds ${timeout} 2s Verify Eapol Flows Added For ONU ${k8s_node_ip}
71 ... ${ONOS_SSH_PORT} ${onu_port}
72 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate Authentication True
73 ... ${src['dp_iface_name']} wpa_supplicant.conf ${src['ip']} ${src['user']} ${src['pass']}
Suchitra Vemuri8a9c3782019-10-23 12:43:01 -070074 ... ${src['container_type']} ${src['container_name']}
Gilles Depatie675a2062019-10-22 12:44:42 -040075 Wait Until Keyword Succeeds ${timeout} 2s Verify ONU in AAA-Users ${k8s_node_ip}
76 ... ${ONOS_SSH_PORT} ${onu_port}
77 Wait Until Keyword Succeeds ${timeout} 2s Execute ONOS CLI Command ${k8s_node_ip}
78 ... ${ONOS_SSH_PORT} volt-add-subscriber-access ${of_id} ${onu_port}
79 Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate DHCP and Ping True
80 ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']}
81 ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
82 ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']}
83 ... ${dst['container_name']}
84 Wait Until Keyword Succeeds ${timeout} 2s Run Keyword And Continue On Failure
85 ... Validate Subscriber DHCP Allocation ${k8s_node_ip} ${ONOS_SSH_PORT} ${onu_port}
Suchitra Vemuri8a9c3782019-10-23 12:43:01 -070086 END
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -070087
88*** Keywords ***
89Setup Suite
Zack Williamsec53a1b2019-09-16 15:50:52 -070090 [Documentation] Setup the whole test suite
Andy Bavierba9866b2019-10-11 07:11:53 -070091 # BBSim sanity test doesn't need these imports from other repositories
Gilles Depatie675a2062019-10-22 12:44:42 -040092 Run Keyword If ${external_libs} Import Library
93 ... ${CURDIR}/../../../voltha/tests/atests/common/testCaseUtils.py
94 Run Keyword If ${external_libs} Import Resource
95 ... ${CURDIR}/../../../cord-tester/src/test/cord-api/Framework/Subscriber.robot
96 Run Keyword If ${external_libs} Import Resource
97 ... ${CURDIR}/../../../cord-tester/src/test/cord-api/Framework/OLT.robot
98 Run Keyword If ${external_libs} Import Resource
99 ... ${CURDIR}/../../../cord-tester/src/test/cord-api/Framework/DHCP.robot
100 Run Keyword If ${external_libs} Import Resource
101 ... ${CURDIR}/../../../cord-tester/src/test/cord-api/Framework/Kubernetes.robot
Suchitra Vemuri2adc07e2019-09-05 17:25:31 -0700102 Set Global Variable ${KUBECTL_CONFIG} export KUBECONFIG=%{KUBECONFIG}
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -0700103 Set Global Variable ${export_kubeconfig} export KUBECONFIG=${KUBERNETES_CONF}
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -0700104 Set Global Variable ${VOLTCTL_CONFIG} export VOLTCONFIG=%{VOLTCONFIG}
105 ${k8s_node_ip}= Evaluate ${nodes}[0].get("ip")
106 ${k8s_node_user}= Evaluate ${nodes}[0].get("user")
107 ${k8s_node_pass}= Evaluate ${nodes}[0].get("pass")
108 Check CLI Tools Configured
109 ${onos_auth}= Create List karaf karaf
110 ${HEADERS} Create Dictionary Content-Type=application/json
Suchitra Vemuri9c24d2b2019-09-30 10:28:25 -0700111 Create Session ONOS http://${k8s_node_ip}:${ONOS_REST_PORT} auth=${ONOS_AUTH}
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -0700112 Set Global Variable ${export_kubeconfig} export KUBECONFIG=${KUBERNETES_CONF}
113 ${olt_ip}= Evaluate ${olts}[0].get("ip")
114 ${olt_user}= Evaluate ${olts}[0].get("user")
115 ${olt_pass}= Evaluate ${olts}[0].get("pass")
116 ${olt_serial_number}= Evaluate ${olts}[0].get("serial")
Suchitra Vemuri8a9c3782019-10-23 12:43:01 -0700117 ${num_onus}= Get Length ${hosts.src}
118 ${num_onus}= Convert to String ${num_onus}
119 Set Suite Variable ${num_onus}
Suchitra Vemuri2adc07e2019-09-05 17:25:31 -0700120 Set Suite Variable ${olt_serial_number}
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -0700121 Set Suite Variable ${olt_ip}
122 Set Suite Variable ${olt_user}
123 Set Suite Variable ${olt_pass}
124 Set Suite Variable ${k8s_node_ip}
125 Set Suite Variable ${k8s_node_user}
126 Set Suite Variable ${k8s_node_pass}
Suchitra Vemuri8a9c3782019-10-23 12:43:01 -0700127 @{container_list}= Create List adapter-open-olt adapter-open-onu voltha-api-server
128 ... voltha-ro-core voltha-rw-core-11 voltha-rw-core-12 voltha-ofagent
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -0700129 Set Suite Variable ${container_list}
Andy Bavierba9866b2019-10-11 07:11:53 -0700130 ${datetime}= Get Current Date
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -0700131 Set Suite Variable ${datetime}
132
Andy Bavierba9866b2019-10-11 07:11:53 -0700133
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -0700134Setup
Zack Williamsec53a1b2019-09-16 15:50:52 -0700135 [Documentation] Pre-test Setup
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -0700136 #create/preprovision device
Suchitra Vemuric59eb272019-09-18 17:59:33 -0700137 ${olt_device_id}= Create Device ${olt_ip} ${OLT_PORT}
138 Set Suite Variable ${olt_device_id}
Suchitra Vemuric59eb272019-09-18 17:59:33 -0700139 Enable Device ${olt_device_id}
Andy Bavierba9866b2019-10-11 07:11:53 -0700140 Wait Until Keyword Succeeds ${timeout} 5s Validate Device ${olt_serial_number} ENABLED ACTIVE
Zack Williamsec53a1b2019-09-16 15:50:52 -0700141 ... REACHABLE
Suchitra Vemuri00d147d2019-09-13 13:07:32 -0700142 ${logical_id}= Get Logical Device ID From SN ${olt_serial_number}
143 Set Suite Variable ${logical_id}
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -0700144
145Teardown
146 [Documentation] kills processes and cleans up interfaces on src+dst servers
Suchitra Vemuri65e5fbb2019-09-27 15:23:52 -0700147 Get Device Output from Voltha ${olt_device_id}
148 #Get Logical Device Output from Voltha ${logical_id}
Andy Bavierba9866b2019-10-11 07:11:53 -0700149 Run Keyword If ${external_libs} Get ONOS Status ${k8s_node_ip}
150 Run Keyword If ${has_dataplane} Clean Up Linux
151 Run Keyword If ${external_libs} Log Kubernetes Containers Logs Since Time ${datetime} ${container_list}
152
153Teardown Suite
154 [Documentation] Clean up device if desired
155 Run Keyword If ${teardown_device} Delete Device and Verify
156 Run Keyword If ${teardown_device} Execute ONOS CLI Command ${k8s_node_ip} ${ONOS_SSH_PORT}
157 ... device-remove ${of_id}
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -0700158
159Clean Up Linux
160 [Documentation] Kill processes and clean up interfaces on src+dst servers
Suchitra Vemuri8a9c3782019-10-23 12:43:01 -0700161 FOR ${I} IN RANGE 0 ${num_onus}
162 ${src}= Set Variable ${hosts.src[${I}]}
163 ${dst}= Set Variable ${hosts.dst[${I}]}
164 Run Keyword And Ignore Error Kill Linux Process [w]pa_supplicant ${src['ip']}
165 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
166 Run Keyword And Ignore Error Kill Linux Process [d]hclient ${src['ip']}
167 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
168 Run Keyword If '${dst['ip']}' != '${None}' Run Keyword And Ignore Error
169 ... Kill Linux Process [d]hcpd ${dst['ip']} ${dst['user']}
170 ... ${dst['pass']} ${dst['container_type']} ${dst['container_name']}
171 Delete IP Addresses from Interface on Remote Host ${src['dp_iface_name']} ${src['ip']}
172 ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
173 Run Keyword If '${dst['ip']}' != '${None}' Delete Interface on Remote Host
174 ... ${dst['dp_iface_name']}.${src['s_tag']} ${dst['ip']} ${dst['user']} ${dst['pass']}
175 ... ${dst['container_type']} ${dst['container_name']}
176 END
Andy Bavierba9866b2019-10-11 07:11:53 -0700177
178Delete Device and Verify
179 [Documentation] Disable -> Delete devices via voltctl and verify its removed
Andy Bavierba9866b2019-10-11 07:11:53 -0700180 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device disable ${olt_device_id}
181 Should Be Equal As Integers ${rc} 0
182 Wait Until Keyword Succeeds ${timeout} 5s Validate Device ${olt_serial_number} DISABLED UNKNOWN
183 ... REACHABLE
184 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device delete ${olt_device_id}
185 Should Be Equal As Integers ${rc} 0
186 Wait Until Keyword Succeeds ${timeout} 5s Validate Device Removed ${olt_device_id}