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 |
| 42 | ${auth_request}= Run kubectl -n voltha exec ${RG_CONTAINER} -- wpa_supplicant -i eth0 -Dwired -c /etc/wpa_supplicant/wpa_supplicant.conf -B |
| 43 | Should Contain ${auth_request} Successfully initialized wpa_supplicant |
| 44 | Run kubectl -n voltha exec ${RG_CONTAINER} -- dhclient |
| 45 | Run kubectl -n voltha exec ${RG_CONTAINER} -- dhclient -r |
| 46 | Run kubectl -n voltha exec ${RG_CONTAINER} -- dhclient |
| 47 | Wait Until Keyword Succeeds 10s 2s Validate ONU States ACTIVE ENABLED |
| 48 | Wait Until Keyword Succeeds 60s 2s Validate ATT Workflow Driver SI ENABLED APPROVED |
| 49 | Wait Until Keyword Succeeds 60s 2s Validate Subscriber Status enabled |
| 50 | Should Contain ${auth_request} Successfully initialized wpa_supplicant |
| 51 | Wait Until Keyword Succeeds 60s 2s Ping From RG PASS |
| 52 | |
| 53 | Disable Subscriber |
| 54 | [Tags] disable |
| 55 | ${subscriber_id}= Retrieve Subscriber ${c_tag} |
| 56 | CORD Put ${VOLT_SUBSCRIBER} {"status":"disabled"} ${subscriber_id} |
| 57 | Wait Until Keyword Succeeds 60s 2s Ping From RG FAIL |
| 58 | |
| 59 | Enable Subscriber |
| 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 |
| 66 | [Tags] notready |
| 67 | ${whitelist_id}= Retrieve Whitelist Entry ${onu_sn} |
| 68 | CORD Put ${ATT_WHITELIST} {"pon_port_id": 55 } ${whitelist_id} |
| 69 | Wait Until Keyword Succeeds 60s 2s Validate ATT Workflow Driver SI DISABLED AWAITING |
| 70 | Wait Until Keyword Succeeds 60s 2s Validate Subscriber Status awaiting-auth |
| 71 | Wait Until Keyword Succeeds 60s 2s Ping From RG FAIL |
| 72 | |
| 73 | Update Whitelist to Correct Port Location |
| 74 | [Tags] notready |
| 75 | ${whitelist_id}= Retrieve Whitelist Entry ${onu_sn} |
| 76 | CORD Put ${ATT_WHITELIST} {"pon_port_id": 1 } ${whitelist_id} |
| 77 | ${auth_request}= Run kubectl -n voltha exec ${RG_CONTAINER} -- wpa_supplicant -i eth0 -Dwired -c /etc/wpa_supplicant/wpa_supplicant.conf -B |
| 78 | Should Contain ${auth_request} Successfully initialized wpa_supplicant |
| 79 | Wait Until Keyword Succeeds 60s 2s Validate ATT Workflow Driver SI ENABLED APPROVED |
| 80 | Wait Until Keyword Succeeds 60s 2s Validate Subscriber Status enabled |
| 81 | Wait Until Keyword Succeeds 60s 2s Ping From RG PASS |
| 82 | |
| 83 | *** Keywords *** |
| 84 | Setup |
| 85 | ${auth} = Create List ${XOS_USER} ${XOS_PASSWD} |
| 86 | ${HEADERS} Create Dictionary Content-Type=application/json |
| 87 | Create Session ${server_ip} http://${server_ip}:${server_port} auth=${AUTH} headers=${HEADERS} |
| 88 | ${att_workflow_service_id}= Get Service Owner Id ${ATT_SERVICE} |
| 89 | ${volt_service_id}= Get Service Owner Id ${VOLT_SERVICE} |
| 90 | ${AttWhiteListList}= utils.jsonToList ${WHITELIST_PATHFILE} AttWhiteListInfo |
| 91 | Set Suite Variable ${alist} ${AttWhiteListList} |
| 92 | ${AttWhiteListList} = Get Variable Value ${alist} |
| 93 | ${AttWhiteListDict}= utils.listToDict ${AttWhiteListList} 0 |
| 94 | ${AttWhiteListDict}= utils.setFieldValueInDict ${AttWhiteListDict} owner_id ${att_workflow_service_id} |
| 95 | ${onu_sn}= Get From Dictionary ${AttWhiteListDict} serial_number |
| 96 | Log ${onu_sn} |
| 97 | Set Global Variable ${onu_sn} |
| 98 | ${SubscriberList}= utils.jsonToList ${SUBSCRIBER_PATHFILE} SubscriberInfo |
| 99 | Set Global Variable ${slist} ${SubscriberList} |
| 100 | ${SubscriberList} = Get Variable Value ${slist} |
| 101 | ${SubscriberDict}= utils.listToDict ${SubscriberList} 0 |
| 102 | ${s_tag}= utils.getFieldValueFromDict ${SubscriberDict} s_tag |
| 103 | ${c_tag}= utils.getFieldValueFromDict ${SubscriberDict} c_tag |
| 104 | ${VoltDeviceList}= utils.jsonToList ${VOLT_DEVICE_PATHFILE} VOLTDeviceInfo |
| 105 | Set Global Variable ${vlist} ${VoltDeviceList} |
| 106 | Set Suite Variable ${s_tag} |
| 107 | Set Suite Variable ${c_tag} |
| 108 | ${RG_CONTAINER}= Run kubectl -n voltha get pod|grep "^rg-"|cut -d' ' -f1 |
| 109 | Set Suite Variable ${RG_CONTAINER} |
| 110 | |
| 111 | Teardown |
| 112 | [Documentation] Performs any additional cleanup required |
| 113 | Log Suite Teardown cleanup |
| 114 | Delete All Sessions |
| 115 | |
| 116 | Clean Test Environment |
| 117 | ## TODO: fix this. not working right now |
| 118 | #Run kubectl -n voltha exec ${RG_CONTAINER} -- kill $(ps aux | grep [w]pa_supplicant | awk '{print $2}') |
| 119 | Log Need to kill wpa_supplicant process on RG |
| 120 | |
| 121 | Validate ONU States |
| 122 | [Arguments] ${expected_op_status} ${expected_admin_status} |
| 123 | ${operational_status} ${admin_status} ONU Status Check ${onu_sn} |
| 124 | Should Be Equal ${operational_status} ${expected_op_status} |
| 125 | Should Be Equal ${admin_status} ${expected_admin_status} |
| 126 | |
| 127 | Validate ATT Workflow Driver SI |
| 128 | [Arguments] ${expected_status} ${expected_auth_status} |
| 129 | ${onu_state} ${authentication_status} Service Instance Status Check ${onu_sn} |
| 130 | Should Be Equal ${onu_state} ${expected_status} |
| 131 | Should Be Equal ${authentication_status} ${expected_auth_status} |
| 132 | |
| 133 | Validate Subscriber Status |
| 134 | [Arguments] ${exepected_status} |
| 135 | ${status} Subscriber Status Check ${onu_sn} |
| 136 | Should Be Equal ${status} ${exepected_status} |
| 137 | |
| 138 | Ping From RG |
| 139 | [Arguments] ${status} |
| 140 | ${result}= Run kubectl -n voltha exec ${RG_CONTAINER} -- ping -c 5 172.18.0.10 |
| 141 | Run Keyword If '${status}' == 'PASS' Should Contain ${result} 64 bytes |
| 142 | Run Keyword If '${status}' == 'PASS' Should Contain ${result} 0% packet loss |
| 143 | Run Keyword If '${status}' == 'PASS' Should Not Contain ${result} 100% packet loss |
| 144 | Run Keyword If '${status}' == 'PASS' Should Not Contain ${result} 80% packet loss |
| 145 | Run Keyword If '${status}' == 'PASS' Should Not Contain ${result} 60% packet loss |
| 146 | Run Keyword If '${status}' == 'PASS' Should Not Contain ${result} 40% packet loss |
| 147 | Run Keyword If '${status}' == 'PASS' Should Not Contain ${result} 20% packet loss |
| 148 | Run Keyword If '${status}' == 'PASS' Should Not Contain ${result} Destination Host Unreachable |
| 149 | Run Keyword If '${status}' == 'FAIL' Should Not Contain ${result} 64 bytes |
| 150 | Run Keyword If '${status}' == 'FAIL' Should Contain ${result} 100% packet loss |
| 151 | Log To Console \n ${result} |