blob: 38184054d464a939a8a9e3dae609ecedb5bd98d1 [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
Kailash Khalasi16d95c12018-09-21 14:17:28 -070019Library Collections
20Library String
21Library OperatingSystem
22Library XML
23Library RequestsLibrary
24Library ../../Framework/utils/utils.py
25Resource ../../Framework/utils/utils.robot
26Library ../../Framework/restApi.py
27Resource ../../Framework/Subscriber.robot
28Resource ../../Framework/ATTWorkFlowDriver.robot
29Resource ../../Framework/ONU.robot
30Resource ../../Framework/DHCP.robot
31Variables ../../Properties/RestApiProperties.py
32
33*** Variables ***
34${WHITELIST_PATHFILE} ${CURDIR}/data/SIABWhitelist.json
35${SUBSCRIBER_PATHFILE} ${CURDIR}/data/SIABSubscriber.json
36${VOLT_DEVICE_PATHFILE} ${CURDIR}/data/SIABOLTDevice.json
37
38*** Test Cases ***
39Send Auth Request and Validate PING
Kailash Khalasi0e515fe2018-10-02 12:13:47 -070040 [Documentation] Validate successful pings from valid auth request
Kailash Khalasi16d95c12018-09-21 14:17:28 -070041 [Tags] inittest
Kailash Khalasib5975cf2018-10-01 12:57:44 -070042 Execute EAPOL Request and Verify
Kailash Khalasif1500c32018-10-01 12:59:44 -070043 Run kubectl -n voltha exec ${RG_CONTAINER} -- dhclient -nw
44 Run kubectl -n voltha exec ${RG_CONTAINER} -- dhclient -nw -r
45 Run kubectl -n voltha exec ${RG_CONTAINER} -- dhclient -nw
Kailash Khalasi16d95c12018-09-21 14:17:28 -070046 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
Kailash Khalasi0e515fe2018-10-02 12:13:47 -070052 [Documentation] Validate pings fail when subscriber disabled
Kailash Khalasi16d95c12018-09-21 14:17:28 -070053 [Tags] disable
54 ${subscriber_id}= Retrieve Subscriber ${c_tag}
55 CORD Put ${VOLT_SUBSCRIBER} {"status":"disabled"} ${subscriber_id}
56 Wait Until Keyword Succeeds 60s 2s Ping From RG FAIL
57
58Enable Subscriber
Kailash Khalasi0e515fe2018-10-02 12:13:47 -070059 [Documentation] Validate pings pass when subscriber enabled
Kailash Khalasi16d95c12018-09-21 14:17:28 -070060 [Tags] enable
61 ${subscriber_id}= Retrieve Subscriber ${c_tag}
62 CORD Put ${VOLT_SUBSCRIBER} {"status":"enabled"} ${subscriber_id}
63 Wait Until Keyword Succeeds 60s 2s Ping From RG PASS
64
65Change Whitelist to Wrong Port Location
Kailash Khalasi0e515fe2018-10-02 12:13:47 -070066 [Documentation] Validate pings fail from when onu port location in whitelist is changed
Kailash Khalasib5975cf2018-10-01 12:57:44 -070067 [Tags] negative
Kailash Khalasi16d95c12018-09-21 14:17:28 -070068 ${whitelist_id}= Retrieve Whitelist Entry ${onu_sn}
69 CORD Put ${ATT_WHITELIST} {"pon_port_id": 55 } ${whitelist_id}
70 Wait Until Keyword Succeeds 60s 2s Validate ATT Workflow Driver SI DISABLED AWAITING
71 Wait Until Keyword Succeeds 60s 2s Validate Subscriber Status awaiting-auth
72 Wait Until Keyword Succeeds 60s 2s Ping From RG FAIL
Kailash Khalasi0e515fe2018-10-02 12:13:47 -070073 [Teardown] Restart RG Pod
Kailash Khalasi16d95c12018-09-21 14:17:28 -070074
75Update Whitelist to Correct Port Location
Kailash Khalasi0e515fe2018-10-02 12:13:47 -070076 [Documentation] Validate pings pass from when whitelist updated to correct port location
77 [Tags] update
Kailash Khalasi16d95c12018-09-21 14:17:28 -070078 ${whitelist_id}= Retrieve Whitelist Entry ${onu_sn}
79 CORD Put ${ATT_WHITELIST} {"pon_port_id": 1 } ${whitelist_id}
Kailash Khalasib5975cf2018-10-01 12:57:44 -070080 Execute EAPOL Request and Verify
Kailash Khalasi0e515fe2018-10-02 12:13:47 -070081 Run kubectl -n voltha exec ${RG_CONTAINER} -- dhclient -nw
82 Run kubectl -n voltha exec ${RG_CONTAINER} -- dhclient -nw -r
83 Run kubectl -n voltha exec ${RG_CONTAINER} -- dhclient -nw
Kailash Khalasi16d95c12018-09-21 14:17:28 -070084 Wait Until Keyword Succeeds 60s 2s Validate ATT Workflow Driver SI ENABLED APPROVED
85 Wait Until Keyword Succeeds 60s 2s Validate Subscriber Status enabled
86 Wait Until Keyword Succeeds 60s 2s Ping From RG PASS
Kailash Khalasi0e515fe2018-10-02 12:13:47 -070087 [Teardown] Restart RG Pod
Kailash Khalasi16d95c12018-09-21 14:17:28 -070088
89*** Keywords ***
90Setup
91 ${auth} = Create List ${XOS_USER} ${XOS_PASSWD}
92 ${HEADERS} Create Dictionary Content-Type=application/json
93 Create Session ${server_ip} http://${server_ip}:${server_port} auth=${AUTH} headers=${HEADERS}
94 ${att_workflow_service_id}= Get Service Owner Id ${ATT_SERVICE}
95 ${volt_service_id}= Get Service Owner Id ${VOLT_SERVICE}
96 ${AttWhiteListList}= utils.jsonToList ${WHITELIST_PATHFILE} AttWhiteListInfo
97 Set Suite Variable ${alist} ${AttWhiteListList}
98 ${AttWhiteListList} = Get Variable Value ${alist}
99 ${AttWhiteListDict}= utils.listToDict ${AttWhiteListList} 0
100 ${AttWhiteListDict}= utils.setFieldValueInDict ${AttWhiteListDict} owner_id ${att_workflow_service_id}
101 ${onu_sn}= Get From Dictionary ${AttWhiteListDict} serial_number
102 Log ${onu_sn}
103 Set Global Variable ${onu_sn}
104 ${SubscriberList}= utils.jsonToList ${SUBSCRIBER_PATHFILE} SubscriberInfo
105 Set Global Variable ${slist} ${SubscriberList}
106 ${SubscriberList} = Get Variable Value ${slist}
107 ${SubscriberDict}= utils.listToDict ${SubscriberList} 0
108 ${s_tag}= utils.getFieldValueFromDict ${SubscriberDict} s_tag
109 ${c_tag}= utils.getFieldValueFromDict ${SubscriberDict} c_tag
110 ${VoltDeviceList}= utils.jsonToList ${VOLT_DEVICE_PATHFILE} VOLTDeviceInfo
111 Set Global Variable ${vlist} ${VoltDeviceList}
112 Set Suite Variable ${s_tag}
113 Set Suite Variable ${c_tag}
Kailash Khalasi0e515fe2018-10-02 12:13:47 -0700114 ${whitelist_id}= Retrieve Whitelist Entry ${onu_sn}
115 Set Suite Variable ${whitelist_id}
116 ${att_si_id}= Retrieve ATT Service Instance ID ${onu_sn}
117 Set Suite Variable ${att_si_id}
Kailash Khalasi16d95c12018-09-21 14:17:28 -0700118 ${RG_CONTAINER}= Run kubectl -n voltha get pod|grep "^rg-"|cut -d' ' -f1
119 Set Suite Variable ${RG_CONTAINER}
Kailash Khalasib5975cf2018-10-01 12:57:44 -0700120 ## Validate ATT Workflow SI
Kailash Khalasie31a78e2018-10-01 13:19:11 -0700121 Wait Until Keyword Succeeds 90s 2s Validate ATT Workflow Driver SI ENABLED AWAITING
Kailash Khalasi16d95c12018-09-21 14:17:28 -0700122
123Teardown
Kailash Khalasi0e515fe2018-10-02 12:13:47 -0700124 [Documentation] Restores ATT SI back to initial awaiting state
125 Log Suite Teardown cleanup/restoring back to initial state
126 CORD Put ${ATT_WHITELIST} {"pon_port_id": 1 } ${whitelist_id}
127 CORD Put ${ATT_SERVICEINSTANCES} {"authentication_state": "AWAITING"} ${att_si_id}
Kailash Khalasi16d95c12018-09-21 14:17:28 -0700128 Delete All Sessions
129
Kailash Khalasi0e515fe2018-10-02 12:13:47 -0700130Restart RG Pod
131 Run kubectl -n voltha delete pod ${RG_CONTAINER}
132 ${RG_CONTAINER}= Wait Until Keyword Succeeds 60s 1s Run kubectl -n voltha get pod|grep "^rg-"|cut -d' ' -f1
133 Set Suite Variable ${RG_CONTAINER}
134 Run kubectl wait -n voltha pod/${RG_CONTAINER} --for condition=Ready --timeout=180s
Kailash Khalasi16d95c12018-09-21 14:17:28 -0700135
136Validate ONU States
137 [Arguments] ${expected_op_status} ${expected_admin_status}
138 ${operational_status} ${admin_status} ONU Status Check ${onu_sn}
139 Should Be Equal ${operational_status} ${expected_op_status}
140 Should Be Equal ${admin_status} ${expected_admin_status}
141
142Validate ATT Workflow Driver SI
143 [Arguments] ${expected_status} ${expected_auth_status}
144 ${onu_state} ${authentication_status} Service Instance Status Check ${onu_sn}
145 Should Be Equal ${onu_state} ${expected_status}
146 Should Be Equal ${authentication_status} ${expected_auth_status}
147
148Validate Subscriber Status
149 [Arguments] ${exepected_status}
150 ${status} Subscriber Status Check ${onu_sn}
151 Should Be Equal ${status} ${exepected_status}
152
Kailash Khalasib5975cf2018-10-01 12:57:44 -0700153Execute EAPOL Request and Verify
154 Run kubectl -n voltha exec ${RG_CONTAINER} -- rm -f wpa.log
155 Run kubectl -n voltha exec ${RG_CONTAINER} -- wpa_supplicant -B -i eth0 -Dwired -c /etc/wpa_supplicant/wpa_supplicant.conf -f wpa.log
156 Wait Until Keyword Succeeds 30s 1s Authentication Completed
157
158Authentication Completed
159 ${output}= Run kubectl -n voltha exec ${RG_CONTAINER} -- cat wpa.log
160 Should Contain ${output} authentication completed successfully
161
Kailash Khalasi16d95c12018-09-21 14:17:28 -0700162Ping From RG
163 [Arguments] ${status}
164 ${result}= Run kubectl -n voltha exec ${RG_CONTAINER} -- ping -c 5 172.18.0.10
165 Run Keyword If '${status}' == 'PASS' Should Contain ${result} 64 bytes
166 Run Keyword If '${status}' == 'PASS' Should Contain ${result} 0% packet loss
167 Run Keyword If '${status}' == 'PASS' Should Not Contain ${result} 100% packet loss
168 Run Keyword If '${status}' == 'PASS' Should Not Contain ${result} 80% packet loss
169 Run Keyword If '${status}' == 'PASS' Should Not Contain ${result} 60% packet loss
170 Run Keyword If '${status}' == 'PASS' Should Not Contain ${result} 40% packet loss
171 Run Keyword If '${status}' == 'PASS' Should Not Contain ${result} 20% packet loss
172 Run Keyword If '${status}' == 'PASS' Should Not Contain ${result} Destination Host Unreachable
173 Run Keyword If '${status}' == 'FAIL' Should Not Contain ${result} 64 bytes
174 Run Keyword If '${status}' == 'FAIL' Should Contain ${result} 100% packet loss
Kailash Khalasi0e515fe2018-10-02 12:13:47 -0700175 Log To Console \n ${result}