blob: 71dd8894ad707c0eb84c05d5a137fc4fb6091c52 [file] [log] [blame]
Suchitra Vemurif8ef2842018-12-18 15:11:39 -08001# 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 data plane failure scenarios with ATT workflow
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 ../../Framework/utils/utils.py
27Resource ../../Framework/utils/utils.robot
28Library ../../Framework/restApi.py
29Resource ../../Framework/Subscriber.robot
30Resource ../../Framework/ATTWorkFlowDriver.robot
31Resource ../../Framework/Kubernetes.robot
32Resource ../../Framework/ONU.robot
33Resource ../../Framework/OLT.robot
34Resource ../../Framework/DHCP.robot
35Variables ../../Properties/RestApiProperties.py
36
37*** Variables ***
38${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
47
48*** Test Cases ***
49
50OLT Reboot
51 [Documentation] Validates E2E Ping Connectivity and object states for the given scenario:
52 ... Configure whitelist with correct ONU location
53 ... Validate successful authentication/DHCP/E2E ping
54 ... Reboots OLT
55 ... Validate that pings fail
56 ... Validate successful authentication/DHCP/E2E ping after OLT comes back up
57 [Tags] olt1
58 Wait Until Keyword Succeeds 300s 15s Validate ONU States ACTIVE ENABLED ${onu_device}
59 Wait Until Keyword Succeeds 60s 2s Validate ATT Workflow Driver SI ENABLED AWAITING ${onu_device}
60 Wait Until Keyword Succeeds 60s 2s Validate Subscriber Status awaiting-auth ${onu_device}
61 Validate Authentication True ${src_iface} wpa_supplicant.conf ${src_ip} ${src_user} ${src_pass} ${src_container_type} ${src_container_name}
62 Wait Until Keyword Succeeds 60s 2s Validate ATT Workflow Driver SI ENABLED APPROVED ${onu_device}
63 Wait Until Keyword Succeeds 60s 2s Validate Subscriber Status enabled ${onu_device}
64 Validate DHCP and Ping True True ${src_iface} ${s_tag} ${c_tag} ${dst_dp_ip} ${src_ip} ${src_user} ${src_pass} ${src_container_type} ${src_container_name} ${dst_dp_iface} ${dst_ip} ${dst_user} ${dst_pass} ${dst_container_type} ${dst_container_name}
65 # Reboot OLT
66 Login And Run Command On Remote System sudo reboot ${olt_ip} ${olt_user} ${olt_pass} prompt=#
67 Wait Until Keyword Succeeds 120s 10s Check Remote System Reachability False ${olt_ip}
68 Wait Until Keyword Succeeds 60s 2s Check Ping False ${dst_dp_ip} ${src_iface} ${src_ip} ${src_user} ${src_pass}
69 Wait Until Keyword Succeeds 120s 10s Check Remote System Reachability True ${olt_ip}
70 Wait Until Keyword Succeeds 120s 10s Openolt is Up ${olt_ip} ${olt_user} ${olt_pass}
71 # Validate successful pings since the OLT is Up
72 Wait Until Keyword Succeeds 60s 2s Validate ATT Workflow Driver SI ENABLED APPROVED ${onu_device}
73 Wait Until Keyword Succeeds 60s 2s Validate Subscriber Status enabled ${onu_device}
74 Wait Until Keyword Succeeds 60s 2s Check Ping True ${dst_dp_ip} ${src_iface} ${src_ip} ${src_user} ${src_pass}
75
76
77*** Keywords ***
78Setup Suite
79 ${auth} = Create List ${XOS_USER} ${XOS_PASSWD}
80 ${HEADERS} Create Dictionary Content-Type=application/json
81 Create Session ${server_ip} http://${server_ip}:${server_port} auth=${AUTH} headers=${HEADERS}
82 ${att_workflow_service_id}= Get Service Owner Id ${ATT_SERVICE}
83 ${volt_service_id}= Get Service Owner Id ${VOLT_SERVICE}
84 ${AttWhiteListList}= utils.jsonToList ${WHITELIST_PATHFILE} AttWhiteListInfo
85 Set Suite Variable ${AttWhiteListList}
86 ${AttWhiteListDict}= utils.listToDict ${AttWhiteListList} 0
87 ${AttWhiteListDict}= utils.setFieldValueInDict ${AttWhiteListDict} owner_id ${att_workflow_service_id}
88 ${onu_device}= Get From Dictionary ${AttWhiteListDict} serial_number
89 Set Global Variable ${onu_device}
90 ${onu_location}= Get From Dictionary ${AttWhiteListDict} pon_port_id
91 Set Global Variable ${onu_location}
92 ${SubscriberList}= utils.jsonToList ${SUBSCRIBER_PATHFILE} SubscriberInfo
93 Set Global Variable ${SubscriberList}
94 ${SubscriberDict}= utils.listToDict ${SubscriberList} 0
95 ${s_tag}= utils.getFieldValueFromDict ${SubscriberDict} s_tag
96 ${c_tag}= utils.getFieldValueFromDict ${SubscriberDict} c_tag
97 ${VoltDeviceList}= utils.jsonToList ${VOLT_DEVICE_PATHFILE} VOLTDeviceInfo
98 Set Global Variable ${VoltDeviceList}
99 Set Suite Variable ${s_tag}
100 Set Suite Variable ${c_tag}
101 Set Global Variable ${export_kubeconfig} export KUBECONFIG=${KUBERNETES_CONF}
102 # Read variables from yaml file
103 ${src_ip}= Evaluate ${hosts}.get("src").get("ip")
104 ${src_user}= Evaluate ${hosts}.get("src").get("user")
105 ${src_pass}= Evaluate ${hosts}.get("src").get("pass")
106 ${src_container_type}= Evaluate ${hosts}.get("src").get("container_type")
107 ${src_container_name}= Evaluate ${hosts}.get("src").get("container_name")
108 ${src_iface}= Evaluate ${hosts}.get("src").get("dp_iface_name")
109 ${dst_ip}= Evaluate ${hosts}.get("dst").get("ip")
110 ${dst_user} = Evaluate ${hosts}.get("dst").get("user")
111 ${dst_pass}= Evaluate ${hosts}.get("dst").get("pass")
112 ${dst_container_type}= Evaluate ${hosts}.get("dst").get("container_type")
113 ${dst_container_name}= Evaluate ${hosts}.get("dst").get("container_name")
114 ${dst_dp_iface}= Evaluate ${hosts}.get("dst").get("dp_iface_name")
115 ${dst_dp_ip}= Evaluate ${hosts}.get("dst").get("dp_iface_ip_qinq")
116 ${olt_ip}= Evaluate ${olts}[0].get("ip")
117 ${olt_user}= Evaluate ${olts}[0].get("user")
118 ${olt_pass}= Evaluate ${olts}[0].get("pass")
119 ${fabric_ip}= Evaluate ${fabric_switches}[0].get("ip")
120 ${fabric_user}= Evaluate ${fabric_switches}[0].get("user")
121 ${fabric_pass}= Evaluate ${fabric_switches}[0].get("pass")
122 ${k8s_node_ip}= Evaluate ${nodes}[0].get("ip")
123 ${k8s_node_user}= Evaluate ${nodes}[0].get("user")
124 ${k8s_node_pass}= Evaluate ${nodes}[0].get("pass")
125 Set Suite Variable ${src_ip}
126 Set Suite Variable ${src_user}
127 Set Suite Variable ${src_pass}
128 Set Suite Variable ${src_container_type}
129 Set Suite Variable ${src_container_name}
130 Set Suite Variable ${src_iface}
131 Set Suite Variable ${dst_ip}
132 Set Suite Variable ${dst_user}
133 Set Suite Variable ${dst_pass}
134 Set Suite Variable ${dst_container_type}
135 Set Suite Variable ${dst_container_name}
136 Set Suite Variable ${dst_dp_iface}
137 Set Suite Variable ${dst_dp_ip}
138 Set Suite Variable ${olt_ip}
139 Set Suite Variable ${olt_user}
140 Set Suite Variable ${olt_pass}
141 Set Suite Variable ${fabric_ip}
142 Set Suite Variable ${fabric_user}
143 Set Suite Variable ${fabric_pass}
144 Set Suite Variable ${k8s_node_ip}
145 Set Suite Variable ${k8s_node_user}
146 Set Suite Variable ${k8s_node_pass}
147 @{container_list}= Create List
148 Append To List ${container_list} att-workflow-att-workflow-driver
149 Append To List ${container_list} att-workflow-volt
150 Append To List ${container_list} onos
151 Append To List ${container_list} xos-core
152 Append To List ${container_list} vcore
153 Set Suite Variable ${container_list}
154 ${datetime}= Get Current Datetime On Kubernetes Node ${k8s_node_ip} ${k8s_node_user} ${k8s_node_pass}
155 Set Suite Variable ${datetime}
156
157Teardown Suite
158 [Documentation] Performs any additional cleanup required
159 Log Suite Teardown cleanup
160 Delete All Sessions
161
162Setup Test
163 [Documentation] Re-create Subscriber, whitelist, and olt-device models to test
164 Log Re-creating objects
165 ${datetime}= Get Current Datetime On Kubernetes Node ${k8s_node_ip} ${k8s_node_user} ${k8s_node_pass}
166 Create Whitelist
167 Create Subscriber
168 Create VOLT
169
170Teardown Test
171 [Documentation] Delete xos objects, kills processes and cleans up interfaces on src+dst servers
172 Clean Up Linux
173 Clean Up XOS
174 Log Kubernetes Containers Logs Since Time ${datetime} ${container_list}
175
176Clean Up Linux
177 [Documentation] Kill processes and clean up interfaces on src+dst servers
178 Run Keyword And Ignore Error Kill Linux Process [w]pa_supplicant ${src_ip} ${src_user} ${src_pass} ${src_container_type} ${src_container_name}
179 Run Keyword And Ignore Error Kill Linux Process [d]hclient ${src_ip} ${src_user} ${src_pass} ${src_container_type} ${src_container_name}
180 Run Keyword If '${dst_ip}' != '${None}' Run Keyword And Ignore Error Kill Linux Process [d]hcpd ${dst_ip} ${dst_user} ${dst_pass} ${dst_container_type} ${dst_container_name}
181 Delete IP Addresses from Interface on Remote Host ${src_iface} ${src_ip} ${src_user} ${src_pass} ${src_container_type} ${src_container_name}
182 Run Keyword If '${dst_ip}' != '${None}' Delete Interface on Remote Host ${dst_dp_iface}.${s_tag} ${dst_ip} ${dst_user} ${dst_pass} ${dst_container_type} ${dst_container_name}
183
184Clean Up XOS
185 [Documentation] Clean up all XOS objects and reinstall voltha after OLT reboots
186 Wait Until Keyword Succeeds 60s 2s Clean Up Objects ${VOLT_SUBSCRIBER}
187 Wait Until Keyword Succeeds 60s 2s Clean Up Objects ${ATT_WHITELIST}
188 Sleep 20s
189 Wait Until Keyword Succeeds 30s 2s Validate Subscriber Count 0
190 Sleep 10s
191 Wait Until Keyword Succeeds 60s 2s Clean Up Objects ${VOLT_DEVICE}
192 Sleep 20s
193 Wait Until Keyword Succeeds 60s 2s Clean Up Objects ${ATT_SERVICEINSTANCES}
194 Wait Until Keyword Succeeds 120s 10s Check Remote System Reachability False ${olt_ip}
195 Wait Until Keyword Succeeds 120s 10s Check Remote System Reachability True ${olt_ip}
196 Wait Until Keyword Succeeds 120s 10s Openolt is Up ${olt_ip} ${olt_user} ${olt_pass}
197 Sleep 15s
198
199Create Whitelist
200 ${AttWhiteListDict}= utils.listToDict ${AttWhiteListList} 0
201 CORD Post ${ATT_WHITELIST} ${AttWhiteListDict}
202
203Remove Whitelist
204 ${whitelist_id}= Retrieve Whitelist Entry ${onu_device}
205 CORD Delete ${ATT_WHITELIST} ${whitelist_id}
206
207Update Whitelist with Wrong Location
208 ${whitelist_id}= Retrieve Whitelist Entry ${onu_device}
209 CORD Put ${ATT_WHITELIST} {"pon_port_id": 55 } ${whitelist_id}
210
211Update Whitelist with Correct Location
212 ${whitelist_id}= Retrieve Whitelist Entry ${onu_device}
213 CORD Put ${ATT_WHITELIST} {"pon_port_id": ${onu_location} } ${whitelist_id}
214
215Create Subscriber
216 ${SubscriberDict}= utils.listToDict ${SubscriberList} 0
217 Wait Until Keyword Succeeds 120s 15s CORD Post ${VOLT_SUBSCRIBER} ${SubscriberDict}
218
219Remove Subscriber
220 ${subscriber_id}= Retrieve Subscriber ${c_tag}
221 CORD Delete ${VOLT_SUBSCRIBER} ${subscriber_id}
222
223Create VOLT
224 ${VoltDeviceDict}= utils.listToDict ${VoltDeviceList} 0
225 CORD Post ${VOLT_DEVICE} ${VoltDeviceDict}