blob: 48b2fe6c738cdc89428175ddc3a2fe9a8ff2312d [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 ***
You Wang59ded6c2018-10-05 17:43:44 -070016Documentation Test various end-to-end scenarios with ATT workflow
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 ***
You Wang59ded6c2018-10-05 17:43:44 -070038${POD_NAME} flex-pod1-olt
39${KUBERNETES_CONFIGS_DIR} ~/pod-configs/kubernetes-configs
40${HELM_CHARTS_DIR} ~/helm-charts
41${WHITELIST_PATHFILE} ${CURDIR}/data/${POD_NAME}/ATTWhiteList.json
42${SUBSCRIBER_PATHFILE} ${CURDIR}/data/${POD_NAME}/ATTSubscriber.json
43${VOLT_DEVICE_PATHFILE} ${CURDIR}/data/${POD_NAME}/RealOLTDevice.json
44${KUBERNETES_CONF} ${KUBERNETES_CONFIGS_DIR}/${POD_NAME}.conf
45${KUBERNETES_YAML} ${KUBERNETES_CONFIGS_DIR}/${POD_NAME}.yml
46${VOLTHA_POD_NUM} 8
Suchitra Vemuriff825322018-09-07 14:00:04 -070047
Kailash Khalasia0810ce2018-09-10 13:03:27 -070048*** Test Cases ***
Kailash Khalasif3e0a9f2018-09-18 13:43:42 -070049ONU in Correct Location + Successful Auth Request
50 [Documentation] Validates E2E Ping Connectivity and object states for the given scenario:
51 ... Discovery of ONU Device after whitelist has been configured
52 ... Sending of a successful 802.1x auth request
53 ... Configuration of the destination servers interface and start dhcpd
54 ... Configuration of source server interface and execute dhclient on interface
55 ... Validate successful pings from src to dst
56 [Setup] None
You Wang88e1d852018-10-05 11:44:19 -070057 Wait Until Keyword Succeeds 300s 15s Validate ONU States ACTIVE ENABLED
You Wangfa6d8cf2018-09-18 16:54:30 -070058 Wait Until Keyword Succeeds 60s 2s Validate ATT Workflow Driver SI ENABLED AWAITING
59 Wait Until Keyword Succeeds 60s 2s Validate Subscriber Status awaiting-auth
You Wang59ded6c2018-10-05 17:43:44 -070060 Send EAPOL Message True ${src_iface} wpa_supplicant.conf ${src_ip} ${src_user} ${src_pass} ${src_container_name}
You Wangfa6d8cf2018-09-18 16:54:30 -070061 Wait Until Keyword Succeeds 60s 2s Validate ATT Workflow Driver SI ENABLED APPROVED
62 Wait Until Keyword Succeeds 60s 2s Validate Subscriber Status enabled
You Wang0c2b3662018-10-01 16:56:17 -070063 Validate DHCP and Ping True True
64
65ONU in Correct Location + Skip Auth
66 [Documentation] Validates E2E Ping Connectivity and object states for the given scenario:
67 ... Discovery of ONU Device after whitelist has been configured
68 ... Configuration of the destination servers interface and start dhcpd
69 ... Configuration of source server interface and execute dhclient on interface
70 ... Validate failed DHCP and pings from src to dst
You Wang88e1d852018-10-05 11:44:19 -070071 Wait Until Keyword Succeeds 300s 15s Validate ONU States ACTIVE ENABLED
You Wang0c2b3662018-10-01 16:56:17 -070072 Wait Until Keyword Succeeds 60s 2s Validate ATT Workflow Driver SI ENABLED AWAITING
73 Wait Until Keyword Succeeds 60s 2s Validate Subscriber Status awaiting-auth
74 Validate DHCP and Ping False False
75
76ONU not in Whitelist + Failed Auth Request
77 [Documentation] Validates E2E Ping Connectivity and object states for the given scenario:
78 ... Discovery of ONU Device that is not in the whitelist
79 ... Sending a 802.1x auth request
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
83 [Setup] None
84 ${SubscriberList} = Get Variable Value ${slist}
85 ${SubscriberDict}= utils.listToDict ${SubscriberList} 0
86 Wait Until Keyword Succeeds 120s 15s CORD Post ${VOLT_SUBSCRIBER} ${SubscriberDict}
87 ${VoltDeviceList} = Get Variable Value ${vlist}
88 ${VoltDeviceDict}= utils.listToDict ${VoltDeviceList} 0
89 CORD Post ${VOLT_DEVICE} ${VoltDeviceDict}
You Wang88e1d852018-10-05 11:44:19 -070090 Wait Until Keyword Succeeds 300s 15s Validate ONU States UNKNOWN DISABLED
You Wang0c2b3662018-10-01 16:56:17 -070091 Wait Until Keyword Succeeds 60s 2s Validate ATT Workflow Driver SI DISABLED AWAITING
92 Wait Until Keyword Succeeds 60s 2s Validate Subscriber Status awaiting-auth
You Wang59ded6c2018-10-05 17:43:44 -070093 Send EAPOL Message False ${src_iface} wpa_supplicant.conf ${src_ip} ${src_user} ${src_pass} ${src_container_name}
You Wang0c2b3662018-10-01 16:56:17 -070094 Wait Until Keyword Succeeds 60s 2s Validate ATT Workflow Driver SI DISABLED AWAITING
95 Wait Until Keyword Succeeds 60s 2s Validate Subscriber Status awaiting-auth
96 Validate DHCP and Ping False False
Suchitra Vemuriff825322018-09-07 14:00:04 -070097
98*** Keywords ***
Kailash Khalasif3e0a9f2018-09-18 13:43:42 -070099Setup
100 ${auth} = Create List ${XOS_USER} ${XOS_PASSWD}
101 ${HEADERS} Create Dictionary Content-Type=application/json
102 Create Session ${server_ip} http://${server_ip}:${server_port} auth=${AUTH} headers=${HEADERS}
103 ${att_workflow_service_id}= Get Service Owner Id ${ATT_SERVICE}
104 ${volt_service_id}= Get Service Owner Id ${VOLT_SERVICE}
Kailash Khalasi30a6a392018-09-10 14:32:39 -0700105 ${AttWhiteListList}= utils.jsonToList ${WHITELIST_PATHFILE} AttWhiteListInfo
106 Set Suite Variable ${alist} ${AttWhiteListList}
107 ${AttWhiteListList} = Get Variable Value ${alist}
Suchitra Vemuriff825322018-09-07 14:00:04 -0700108 ${AttWhiteListDict}= utils.listToDict ${AttWhiteListList} 0
Kailash Khalasif3e0a9f2018-09-18 13:43:42 -0700109 ${AttWhiteListDict}= utils.setFieldValueInDict ${AttWhiteListDict} owner_id ${att_workflow_service_id}
Suchitra Vemuriff825322018-09-07 14:00:04 -0700110 ${onu_device}= Get From Dictionary ${AttWhiteListDict} serial_number
111 Log ${onu_device}
Suchitra Vemuriff825322018-09-07 14:00:04 -0700112 Set Global Variable ${onu_device}
Kailash Khalasi30a6a392018-09-10 14:32:39 -0700113 ${SubscriberList}= utils.jsonToList ${SUBSCRIBER_PATHFILE} SubscriberInfo
114 Set Global Variable ${slist} ${SubscriberList}
Kailash Khalasi6dab16e2018-09-17 20:24:08 -0700115 ${SubscriberList} = Get Variable Value ${slist}
116 ${SubscriberDict}= utils.listToDict ${SubscriberList} 0
117 ${s_tag}= utils.getFieldValueFromDict ${SubscriberDict} s_tag
118 ${c_tag}= utils.getFieldValueFromDict ${SubscriberDict} c_tag
Kailash Khalasif3e0a9f2018-09-18 13:43:42 -0700119 ${VoltDeviceList}= utils.jsonToList ${VOLT_DEVICE_PATHFILE} VOLTDeviceInfo
120 Set Global Variable ${vlist} ${VoltDeviceList}
Kailash Khalasi6dab16e2018-09-17 20:24:08 -0700121 Set Suite Variable ${s_tag}
122 Set Suite Variable ${c_tag}
You Wang59ded6c2018-10-05 17:43:44 -0700123 Set Global Variable ${export_kubeconfig} export KUBECONFIG=${KUBERNETES_CONF}
124 # Read variables from yaml file
125 ${src_ip}= Evaluate ${hosts}.get("src").get("ip")
126 ${src_user}= Evaluate ${hosts}.get("src").get("user")
127 ${src_pass}= Evaluate ${hosts}.get("src").get("pass")
128 ${src_container_name}= Evaluate ${hosts}.get("src").get("container_name")
129 ${src_iface}= Evaluate ${hosts}.get("src").get("dp_iface_name")
130 ${dst_ip}= Evaluate ${hosts}.get("dst").get("ip")
131 ${dst_user} = Evaluate ${hosts}.get("dst").get("user")
132 ${dst_pass}= Evaluate ${hosts}.get("dst").get("pass")
133 ${dst_container_name}= Evaluate ${hosts}.get("dst").get("container_name")
134 ${dst_dp_iface}= Evaluate ${hosts}.get("dst").get("dp_iface_name")
135 ${dst_dp_ip}= Evaluate ${hosts}.get("dst").get("dp_iface_ip_qinq")
136 ${olt_ip}= Evaluate ${olts}[0].get("ip")
137 ${olt_user}= Evaluate ${olts}[0].get("user")
138 ${olt_pass}= Evaluate ${olts}[0].get("pass")
139 Set Suite Variable ${src_ip}
140 Set Suite Variable ${src_user}
141 Set Suite Variable ${src_pass}
142 Set Suite Variable ${src_container_name}
143 Set Suite Variable ${src_iface}
144 Set Suite Variable ${dst_ip}
145 Set Suite Variable ${dst_user}
146 Set Suite Variable ${dst_pass}
147 Set Suite Variable ${dst_container_name}
148 Set Suite Variable ${dst_dp_iface}
149 Set Suite Variable ${dst_dp_ip}
150 Set Suite Variable ${olt_ip}
151 Set Suite Variable ${olt_user}
152 Set Suite Variable ${olt_pass}
Suchitra Vemuriff825322018-09-07 14:00:04 -0700153
Suchitra Vemuri32fc2f22018-09-10 12:06:01 -0700154Teardown
Kailash Khalasif3e0a9f2018-09-18 13:43:42 -0700155 [Documentation] Performs any additional cleanup required
156 Log Suite Teardown cleanup
157 Delete All Sessions
158
159Create Models
160 [Documentation] Re-create Subscriber, whitelist, and olt-device models to test
161 Log Re-creating objects
162 #create attwhitelist
You Wang59ded6c2018-10-05 17:43:44 -0700163 ${AttWhiteListList}= Get Variable Value ${alist}
Kailash Khalasif3e0a9f2018-09-18 13:43:42 -0700164 ${AttWhiteListDict}= utils.listToDict ${AttWhiteListList} 0
165 CORD Post ${ATT_WHITELIST} ${AttWhiteListDict}
166 #create subscriber
You Wang59ded6c2018-10-05 17:43:44 -0700167 ${SubscriberList}= Get Variable Value ${slist}
Kailash Khalasif3e0a9f2018-09-18 13:43:42 -0700168 ${SubscriberDict}= utils.listToDict ${SubscriberList} 0
169 Wait Until Keyword Succeeds 120s 15s CORD Post ${VOLT_SUBSCRIBER} ${SubscriberDict}
170 #create olt device
You Wang59ded6c2018-10-05 17:43:44 -0700171 ${VoltDeviceList}= Get Variable Value ${vlist}
Kailash Khalasif3e0a9f2018-09-18 13:43:42 -0700172 ${VoltDeviceDict}= utils.listToDict ${VoltDeviceList} 0
173 CORD Post ${VOLT_DEVICE} ${VoltDeviceDict}
174
175Clean Test Environment
176 [Documentation] Delete xos objects, kills processes and cleans up interfaces on src+dst servers
You Wang59ded6c2018-10-05 17:43:44 -0700177 Run Keyword And Ignore Error Kill Linux Process [w]pa_supplicant ${src_ip} ${src_user} ${src_pass} ${src_container_name}
178 Run Keyword And Ignore Error Kill Linux Process [d]hclient ${src_ip} ${src_user} ${src_pass} ${src_container_name}
179 Run Keyword If '${dst_ip}' != '${None}' Run Keyword And Ignore Error Kill Linux Process [d]hcpd ${dst_ip} ${dst_user} ${dst_pass} ${dst_container_name}
180 Delete IP Addresses from Interface on Remote Host ${src_iface} ${src_ip} ${src_user} ${src_pass} ${src_container_name}
181 Run Keyword If '${dst_ip}' != '${None}' Delete Interface on Remote Host ${dst_dp_iface}.${s_tag} ${dst_ip} ${dst_user} ${dst_pass} ${dst_container_name}
You Wang88e1d852018-10-05 11:44:19 -0700182 Wait Until Keyword Succeeds 60s 2s Clean Up Objects ${VOLT_SUBSCRIBER}
183 Wait Until Keyword Succeeds 60s 2s Clean Up Objects ${VOLT_DEVICE}
184 Wait Until Keyword Succeeds 60s 2s Clean Up Objects ${ATT_WHITELIST}
You Wang0c2b3662018-10-01 16:56:17 -0700185 Wait Until Keyword Succeeds 120s 10s Check Remote System Reachability False ${olt_ip}
186 Wait Until Keyword Succeeds 120s 10s Check Remote System Reachability True ${olt_ip}
187 Wait Until Keyword Succeeds 120s 10s Openolt is Up ${olt_ip} ${olt_user} ${olt_pass}
188 Wait Until Keyword Succeeds 300s 10s Reinstall Voltha
Kailash Khalasia0810ce2018-09-10 13:03:27 -0700189
190Validate ONU States
191 [Arguments] ${expected_op_status} ${expected_admin_status}
192 ${operational_status} ${admin_status} ONU Status Check ${onu_device}
193 Should Be Equal ${operational_status} ${expected_op_status}
194 Should Be Equal ${admin_status} ${expected_admin_status}
195
196Validate ATT Workflow Driver SI
197 [Arguments] ${expected_status} ${expected_auth_status}
You Wangfa6d8cf2018-09-18 16:54:30 -0700198 ${onu_state} ${authentication_status} Service Instance Status Check ${onu_device}
199 Should Be Equal ${onu_state} ${expected_status}
Kailash Khalasia0810ce2018-09-10 13:03:27 -0700200 Should Be Equal ${authentication_status} ${expected_auth_status}
201
202Validate Subscriber Status
203 [Arguments] ${exepected_status}
204 ${status} Subscriber Status Check ${onu_device}
You Wangfa6d8cf2018-09-18 16:54:30 -0700205 Should Be Equal ${status} ${exepected_status}
You Wang0c2b3662018-10-01 16:56:17 -0700206
207Validate DHCP and Ping
You Wang88e1d852018-10-05 11:44:19 -0700208 [Arguments] ${dhcp_should_pass} ${ping_should_pass}
You Wang59ded6c2018-10-05 17:43:44 -0700209 Run Keyword If '${dst_ip}' != '${None}' Run Keywords
210 ... Add Double Vlan Interface on Host ${dst_dp_iface} ${s_tag} ${c_tag} ${dst_ip} ${dst_user} ${dst_pass} ${dst_container_name} AND
211 ... Add IP Address on Interface on Host ${dst_dp_ip}/24 ${dst_dp_iface}.${s_tag}.${c_tag} ${dst_ip} ${dst_user} ${dst_pass} ${dst_container_name} AND
212 ... Start DHCP Server on Remote Host ${dst_dp_iface}.${s_tag}.${c_tag} ${dst_ip} ${dst_user} ${dst_pass} ${dst_container_name}
213 Send Dhclient Request ${src_iface} ${src_ip} ${src_user} ${src_pass} ${src_container_name}
214 Run Keyword If '${dhcp_should_pass}' == 'True' Wait Until Keyword Succeeds 60s 5s Check IPv4 Address on DHCP Client True ${src_iface} ${src_ip} ${src_user} ${src_pass} ${src_container_name}
You Wang88e1d852018-10-05 11:44:19 -0700215 Run Keyword If '${dhcp_should_pass}' == 'False' Sleep 10s
You Wang59ded6c2018-10-05 17:43:44 -0700216 Run Keyword If '${dhcp_should_pass}' == 'False' Check IPv4 Address on DHCP Client False ${src_iface} ${src_ip} ${src_user} ${src_pass} ${src_container_name}
217 Run Keyword If '${ping_should_pass}' == 'True' Wait Until Keyword Succeeds 60s 5s Check Ping True ${dst_dp_ip} ${src_iface} ${src_ip} ${src_user} ${src_pass} ${src_container_name}
218 ... ELSE Wait Until Keyword Succeeds 60s 5s Check Ping False ${dst_dp_ip} ${src_iface} ${src_ip} ${src_user} ${src_pass} ${src_container_name}
You Wang0c2b3662018-10-01 16:56:17 -0700219
220Reinstall Voltha
You Wang88e1d852018-10-05 11:44:19 -0700221 Run ${export_kubeconfig}; helm delete --purge voltha
222 Wait Until Keyword Succeeds 60s 10s Helm Chart is Removed voltha
223 Wait Until Keyword Succeeds 120s 10s Kubernetes PODs in Namespace are Removed voltha
You Wang59ded6c2018-10-05 17:43:44 -0700224 Run ${export_kubeconfig}; cd ${HELM_CHARTS_DIR}; helm repo add incubator https://kubernetes-charts-incubator.storage.googleapis.com/
225 Run ${export_kubeconfig}; cd ${HELM_CHARTS_DIR}; helm dep up voltha
226 Run ${export_kubeconfig}; helm install -n voltha -f ${KUBERNETES_YAML} --set etcd-operator.customResources.createEtcdClusterCRD=false ${HELM_CHARTS_DIR}/voltha
227 Run ${export_kubeconfig}; helm upgrade -f ${KUBERNETES_YAML} --set etcd-operator.customResources.createEtcdClusterCRD=true voltha ${HELM_CHARTS_DIR}/voltha
228 Wait Until Keyword Succeeds 60s 10s Kubernetes PODs in Namespace are Running voltha ${VOLTHA_POD_NUM}
You Wang0c2b3662018-10-01 16:56:17 -0700229 Sleep 10s