blob: 2aaba084db6e3c107c5a4db8168754ad3429b04e [file] [log] [blame]
Kailash Khalasi6dab16e2018-09-17 20:24:08 -07001# 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
Suchitra Vemuriff825322018-09-07 14:00:04 -070015*** Settings ***
Suchitra Vemuri32fc2f22018-09-10 12:06:01 -070016Documentation Test successful ping from end-end
Kailash Khalasif3e0a9f2018-09-18 13:43:42 -070017Suite Setup Setup
Kailash Khalasi6dab16e2018-09-17 20:24:08 -070018Suite Teardown Teardown
Kailash Khalasif3e0a9f2018-09-18 13:43:42 -070019Test Setup Create Models
20Test Teardown Clean Test Environment
Suchitra Vemuriff825322018-09-07 14:00:04 -070021Library Collections
22Library String
23Library OperatingSystem
24Library XML
25Library RequestsLibrary
Suchitra Vemuri32fc2f22018-09-10 12:06:01 -070026Library ../../Framework/utils/utils.py
Kailash Khalasi6dab16e2018-09-17 20:24:08 -070027Resource ../../Framework/utils/utils.robot
Suchitra Vemuri32fc2f22018-09-10 12:06:01 -070028Library ../../Framework/restApi.py
Kailash Khalasi6dab16e2018-09-17 20:24:08 -070029Resource ../../Framework/Subscriber.robot
30Resource ../../Framework/ATTWorkFlowDriver.robot
You Wang0c2b3662018-10-01 16:56:17 -070031Resource ../../Framework/Kubernetes.robot
Kailash Khalasi6dab16e2018-09-17 20:24:08 -070032Resource ../../Framework/ONU.robot
You Wang0c2b3662018-10-01 16:56:17 -070033Resource ../../Framework/OLT.robot
Kailash Khalasi6dab16e2018-09-17 20:24:08 -070034Resource ../../Framework/DHCP.robot
35Variables ../../Properties/RestApiProperties.py
Suchitra Vemuriff825322018-09-07 14:00:04 -070036
37*** Variables ***
Kailash Khalasi30a6a392018-09-10 14:32:39 -070038${WHITELIST_PATHFILE} ${CURDIR}/data/ATTWhiteList.json
39${SUBSCRIBER_PATHFILE} ${CURDIR}/data/ATTSubscriber.json
Kailash Khalasif3e0a9f2018-09-18 13:43:42 -070040${VOLT_DEVICE_PATHFILE} ${CURDIR}/../data/RealOLTDevice.json
Kailash Khalasi6dab16e2018-09-17 20:24:08 -070041${src_ip} X.X.X.X
42${src_gateway} X.X.X.X
43${src_user} user
44${src_pass} pass
45${src_iface} eth0
46${dst_ip} X.X.X.X
47${dst_dp_iface} eth0
48${dst_dp_ip} X.X.X.X
49${dst_user} user
50${dst_pass} pass
51${dst_gateway} X.X.X.X
You Wang0c2b3662018-10-01 16:56:17 -070052${olt_ip} X.X.X.X
53${olt_user} user
54${olt_pass} pass
55${kubernetes_conf} x.conf
56${kubernetes_yml} x.yml
57${helm_dir} ~/helm-charts
58${voltha_pod_num} 8
Suchitra Vemuriff825322018-09-07 14:00:04 -070059
Kailash Khalasia0810ce2018-09-10 13:03:27 -070060*** Test Cases ***
Kailash Khalasif3e0a9f2018-09-18 13:43:42 -070061ONU in Correct Location + Successful Auth Request
62 [Documentation] Validates E2E Ping Connectivity and object states for the given scenario:
63 ... Discovery of ONU Device after whitelist has been configured
64 ... Sending of a successful 802.1x auth request
65 ... Configuration of the destination servers interface and start dhcpd
66 ... Configuration of source server interface and execute dhclient on interface
67 ... Validate successful pings from src to dst
68 [Setup] None
You Wanga7442762018-10-03 11:45:03 -070069 Wait Until Keyword Succeeds 180s 10s Validate ONU States ACTIVE ENABLED
You Wangfa6d8cf2018-09-18 16:54:30 -070070 Wait Until Keyword Succeeds 60s 2s Validate ATT Workflow Driver SI ENABLED AWAITING
71 Wait Until Keyword Succeeds 60s 2s Validate Subscriber Status awaiting-auth
You Wang0c2b3662018-10-01 16:56:17 -070072 Send EAPOL Message True ${src_ip} ${src_user} ${src_pass} ${src_iface} wpa_supplicant.conf
You Wangfa6d8cf2018-09-18 16:54:30 -070073 Wait Until Keyword Succeeds 60s 2s Validate ATT Workflow Driver SI ENABLED APPROVED
74 Wait Until Keyword Succeeds 60s 2s Validate Subscriber Status enabled
You Wang0c2b3662018-10-01 16:56:17 -070075 Validate DHCP and Ping True True
76
77ONU in Correct Location + Skip Auth
78 [Documentation] Validates E2E Ping Connectivity and object states for the given scenario:
79 ... Discovery of ONU Device after whitelist has been configured
80 ... Configuration of the destination servers interface and start dhcpd
81 ... Configuration of source server interface and execute dhclient on interface
82 ... Validate failed DHCP and pings from src to dst
You Wanga7442762018-10-03 11:45:03 -070083 Wait Until Keyword Succeeds 180s 10s Validate ONU States ACTIVE ENABLED
You Wang0c2b3662018-10-01 16:56:17 -070084 Wait Until Keyword Succeeds 60s 2s Validate ATT Workflow Driver SI ENABLED AWAITING
85 Wait Until Keyword Succeeds 60s 2s Validate Subscriber Status awaiting-auth
86 Validate DHCP and Ping False False
87
88ONU not in Whitelist + Failed Auth Request
89 [Documentation] Validates E2E Ping Connectivity and object states for the given scenario:
90 ... Discovery of ONU Device that is not in the whitelist
91 ... Sending a 802.1x auth request
92 ... Configuration of the destination servers interface and start dhcpd
93 ... Configuration of source server interface and execute dhclient on interface
94 ... Validate failed DHCP and pings from src to dst
95 [Setup] None
96 ${SubscriberList} = Get Variable Value ${slist}
97 ${SubscriberDict}= utils.listToDict ${SubscriberList} 0
98 Wait Until Keyword Succeeds 120s 15s CORD Post ${VOLT_SUBSCRIBER} ${SubscriberDict}
99 ${VoltDeviceList} = Get Variable Value ${vlist}
100 ${VoltDeviceDict}= utils.listToDict ${VoltDeviceList} 0
101 CORD Post ${VOLT_DEVICE} ${VoltDeviceDict}
You Wanga7442762018-10-03 11:45:03 -0700102 Wait Until Keyword Succeeds 180s 10s Validate ONU States UNKNOWN DISABLED
You Wang0c2b3662018-10-01 16:56:17 -0700103 Wait Until Keyword Succeeds 60s 2s Validate ATT Workflow Driver SI DISABLED AWAITING
104 Wait Until Keyword Succeeds 60s 2s Validate Subscriber Status awaiting-auth
105 Send EAPOL Message False ${src_ip} ${src_user} ${src_pass} ${src_iface} wpa_supplicant.conf
106 Wait Until Keyword Succeeds 60s 2s Validate ATT Workflow Driver SI DISABLED AWAITING
107 Wait Until Keyword Succeeds 60s 2s Validate Subscriber Status awaiting-auth
108 Validate DHCP and Ping False False
Suchitra Vemuriff825322018-09-07 14:00:04 -0700109
110*** Keywords ***
Kailash Khalasif3e0a9f2018-09-18 13:43:42 -0700111Setup
112 ${auth} = Create List ${XOS_USER} ${XOS_PASSWD}
113 ${HEADERS} Create Dictionary Content-Type=application/json
114 Create Session ${server_ip} http://${server_ip}:${server_port} auth=${AUTH} headers=${HEADERS}
115 ${att_workflow_service_id}= Get Service Owner Id ${ATT_SERVICE}
116 ${volt_service_id}= Get Service Owner Id ${VOLT_SERVICE}
Kailash Khalasi30a6a392018-09-10 14:32:39 -0700117 ${AttWhiteListList}= utils.jsonToList ${WHITELIST_PATHFILE} AttWhiteListInfo
118 Set Suite Variable ${alist} ${AttWhiteListList}
119 ${AttWhiteListList} = Get Variable Value ${alist}
Suchitra Vemuriff825322018-09-07 14:00:04 -0700120 ${AttWhiteListDict}= utils.listToDict ${AttWhiteListList} 0
Kailash Khalasif3e0a9f2018-09-18 13:43:42 -0700121 ${AttWhiteListDict}= utils.setFieldValueInDict ${AttWhiteListDict} owner_id ${att_workflow_service_id}
Suchitra Vemuriff825322018-09-07 14:00:04 -0700122 ${onu_device}= Get From Dictionary ${AttWhiteListDict} serial_number
123 Log ${onu_device}
Suchitra Vemuriff825322018-09-07 14:00:04 -0700124 Set Global Variable ${onu_device}
Kailash Khalasi30a6a392018-09-10 14:32:39 -0700125 ${SubscriberList}= utils.jsonToList ${SUBSCRIBER_PATHFILE} SubscriberInfo
126 Set Global Variable ${slist} ${SubscriberList}
Kailash Khalasi6dab16e2018-09-17 20:24:08 -0700127 ${SubscriberList} = Get Variable Value ${slist}
128 ${SubscriberDict}= utils.listToDict ${SubscriberList} 0
129 ${s_tag}= utils.getFieldValueFromDict ${SubscriberDict} s_tag
130 ${c_tag}= utils.getFieldValueFromDict ${SubscriberDict} c_tag
Kailash Khalasif3e0a9f2018-09-18 13:43:42 -0700131 ${VoltDeviceList}= utils.jsonToList ${VOLT_DEVICE_PATHFILE} VOLTDeviceInfo
132 Set Global Variable ${vlist} ${VoltDeviceList}
Kailash Khalasi6dab16e2018-09-17 20:24:08 -0700133 Set Suite Variable ${s_tag}
134 Set Suite Variable ${c_tag}
Suchitra Vemuriff825322018-09-07 14:00:04 -0700135
Suchitra Vemuri32fc2f22018-09-10 12:06:01 -0700136Teardown
Kailash Khalasif3e0a9f2018-09-18 13:43:42 -0700137 [Documentation] Performs any additional cleanup required
138 Log Suite Teardown cleanup
139 Delete All Sessions
140
141Create Models
142 [Documentation] Re-create Subscriber, whitelist, and olt-device models to test
143 Log Re-creating objects
144 #create attwhitelist
145 ${AttWhiteListList} = Get Variable Value ${alist}
146 ${AttWhiteListDict}= utils.listToDict ${AttWhiteListList} 0
147 CORD Post ${ATT_WHITELIST} ${AttWhiteListDict}
148 #create subscriber
149 ${SubscriberList} = Get Variable Value ${slist}
150 ${SubscriberDict}= utils.listToDict ${SubscriberList} 0
151 Wait Until Keyword Succeeds 120s 15s CORD Post ${VOLT_SUBSCRIBER} ${SubscriberDict}
152 #create olt device
153 ${VoltDeviceList} = Get Variable Value ${vlist}
154 ${VoltDeviceDict}= utils.listToDict ${VoltDeviceList} 0
155 CORD Post ${VOLT_DEVICE} ${VoltDeviceDict}
156
157Clean Test Environment
158 [Documentation] Delete xos objects, kills processes and cleans up interfaces on src+dst servers
Kailash Khalasi052cbb12018-09-13 16:50:13 -0700159 Run Keyword And Ignore Error Kill Linux Process ${src_ip} ${src_user} ${src_pass} [w]pa_supplicant
160 Run Keyword And Ignore Error Kill Linux Process ${src_ip} ${src_user} ${src_pass} [d]hclient
Kailash Khalasi6dab16e2018-09-17 20:24:08 -0700161 Run Keyword And Ignore Error Kill Linux Process ${dst_ip} ${dst_user} ${dst_pass} [d]hcpd
Kailash Khalasi052cbb12018-09-13 16:50:13 -0700162 Delete IP Addresses from Interface on Remote Host ${src_ip} ${src_user} ${src_pass} ${src_iface}
You Wang0c2b3662018-10-01 16:56:17 -0700163 Delete Interface on Remote Host ${dst_ip} ${dst_user} ${dst_pass} ${dst_dp_iface}.${s_tag}
Kailash Khalasiadc4b4d2018-09-19 10:23:55 -0700164 Wait Until Keyword Succeeds 60s 2s Clean Up Objects ${VOLT_SUBSCRIBER}
165 Wait Until Keyword Succeeds 60s 2s Clean Up Objects ${VOLT_DEVICE}
166 Wait Until Keyword Succeeds 60s 2s Clean Up Objects ${ATT_WHITELIST}
You Wang0c2b3662018-10-01 16:56:17 -0700167 Wait Until Keyword Succeeds 120s 10s Check Remote System Reachability False ${olt_ip}
168 Wait Until Keyword Succeeds 120s 10s Check Remote System Reachability True ${olt_ip}
169 Wait Until Keyword Succeeds 120s 10s Openolt is Up ${olt_ip} ${olt_user} ${olt_pass}
170 Wait Until Keyword Succeeds 300s 10s Reinstall Voltha
Kailash Khalasia0810ce2018-09-10 13:03:27 -0700171
172Validate ONU States
173 [Arguments] ${expected_op_status} ${expected_admin_status}
174 ${operational_status} ${admin_status} ONU Status Check ${onu_device}
175 Should Be Equal ${operational_status} ${expected_op_status}
176 Should Be Equal ${admin_status} ${expected_admin_status}
177
178Validate ATT Workflow Driver SI
179 [Arguments] ${expected_status} ${expected_auth_status}
You Wangfa6d8cf2018-09-18 16:54:30 -0700180 ${onu_state} ${authentication_status} Service Instance Status Check ${onu_device}
181 Should Be Equal ${onu_state} ${expected_status}
Kailash Khalasia0810ce2018-09-10 13:03:27 -0700182 Should Be Equal ${authentication_status} ${expected_auth_status}
183
184Validate Subscriber Status
185 [Arguments] ${exepected_status}
186 ${status} Subscriber Status Check ${onu_device}
You Wangfa6d8cf2018-09-18 16:54:30 -0700187 Should Be Equal ${status} ${exepected_status}
You Wang0c2b3662018-10-01 16:56:17 -0700188
189Validate DHCP and Ping
190 [Arguments] ${dhcp_pass} ${ping_pass}
191 Add Double Vlan Interface on Host ${dst_ip} ${dst_user} ${dst_pass} ${dst_dp_iface} ${s_tag} ${c_tag}
192 Add IP Address on Interface on Host ${dst_ip} ${dst_user} ${dst_pass} ${dst_dp_ip}/24 ${dst_dp_iface}.${s_tag}.${c_tag}
193 Start DHCP Server on Remote Host ${dst_ip} ${dst_user} ${dst_pass} ${dst_dp_iface}.${s_tag}.${c_tag}
194 Send Dhclient Request ${src_ip} ${src_user} ${src_pass} ${src_iface}
195 Run Keyword If '${dhcp_pass}' == 'True' Wait Until Keyword Succeeds 60s 5s Check IPv4 Address on DHCP Client True ${src_ip} ${src_user} ${src_pass} ${src_iface}
196 Run Keyword If '${dhcp_pass}' == 'False' Sleep 10s
197 Run Keyword If '${dhcp_pass}' == 'False' Check IPv4 Address on DHCP Client False ${src_ip} ${src_user} ${src_pass} ${src_iface}
198 Run Keyword If '${ping_pass}' == 'True' Wait Until Keyword Succeeds 60s 5s Test Ping PASS ${src_ip} ${src_user} ${src_pass} ${dst_dp_ip} ${src_iface}
199 Run Keyword If '${ping_pass}' == 'False' Wait Until Keyword Succeeds 60s 5s Test Ping FAIL ${src_ip} ${src_user} ${src_pass} ${dst_dp_ip} ${src_iface}
200
201Reinstall Voltha
202 Run export KUBECONFIG=${kubernetes_conf}
203 Run helm delete --purge voltha
204 Wait Until Keyword Succeeds 60s 10s Helm Chart is Removed ${kubernetes_conf} voltha
205 Wait Until Keyword Succeeds 120s 10s Kubernetes PODs in Namespace are Removed ${kubernetes_conf} voltha
206 ${rc} ${output}= Run And Return Rc And Output helm install -n voltha -f ${kubernetes_yml} --set etcd-operator.customResources.createEtcdClusterCRD=false ${helm_dir}/voltha
207 ${rc} ${output}= Run And Return Rc And Output helm upgrade -f ${kubernetes_yml} --set etcd-operator.customResources.createEtcdClusterCRD=true voltha ${helm_dir}/voltha
208 Wait Until Keyword Succeeds 30s 5s Kubernetes PODs in Namespace are Running ${kubernetes_conf} voltha ${voltha_pod_num}
209 Sleep 10s