blob: 5c27f6e580b5c1f37bf0ddb42c2b5c92d8431001 [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
26Library /home/cord/voltha/tests/atests/common/testCaseUtils.py
27Library ../../Framework/utils/utils.py
28Resource ../../Framework/utils/utils.robot
29Library ../../Framework/restApi.py
30Resource ../../Framework/Subscriber.robot
31Resource ../../Framework/ATTWorkFlowDriver.robot
32Resource ../../Framework/Kubernetes.robot
33Resource ../../Framework/ONU.robot
34Resource ../../Framework/OLT.robot
35Resource ../../Framework/DHCP.robot
36Variables ../../Properties/RestApiProperties.py
37
38*** Variables ***
Suchitra Vemuri94ea16b2019-06-04 17:16:12 -070039${POD_NAME} onlab-pod1-qa
Suchitra Vemuri58eeaa32019-05-23 22:55:30 -070040${KUBERNETES_CONFIGS_DIR} ~/pod-configs/kubernetes-configs
41${HELM_CHARTS_DIR} ~/helm-charts
42${WHITELIST_PATHFILE} ${CURDIR}/data/${POD_NAME}/ATTWhiteList.json
43${SUBSCRIBER_PATHFILE} ${CURDIR}/data/${POD_NAME}/ATTSubscriber.json
44${VOLT_DEVICE_PATHFILE} ${CURDIR}/data/${POD_NAME}/RealOLTDevice.json
45${KUBERNETES_CONF} ${KUBERNETES_CONFIGS_DIR}/${POD_NAME}.conf
46${KUBERNETES_YAML} ${KUBERNETES_CONFIGS_DIR}/${POD_NAME}.yml
47${VOLTHA_POD_NUM} 8
48
49*** Test Cases ***
50ONU in Correct Location with two ONUs
Suchitra Vemuri9ba61b82019-06-05 15:00:21 -070051 [Documentation] Test with two ONUs(same s-tag) - authenticate/dhcp/ping on both the ONUs
Suchitra Vemuri58eeaa32019-05-23 22:55:30 -070052 ... Validates E2E Ping Connectivity and object states for the given scenario:
53 ... Configure whitelist with correct first ONU location
54 ... Validate successful authentication/DHCP/E2E ping
55 ... Configure whitelist with correct details for the second ONU location
56 ... Validate successful authentication/DHCP/E2E ping for the second ONU
57 ... Validates that the first ONU can still ping
Suchitra Vemuri94ea16b2019-06-04 17:16:12 -070058 #[Setup] None
Suchitra Vemuri9ba61b82019-06-05 15:00:21 -070059 [Teardown] None
Suchitra Vemuri58eeaa32019-05-23 22:55:30 -070060 [Tags] multipleONU-test1
Suchitra Vemuri58eeaa32019-05-23 22:55:30 -070061 Wait Until Keyword Succeeds 300s 15s Validate ONU States ACTIVE ENABLED ${src0['onu']}
62 Wait Until Keyword Succeeds 60s 2s Validate ATT Workflow Driver SI ENABLED AWAITING ${src0['onu']}
63 Wait Until Keyword Succeeds 60s 2s Validate Subscriber Status awaiting-auth ${src0['onu']}
64 Validate Authentication True ${src0['dp_iface_name']} wpa_supplicant.conf ${src0['ip']} ${src0['user']} ${src0['pass']} ${src0['container_type']} ${src0['container_name']}
65 Wait Until Keyword Succeeds 60s 2s Validate ATT Workflow Driver SI ENABLED APPROVED ${src0['onu']}
66 Wait Until Keyword Succeeds 60s 2s Validate Subscriber Status enabled ${src0['onu']}
Suchitra Vemuri7dee24a2019-05-24 11:59:52 -070067 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 -070068 #Second ONU
69 Wait Until Keyword Succeeds 300s 15s Validate ONU States ACTIVE ENABLED ${src1['onu']}
Suchitra Vemuricb4d5a22019-05-24 11:39:38 -070070 Wait Until Keyword Succeeds 60s 2s Validate ATT Workflow Driver SI ENABLED AWAITING ${src1['onu']}
71 Wait Until Keyword Succeeds 60s 2s Validate Subscriber Status awaiting-auth ${src1['onu']}
72 Validate Authentication True ${src1['dp_iface_name']} wpa_supplicant.conf ${src1['ip']} ${src1['user']} ${src1['pass']} ${src1['container_type']} ${src1['container_name']}
73 Wait Until Keyword Succeeds 60s 2s Validate ATT Workflow Driver SI ENABLED APPROVED ${src1['onu']}
74 Wait Until Keyword Succeeds 60s 2s Validate Subscriber Status enabled ${src1['onu']}
75 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 -070076 # Validate that the first ONU can still ping
Suchitra Vemuri7dee24a2019-05-24 11:59:52 -070077 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 -070078
Suchitra Vemuri9ba61b82019-06-05 15:00:21 -070079Deletion of one ONU from the whitelist while other ONU exists
80 [Documentation] Test with two ONUs(same s-tag) - delete one ONU from the whitelist
81 ... Validates E2E Ping Connectivity and object states for the given scenario:
82 ... After validating authentication/dhcp/ping from the above tests
83 ... Delete the second ONU from the whitelist
84 ... Validate that pings fail on the second ONU
85 ... Validate that the first ONU can still ping
86 #[Setup] None
87 [Tags] multipleONU-test2
88 #Second ONU
89 Remove Whitelist $[src1['onu']}
90 Wait Until Keyword Succeeds 60s 2s Validate Subscriber Status awaiting-auth ${src1['onu']}
91 Wait Until Keyword Succeeds 60s 2s Check Ping False ${dst1['dst_iface_ip_qinq']} ${src1['dp_iface_name']} ${src1['ip']} ${src1['user']} ${src1['pass']}
92 # Validate that the first ONU can still ping
93 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']}
94
Suchitra Vemuri58eeaa32019-05-23 22:55:30 -070095*** Keywords ***
96Setup Suite
97 ${auth} = Create List ${XOS_USER} ${XOS_PASSWD}
98 ${HEADERS} Create Dictionary Content-Type=application/json
99 Create Session ${server_ip} http://${server_ip}:${server_port} auth=${AUTH} headers=${HEADERS}
100 ${att_workflow_service_id}= Get Service Owner Id ${ATT_SERVICE}
101 ${volt_service_id}= Get Service Owner Id ${VOLT_SERVICE}
102 ${AttWhiteListList}= utils.jsonToList ${WHITELIST_PATHFILE} AttWhiteListInfo
103 Set Suite Variable ${AttWhiteListList}
104 ${AttWhiteListDict}= utils.listToDict ${AttWhiteListList} 0
105 ${AttWhiteListDict}= utils.setFieldValueInDict ${AttWhiteListDict} owner_id ${att_workflow_service_id}
Suchitra Vemuri94ea16b2019-06-04 17:16:12 -0700106 Set Suite Variable ${att_workflow_service_id}
Suchitra Vemuri58eeaa32019-05-23 22:55:30 -0700107 ${onu_location}= Get From Dictionary ${AttWhiteListDict} pon_port_id
108 Set Global Variable ${onu_location}
109 ${SubscriberList}= utils.jsonToList ${SUBSCRIBER_PATHFILE} SubscriberInfo
110 Set Global Variable ${SubscriberList}
111 ${SubscriberDict}= utils.listToDict ${SubscriberList} 0
112 ${s_tag}= utils.getFieldValueFromDict ${SubscriberDict} s_tag
113 ${c_tag}= utils.getFieldValueFromDict ${SubscriberDict} c_tag
114 ${VoltDeviceList}= utils.jsonToList ${VOLT_DEVICE_PATHFILE} VOLTDeviceInfo
115 ${VoltDeviceDict}= utils.setFieldValueInDict ${VoltDeviceList[0]} volt_service_id ${volt_service_id}
116 Set Global Variable ${VoltDeviceList}
117 Set Global Variable ${VoltDeviceDict}
118 Set Suite Variable ${s_tag}
119 Set Suite Variable ${c_tag}
Suchitra Vemurid1488e52019-05-31 12:38:47 -0700120 ${olt_ip}= Evaluate ${olts}[0].get("ip")
121 ${olt_user}= Evaluate ${olts}[0].get("user")
122 ${olt_pass}= Evaluate ${olts}[0].get("pass")
123 ${k8s_node_ip}= Evaluate ${nodes}[0].get("ip")
124 ${k8s_node_user}= Evaluate ${nodes}[0].get("user")
125 ${k8s_node_pass}= Evaluate ${nodes}[0].get("pass")
Suchitra Vemuri94ea16b2019-06-04 17:16:12 -0700126 Set Suite Variable ${olt_ip}
Suchitra Vemuri94ea16b2019-06-04 17:16:12 -0700127 Set Suite Variable ${olt_user}
128 Set Suite Variable ${olt_pass}
129 Set Suite Variable ${k8s_node_ip}
130 Set Suite Variable ${k8s_node_user}
131 Set Suite Variable ${k8s_node_pass}
132 Set Global Variable ${export_kubeconfig} export KUBECONFIG=${KUBERNETES_CONF}
Suchitra Vemuri58eeaa32019-05-23 22:55:30 -0700133 @{container_list}= Create List
134 Append To List ${container_list} att-workflow-att-workflow-driver
135 Append To List ${container_list} seba-services-volt
136 Append To List ${container_list} seba-services-rcord
137 Append To List ${container_list} onos
138 Append To List ${container_list} seba-services-fabric-crossconnect
139 Append To List ${container_list} xos-core
140 Append To List ${container_list} vcore
141 Set Suite Variable ${container_list}
142 Set Deployment Config Variables
143 ${datetime}= Get Current Datetime On Kubernetes Node ${k8s_node_ip} ${k8s_node_user} ${k8s_node_pass}
144 Set Suite Variable ${datetime}
145
146Teardown Suite
147 [Documentation] Performs any additional cleanup required
148 Log Suite Teardown cleanup
149 Delete All Sessions
150
151Setup Test
152 [Documentation] Re-create Subscriber, whitelist, and olt-device models to test
153 Log Re-creating objects
154 ${datetime}= Get Current Datetime On Kubernetes Node ${k8s_node_ip} ${k8s_node_user} ${k8s_node_pass}
155 Set Suite Variable ${datetime}
Suchitra Vemuri94ea16b2019-06-04 17:16:12 -0700156 Create Whitelist 0
157 Create Whitelist 1
158 Create Subscriber 0
159 Create Subscriber 1
Suchitra Vemuri58eeaa32019-05-23 22:55:30 -0700160 Create VOLT
161 Wait Until Keyword Succeeds 200s 15s Validate OLT States ACTIVE ENABLED ${olt_ip}
162
163Teardown Test
164 [Documentation] Delete xos objects, kills processes and cleans up interfaces on src+dst servers
165 Get VOLTHA Status
166 Get ONOS Status
167 Clean Up Linux
168 Clean Up XOS
169 Log Kubernetes Containers Logs Since Time ${datetime} ${container_list}
170
171Clean Up Linux
172 [Documentation] Kill processes and clean up interfaces on src+dst servers
173 Run Keyword And Ignore Error Kill Linux Process [w]pa_supplicant ${src0['ip']} ${src0['user']} ${src0['pass']} ${src0['container_type']} ${src0['container_name']}
174 Run Keyword And Ignore Error Kill Linux Process [d]hclient ${src0['ip']} ${src0['user']} ${src0['pass']} ${src0['container_type']} ${src0['container_name']}
175 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']}
176 Delete IP Addresses from Interface on Remote Host ${src0['dp_iface_name']} ${src0['ip']} ${src0['user']} ${src0['pass']} ${src0['container_type']} ${src0['container_name']}
177 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']}
178
179Clean Up XOS
180 [Documentation] Clean up all XOS objects and reinstall voltha after OLT reboots
181 Wait Until Keyword Succeeds 60s 2s Clean Up Objects ${VOLT_SUBSCRIBER}
182 Wait Until Keyword Succeeds 60s 2s Clean Up Objects ${ATT_WHITELIST}
183 Sleep 20s
184 Wait Until Keyword Succeeds 30s 2s Validate Subscriber Count 0
185 Wait Until Keyword Succeeds 60s 2s Clean Up Objects ${VOLT_DEVICE}
186 Wait Until Keyword Succeeds 60s 2s Clean Up Objects ${ATT_SERVICEINSTANCES}
187 Wait Until Keyword Succeeds 120s 10s Check Remote System Reachability False ${olt_ip}
188 Wait Until Keyword Succeeds 120s 10s Check Remote System Reachability True ${olt_ip}
189 Wait Until Keyword Succeeds 120s 10s Openolt is Up ${olt_ip} ${olt_user} ${olt_pass}
190
191Create Whitelist
192 [Arguments] ${index_id}
Suchitra Vemurid1488e52019-05-31 12:38:47 -0700193 ${AttWhiteListDict}= utils.listToDict ${AttWhiteListList} ${index_id}
Suchitra Vemuri94ea16b2019-06-04 17:16:12 -0700194 ${AttWhiteListDict}= utils.setFieldValueInDict ${AttWhiteListDict} owner_id ${att_workflow_service_id}
Suchitra Vemuri58eeaa32019-05-23 22:55:30 -0700195 CORD Post ${ATT_WHITELIST} ${AttWhiteListDict}
196
197Remove Whitelist
198 [Arguments] ${onu_device}
199 ${whitelist_id}= Retrieve Whitelist Entry ${onu_device}
Suchitra Vemuri58eeaa32019-05-23 22:55:30 -0700200 CORD Delete ${ATT_WHITELIST} ${whitelist_id}
201
202Update Whitelist with Wrong Location
203 [Arguments] ${onu_device}
204 ${whitelist_id}= Retrieve Whitelist Entry ${onu_device}
205 CORD Put ${ATT_WHITELIST} {"pon_port_id": 5345 } ${whitelist_id}
206
207Update Whitelist with Correct Location
208 [Arguments] ${onu_device}
209 ${whitelist_id}= Retrieve Whitelist Entry ${onu_device}
210 CORD Put ${ATT_WHITELIST} {"pon_port_id": ${onu_location} } ${whitelist_id}
211
212Create Subscriber
213 [Arguments] ${index_id}
Suchitra Vemurid1488e52019-05-31 12:38:47 -0700214 ${SubscriberDict}= utils.listToDict ${SubscriberList} ${index_id}
Suchitra Vemuri58eeaa32019-05-23 22:55:30 -0700215 Wait Until Keyword Succeeds 120s 15s CORD Post ${VOLT_SUBSCRIBER} ${SubscriberDict}
216
217Remove Subscriber
Suchitra Vemuri94ea16b2019-06-04 17:16:12 -0700218 [Arguments] ${c_tag}
Suchitra Vemuri58eeaa32019-05-23 22:55:30 -0700219 ${subscriber_id}= Retrieve Subscriber ${c_tag}
220 CORD Delete ${VOLT_SUBSCRIBER} ${subscriber_id}
221
222Create VOLT
223 CORD Post ${VOLT_DEVICE} ${VoltDeviceDict}
224
225Update ONU AdminState
Suchitra Vemurid1488e52019-05-31 12:38:47 -0700226 [Arguments] ${onu_device} ${new_admin_state}
227 ${onudevice_id}= Retrieve ONU Device ${onu_device}
Suchitra Vemuri58eeaa32019-05-23 22:55:30 -0700228 CORD Put ${VOLT_DEVICE} ${"admin_state": ${new_admin_state} } ${onudevice_id}
229