blob: aa68e6026e6d74e941aa1c2b61366d299cccc401 [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 ***
39${POD_NAME} onlab-pod1-qa
40${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
51 [Documentation] Test with two ONUs
52 ... 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
58 [Setup] None
59 [Tags] multipleONU-test1
60 #Create WhiteList 0
61 #Create WhiteList 1
62 #Create Subscriber 0
63 #Create Subscriber 1
64 Wait Until Keyword Succeeds 300s 15s Validate ONU States ACTIVE ENABLED ${src0['onu']}
65 Wait Until Keyword Succeeds 60s 2s Validate ATT Workflow Driver SI ENABLED AWAITING ${src0['onu']}
66 Wait Until Keyword Succeeds 60s 2s Validate Subscriber Status awaiting-auth ${src0['onu']}
67 Validate Authentication True ${src0['dp_iface_name']} wpa_supplicant.conf ${src0['ip']} ${src0['user']} ${src0['pass']} ${src0['container_type']} ${src0['container_name']}
68 Wait Until Keyword Succeeds 60s 2s Validate ATT Workflow Driver SI ENABLED APPROVED ${src0['onu']}
69 Wait Until Keyword Succeeds 60s 2s Validate Subscriber Status enabled ${src0['onu']}
Suchitra Vemuri7dee24a2019-05-24 11:59:52 -070070 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 -070071 #Second ONU
72 Wait Until Keyword Succeeds 300s 15s Validate ONU States ACTIVE ENABLED ${src1['onu']}
Suchitra Vemuricb4d5a22019-05-24 11:39:38 -070073 Wait Until Keyword Succeeds 60s 2s Validate ATT Workflow Driver SI ENABLED AWAITING ${src1['onu']}
74 Wait Until Keyword Succeeds 60s 2s Validate Subscriber Status awaiting-auth ${src1['onu']}
75 Validate Authentication True ${src1['dp_iface_name']} wpa_supplicant.conf ${src1['ip']} ${src1['user']} ${src1['pass']} ${src1['container_type']} ${src1['container_name']}
76 Wait Until Keyword Succeeds 60s 2s Validate ATT Workflow Driver SI ENABLED APPROVED ${src1['onu']}
77 Wait Until Keyword Succeeds 60s 2s Validate Subscriber Status enabled ${src1['onu']}
78 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 -070079 # Validate that the first ONU can still ping
Suchitra Vemuri7dee24a2019-05-24 11:59:52 -070080 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 -070081
82*** Keywords ***
83Setup Suite
84 ${auth} = Create List ${XOS_USER} ${XOS_PASSWD}
85 ${HEADERS} Create Dictionary Content-Type=application/json
86 Create Session ${server_ip} http://${server_ip}:${server_port} auth=${AUTH} headers=${HEADERS}
87 ${att_workflow_service_id}= Get Service Owner Id ${ATT_SERVICE}
88 ${volt_service_id}= Get Service Owner Id ${VOLT_SERVICE}
89 ${AttWhiteListList}= utils.jsonToList ${WHITELIST_PATHFILE} AttWhiteListInfo
90 Set Suite Variable ${AttWhiteListList}
91 ${AttWhiteListDict}= utils.listToDict ${AttWhiteListList} 0
92 ${AttWhiteListDict}= utils.setFieldValueInDict ${AttWhiteListDict} owner_id ${att_workflow_service_id}
93 ${onu_location}= Get From Dictionary ${AttWhiteListDict} pon_port_id
94 Set Global Variable ${onu_location}
95 ${SubscriberList}= utils.jsonToList ${SUBSCRIBER_PATHFILE} SubscriberInfo
96 Set Global Variable ${SubscriberList}
97 ${SubscriberDict}= utils.listToDict ${SubscriberList} 0
98 ${s_tag}= utils.getFieldValueFromDict ${SubscriberDict} s_tag
99 ${c_tag}= utils.getFieldValueFromDict ${SubscriberDict} c_tag
100 ${VoltDeviceList}= utils.jsonToList ${VOLT_DEVICE_PATHFILE} VOLTDeviceInfo
101 ${VoltDeviceDict}= utils.setFieldValueInDict ${VoltDeviceList[0]} volt_service_id ${volt_service_id}
102 Set Global Variable ${VoltDeviceList}
103 Set Global Variable ${VoltDeviceDict}
104 Set Suite Variable ${s_tag}
105 Set Suite Variable ${c_tag}
106 Set Global Variable ${export_kubeconfig} export KUBECONFIG=${KUBERNETES_CONF}
107 @{container_list}= Create List
108 Append To List ${container_list} att-workflow-att-workflow-driver
109 Append To List ${container_list} seba-services-volt
110 Append To List ${container_list} seba-services-rcord
111 Append To List ${container_list} onos
112 Append To List ${container_list} seba-services-fabric-crossconnect
113 Append To List ${container_list} xos-core
114 Append To List ${container_list} vcore
115 Set Suite Variable ${container_list}
116 Set Deployment Config Variables
117 ${datetime}= Get Current Datetime On Kubernetes Node ${k8s_node_ip} ${k8s_node_user} ${k8s_node_pass}
118 Set Suite Variable ${datetime}
119
120Teardown Suite
121 [Documentation] Performs any additional cleanup required
122 Log Suite Teardown cleanup
123 Delete All Sessions
124
125Setup Test
126 [Documentation] Re-create Subscriber, whitelist, and olt-device models to test
127 Log Re-creating objects
128 ${datetime}= Get Current Datetime On Kubernetes Node ${k8s_node_ip} ${k8s_node_user} ${k8s_node_pass}
129 Set Suite Variable ${datetime}
130 Create Whitelist
131 Create Subscriber
132 Create VOLT
133 Wait Until Keyword Succeeds 200s 15s Validate OLT States ACTIVE ENABLED ${olt_ip}
134
135Teardown Test
136 [Documentation] Delete xos objects, kills processes and cleans up interfaces on src+dst servers
137 Get VOLTHA Status
138 Get ONOS Status
139 Clean Up Linux
140 Clean Up XOS
141 Log Kubernetes Containers Logs Since Time ${datetime} ${container_list}
142
143Clean Up Linux
144 [Documentation] Kill processes and clean up interfaces on src+dst servers
145 Run Keyword And Ignore Error Kill Linux Process [w]pa_supplicant ${src0['ip']} ${src0['user']} ${src0['pass']} ${src0['container_type']} ${src0['container_name']}
146 Run Keyword And Ignore Error Kill Linux Process [d]hclient ${src0['ip']} ${src0['user']} ${src0['pass']} ${src0['container_type']} ${src0['container_name']}
147 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']}
148 Delete IP Addresses from Interface on Remote Host ${src0['dp_iface_name']} ${src0['ip']} ${src0['user']} ${src0['pass']} ${src0['container_type']} ${src0['container_name']}
149 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']}
150
151Clean Up XOS
152 [Documentation] Clean up all XOS objects and reinstall voltha after OLT reboots
153 Wait Until Keyword Succeeds 60s 2s Clean Up Objects ${VOLT_SUBSCRIBER}
154 Wait Until Keyword Succeeds 60s 2s Clean Up Objects ${ATT_WHITELIST}
155 Sleep 20s
156 Wait Until Keyword Succeeds 30s 2s Validate Subscriber Count 0
157 Wait Until Keyword Succeeds 60s 2s Clean Up Objects ${VOLT_DEVICE}
158 Wait Until Keyword Succeeds 60s 2s Clean Up Objects ${ATT_SERVICEINSTANCES}
159 Wait Until Keyword Succeeds 120s 10s Check Remote System Reachability False ${olt_ip}
160 Wait Until Keyword Succeeds 120s 10s Check Remote System Reachability True ${olt_ip}
161 Wait Until Keyword Succeeds 120s 10s Openolt is Up ${olt_ip} ${olt_user} ${olt_pass}
162
163Create Whitelist
164 [Arguments] ${index_id}
165 ${AttWhiteListDict}= utils.listToDict ${AttWhiteListList} 0
166 CORD Post ${ATT_WHITELIST} ${AttWhiteListDict}
167
168Remove Whitelist
169 [Arguments] ${onu_device}
170 ${whitelist_id}= Retrieve Whitelist Entry ${onu_device}
171 #${whitelist_id}= Retrieve Whitelist Entry ${src0['onu']}
172 CORD Delete ${ATT_WHITELIST} ${whitelist_id}
173
174Update Whitelist with Wrong Location
175 [Arguments] ${onu_device}
176 ${whitelist_id}= Retrieve Whitelist Entry ${onu_device}
177 CORD Put ${ATT_WHITELIST} {"pon_port_id": 5345 } ${whitelist_id}
178
179Update Whitelist with Correct Location
180 [Arguments] ${onu_device}
181 ${whitelist_id}= Retrieve Whitelist Entry ${onu_device}
182 CORD Put ${ATT_WHITELIST} {"pon_port_id": ${onu_location} } ${whitelist_id}
183
184Create Subscriber
185 [Arguments] ${index_id}
186 ${SubscriberDict}= utils.listToDict ${SubscriberList} ${index_id}0
187 Wait Until Keyword Succeeds 120s 15s CORD Post ${VOLT_SUBSCRIBER} ${SubscriberDict}
188
189Remove Subscriber
190 [Arugments] ${c_tag}
191 ${subscriber_id}= Retrieve Subscriber ${c_tag}
192 CORD Delete ${VOLT_SUBSCRIBER} ${subscriber_id}
193
194Create VOLT
195 CORD Post ${VOLT_DEVICE} ${VoltDeviceDict}
196
197Update ONU AdminState
198 [Arguments] ${new_admin_state}
199 ${onudevice_id}= Retrieve ONU Device ${src0['onu']}
200 CORD Put ${VOLT_DEVICE} ${"admin_state": ${new_admin_state} } ${onudevice_id}
201