blob: 2acdd492ba2ffaf086268f3c0b62f98017d363c6 [file] [log] [blame]
Suchitra Vemuri58eeaa32019-05-23 22:55:30 -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
15*** Settings ***
16Documentation Test various with ATT workflow using multiple ONUs
17Suite Setup Setup Suite
18Suite Teardown Teardown Suite
19Test Setup Setup Test
20Test Teardown Teardown Test
21Library Collections
22Library String
23Library OperatingSystem
24Library XML
25Library RequestsLibrary
Zack Williams821c5022020-01-15 15:11:46 -070026Library CORDRobot
27Library ImportResource resources=CORDRobot
Suchitra Vemuri58eeaa32019-05-23 22:55:30 -070028Variables ../../Properties/RestApiProperties.py
29
30*** Variables ***
Suchitra Vemuri94ea16b2019-06-04 17:16:12 -070031${POD_NAME} onlab-pod1-qa
Suchitra Vemuri58eeaa32019-05-23 22:55:30 -070032${KUBERNETES_CONFIGS_DIR} ~/pod-configs/kubernetes-configs
33${HELM_CHARTS_DIR} ~/helm-charts
34${WHITELIST_PATHFILE} ${CURDIR}/data/${POD_NAME}/ATTWhiteList.json
35${SUBSCRIBER_PATHFILE} ${CURDIR}/data/${POD_NAME}/ATTSubscriber.json
36${VOLT_DEVICE_PATHFILE} ${CURDIR}/data/${POD_NAME}/RealOLTDevice.json
37${KUBERNETES_CONF} ${KUBERNETES_CONFIGS_DIR}/${POD_NAME}.conf
38${KUBERNETES_YAML} ${KUBERNETES_CONFIGS_DIR}/${POD_NAME}.yml
39${VOLTHA_POD_NUM} 8
40
41*** Test Cases ***
42ONU in Correct Location with two ONUs
Suchitra Vemuri9ba61b82019-06-05 15:00:21 -070043 [Documentation] Test with two ONUs(same s-tag) - authenticate/dhcp/ping on both the ONUs
Suchitra Vemuri58eeaa32019-05-23 22:55:30 -070044 ... Validates E2E Ping Connectivity and object states for the given scenario:
45 ... Configure whitelist with correct first ONU location
46 ... Validate successful authentication/DHCP/E2E ping
47 ... Configure whitelist with correct details for the second ONU location
48 ... Validate successful authentication/DHCP/E2E ping for the second ONU
49 ... Validates that the first ONU can still ping
Suchitra Vemuri94ea16b2019-06-04 17:16:12 -070050 #[Setup] None
Suchitra Vemuri9ba61b82019-06-05 15:00:21 -070051 [Teardown] None
Suchitra Vemuri58eeaa32019-05-23 22:55:30 -070052 [Tags] multipleONU-test1
Suchitra Vemuria0cc7872019-06-12 16:23:00 -070053 Log $[src0['onu']}
Suchitra Vemuri58eeaa32019-05-23 22:55:30 -070054 Wait Until Keyword Succeeds 300s 15s Validate ONU States ACTIVE ENABLED ${src0['onu']}
55 Wait Until Keyword Succeeds 60s 2s Validate ATT Workflow Driver SI ENABLED AWAITING ${src0['onu']}
56 Wait Until Keyword Succeeds 60s 2s Validate Subscriber Status awaiting-auth ${src0['onu']}
57 Validate Authentication True ${src0['dp_iface_name']} wpa_supplicant.conf ${src0['ip']} ${src0['user']} ${src0['pass']} ${src0['container_type']} ${src0['container_name']}
58 Wait Until Keyword Succeeds 60s 2s Validate ATT Workflow Driver SI ENABLED APPROVED ${src0['onu']}
59 Wait Until Keyword Succeeds 60s 2s Validate Subscriber Status enabled ${src0['onu']}
Suchitra Vemuri7dee24a2019-05-24 11:59:52 -070060 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']}
Suchitra Vemuri58eeaa32019-05-23 22:55:30 -070061 #Second ONU
Suchitra Vemuria0cc7872019-06-12 16:23:00 -070062 Log $[src1['onu']}
Suchitra Vemuri58eeaa32019-05-23 22:55:30 -070063 Wait Until Keyword Succeeds 300s 15s Validate ONU States ACTIVE ENABLED ${src1['onu']}
Suchitra Vemuricb4d5a22019-05-24 11:39:38 -070064 Wait Until Keyword Succeeds 60s 2s Validate ATT Workflow Driver SI ENABLED AWAITING ${src1['onu']}
65 Wait Until Keyword Succeeds 60s 2s Validate Subscriber Status awaiting-auth ${src1['onu']}
66 Validate Authentication True ${src1['dp_iface_name']} wpa_supplicant.conf ${src1['ip']} ${src1['user']} ${src1['pass']} ${src1['container_type']} ${src1['container_name']}
67 Wait Until Keyword Succeeds 60s 2s Validate ATT Workflow Driver SI ENABLED APPROVED ${src1['onu']}
68 Wait Until Keyword Succeeds 60s 2s Validate Subscriber Status enabled ${src1['onu']}
69 Validate DHCP and Ping True True ${src1['dp_iface_name']} ${src1['s_tag']} ${src1['c_tag']} ${dst1['dp_iface_ip_qinq']} ${src1['ip']} ${src1['user']} ${src1['pass']} ${src1['container_type']} ${src1['container_name']} ${dst1['dp_iface_name']} ${dst1['ip']} ${dst1['user']} ${dst1['pass']} ${dst1['container_type']} ${dst1['container_name']}
Suchitra Vemuri58eeaa32019-05-23 22:55:30 -070070 # Validate that the first ONU can still ping
Suchitra Vemuri7dee24a2019-05-24 11:59:52 -070071 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']}
Suchitra Vemuri58eeaa32019-05-23 22:55:30 -070072
Suchitra Vemuri9ba61b82019-06-05 15:00:21 -070073Deletion of one ONU from the whitelist while other ONU exists
74 [Documentation] Test with two ONUs(same s-tag) - delete one ONU from the whitelist
75 ... Validates E2E Ping Connectivity and object states for the given scenario:
76 ... After validating authentication/dhcp/ping from the above tests
77 ... Delete the second ONU from the whitelist
78 ... Validate that pings fail on the second ONU
79 ... Validate that the first ONU can still ping
Suchitra Vemuria0cc7872019-06-12 16:23:00 -070080 [Setup] None
81 [Teardown] None
Suchitra Vemuri9ba61b82019-06-05 15:00:21 -070082 [Tags] multipleONU-test2
83 #Second ONU
Suchitra Vemuria0cc7872019-06-12 16:23:00 -070084 Remove Whitelist ${src1['onu']}
Suchitra Vemuri9ba61b82019-06-05 15:00:21 -070085 Wait Until Keyword Succeeds 60s 2s Validate Subscriber Status awaiting-auth ${src1['onu']}
Suchitra Vemuria0cc7872019-06-12 16:23:00 -070086 Wait Until Keyword Succeeds 60s 2s Check Ping False ${dst1['dp_iface_ip_qinq']} ${src1['dp_iface_name']} ${src1['ip']} ${src1['user']} ${src1['pass']} ${src1['container_type']} ${src1['container_name']}
87 # Validate that the first ONU can still ping
88 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']}
89
90Readd the deleted ONU to the whitelist while other ONU exists
91 [Documentation] Test with two ONUs(same s-tag) - readd deleted ONU to the whitelist
92 ... Validates E2E Ping Connectivity and object states for the given scenario:
93 ... After validating authentication/dhcp/ping from the above tests
94 ... Add the second ONU to the whitelist
95 ... Perform authentication/dhcp/ping on the second ONU
96 ... Validate that pings succeed on the second ONU
97 ... Validate that the first ONU can still ping
98 [Setup] None
99 [Teardown] None
100 [Tags] multipleONU-test3
101 #Second ONU
102 Create Whitelist 1
103 Log $[src1['onu']}
104 Wait Until Keyword Succeeds 300s 15s Validate ONU States ACTIVE ENABLED ${src1['onu']}
105 Wait Until Keyword Succeeds 60s 2s Validate ATT Workflow Driver SI ENABLED AWAITING ${src1['onu']}
106 Wait Until Keyword Succeeds 60s 2s Validate Subscriber Status awaiting-auth ${src1['onu']}
107 Validate Authentication True ${src1['dp_iface_name']} wpa_supplicant.conf ${src1['ip']} ${src1['user']} ${src1['pass']} ${src1['container_type']} ${src1['container_name']}
108 Wait Until Keyword Succeeds 60s 2s Validate ATT Workflow Driver SI ENABLED APPROVED ${src1['onu']}
109 Wait Until Keyword Succeeds 60s 2s Validate Subscriber Status enabled ${src1['onu']}
110 Validate DHCP and Ping True True ${src1['dp_iface_name']} ${src1['s_tag']} ${src1['c_tag']} ${dst1['dp_iface_ip_qinq']} ${src1['ip']} ${src1['user']} ${src1['pass']} ${src1['container_type']} ${src1['container_name']} ${dst1['dp_iface_name']} ${dst1['ip']} ${dst1['user']} ${dst1['pass']} ${dst1['container_type']} ${dst1['container_name']}
Suchitra Vemuri9ba61b82019-06-05 15:00:21 -0700111 # Validate that the first ONU can still ping
112 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']}
113
Suchitra Vemuri58eeaa32019-05-23 22:55:30 -0700114*** Keywords ***
115Setup Suite
116 ${auth} = Create List ${XOS_USER} ${XOS_PASSWD}
117 ${HEADERS} Create Dictionary Content-Type=application/json
118 Create Session ${server_ip} http://${server_ip}:${server_port} auth=${AUTH} headers=${HEADERS}
119 ${att_workflow_service_id}= Get Service Owner Id ${ATT_SERVICE}
120 ${volt_service_id}= Get Service Owner Id ${VOLT_SERVICE}
Zack Williams821c5022020-01-15 15:11:46 -0700121 ${AttWhiteListList}= CORDRobot.jsonToList ${WHITELIST_PATHFILE} AttWhiteListInfo
Suchitra Vemuri58eeaa32019-05-23 22:55:30 -0700122 Set Suite Variable ${AttWhiteListList}
Zack Williams821c5022020-01-15 15:11:46 -0700123 ${AttWhiteListDict}= CORDRobot.listToDict ${AttWhiteListList} 0
124 ${AttWhiteListDict}= CORDRobot.setFieldValueInDict ${AttWhiteListDict} owner_id ${att_workflow_service_id}
Suchitra Vemuri94ea16b2019-06-04 17:16:12 -0700125 Set Suite Variable ${att_workflow_service_id}
Suchitra Vemuri58eeaa32019-05-23 22:55:30 -0700126 ${onu_location}= Get From Dictionary ${AttWhiteListDict} pon_port_id
127 Set Global Variable ${onu_location}
Zack Williams821c5022020-01-15 15:11:46 -0700128 ${SubscriberList}= CORDRobot.jsonToList ${SUBSCRIBER_PATHFILE} SubscriberInfo
Suchitra Vemuri58eeaa32019-05-23 22:55:30 -0700129 Set Global Variable ${SubscriberList}
Zack Williams821c5022020-01-15 15:11:46 -0700130 ${SubscriberDict}= CORDRobot.listToDict ${SubscriberList} 0
131 ${s_tag}= CORDRobot.getFieldValueFromDict ${SubscriberDict} s_tag
132 ${c_tag}= CORDRobot.getFieldValueFromDict ${SubscriberDict} c_tag
133 ${VoltDeviceList}= CORDRobot.jsonToList ${VOLT_DEVICE_PATHFILE} VOLTDeviceInfo
134 ${VoltDeviceDict}= CORDRobot.setFieldValueInDict ${VoltDeviceList[0]} volt_service_id ${volt_service_id}
Suchitra Vemuri58eeaa32019-05-23 22:55:30 -0700135 Set Global Variable ${VoltDeviceList}
136 Set Global Variable ${VoltDeviceDict}
137 Set Suite Variable ${s_tag}
138 Set Suite Variable ${c_tag}
Suchitra Vemurid1488e52019-05-31 12:38:47 -0700139 ${olt_ip}= Evaluate ${olts}[0].get("ip")
140 ${olt_user}= Evaluate ${olts}[0].get("user")
141 ${olt_pass}= Evaluate ${olts}[0].get("pass")
142 ${k8s_node_ip}= Evaluate ${nodes}[0].get("ip")
143 ${k8s_node_user}= Evaluate ${nodes}[0].get("user")
144 ${k8s_node_pass}= Evaluate ${nodes}[0].get("pass")
Suchitra Vemuri94ea16b2019-06-04 17:16:12 -0700145 Set Suite Variable ${olt_ip}
Suchitra Vemuri94ea16b2019-06-04 17:16:12 -0700146 Set Suite Variable ${olt_user}
147 Set Suite Variable ${olt_pass}
148 Set Suite Variable ${k8s_node_ip}
149 Set Suite Variable ${k8s_node_user}
150 Set Suite Variable ${k8s_node_pass}
151 Set Global Variable ${export_kubeconfig} export KUBECONFIG=${KUBERNETES_CONF}
Suchitra Vemuri58eeaa32019-05-23 22:55:30 -0700152 @{container_list}= Create List
153 Append To List ${container_list} att-workflow-att-workflow-driver
154 Append To List ${container_list} seba-services-volt
155 Append To List ${container_list} seba-services-rcord
156 Append To List ${container_list} onos
157 Append To List ${container_list} seba-services-fabric-crossconnect
158 Append To List ${container_list} xos-core
159 Append To List ${container_list} vcore
160 Set Suite Variable ${container_list}
161 Set Deployment Config Variables
162 ${datetime}= Get Current Datetime On Kubernetes Node ${k8s_node_ip} ${k8s_node_user} ${k8s_node_pass}
163 Set Suite Variable ${datetime}
164
165Teardown Suite
166 [Documentation] Performs any additional cleanup required
167 Log Suite Teardown cleanup
168 Delete All Sessions
169
170Setup Test
171 [Documentation] Re-create Subscriber, whitelist, and olt-device models to test
172 Log Re-creating objects
173 ${datetime}= Get Current Datetime On Kubernetes Node ${k8s_node_ip} ${k8s_node_user} ${k8s_node_pass}
174 Set Suite Variable ${datetime}
Suchitra Vemuri94ea16b2019-06-04 17:16:12 -0700175 Create Whitelist 0
176 Create Whitelist 1
177 Create Subscriber 0
178 Create Subscriber 1
Suchitra Vemuri58eeaa32019-05-23 22:55:30 -0700179 Create VOLT
180 Wait Until Keyword Succeeds 200s 15s Validate OLT States ACTIVE ENABLED ${olt_ip}
181
182Teardown Test
183 [Documentation] Delete xos objects, kills processes and cleans up interfaces on src+dst servers
184 Get VOLTHA Status
185 Get ONOS Status
186 Clean Up Linux
187 Clean Up XOS
188 Log Kubernetes Containers Logs Since Time ${datetime} ${container_list}
189
190Clean Up Linux
191 [Documentation] Kill processes and clean up interfaces on src+dst servers
192 Run Keyword And Ignore Error Kill Linux Process [w]pa_supplicant ${src0['ip']} ${src0['user']} ${src0['pass']} ${src0['container_type']} ${src0['container_name']}
193 Run Keyword And Ignore Error Kill Linux Process [d]hclient ${src0['ip']} ${src0['user']} ${src0['pass']} ${src0['container_type']} ${src0['container_name']}
194 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']}
195 Delete IP Addresses from Interface on Remote Host ${src0['dp_iface_name']} ${src0['ip']} ${src0['user']} ${src0['pass']} ${src0['container_type']} ${src0['container_name']}
196 Run Keyword If '${dst0['ip']}' != '${None}' Delete Interface on Remote Host ${dst0['dp_iface_name']}.${s_tag} ${dst0['ip']} ${dst0['user']} ${dst0['pass']} ${dst0['container_type']} ${dst0['container_name']}
197
198Clean Up XOS
199 [Documentation] Clean up all XOS objects and reinstall voltha after OLT reboots
200 Wait Until Keyword Succeeds 60s 2s Clean Up Objects ${VOLT_SUBSCRIBER}
201 Wait Until Keyword Succeeds 60s 2s Clean Up Objects ${ATT_WHITELIST}
202 Sleep 20s
203 Wait Until Keyword Succeeds 30s 2s Validate Subscriber Count 0
204 Wait Until Keyword Succeeds 60s 2s Clean Up Objects ${VOLT_DEVICE}
205 Wait Until Keyword Succeeds 60s 2s Clean Up Objects ${ATT_SERVICEINSTANCES}
206 Wait Until Keyword Succeeds 120s 10s Check Remote System Reachability False ${olt_ip}
207 Wait Until Keyword Succeeds 120s 10s Check Remote System Reachability True ${olt_ip}
208 Wait Until Keyword Succeeds 120s 10s Openolt is Up ${olt_ip} ${olt_user} ${olt_pass}
209
210Create Whitelist
211 [Arguments] ${index_id}
Zack Williams821c5022020-01-15 15:11:46 -0700212 ${AttWhiteListDict}= CORDRobot.listToDict ${AttWhiteListList} ${index_id}
213 ${AttWhiteListDict}= CORDRobot.setFieldValueInDict ${AttWhiteListDict} owner_id ${att_workflow_service_id}
Suchitra Vemuri58eeaa32019-05-23 22:55:30 -0700214 CORD Post ${ATT_WHITELIST} ${AttWhiteListDict}
215
216Remove Whitelist
217 [Arguments] ${onu_device}
Suchitra Vemuria0cc7872019-06-12 16:23:00 -0700218 Log ${onu_device}
Suchitra Vemuri58eeaa32019-05-23 22:55:30 -0700219 ${whitelist_id}= Retrieve Whitelist Entry ${onu_device}
Suchitra Vemuri58eeaa32019-05-23 22:55:30 -0700220 CORD Delete ${ATT_WHITELIST} ${whitelist_id}
221
222Update Whitelist with Wrong Location
223 [Arguments] ${onu_device}
224 ${whitelist_id}= Retrieve Whitelist Entry ${onu_device}
225 CORD Put ${ATT_WHITELIST} {"pon_port_id": 5345 } ${whitelist_id}
226
227Update Whitelist with Correct Location
228 [Arguments] ${onu_device}
229 ${whitelist_id}= Retrieve Whitelist Entry ${onu_device}
230 CORD Put ${ATT_WHITELIST} {"pon_port_id": ${onu_location} } ${whitelist_id}
231
232Create Subscriber
233 [Arguments] ${index_id}
Zack Williams821c5022020-01-15 15:11:46 -0700234 ${SubscriberDict}= CORDRobot.listToDict ${SubscriberList} ${index_id}
Suchitra Vemuri58eeaa32019-05-23 22:55:30 -0700235 Wait Until Keyword Succeeds 120s 15s CORD Post ${VOLT_SUBSCRIBER} ${SubscriberDict}
236
237Remove Subscriber
Suchitra Vemuri94ea16b2019-06-04 17:16:12 -0700238 [Arguments] ${c_tag}
Suchitra Vemuri58eeaa32019-05-23 22:55:30 -0700239 ${subscriber_id}= Retrieve Subscriber ${c_tag}
240 CORD Delete ${VOLT_SUBSCRIBER} ${subscriber_id}
241
242Create VOLT
243 CORD Post ${VOLT_DEVICE} ${VoltDeviceDict}
244
245Update ONU AdminState
Suchitra Vemurid1488e52019-05-31 12:38:47 -0700246 [Arguments] ${onu_device} ${new_admin_state}
247 ${onudevice_id}= Retrieve ONU Device ${onu_device}
Suchitra Vemuri58eeaa32019-05-23 22:55:30 -0700248 CORD Put ${VOLT_DEVICE} ${"admin_state": ${new_admin_state} } ${onudevice_id}
249