blob: c2045607b1e74259ab3aaeec12d71fd29361875e [file] [log] [blame]
Kailash Khalasi16d95c12018-09-21 14:17:28 -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 E2E conditions for seba-in-a-box
17Suite Setup Setup
18Suite Teardown Teardown
19Test Teardown Clean Test Environment
20Library Collections
21Library String
22Library OperatingSystem
23Library XML
24Library RequestsLibrary
25Library ../../Framework/utils/utils.py
26Resource ../../Framework/utils/utils.robot
27Library ../../Framework/restApi.py
28Resource ../../Framework/Subscriber.robot
29Resource ../../Framework/ATTWorkFlowDriver.robot
30Resource ../../Framework/ONU.robot
31Resource ../../Framework/DHCP.robot
32Variables ../../Properties/RestApiProperties.py
33
34*** Variables ***
35${WHITELIST_PATHFILE} ${CURDIR}/data/SIABWhitelist.json
36${SUBSCRIBER_PATHFILE} ${CURDIR}/data/SIABSubscriber.json
37${VOLT_DEVICE_PATHFILE} ${CURDIR}/data/SIABOLTDevice.json
38
39*** Test Cases ***
40Send Auth Request and Validate PING
41 [Tags] inittest
Kailash Khalasib5975cf2018-10-01 12:57:44 -070042 Execute EAPOL Request and Verify
Kailash Khalasi16d95c12018-09-21 14:17:28 -070043 Run kubectl -n voltha exec ${RG_CONTAINER} -- dhclient
44 Run kubectl -n voltha exec ${RG_CONTAINER} -- dhclient -r
45 Run kubectl -n voltha exec ${RG_CONTAINER} -- dhclient
46 Wait Until Keyword Succeeds 10s 2s Validate ONU States ACTIVE ENABLED
47 Wait Until Keyword Succeeds 60s 2s Validate ATT Workflow Driver SI ENABLED APPROVED
48 Wait Until Keyword Succeeds 60s 2s Validate Subscriber Status enabled
Kailash Khalasi16d95c12018-09-21 14:17:28 -070049 Wait Until Keyword Succeeds 60s 2s Ping From RG PASS
50
51Disable Subscriber
52 [Tags] disable
53 ${subscriber_id}= Retrieve Subscriber ${c_tag}
54 CORD Put ${VOLT_SUBSCRIBER} {"status":"disabled"} ${subscriber_id}
55 Wait Until Keyword Succeeds 60s 2s Ping From RG FAIL
56
57Enable Subscriber
58 [Tags] enable
59 ${subscriber_id}= Retrieve Subscriber ${c_tag}
60 CORD Put ${VOLT_SUBSCRIBER} {"status":"enabled"} ${subscriber_id}
61 Wait Until Keyword Succeeds 60s 2s Ping From RG PASS
62
63Change Whitelist to Wrong Port Location
Kailash Khalasib5975cf2018-10-01 12:57:44 -070064 [Tags] negative
Kailash Khalasi16d95c12018-09-21 14:17:28 -070065 ${whitelist_id}= Retrieve Whitelist Entry ${onu_sn}
66 CORD Put ${ATT_WHITELIST} {"pon_port_id": 55 } ${whitelist_id}
67 Wait Until Keyword Succeeds 60s 2s Validate ATT Workflow Driver SI DISABLED AWAITING
68 Wait Until Keyword Succeeds 60s 2s Validate Subscriber Status awaiting-auth
69 Wait Until Keyword Succeeds 60s 2s Ping From RG FAIL
70
71Update Whitelist to Correct Port Location
72 [Tags] notready
73 ${whitelist_id}= Retrieve Whitelist Entry ${onu_sn}
74 CORD Put ${ATT_WHITELIST} {"pon_port_id": 1 } ${whitelist_id}
Kailash Khalasib5975cf2018-10-01 12:57:44 -070075 Execute EAPOL Request and Verify
Kailash Khalasi16d95c12018-09-21 14:17:28 -070076 Wait Until Keyword Succeeds 60s 2s Validate ATT Workflow Driver SI ENABLED APPROVED
77 Wait Until Keyword Succeeds 60s 2s Validate Subscriber Status enabled
78 Wait Until Keyword Succeeds 60s 2s Ping From RG PASS
79
80*** Keywords ***
81Setup
82 ${auth} = Create List ${XOS_USER} ${XOS_PASSWD}
83 ${HEADERS} Create Dictionary Content-Type=application/json
84 Create Session ${server_ip} http://${server_ip}:${server_port} auth=${AUTH} headers=${HEADERS}
85 ${att_workflow_service_id}= Get Service Owner Id ${ATT_SERVICE}
86 ${volt_service_id}= Get Service Owner Id ${VOLT_SERVICE}
87 ${AttWhiteListList}= utils.jsonToList ${WHITELIST_PATHFILE} AttWhiteListInfo
88 Set Suite Variable ${alist} ${AttWhiteListList}
89 ${AttWhiteListList} = Get Variable Value ${alist}
90 ${AttWhiteListDict}= utils.listToDict ${AttWhiteListList} 0
91 ${AttWhiteListDict}= utils.setFieldValueInDict ${AttWhiteListDict} owner_id ${att_workflow_service_id}
92 ${onu_sn}= Get From Dictionary ${AttWhiteListDict} serial_number
93 Log ${onu_sn}
94 Set Global Variable ${onu_sn}
95 ${SubscriberList}= utils.jsonToList ${SUBSCRIBER_PATHFILE} SubscriberInfo
96 Set Global Variable ${slist} ${SubscriberList}
97 ${SubscriberList} = Get Variable Value ${slist}
98 ${SubscriberDict}= utils.listToDict ${SubscriberList} 0
99 ${s_tag}= utils.getFieldValueFromDict ${SubscriberDict} s_tag
100 ${c_tag}= utils.getFieldValueFromDict ${SubscriberDict} c_tag
101 ${VoltDeviceList}= utils.jsonToList ${VOLT_DEVICE_PATHFILE} VOLTDeviceInfo
102 Set Global Variable ${vlist} ${VoltDeviceList}
103 Set Suite Variable ${s_tag}
104 Set Suite Variable ${c_tag}
105 ${RG_CONTAINER}= Run kubectl -n voltha get pod|grep "^rg-"|cut -d' ' -f1
106 Set Suite Variable ${RG_CONTAINER}
Kailash Khalasib5975cf2018-10-01 12:57:44 -0700107 ## Validate ATT Workflow SI
108 Wait Until Keyword Succeeds 90s 2s Validate ATT Workflow Driver SI DISABLED AWAITING
Kailash Khalasi16d95c12018-09-21 14:17:28 -0700109
110Teardown
111 [Documentation] Performs any additional cleanup required
112 Log Suite Teardown cleanup
113 Delete All Sessions
114
115Clean Test Environment
116 ## TODO: fix this. not working right now
117 #Run kubectl -n voltha exec ${RG_CONTAINER} -- kill $(ps aux | grep [w]pa_supplicant | awk '{print $2}')
118 Log Need to kill wpa_supplicant process on RG
119
120Validate ONU States
121 [Arguments] ${expected_op_status} ${expected_admin_status}
122 ${operational_status} ${admin_status} ONU Status Check ${onu_sn}
123 Should Be Equal ${operational_status} ${expected_op_status}
124 Should Be Equal ${admin_status} ${expected_admin_status}
125
126Validate ATT Workflow Driver SI
127 [Arguments] ${expected_status} ${expected_auth_status}
128 ${onu_state} ${authentication_status} Service Instance Status Check ${onu_sn}
129 Should Be Equal ${onu_state} ${expected_status}
130 Should Be Equal ${authentication_status} ${expected_auth_status}
131
132Validate Subscriber Status
133 [Arguments] ${exepected_status}
134 ${status} Subscriber Status Check ${onu_sn}
135 Should Be Equal ${status} ${exepected_status}
136
Kailash Khalasib5975cf2018-10-01 12:57:44 -0700137Execute EAPOL Request and Verify
138 Run kubectl -n voltha exec ${RG_CONTAINER} -- rm -f wpa.log
139 Run kubectl -n voltha exec ${RG_CONTAINER} -- wpa_supplicant -B -i eth0 -Dwired -c /etc/wpa_supplicant/wpa_supplicant.conf -f wpa.log
140 Wait Until Keyword Succeeds 30s 1s Authentication Completed
141
142Authentication Completed
143 ${output}= Run kubectl -n voltha exec ${RG_CONTAINER} -- cat wpa.log
144 Should Contain ${output} authentication completed successfully
145
Kailash Khalasi16d95c12018-09-21 14:17:28 -0700146Ping From RG
147 [Arguments] ${status}
148 ${result}= Run kubectl -n voltha exec ${RG_CONTAINER} -- ping -c 5 172.18.0.10
149 Run Keyword If '${status}' == 'PASS' Should Contain ${result} 64 bytes
150 Run Keyword If '${status}' == 'PASS' Should Contain ${result} 0% packet loss
151 Run Keyword If '${status}' == 'PASS' Should Not Contain ${result} 100% packet loss
152 Run Keyword If '${status}' == 'PASS' Should Not Contain ${result} 80% packet loss
153 Run Keyword If '${status}' == 'PASS' Should Not Contain ${result} 60% packet loss
154 Run Keyword If '${status}' == 'PASS' Should Not Contain ${result} 40% packet loss
155 Run Keyword If '${status}' == 'PASS' Should Not Contain ${result} 20% packet loss
156 Run Keyword If '${status}' == 'PASS' Should Not Contain ${result} Destination Host Unreachable
157 Run Keyword If '${status}' == 'FAIL' Should Not Contain ${result} 64 bytes
158 Run Keyword If '${status}' == 'FAIL' Should Contain ${result} 100% packet loss
159 Log To Console \n ${result}