Suchitra Vemuri | 3f8b0f6 | 2019-09-12 13:25:16 -0700 | [diff] [blame] | 1 | #Copyright 2017-present Open Networking Foundation |
Suchitra Vemuri | 65cd65f | 2019-08-30 14:39:22 -0700 | [diff] [blame] | 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 | |
Matteo Scandolo | 1294aeb | 2019-09-24 16:20:32 -0700 | [diff] [blame] | 15 | # FIXME Can we use the same test against BBSim and Hardware? |
| 16 | |
Suchitra Vemuri | 65cd65f | 2019-08-30 14:39:22 -0700 | [diff] [blame] | 17 | *** Settings *** |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 18 | Documentation Test various end-to-end scenarios |
Suchitra Vemuri | 65cd65f | 2019-08-30 14:39:22 -0700 | [diff] [blame] | 19 | Suite Setup Setup Suite |
Suchitra Vemuri | 65cd65f | 2019-08-30 14:39:22 -0700 | [diff] [blame] | 20 | Test Setup Setup |
| 21 | Test Teardown Teardown |
Andy Bavier | ba9866b | 2019-10-11 07:11:53 -0700 | [diff] [blame] | 22 | Suite Teardown Teardown Suite |
Suchitra Vemuri | 65cd65f | 2019-08-30 14:39:22 -0700 | [diff] [blame] | 23 | Library Collections |
| 24 | Library String |
| 25 | Library OperatingSystem |
| 26 | Library XML |
| 27 | Library RequestsLibrary |
Andy Bavier | ba9866b | 2019-10-11 07:11:53 -0700 | [diff] [blame] | 28 | Library ../../libraries/DependencyLibrary.py |
Suchitra Vemuri | b8ed2d5 | 2019-09-30 13:22:51 -0700 | [diff] [blame] | 29 | Resource ../../libraries/onos.robot |
| 30 | Resource ../../libraries/voltctl.robot |
| 31 | Resource ../../libraries/utils.robot |
Andy Bavier | ba9866b | 2019-10-11 07:11:53 -0700 | [diff] [blame] | 32 | Resource ../../libraries/k8s.robot |
Suchitra Vemuri | b8ed2d5 | 2019-09-30 13:22:51 -0700 | [diff] [blame] | 33 | Resource ../../variables/variables.robot |
Suchitra Vemuri | 65cd65f | 2019-08-30 14:39:22 -0700 | [diff] [blame] | 34 | |
| 35 | *** Variables *** |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 36 | ${POD_NAME} flex-ocp-cord |
| 37 | ${KUBERNETES_CONF} ${KUBERNETES_CONFIGS_DIR}/${POD_NAME}.conf |
| 38 | ${KUBERNETES_CONFIGS_DIR} ~/pod-configs/kubernetes-configs |
| 39 | #${KUBERNETES_CONFIGS_DIR} ${KUBERNETES_CONFIGS_DIR}/${POD_NAME}.conf |
| 40 | ${KUBERNETES_YAML} ${KUBERNETES_CONFIGS_DIR}/${POD_NAME}.yml |
| 41 | ${HELM_CHARTS_DIR} ~/helm-charts |
| 42 | ${VOLTHA_POD_NUM} 8 |
Andy Bavier | ba9866b | 2019-10-11 07:11:53 -0700 | [diff] [blame] | 43 | ${timeout} 60s |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 44 | ${of_id} 0 |
| 45 | ${logical_id} 0 |
Andy Bavier | ba9866b | 2019-10-11 07:11:53 -0700 | [diff] [blame] | 46 | ${has_dataplane} True |
| 47 | ${external_libs} True |
| 48 | ${teardown_device} False |
Suchitra Vemuri | 65cd65f | 2019-08-30 14:39:22 -0700 | [diff] [blame] | 49 | |
| 50 | *** Test Cases *** |
| 51 | Sanity E2E Test for OLT/ONU on POD |
| 52 | [Documentation] Validates E2E Ping Connectivity and object states for the given scenario: |
| 53 | ... Validate successful authentication/DHCP/E2E ping for the tech profile that is used |
Andy Bavier | ba9866b | 2019-10-11 07:11:53 -0700 | [diff] [blame] | 54 | [Tags] sanity test1 |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 55 | #[Setup] Clean Up Linux |
Andy Bavier | ba9866b | 2019-10-11 07:11:53 -0700 | [diff] [blame] | 56 | ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${olt_serial_number} |
| 57 | Set Global Variable ${of_id} |
Suchitra Vemuri | 8a9c378 | 2019-10-23 12:43:01 -0700 | [diff] [blame] | 58 | |
| 59 | FOR ${I} IN RANGE 0 ${num_onus} |
| 60 | ${src}= Set Variable ${hosts.src[${I}]} |
| 61 | ${dst}= Set Variable ${hosts.dst[${I}]} |
| 62 | |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame^] | 63 | Wait Until Keyword Succeeds ${timeout} 5s Validate Device ENABLED ACTIVE REACHABLE |
| 64 | ... ${src['onu']} onu=True onu_reason=omci-flows-pushed |
Suchitra Vemuri | 8a9c378 | 2019-10-23 12:43:01 -0700 | [diff] [blame] | 65 | |
| 66 | ${onu_device_id}= Get Device ID From SN ${src['onu']} |
Gilles Depatie | 675a206 | 2019-10-22 12:44:42 -0400 | [diff] [blame] | 67 | ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']} |
| 68 | ... ${of_id} |
| 69 | Wait Until Keyword Succeeds ${timeout} 2s Verify Eapol Flows Added For ONU ${k8s_node_ip} |
| 70 | ... ${ONOS_SSH_PORT} ${onu_port} |
| 71 | Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate Authentication True |
| 72 | ... ${src['dp_iface_name']} wpa_supplicant.conf ${src['ip']} ${src['user']} ${src['pass']} |
Suchitra Vemuri | 8a9c378 | 2019-10-23 12:43:01 -0700 | [diff] [blame] | 73 | ... ${src['container_type']} ${src['container_name']} |
Gilles Depatie | 675a206 | 2019-10-22 12:44:42 -0400 | [diff] [blame] | 74 | Wait Until Keyword Succeeds ${timeout} 2s Verify ONU in AAA-Users ${k8s_node_ip} |
| 75 | ... ${ONOS_SSH_PORT} ${onu_port} |
| 76 | Wait Until Keyword Succeeds ${timeout} 2s Execute ONOS CLI Command ${k8s_node_ip} |
| 77 | ... ${ONOS_SSH_PORT} volt-add-subscriber-access ${of_id} ${onu_port} |
| 78 | Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate DHCP and Ping True |
| 79 | ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']} |
| 80 | ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']} |
| 81 | ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']} |
| 82 | ... ${dst['container_name']} |
| 83 | Wait Until Keyword Succeeds ${timeout} 2s Run Keyword And Continue On Failure |
| 84 | ... Validate Subscriber DHCP Allocation ${k8s_node_ip} ${ONOS_SSH_PORT} ${onu_port} |
Suchitra Vemuri | 8a9c378 | 2019-10-23 12:43:01 -0700 | [diff] [blame] | 85 | END |
Suchitra Vemuri | 65cd65f | 2019-08-30 14:39:22 -0700 | [diff] [blame] | 86 | |
| 87 | *** Keywords *** |
| 88 | Setup Suite |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 89 | [Documentation] Setup the whole test suite |
Andy Bavier | ba9866b | 2019-10-11 07:11:53 -0700 | [diff] [blame] | 90 | # BBSim sanity test doesn't need these imports from other repositories |
Gilles Depatie | 675a206 | 2019-10-22 12:44:42 -0400 | [diff] [blame] | 91 | Run Keyword If ${external_libs} Import Library |
| 92 | ... ${CURDIR}/../../../voltha/tests/atests/common/testCaseUtils.py |
| 93 | Run Keyword If ${external_libs} Import Resource |
| 94 | ... ${CURDIR}/../../../cord-tester/src/test/cord-api/Framework/Subscriber.robot |
| 95 | Run Keyword If ${external_libs} Import Resource |
| 96 | ... ${CURDIR}/../../../cord-tester/src/test/cord-api/Framework/OLT.robot |
| 97 | Run Keyword If ${external_libs} Import Resource |
| 98 | ... ${CURDIR}/../../../cord-tester/src/test/cord-api/Framework/DHCP.robot |
| 99 | Run Keyword If ${external_libs} Import Resource |
| 100 | ... ${CURDIR}/../../../cord-tester/src/test/cord-api/Framework/Kubernetes.robot |
Suchitra Vemuri | 2adc07e | 2019-09-05 17:25:31 -0700 | [diff] [blame] | 101 | Set Global Variable ${KUBECTL_CONFIG} export KUBECONFIG=%{KUBECONFIG} |
Suchitra Vemuri | 65cd65f | 2019-08-30 14:39:22 -0700 | [diff] [blame] | 102 | Set Global Variable ${export_kubeconfig} export KUBECONFIG=${KUBERNETES_CONF} |
Suchitra Vemuri | 65cd65f | 2019-08-30 14:39:22 -0700 | [diff] [blame] | 103 | Set Global Variable ${VOLTCTL_CONFIG} export VOLTCONFIG=%{VOLTCONFIG} |
| 104 | ${k8s_node_ip}= Evaluate ${nodes}[0].get("ip") |
| 105 | ${k8s_node_user}= Evaluate ${nodes}[0].get("user") |
| 106 | ${k8s_node_pass}= Evaluate ${nodes}[0].get("pass") |
| 107 | Check CLI Tools Configured |
| 108 | ${onos_auth}= Create List karaf karaf |
| 109 | ${HEADERS} Create Dictionary Content-Type=application/json |
Suchitra Vemuri | 9c24d2b | 2019-09-30 10:28:25 -0700 | [diff] [blame] | 110 | Create Session ONOS http://${k8s_node_ip}:${ONOS_REST_PORT} auth=${ONOS_AUTH} |
Suchitra Vemuri | 65cd65f | 2019-08-30 14:39:22 -0700 | [diff] [blame] | 111 | ${olt_ip}= Evaluate ${olts}[0].get("ip") |
| 112 | ${olt_user}= Evaluate ${olts}[0].get("user") |
| 113 | ${olt_pass}= Evaluate ${olts}[0].get("pass") |
| 114 | ${olt_serial_number}= Evaluate ${olts}[0].get("serial") |
Suchitra Vemuri | 8a9c378 | 2019-10-23 12:43:01 -0700 | [diff] [blame] | 115 | ${num_onus}= Get Length ${hosts.src} |
| 116 | ${num_onus}= Convert to String ${num_onus} |
| 117 | Set Suite Variable ${num_onus} |
Suchitra Vemuri | 2adc07e | 2019-09-05 17:25:31 -0700 | [diff] [blame] | 118 | Set Suite Variable ${olt_serial_number} |
Suchitra Vemuri | 65cd65f | 2019-08-30 14:39:22 -0700 | [diff] [blame] | 119 | Set Suite Variable ${olt_ip} |
| 120 | Set Suite Variable ${olt_user} |
| 121 | Set Suite Variable ${olt_pass} |
| 122 | Set Suite Variable ${k8s_node_ip} |
| 123 | Set Suite Variable ${k8s_node_user} |
| 124 | Set Suite Variable ${k8s_node_pass} |
Suchitra Vemuri | 8a9c378 | 2019-10-23 12:43:01 -0700 | [diff] [blame] | 125 | @{container_list}= Create List adapter-open-olt adapter-open-onu voltha-api-server |
| 126 | ... voltha-ro-core voltha-rw-core-11 voltha-rw-core-12 voltha-ofagent |
Suchitra Vemuri | 65cd65f | 2019-08-30 14:39:22 -0700 | [diff] [blame] | 127 | Set Suite Variable ${container_list} |
Andy Bavier | ba9866b | 2019-10-11 07:11:53 -0700 | [diff] [blame] | 128 | ${datetime}= Get Current Date |
Suchitra Vemuri | 65cd65f | 2019-08-30 14:39:22 -0700 | [diff] [blame] | 129 | Set Suite Variable ${datetime} |
| 130 | |
| 131 | Setup |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 132 | [Documentation] Pre-test Setup |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame^] | 133 | #test for empty device list |
| 134 | ${length}= Test Empty Device List |
| 135 | Should Be Equal As Integers ${length} 0 |
Suchitra Vemuri | 65cd65f | 2019-08-30 14:39:22 -0700 | [diff] [blame] | 136 | #create/preprovision device |
Suchitra Vemuri | c59eb27 | 2019-09-18 17:59:33 -0700 | [diff] [blame] | 137 | ${olt_device_id}= Create Device ${olt_ip} ${OLT_PORT} |
| 138 | Set Suite Variable ${olt_device_id} |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame^] | 139 | #validate olt states |
| 140 | Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device PREPROVISIONED UNKNOWN UNKNOWN |
| 141 | ... ${EMPTY} ${olt_device_id} |
Suchitra Vemuri | c59eb27 | 2019-09-18 17:59:33 -0700 | [diff] [blame] | 142 | Enable Device ${olt_device_id} |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame^] | 143 | Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device ENABLED ACTIVE REACHABLE |
| 144 | ... ${olt_serial_number} |
Suchitra Vemuri | 00d147d | 2019-09-13 13:07:32 -0700 | [diff] [blame] | 145 | ${logical_id}= Get Logical Device ID From SN ${olt_serial_number} |
| 146 | Set Suite Variable ${logical_id} |
Suchitra Vemuri | 65cd65f | 2019-08-30 14:39:22 -0700 | [diff] [blame] | 147 | |
| 148 | Teardown |
| 149 | [Documentation] kills processes and cleans up interfaces on src+dst servers |
Suchitra Vemuri | 65e5fbb | 2019-09-27 15:23:52 -0700 | [diff] [blame] | 150 | Get Device Output from Voltha ${olt_device_id} |
| 151 | #Get Logical Device Output from Voltha ${logical_id} |
Andy Bavier | ba9866b | 2019-10-11 07:11:53 -0700 | [diff] [blame] | 152 | Run Keyword If ${external_libs} Get ONOS Status ${k8s_node_ip} |
| 153 | Run Keyword If ${has_dataplane} Clean Up Linux |
| 154 | Run Keyword If ${external_libs} Log Kubernetes Containers Logs Since Time ${datetime} ${container_list} |
| 155 | |
| 156 | Teardown Suite |
| 157 | [Documentation] Clean up device if desired |
| 158 | Run Keyword If ${teardown_device} Delete Device and Verify |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame^] | 159 | ${length}= Run Keyword If ${teardown_device} Run Keyword And Return Test Empty Device List |
| 160 | Run Keyword If ${teardown_device} Should Be Equal As Integers ${length} 0 |
Andy Bavier | ba9866b | 2019-10-11 07:11:53 -0700 | [diff] [blame] | 161 | Run Keyword If ${teardown_device} Execute ONOS CLI Command ${k8s_node_ip} ${ONOS_SSH_PORT} |
| 162 | ... device-remove ${of_id} |
Suchitra Vemuri | 65cd65f | 2019-08-30 14:39:22 -0700 | [diff] [blame] | 163 | |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame^] | 164 | |
Suchitra Vemuri | 65cd65f | 2019-08-30 14:39:22 -0700 | [diff] [blame] | 165 | Clean Up Linux |
| 166 | [Documentation] Kill processes and clean up interfaces on src+dst servers |
Suchitra Vemuri | 8a9c378 | 2019-10-23 12:43:01 -0700 | [diff] [blame] | 167 | FOR ${I} IN RANGE 0 ${num_onus} |
| 168 | ${src}= Set Variable ${hosts.src[${I}]} |
| 169 | ${dst}= Set Variable ${hosts.dst[${I}]} |
| 170 | Run Keyword And Ignore Error Kill Linux Process [w]pa_supplicant ${src['ip']} |
| 171 | ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']} |
| 172 | Run Keyword And Ignore Error Kill Linux Process [d]hclient ${src['ip']} |
| 173 | ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']} |
| 174 | Run Keyword If '${dst['ip']}' != '${None}' Run Keyword And Ignore Error |
| 175 | ... Kill Linux Process [d]hcpd ${dst['ip']} ${dst['user']} |
| 176 | ... ${dst['pass']} ${dst['container_type']} ${dst['container_name']} |
| 177 | Delete IP Addresses from Interface on Remote Host ${src['dp_iface_name']} ${src['ip']} |
| 178 | ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']} |
| 179 | Run Keyword If '${dst['ip']}' != '${None}' Delete Interface on Remote Host |
| 180 | ... ${dst['dp_iface_name']}.${src['s_tag']} ${dst['ip']} ${dst['user']} ${dst['pass']} |
| 181 | ... ${dst['container_type']} ${dst['container_name']} |
| 182 | END |
Andy Bavier | ba9866b | 2019-10-11 07:11:53 -0700 | [diff] [blame] | 183 | |
| 184 | Delete Device and Verify |
| 185 | [Documentation] Disable -> Delete devices via voltctl and verify its removed |
Andy Bavier | ba9866b | 2019-10-11 07:11:53 -0700 | [diff] [blame] | 186 | ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device disable ${olt_device_id} |
| 187 | Should Be Equal As Integers ${rc} 0 |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame^] | 188 | Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device DISABLED UNKNOWN REACHABLE |
| 189 | ... ${olt_serial_number} |
Andy Bavier | ba9866b | 2019-10-11 07:11:53 -0700 | [diff] [blame] | 190 | ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device delete ${olt_device_id} |
| 191 | Should Be Equal As Integers ${rc} 0 |
| 192 | Wait Until Keyword Succeeds ${timeout} 5s Validate Device Removed ${olt_device_id} |