blob: 95479fc6e3b9745133775149d4604b6fb0149d54 [file] [log] [blame]
#Copyright 2017-present Open Networking Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# FIXME Can we use the same test against BBSim and Hardware?
*** Settings ***
Documentation Test various end-to-end scenarios
Suite Setup Setup Suite
Test Setup Setup
Test Teardown Teardown
Suite Teardown Teardown Suite
Library Collections
Library String
Library OperatingSystem
Library XML
Library RequestsLibrary
Library ../../libraries/DependencyLibrary.py
Resource ../../libraries/onos.robot
Resource ../../libraries/voltctl.robot
Resource ../../libraries/utils.robot
Resource ../../libraries/k8s.robot
Resource ../../variables/variables.robot
*** Variables ***
${POD_NAME} flex-ocp-cord
${KUBERNETES_CONF} ${KUBERNETES_CONFIGS_DIR}/${POD_NAME}.conf
${KUBERNETES_CONFIGS_DIR} ~/pod-configs/kubernetes-configs
#${KUBERNETES_CONFIGS_DIR} ${KUBERNETES_CONFIGS_DIR}/${POD_NAME}.conf
${KUBERNETES_YAML} ${KUBERNETES_CONFIGS_DIR}/${POD_NAME}.yml
${HELM_CHARTS_DIR} ~/helm-charts
${VOLTHA_POD_NUM} 8
${timeout} 60s
${of_id} 0
${logical_id} 0
${has_dataplane} True
${external_libs} True
${teardown_device} False
*** Test Cases ***
Sanity E2E Test for OLT/ONU on POD
[Documentation] Validates E2E Ping Connectivity and object states for the given scenario:
... Validate successful authentication/DHCP/E2E ping for the tech profile that is used
[Tags] sanity test1
#[Setup] Clean Up Linux
${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${olt_serial_number}
Set Global Variable ${of_id}
FOR ${I} IN RANGE 0 ${num_onus}
${src}= Set Variable ${hosts.src[${I}]}
${dst}= Set Variable ${hosts.dst[${I}]}
${onu_reasons}= Create List tech-profile-config-download-success omci-flows-pushed
Wait Until Keyword Succeeds ${timeout} 5s Validate Device ${src['onu']} ENABLED ACTIVE
... REACHABLE onu=True onu_reasons=${onu_reasons}
${onu_device_id}= Get Device ID From SN ${src['onu']}
${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']} ${of_id}
Wait Until Keyword Succeeds ${timeout} 2s Verify Eapol Flows Added For ONU ${k8s_node_ip} ${ONOS_SSH_PORT} ${onu_port}
Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate Authentication True ${src['dp_iface_name']}
... wpa_supplicant.conf ${src['ip']} ${src['user']} ${src['pass']}
... ${src['container_type']} ${src['container_name']}
Wait Until Keyword Succeeds ${timeout} 2s Verify ONU in AAA-Users ${k8s_node_ip} ${ONOS_SSH_PORT}
... ${onu_port}
Wait Until Keyword Succeeds ${timeout} 2s Execute ONOS CLI Command ${k8s_node_ip} ${ONOS_SSH_PORT}
... volt-add-subscriber-access ${of_id} ${onu_port}
Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate DHCP and Ping True True ${src['dp_iface_name']}
... ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']} ${src['ip']} ${src['user']}
... ${src['pass']} ${src['container_type']} ${src['container_name']} ${dst['dp_iface_name']}
... ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']} ${dst['container_name']}
Wait Until Keyword Succeeds ${timeout} 2s Validate Subscriber DHCP Allocation ${k8s_node_ip} ${ONOS_SSH_PORT} ${onu_port}
END
*** Keywords ***
Setup Suite
[Documentation] Setup the whole test suite
# BBSim sanity test doesn't need these imports from other repositories
Run Keyword If ${external_libs} Import Library ${CURDIR}/../../../voltha/tests/atests/common/testCaseUtils.py
Run Keyword If ${external_libs} Import Resource ${CURDIR}/../../../cord-tester/src/test/cord-api/Framework/Subscriber.robot
Run Keyword If ${external_libs} Import Resource ${CURDIR}/../../../cord-tester/src/test/cord-api/Framework/OLT.robot
Run Keyword If ${external_libs} Import Resource ${CURDIR}/../../../cord-tester/src/test/cord-api/Framework/DHCP.robot
Run Keyword If ${external_libs} Import Resource ${CURDIR}/../../../cord-tester/src/test/cord-api/Framework/Kubernetes.robot
Set Global Variable ${KUBECTL_CONFIG} export KUBECONFIG=%{KUBECONFIG}
Set Global Variable ${export_kubeconfig} export KUBECONFIG=${KUBERNETES_CONF}
Set Global Variable ${VOLTCTL_CONFIG} export VOLTCONFIG=%{VOLTCONFIG}
${k8s_node_ip}= Evaluate ${nodes}[0].get("ip")
${k8s_node_user}= Evaluate ${nodes}[0].get("user")
${k8s_node_pass}= Evaluate ${nodes}[0].get("pass")
Check CLI Tools Configured
${onos_auth}= Create List karaf karaf
${HEADERS} Create Dictionary Content-Type=application/json
Create Session ONOS http://${k8s_node_ip}:${ONOS_REST_PORT} auth=${ONOS_AUTH}
Set Global Variable ${export_kubeconfig} export KUBECONFIG=${KUBERNETES_CONF}
${olt_ip}= Evaluate ${olts}[0].get("ip")
${olt_user}= Evaluate ${olts}[0].get("user")
${olt_pass}= Evaluate ${olts}[0].get("pass")
${olt_serial_number}= Evaluate ${olts}[0].get("serial")
${num_onus}= Get Length ${hosts.src}
${num_onus}= Convert to String ${num_onus}
Set Suite Variable ${num_onus}
Set Suite Variable ${olt_serial_number}
Set Suite Variable ${olt_ip}
Set Suite Variable ${olt_user}
Set Suite Variable ${olt_pass}
Set Suite Variable ${k8s_node_ip}
Set Suite Variable ${k8s_node_user}
Set Suite Variable ${k8s_node_pass}
@{container_list}= Create List adapter-open-olt adapter-open-onu voltha-api-server
... voltha-ro-core voltha-rw-core-11 voltha-rw-core-12 voltha-ofagent
Set Suite Variable ${container_list}
${datetime}= Get Current Date
Set Suite Variable ${datetime}
Setup
[Documentation] Pre-test Setup
#create/preprovision device
${olt_device_id}= Create Device ${olt_ip} ${OLT_PORT}
Set Suite Variable ${olt_device_id}
Enable Device ${olt_device_id}
Wait Until Keyword Succeeds ${timeout} 5s Validate Device ${olt_serial_number} ENABLED ACTIVE
... REACHABLE
${logical_id}= Get Logical Device ID From SN ${olt_serial_number}
Set Suite Variable ${logical_id}
Teardown
[Documentation] kills processes and cleans up interfaces on src+dst servers
Get Device Output from Voltha ${olt_device_id}
#Get Logical Device Output from Voltha ${logical_id}
Run Keyword If ${external_libs} Get ONOS Status ${k8s_node_ip}
Run Keyword If ${has_dataplane} Clean Up Linux
Run Keyword If ${external_libs} Log Kubernetes Containers Logs Since Time ${datetime} ${container_list}
Teardown Suite
[Documentation] Clean up device if desired
Run Keyword If ${teardown_device} Delete Device and Verify
Run Keyword If ${teardown_device} Execute ONOS CLI Command ${k8s_node_ip} ${ONOS_SSH_PORT}
... device-remove ${of_id}
Clean Up Linux
[Documentation] Kill processes and clean up interfaces on src+dst servers
FOR ${I} IN RANGE 0 ${num_onus}
${src}= Set Variable ${hosts.src[${I}]}
${dst}= Set Variable ${hosts.dst[${I}]}
Run Keyword And Ignore Error Kill Linux Process [w]pa_supplicant ${src['ip']}
... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
Run Keyword And Ignore Error Kill Linux Process [d]hclient ${src['ip']}
... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
Run Keyword If '${dst['ip']}' != '${None}' Run Keyword And Ignore Error
... Kill Linux Process [d]hcpd ${dst['ip']} ${dst['user']}
... ${dst['pass']} ${dst['container_type']} ${dst['container_name']}
Delete IP Addresses from Interface on Remote Host ${src['dp_iface_name']} ${src['ip']}
... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
Run Keyword If '${dst['ip']}' != '${None}' Delete Interface on Remote Host
... ${dst['dp_iface_name']}.${src['s_tag']} ${dst['ip']} ${dst['user']} ${dst['pass']}
... ${dst['container_type']} ${dst['container_name']}
END
Delete Device and Verify
[Documentation] Disable -> Delete devices via voltctl and verify its removed
${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device disable ${olt_device_id}
Should Be Equal As Integers ${rc} 0
Wait Until Keyword Succeeds ${timeout} 5s Validate Device ${olt_serial_number} DISABLED UNKNOWN
... REACHABLE
${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device delete ${olt_device_id}
Should Be Equal As Integers ${rc} 0
Wait Until Keyword Succeeds ${timeout} 5s Validate Device Removed ${olt_device_id}