Kailash Khalasi | 6dab16e | 2018-09-17 20:24:08 -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 | |
Suchitra Vemuri | ff82532 | 2018-09-07 14:00:04 -0700 | [diff] [blame] | 15 | *** Settings *** |
Suchitra Vemuri | 32fc2f2 | 2018-09-10 12:06:01 -0700 | [diff] [blame] | 16 | Documentation Test successful ping from end-end |
Kailash Khalasi | f3e0a9f | 2018-09-18 13:43:42 -0700 | [diff] [blame] | 17 | Suite Setup Setup |
Kailash Khalasi | 6dab16e | 2018-09-17 20:24:08 -0700 | [diff] [blame] | 18 | Suite Teardown Teardown |
Kailash Khalasi | f3e0a9f | 2018-09-18 13:43:42 -0700 | [diff] [blame] | 19 | Test Setup Create Models |
| 20 | Test Teardown Clean Test Environment |
Suchitra Vemuri | ff82532 | 2018-09-07 14:00:04 -0700 | [diff] [blame] | 21 | Library Collections |
| 22 | Library String |
| 23 | Library OperatingSystem |
| 24 | Library XML |
| 25 | Library RequestsLibrary |
Suchitra Vemuri | 32fc2f2 | 2018-09-10 12:06:01 -0700 | [diff] [blame] | 26 | Library ../../Framework/utils/utils.py |
Kailash Khalasi | 6dab16e | 2018-09-17 20:24:08 -0700 | [diff] [blame] | 27 | Resource ../../Framework/utils/utils.robot |
Suchitra Vemuri | 32fc2f2 | 2018-09-10 12:06:01 -0700 | [diff] [blame] | 28 | Library ../../Framework/restApi.py |
Kailash Khalasi | 6dab16e | 2018-09-17 20:24:08 -0700 | [diff] [blame] | 29 | Resource ../../Framework/Subscriber.robot |
| 30 | Resource ../../Framework/ATTWorkFlowDriver.robot |
You Wang | 0c2b366 | 2018-10-01 16:56:17 -0700 | [diff] [blame] | 31 | Resource ../../Framework/Kubernetes.robot |
Kailash Khalasi | 6dab16e | 2018-09-17 20:24:08 -0700 | [diff] [blame] | 32 | Resource ../../Framework/ONU.robot |
You Wang | 0c2b366 | 2018-10-01 16:56:17 -0700 | [diff] [blame] | 33 | Resource ../../Framework/OLT.robot |
Kailash Khalasi | 6dab16e | 2018-09-17 20:24:08 -0700 | [diff] [blame] | 34 | Resource ../../Framework/DHCP.robot |
| 35 | Variables ../../Properties/RestApiProperties.py |
Suchitra Vemuri | ff82532 | 2018-09-07 14:00:04 -0700 | [diff] [blame] | 36 | |
| 37 | *** Variables *** |
Kailash Khalasi | 30a6a39 | 2018-09-10 14:32:39 -0700 | [diff] [blame] | 38 | ${WHITELIST_PATHFILE} ${CURDIR}/data/ATTWhiteList.json |
| 39 | ${SUBSCRIBER_PATHFILE} ${CURDIR}/data/ATTSubscriber.json |
Kailash Khalasi | f3e0a9f | 2018-09-18 13:43:42 -0700 | [diff] [blame] | 40 | ${VOLT_DEVICE_PATHFILE} ${CURDIR}/../data/RealOLTDevice.json |
Kailash Khalasi | 6dab16e | 2018-09-17 20:24:08 -0700 | [diff] [blame] | 41 | ${src_ip} X.X.X.X |
| 42 | ${src_gateway} X.X.X.X |
| 43 | ${src_user} user |
| 44 | ${src_pass} pass |
| 45 | ${src_iface} eth0 |
| 46 | ${dst_ip} X.X.X.X |
| 47 | ${dst_dp_iface} eth0 |
| 48 | ${dst_dp_ip} X.X.X.X |
| 49 | ${dst_user} user |
| 50 | ${dst_pass} pass |
| 51 | ${dst_gateway} X.X.X.X |
You Wang | 0c2b366 | 2018-10-01 16:56:17 -0700 | [diff] [blame] | 52 | ${olt_ip} X.X.X.X |
| 53 | ${olt_user} user |
| 54 | ${olt_pass} pass |
| 55 | ${kubernetes_conf} x.conf |
| 56 | ${kubernetes_yml} x.yml |
| 57 | ${helm_dir} ~/helm-charts |
| 58 | ${voltha_pod_num} 8 |
Suchitra Vemuri | ff82532 | 2018-09-07 14:00:04 -0700 | [diff] [blame] | 59 | |
Kailash Khalasi | a0810ce | 2018-09-10 13:03:27 -0700 | [diff] [blame] | 60 | *** Test Cases *** |
Kailash Khalasi | f3e0a9f | 2018-09-18 13:43:42 -0700 | [diff] [blame] | 61 | ONU in Correct Location + Successful Auth Request |
| 62 | [Documentation] Validates E2E Ping Connectivity and object states for the given scenario: |
| 63 | ... Discovery of ONU Device after whitelist has been configured |
| 64 | ... Sending of a successful 802.1x auth request |
| 65 | ... Configuration of the destination servers interface and start dhcpd |
| 66 | ... Configuration of source server interface and execute dhclient on interface |
| 67 | ... Validate successful pings from src to dst |
| 68 | [Setup] None |
You Wang | a744276 | 2018-10-03 11:45:03 -0700 | [diff] [blame] | 69 | Wait Until Keyword Succeeds 180s 10s Validate ONU States ACTIVE ENABLED |
You Wang | fa6d8cf | 2018-09-18 16:54:30 -0700 | [diff] [blame] | 70 | Wait Until Keyword Succeeds 60s 2s Validate ATT Workflow Driver SI ENABLED AWAITING |
| 71 | Wait Until Keyword Succeeds 60s 2s Validate Subscriber Status awaiting-auth |
You Wang | 0c2b366 | 2018-10-01 16:56:17 -0700 | [diff] [blame] | 72 | Send EAPOL Message True ${src_ip} ${src_user} ${src_pass} ${src_iface} wpa_supplicant.conf |
You Wang | fa6d8cf | 2018-09-18 16:54:30 -0700 | [diff] [blame] | 73 | Wait Until Keyword Succeeds 60s 2s Validate ATT Workflow Driver SI ENABLED APPROVED |
| 74 | Wait Until Keyword Succeeds 60s 2s Validate Subscriber Status enabled |
You Wang | 0c2b366 | 2018-10-01 16:56:17 -0700 | [diff] [blame] | 75 | Validate DHCP and Ping True True |
| 76 | |
| 77 | ONU in Correct Location + Skip Auth |
| 78 | [Documentation] Validates E2E Ping Connectivity and object states for the given scenario: |
| 79 | ... Discovery of ONU Device after whitelist has been configured |
| 80 | ... Configuration of the destination servers interface and start dhcpd |
| 81 | ... Configuration of source server interface and execute dhclient on interface |
| 82 | ... Validate failed DHCP and pings from src to dst |
You Wang | a744276 | 2018-10-03 11:45:03 -0700 | [diff] [blame] | 83 | Wait Until Keyword Succeeds 180s 10s Validate ONU States ACTIVE ENABLED |
You Wang | 0c2b366 | 2018-10-01 16:56:17 -0700 | [diff] [blame] | 84 | Wait Until Keyword Succeeds 60s 2s Validate ATT Workflow Driver SI ENABLED AWAITING |
| 85 | Wait Until Keyword Succeeds 60s 2s Validate Subscriber Status awaiting-auth |
| 86 | Validate DHCP and Ping False False |
| 87 | |
| 88 | ONU not in Whitelist + Failed Auth Request |
| 89 | [Documentation] Validates E2E Ping Connectivity and object states for the given scenario: |
| 90 | ... Discovery of ONU Device that is not in the whitelist |
| 91 | ... Sending a 802.1x auth request |
| 92 | ... Configuration of the destination servers interface and start dhcpd |
| 93 | ... Configuration of source server interface and execute dhclient on interface |
| 94 | ... Validate failed DHCP and pings from src to dst |
| 95 | [Setup] None |
| 96 | ${SubscriberList} = Get Variable Value ${slist} |
| 97 | ${SubscriberDict}= utils.listToDict ${SubscriberList} 0 |
| 98 | Wait Until Keyword Succeeds 120s 15s CORD Post ${VOLT_SUBSCRIBER} ${SubscriberDict} |
| 99 | ${VoltDeviceList} = Get Variable Value ${vlist} |
| 100 | ${VoltDeviceDict}= utils.listToDict ${VoltDeviceList} 0 |
| 101 | CORD Post ${VOLT_DEVICE} ${VoltDeviceDict} |
You Wang | a744276 | 2018-10-03 11:45:03 -0700 | [diff] [blame] | 102 | Wait Until Keyword Succeeds 180s 10s Validate ONU States UNKNOWN DISABLED |
You Wang | 0c2b366 | 2018-10-01 16:56:17 -0700 | [diff] [blame] | 103 | Wait Until Keyword Succeeds 60s 2s Validate ATT Workflow Driver SI DISABLED AWAITING |
| 104 | Wait Until Keyword Succeeds 60s 2s Validate Subscriber Status awaiting-auth |
| 105 | Send EAPOL Message False ${src_ip} ${src_user} ${src_pass} ${src_iface} wpa_supplicant.conf |
| 106 | Wait Until Keyword Succeeds 60s 2s Validate ATT Workflow Driver SI DISABLED AWAITING |
| 107 | Wait Until Keyword Succeeds 60s 2s Validate Subscriber Status awaiting-auth |
| 108 | Validate DHCP and Ping False False |
Suchitra Vemuri | ff82532 | 2018-09-07 14:00:04 -0700 | [diff] [blame] | 109 | |
| 110 | *** Keywords *** |
Kailash Khalasi | f3e0a9f | 2018-09-18 13:43:42 -0700 | [diff] [blame] | 111 | Setup |
| 112 | ${auth} = Create List ${XOS_USER} ${XOS_PASSWD} |
| 113 | ${HEADERS} Create Dictionary Content-Type=application/json |
| 114 | Create Session ${server_ip} http://${server_ip}:${server_port} auth=${AUTH} headers=${HEADERS} |
| 115 | ${att_workflow_service_id}= Get Service Owner Id ${ATT_SERVICE} |
| 116 | ${volt_service_id}= Get Service Owner Id ${VOLT_SERVICE} |
Kailash Khalasi | 30a6a39 | 2018-09-10 14:32:39 -0700 | [diff] [blame] | 117 | ${AttWhiteListList}= utils.jsonToList ${WHITELIST_PATHFILE} AttWhiteListInfo |
| 118 | Set Suite Variable ${alist} ${AttWhiteListList} |
| 119 | ${AttWhiteListList} = Get Variable Value ${alist} |
Suchitra Vemuri | ff82532 | 2018-09-07 14:00:04 -0700 | [diff] [blame] | 120 | ${AttWhiteListDict}= utils.listToDict ${AttWhiteListList} 0 |
Kailash Khalasi | f3e0a9f | 2018-09-18 13:43:42 -0700 | [diff] [blame] | 121 | ${AttWhiteListDict}= utils.setFieldValueInDict ${AttWhiteListDict} owner_id ${att_workflow_service_id} |
Suchitra Vemuri | ff82532 | 2018-09-07 14:00:04 -0700 | [diff] [blame] | 122 | ${onu_device}= Get From Dictionary ${AttWhiteListDict} serial_number |
| 123 | Log ${onu_device} |
Suchitra Vemuri | ff82532 | 2018-09-07 14:00:04 -0700 | [diff] [blame] | 124 | Set Global Variable ${onu_device} |
Kailash Khalasi | 30a6a39 | 2018-09-10 14:32:39 -0700 | [diff] [blame] | 125 | ${SubscriberList}= utils.jsonToList ${SUBSCRIBER_PATHFILE} SubscriberInfo |
| 126 | Set Global Variable ${slist} ${SubscriberList} |
Kailash Khalasi | 6dab16e | 2018-09-17 20:24:08 -0700 | [diff] [blame] | 127 | ${SubscriberList} = Get Variable Value ${slist} |
| 128 | ${SubscriberDict}= utils.listToDict ${SubscriberList} 0 |
| 129 | ${s_tag}= utils.getFieldValueFromDict ${SubscriberDict} s_tag |
| 130 | ${c_tag}= utils.getFieldValueFromDict ${SubscriberDict} c_tag |
Kailash Khalasi | f3e0a9f | 2018-09-18 13:43:42 -0700 | [diff] [blame] | 131 | ${VoltDeviceList}= utils.jsonToList ${VOLT_DEVICE_PATHFILE} VOLTDeviceInfo |
| 132 | Set Global Variable ${vlist} ${VoltDeviceList} |
Kailash Khalasi | 6dab16e | 2018-09-17 20:24:08 -0700 | [diff] [blame] | 133 | Set Suite Variable ${s_tag} |
| 134 | Set Suite Variable ${c_tag} |
Suchitra Vemuri | ff82532 | 2018-09-07 14:00:04 -0700 | [diff] [blame] | 135 | |
Suchitra Vemuri | 32fc2f2 | 2018-09-10 12:06:01 -0700 | [diff] [blame] | 136 | Teardown |
Kailash Khalasi | f3e0a9f | 2018-09-18 13:43:42 -0700 | [diff] [blame] | 137 | [Documentation] Performs any additional cleanup required |
| 138 | Log Suite Teardown cleanup |
| 139 | Delete All Sessions |
| 140 | |
| 141 | Create Models |
| 142 | [Documentation] Re-create Subscriber, whitelist, and olt-device models to test |
| 143 | Log Re-creating objects |
| 144 | #create attwhitelist |
| 145 | ${AttWhiteListList} = Get Variable Value ${alist} |
| 146 | ${AttWhiteListDict}= utils.listToDict ${AttWhiteListList} 0 |
| 147 | CORD Post ${ATT_WHITELIST} ${AttWhiteListDict} |
| 148 | #create subscriber |
| 149 | ${SubscriberList} = Get Variable Value ${slist} |
| 150 | ${SubscriberDict}= utils.listToDict ${SubscriberList} 0 |
| 151 | Wait Until Keyword Succeeds 120s 15s CORD Post ${VOLT_SUBSCRIBER} ${SubscriberDict} |
| 152 | #create olt device |
| 153 | ${VoltDeviceList} = Get Variable Value ${vlist} |
| 154 | ${VoltDeviceDict}= utils.listToDict ${VoltDeviceList} 0 |
| 155 | CORD Post ${VOLT_DEVICE} ${VoltDeviceDict} |
| 156 | |
| 157 | Clean Test Environment |
| 158 | [Documentation] Delete xos objects, kills processes and cleans up interfaces on src+dst servers |
Kailash Khalasi | 052cbb1 | 2018-09-13 16:50:13 -0700 | [diff] [blame] | 159 | Run Keyword And Ignore Error Kill Linux Process ${src_ip} ${src_user} ${src_pass} [w]pa_supplicant |
| 160 | Run Keyword And Ignore Error Kill Linux Process ${src_ip} ${src_user} ${src_pass} [d]hclient |
Kailash Khalasi | 6dab16e | 2018-09-17 20:24:08 -0700 | [diff] [blame] | 161 | Run Keyword And Ignore Error Kill Linux Process ${dst_ip} ${dst_user} ${dst_pass} [d]hcpd |
Kailash Khalasi | 052cbb1 | 2018-09-13 16:50:13 -0700 | [diff] [blame] | 162 | Delete IP Addresses from Interface on Remote Host ${src_ip} ${src_user} ${src_pass} ${src_iface} |
You Wang | 0c2b366 | 2018-10-01 16:56:17 -0700 | [diff] [blame] | 163 | Delete Interface on Remote Host ${dst_ip} ${dst_user} ${dst_pass} ${dst_dp_iface}.${s_tag} |
Kailash Khalasi | adc4b4d | 2018-09-19 10:23:55 -0700 | [diff] [blame] | 164 | Wait Until Keyword Succeeds 60s 2s Clean Up Objects ${VOLT_SUBSCRIBER} |
| 165 | Wait Until Keyword Succeeds 60s 2s Clean Up Objects ${VOLT_DEVICE} |
| 166 | Wait Until Keyword Succeeds 60s 2s Clean Up Objects ${ATT_WHITELIST} |
You Wang | 0c2b366 | 2018-10-01 16:56:17 -0700 | [diff] [blame] | 167 | Wait Until Keyword Succeeds 120s 10s Check Remote System Reachability False ${olt_ip} |
| 168 | Wait Until Keyword Succeeds 120s 10s Check Remote System Reachability True ${olt_ip} |
| 169 | Wait Until Keyword Succeeds 120s 10s Openolt is Up ${olt_ip} ${olt_user} ${olt_pass} |
| 170 | Wait Until Keyword Succeeds 300s 10s Reinstall Voltha |
Kailash Khalasi | a0810ce | 2018-09-10 13:03:27 -0700 | [diff] [blame] | 171 | |
| 172 | Validate ONU States |
| 173 | [Arguments] ${expected_op_status} ${expected_admin_status} |
| 174 | ${operational_status} ${admin_status} ONU Status Check ${onu_device} |
| 175 | Should Be Equal ${operational_status} ${expected_op_status} |
| 176 | Should Be Equal ${admin_status} ${expected_admin_status} |
| 177 | |
| 178 | Validate ATT Workflow Driver SI |
| 179 | [Arguments] ${expected_status} ${expected_auth_status} |
You Wang | fa6d8cf | 2018-09-18 16:54:30 -0700 | [diff] [blame] | 180 | ${onu_state} ${authentication_status} Service Instance Status Check ${onu_device} |
| 181 | Should Be Equal ${onu_state} ${expected_status} |
Kailash Khalasi | a0810ce | 2018-09-10 13:03:27 -0700 | [diff] [blame] | 182 | Should Be Equal ${authentication_status} ${expected_auth_status} |
| 183 | |
| 184 | Validate Subscriber Status |
| 185 | [Arguments] ${exepected_status} |
| 186 | ${status} Subscriber Status Check ${onu_device} |
You Wang | fa6d8cf | 2018-09-18 16:54:30 -0700 | [diff] [blame] | 187 | Should Be Equal ${status} ${exepected_status} |
You Wang | 0c2b366 | 2018-10-01 16:56:17 -0700 | [diff] [blame] | 188 | |
| 189 | Validate DHCP and Ping |
| 190 | [Arguments] ${dhcp_pass} ${ping_pass} |
| 191 | Add Double Vlan Interface on Host ${dst_ip} ${dst_user} ${dst_pass} ${dst_dp_iface} ${s_tag} ${c_tag} |
| 192 | Add IP Address on Interface on Host ${dst_ip} ${dst_user} ${dst_pass} ${dst_dp_ip}/24 ${dst_dp_iface}.${s_tag}.${c_tag} |
| 193 | Start DHCP Server on Remote Host ${dst_ip} ${dst_user} ${dst_pass} ${dst_dp_iface}.${s_tag}.${c_tag} |
| 194 | Send Dhclient Request ${src_ip} ${src_user} ${src_pass} ${src_iface} |
| 195 | Run Keyword If '${dhcp_pass}' == 'True' Wait Until Keyword Succeeds 60s 5s Check IPv4 Address on DHCP Client True ${src_ip} ${src_user} ${src_pass} ${src_iface} |
| 196 | Run Keyword If '${dhcp_pass}' == 'False' Sleep 10s |
| 197 | Run Keyword If '${dhcp_pass}' == 'False' Check IPv4 Address on DHCP Client False ${src_ip} ${src_user} ${src_pass} ${src_iface} |
| 198 | Run Keyword If '${ping_pass}' == 'True' Wait Until Keyword Succeeds 60s 5s Test Ping PASS ${src_ip} ${src_user} ${src_pass} ${dst_dp_ip} ${src_iface} |
| 199 | Run Keyword If '${ping_pass}' == 'False' Wait Until Keyword Succeeds 60s 5s Test Ping FAIL ${src_ip} ${src_user} ${src_pass} ${dst_dp_ip} ${src_iface} |
| 200 | |
| 201 | Reinstall Voltha |
| 202 | Run export KUBECONFIG=${kubernetes_conf} |
| 203 | Run helm delete --purge voltha |
| 204 | Wait Until Keyword Succeeds 60s 10s Helm Chart is Removed ${kubernetes_conf} voltha |
| 205 | Wait Until Keyword Succeeds 120s 10s Kubernetes PODs in Namespace are Removed ${kubernetes_conf} voltha |
| 206 | ${rc} ${output}= Run And Return Rc And Output helm install -n voltha -f ${kubernetes_yml} --set etcd-operator.customResources.createEtcdClusterCRD=false ${helm_dir}/voltha |
| 207 | ${rc} ${output}= Run And Return Rc And Output helm upgrade -f ${kubernetes_yml} --set etcd-operator.customResources.createEtcdClusterCRD=true voltha ${helm_dir}/voltha |
| 208 | Wait Until Keyword Succeeds 30s 5s Kubernetes PODs in Namespace are Running ${kubernetes_conf} voltha ${voltha_pod_num} |
| 209 | Sleep 10s |