blob: f55afc0eaa36b548b53be6d3efac778655bc23c9 [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
15*** Settings ***
16Documentation Test various end-to-end scenarios
17Suite Setup Setup Suite
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -070018Test Setup Setup
19Test Teardown Teardown
20Library Collections
21Library String
22Library OperatingSystem
23Library XML
24Library RequestsLibrary
Suchitra Vemuri00d147d2019-09-13 13:07:32 -070025Library ../../voltha/tests/atests/common/testCaseUtils.py
26Resource ../../cord-tester/src/test/cord-api/Framework/Subscriber.robot
Suchitra Vemuric59eb272019-09-18 17:59:33 -070027Resource ../../cord-tester/src/test/cord-api/Framework/OLT.robot
Suchitra Vemuri00d147d2019-09-13 13:07:32 -070028Resource ../../cord-tester/src/test/cord-api/Framework/DHCP.robot
29Resource ../../cord-tester/src/test/cord-api/Framework/Kubernetes.robot
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -070030Resource ../libraries/onos.robot
31Resource ../libraries/voltctl.robot
32Resource ../libraries/utils.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${timeout} 90s
44${num_onus} 1
45${of_id} 0
Suchitra Vemuri00d147d2019-09-13 13:07:32 -070046${logical_id} 0
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -070047
48*** Test Cases ***
49Sanity E2E Test for OLT/ONU on POD
50 [Documentation] Validates E2E Ping Connectivity and object states for the given scenario:
51 ... Validate successful authentication/DHCP/E2E ping for the tech profile that is used
52 #[Setup] Clean Up Linux
53 [Tags] test1
Suchitra Vemuri2adc07e2019-09-05 17:25:31 -070054 ${of_id}= Wait Until Keyword Succeeds 60s 15s Validate OLT Device in ONOS ${olt_serial_number}
Suchitra Vemurie1c449b2019-09-20 15:36:55 -070055 #Wait Until Keyword Succeeds 60s 2s Verify Eapol Flows Added ${k8s_node_ip} ${ONOS_SSH_PORT} 5
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -070056 Validate Authentication True ${src0['dp_iface_name']} wpa_supplicant.conf ${src0['ip']} ${src0['user']} ${src0['pass']} ${src0['container_type']} ${src0['container_name']}
57 #Validate ONU authenticated in ONOS
Suchitra Vemuri8d085de2019-09-11 14:04:20 -070058 Wait Until Keyword Succeeds 90s 2s Verify Number of AAA-Users ${k8s_node_ip} ${ONOS_SSH_PORT} ${num_onus}
59 Wait Until Keyword Succeeds 60s 2s Execute ONOS Command ${k8s_node_ip} ${ONOS_SSH_PORT} volt-add-subscriber-access ${of_id} 16
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -070060 # Perform dhclient and ping operations
61 Validate DHCP and Ping True True ${src0['dp_iface_name']} ${src0['s_tag']} ${src0['c_tag']} ${dst0['dp_iface_ip_qinq']} ${src0['ip']} ${src0['user']} ${src0['pass']} ${src0['container_type']} ${src0['container_name']} ${dst0['dp_iface_name']} ${dst0['ip']} ${dst0['user']} ${dst0['pass']} ${dst0['container_type']} ${dst0['container_name']}
62 #Validate DHCP allocation in ONOS
63 Wait Until Keyword Succeeds 60s 2s Validate DHCP Allocations ${k8s_node_ip} ${ONOS_SSH_PORT} ${num_onus}
64
65
66*** Keywords ***
67Setup Suite
Suchitra Vemuri2adc07e2019-09-05 17:25:31 -070068 Set Global Variable ${KUBECTL_CONFIG} export KUBECONFIG=%{KUBECONFIG}
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -070069 Set Global Variable ${export_kubeconfig} export KUBECONFIG=${KUBERNETES_CONF}
70 Set Global Variable ${of_id}
71 Set Global Variable ${VOLTCTL_CONFIG} export VOLTCONFIG=%{VOLTCONFIG}
72 ${k8s_node_ip}= Evaluate ${nodes}[0].get("ip")
73 ${k8s_node_user}= Evaluate ${nodes}[0].get("user")
74 ${k8s_node_pass}= Evaluate ${nodes}[0].get("pass")
75 Check CLI Tools Configured
76 ${onos_auth}= Create List karaf karaf
77 ${HEADERS} Create Dictionary Content-Type=application/json
78 Create Session ONOS http://${k8snode_ip}:${ONOS_REST_PORT} auth=${ONOS_AUTH}
79 Set Global Variable ${export_kubeconfig} export KUBECONFIG=${KUBERNETES_CONF}
80 ${olt_ip}= Evaluate ${olts}[0].get("ip")
81 ${olt_user}= Evaluate ${olts}[0].get("user")
82 ${olt_pass}= Evaluate ${olts}[0].get("pass")
83 ${olt_serial_number}= Evaluate ${olts}[0].get("serial")
84 ${onu_serial_number}= Evaluate ${onus}[0].get("serial")
Suchitra Vemuri2adc07e2019-09-05 17:25:31 -070085 Set Suite Variable ${olt_serial_number}
86 Set Suite Variable ${onu_serial_number}
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -070087 Set Suite Variable ${olt_ip}
88 Set Suite Variable ${olt_user}
89 Set Suite Variable ${olt_pass}
90 Set Suite Variable ${k8s_node_ip}
91 Set Suite Variable ${k8s_node_user}
92 Set Suite Variable ${k8s_node_pass}
93 @{container_list}= Create List
94 Append To List ${container_list} adapter-open-olt
95 Append To List ${container_list} adapter-open-onu
96 Append To List ${container_list} voltha-api-server
97 Append To List ${container_list} voltha-ro-core
98 Append To List ${container_list} voltha-rw-core-11
99 Append To List ${container_list} voltha-rw-core-12
100 Append To List ${container_list} voltha-ofagent
101 Set Suite Variable ${container_list}
102 Set Deployment Config Variables
103 ${datetime}= Get Current Datetime On Kubernetes Node ${k8s_node_ip} ${k8s_node_user} ${k8s_node_pass}
104 Set Suite Variable ${datetime}
105
106Setup
107 #create/preprovision device
Suchitra Vemuric59eb272019-09-18 17:59:33 -0700108 ${olt_device_id}= Create Device ${olt_ip} ${OLT_PORT}
109 Set Suite Variable ${olt_device_id}
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -0700110 #enable device
Suchitra Vemuric59eb272019-09-18 17:59:33 -0700111 Enable Device ${olt_device_id}
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -0700112 #validate olt states
113 Wait Until Keyword Succeeds 60s 5s Validate Device ${olt_serial_number} ENABLED ACTIVE REACHABLE
114 #validate onu states
Suchitra Vemuric59eb272019-09-18 17:59:33 -0700115 Wait Until Keyword Succeeds 60s 5s Validate Device ${onu_serial_number} ENABLED ACTIVE REACHABLE onu=True onu_reason=tech-profile-config-download-success
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -0700116 #get onu device id
117 ${onu_device_id}= Get Device ID From SN ${onu_serial_number}
118 Set Suite Variable ${onu_device_id}
Suchitra Vemuri00d147d2019-09-13 13:07:32 -0700119 ${logical_id}= Get Logical Device ID From SN ${olt_serial_number}
120 Set Suite Variable ${logical_id}
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -0700121
122Teardown
123 [Documentation] kills processes and cleans up interfaces on src+dst servers
Suchitra Vemuri00d147d2019-09-13 13:07:32 -0700124 Get Device Output from Voltha ${of_id}
125 Get Logical Device Output from Voltha ${logical_id}
Suchitra Vemuric59eb272019-09-18 17:59:33 -0700126 Get ONOS Status ${k8s_node_ip}
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -0700127 Clean Up Linux
128 Log Kubernetes Containers Logs Since Time ${datetime} ${container_list}
129
130Clean Up Linux
131 [Documentation] Kill processes and clean up interfaces on src+dst servers
132 Run Keyword And Ignore Error Kill Linux Process [w]pa_supplicant ${src0['ip']} ${src0['user']} ${src0['pass']} ${src0['container_type']} ${src0['container_name']}
133 Run Keyword And Ignore Error Kill Linux Process [d]hclient ${src0['ip']} ${src0['user']} ${src0['pass']} ${src0['container_type']} ${src0['container_name']}
134 Run Keyword If '${dst0['ip']}' != '${None}' Run Keyword And Ignore Error Kill Linux Process [d]hcpd ${dst0['ip']} ${dst0['user']} ${dst0['pass']} ${dst0['container_type']} ${dst0['container_name']}
135 Delete IP Addresses from Interface on Remote Host ${src0['dp_iface_name']} ${src0['ip']} ${src0['user']} ${src0['pass']} ${src0['container_type']} ${src0['container_name']}
Suchitra Vemuri2adc07e2019-09-05 17:25:31 -0700136 Run Keyword If '${dst0['ip']}' != '${None}' Delete Interface on Remote Host ${dst0['dp_iface_name']}.${src0['s_tag']} ${dst0['ip']} ${dst0['user']} ${dst0['pass']} ${dst0['container_type']} ${dst0['container_name']}
Suchitra Vemuri65cd65f2019-08-30 14:39:22 -0700137