Kailash Khalasi | 16d95c1 | 2018-09-21 14:17:28 -0700 | [diff] [blame] | 1 | # 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 *** |
| 16 | Documentation Test various E2E conditions for seba-in-a-box |
| 17 | Suite Setup Setup |
| 18 | Suite Teardown Teardown |
| 19 | Test Teardown Clean Test Environment |
| 20 | Library Collections |
| 21 | Library String |
| 22 | Library OperatingSystem |
| 23 | Library XML |
| 24 | Library RequestsLibrary |
| 25 | Library ../../Framework/utils/utils.py |
| 26 | Resource ../../Framework/utils/utils.robot |
| 27 | Library ../../Framework/restApi.py |
| 28 | Resource ../../Framework/Subscriber.robot |
| 29 | Resource ../../Framework/ATTWorkFlowDriver.robot |
| 30 | Resource ../../Framework/ONU.robot |
| 31 | Resource ../../Framework/DHCP.robot |
| 32 | Variables ../../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 *** |
| 40 | Send Auth Request and Validate PING |
| 41 | [Tags] inittest |
Kailash Khalasi | b5975cf | 2018-10-01 12:57:44 -0700 | [diff] [blame] | 42 | Execute EAPOL Request and Verify |
Kailash Khalasi | f1500c3 | 2018-10-01 12:59:44 -0700 | [diff] [blame^] | 43 | 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 Khalasi | 16d95c1 | 2018-09-21 14:17:28 -0700 | [diff] [blame] | 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 Khalasi | 16d95c1 | 2018-09-21 14:17:28 -0700 | [diff] [blame] | 49 | Wait Until Keyword Succeeds 60s 2s Ping From RG PASS |
| 50 | |
| 51 | Disable 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 | |
| 57 | Enable 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 | |
| 63 | Change Whitelist to Wrong Port Location |
Kailash Khalasi | b5975cf | 2018-10-01 12:57:44 -0700 | [diff] [blame] | 64 | [Tags] negative |
Kailash Khalasi | 16d95c1 | 2018-09-21 14:17:28 -0700 | [diff] [blame] | 65 | ${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 | |
| 71 | Update 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 Khalasi | b5975cf | 2018-10-01 12:57:44 -0700 | [diff] [blame] | 75 | Execute EAPOL Request and Verify |
Kailash Khalasi | 16d95c1 | 2018-09-21 14:17:28 -0700 | [diff] [blame] | 76 | 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 *** |
| 81 | Setup |
| 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 Khalasi | b5975cf | 2018-10-01 12:57:44 -0700 | [diff] [blame] | 107 | ## Validate ATT Workflow SI |
| 108 | Wait Until Keyword Succeeds 90s 2s Validate ATT Workflow Driver SI DISABLED AWAITING |
Kailash Khalasi | 16d95c1 | 2018-09-21 14:17:28 -0700 | [diff] [blame] | 109 | |
| 110 | Teardown |
| 111 | [Documentation] Performs any additional cleanup required |
| 112 | Log Suite Teardown cleanup |
| 113 | Delete All Sessions |
| 114 | |
| 115 | Clean 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 | |
| 120 | Validate 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 | |
| 126 | Validate 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 | |
| 132 | Validate Subscriber Status |
| 133 | [Arguments] ${exepected_status} |
| 134 | ${status} Subscriber Status Check ${onu_sn} |
| 135 | Should Be Equal ${status} ${exepected_status} |
| 136 | |
Kailash Khalasi | b5975cf | 2018-10-01 12:57:44 -0700 | [diff] [blame] | 137 | Execute 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 | |
| 142 | Authentication Completed |
| 143 | ${output}= Run kubectl -n voltha exec ${RG_CONTAINER} -- cat wpa.log |
| 144 | Should Contain ${output} authentication completed successfully |
| 145 | |
Kailash Khalasi | 16d95c1 | 2018-09-21 14:17:28 -0700 | [diff] [blame] | 146 | Ping 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} |