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 |
Kailash Khalasi | 16d95c1 | 2018-09-21 14:17:28 -0700 | [diff] [blame] | 19 | Library Collections |
| 20 | Library String |
| 21 | Library OperatingSystem |
| 22 | Library XML |
| 23 | Library RequestsLibrary |
| 24 | Library ../../Framework/utils/utils.py |
| 25 | Resource ../../Framework/utils/utils.robot |
| 26 | Library ../../Framework/restApi.py |
| 27 | Resource ../../Framework/Subscriber.robot |
| 28 | Resource ../../Framework/ATTWorkFlowDriver.robot |
| 29 | Resource ../../Framework/ONU.robot |
| 30 | Resource ../../Framework/DHCP.robot |
| 31 | Variables ../../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 *** |
| 39 | Send Auth Request and Validate PING |
Kailash Khalasi | 0e515fe | 2018-10-02 12:13:47 -0700 | [diff] [blame] | 40 | [Documentation] Validate successful pings from valid auth request |
Kailash Khalasi | 16d95c1 | 2018-09-21 14:17:28 -0700 | [diff] [blame] | 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 |
Kailash Khalasi | 0e515fe | 2018-10-02 12:13:47 -0700 | [diff] [blame] | 52 | [Documentation] Validate pings fail when subscriber disabled |
Kailash Khalasi | 16d95c1 | 2018-09-21 14:17:28 -0700 | [diff] [blame] | 53 | [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 | |
| 58 | Enable Subscriber |
Kailash Khalasi | 0e515fe | 2018-10-02 12:13:47 -0700 | [diff] [blame] | 59 | [Documentation] Validate pings pass when subscriber enabled |
Kailash Khalasi | 16d95c1 | 2018-09-21 14:17:28 -0700 | [diff] [blame] | 60 | [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 | |
| 65 | Change Whitelist to Wrong Port Location |
Kailash Khalasi | 0e515fe | 2018-10-02 12:13:47 -0700 | [diff] [blame] | 66 | [Documentation] Validate pings fail from when onu port location in whitelist is changed |
Kailash Khalasi | b5975cf | 2018-10-01 12:57:44 -0700 | [diff] [blame] | 67 | [Tags] negative |
Kailash Khalasi | 16d95c1 | 2018-09-21 14:17:28 -0700 | [diff] [blame] | 68 | ${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 Khalasi | 0e515fe | 2018-10-02 12:13:47 -0700 | [diff] [blame] | 73 | [Teardown] Restart RG Pod |
Kailash Khalasi | 16d95c1 | 2018-09-21 14:17:28 -0700 | [diff] [blame] | 74 | |
| 75 | Update Whitelist to Correct Port Location |
Kailash Khalasi | 0e515fe | 2018-10-02 12:13:47 -0700 | [diff] [blame] | 76 | [Documentation] Validate pings pass from when whitelist updated to correct port location |
| 77 | [Tags] update |
Kailash Khalasi | 16d95c1 | 2018-09-21 14:17:28 -0700 | [diff] [blame] | 78 | ${whitelist_id}= Retrieve Whitelist Entry ${onu_sn} |
| 79 | CORD Put ${ATT_WHITELIST} {"pon_port_id": 1 } ${whitelist_id} |
Kailash Khalasi | b5975cf | 2018-10-01 12:57:44 -0700 | [diff] [blame] | 80 | Execute EAPOL Request and Verify |
Kailash Khalasi | 0e515fe | 2018-10-02 12:13:47 -0700 | [diff] [blame] | 81 | 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 Khalasi | 16d95c1 | 2018-09-21 14:17:28 -0700 | [diff] [blame] | 84 | 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 Khalasi | 0e515fe | 2018-10-02 12:13:47 -0700 | [diff] [blame] | 87 | [Teardown] Restart RG Pod |
Kailash Khalasi | 16d95c1 | 2018-09-21 14:17:28 -0700 | [diff] [blame] | 88 | |
| 89 | *** Keywords *** |
| 90 | Setup |
| 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 Khalasi | 0e515fe | 2018-10-02 12:13:47 -0700 | [diff] [blame] | 114 | ${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 Khalasi | 16d95c1 | 2018-09-21 14:17:28 -0700 | [diff] [blame] | 118 | ${RG_CONTAINER}= Run kubectl -n voltha get pod|grep "^rg-"|cut -d' ' -f1 |
| 119 | Set Suite Variable ${RG_CONTAINER} |
Kailash Khalasi | b5975cf | 2018-10-01 12:57:44 -0700 | [diff] [blame] | 120 | ## Validate ATT Workflow SI |
Kailash Khalasi | e31a78e | 2018-10-01 13:19:11 -0700 | [diff] [blame] | 121 | Wait Until Keyword Succeeds 90s 2s Validate ATT Workflow Driver SI ENABLED AWAITING |
Kailash Khalasi | 16d95c1 | 2018-09-21 14:17:28 -0700 | [diff] [blame] | 122 | |
| 123 | Teardown |
Kailash Khalasi | 0e515fe | 2018-10-02 12:13:47 -0700 | [diff] [blame] | 124 | [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 Khalasi | 16d95c1 | 2018-09-21 14:17:28 -0700 | [diff] [blame] | 128 | Delete All Sessions |
| 129 | |
Kailash Khalasi | 0e515fe | 2018-10-02 12:13:47 -0700 | [diff] [blame] | 130 | Restart 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 Khalasi | 16d95c1 | 2018-09-21 14:17:28 -0700 | [diff] [blame] | 135 | |
| 136 | Validate 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 | |
| 142 | Validate 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 | |
| 148 | Validate Subscriber Status |
| 149 | [Arguments] ${exepected_status} |
| 150 | ${status} Subscriber Status Check ${onu_sn} |
| 151 | Should Be Equal ${status} ${exepected_status} |
| 152 | |
Kailash Khalasi | b5975cf | 2018-10-01 12:57:44 -0700 | [diff] [blame] | 153 | Execute 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 | |
| 158 | Authentication Completed |
| 159 | ${output}= Run kubectl -n voltha exec ${RG_CONTAINER} -- cat wpa.log |
| 160 | Should Contain ${output} authentication completed successfully |
| 161 | |
Kailash Khalasi | 16d95c1 | 2018-09-21 14:17:28 -0700 | [diff] [blame] | 162 | Ping 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 Khalasi | 0e515fe | 2018-10-02 12:13:47 -0700 | [diff] [blame] | 175 | Log To Console \n ${result} |