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 | ${num_onus} 1 |
| 45 | ${of_id} 0 |
| 46 | ${logical_id} 0 |
Andy Bavier | ba9866b | 2019-10-11 07:11:53 -0700 | [diff] [blame] | 47 | ${ports_per_onu} 5 |
| 48 | ${has_dataplane} True |
| 49 | ${external_libs} True |
| 50 | ${teardown_device} False |
Suchitra Vemuri | 65cd65f | 2019-08-30 14:39:22 -0700 | [diff] [blame] | 51 | |
| 52 | *** Test Cases *** |
| 53 | Sanity E2E Test for OLT/ONU on POD |
| 54 | [Documentation] Validates E2E Ping Connectivity and object states for the given scenario: |
| 55 | ... 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] | 56 | [Tags] sanity test1 |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 57 | #[Setup] Clean Up Linux |
Andy Bavier | ba9866b | 2019-10-11 07:11:53 -0700 | [diff] [blame] | 58 | ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${olt_serial_number} |
| 59 | Set Global Variable ${of_id} |
| 60 | ${num_flows}= Evaluate ${num_onus} * ${ports_per_onu} |
| 61 | ${flows_str}= Convert To String ${num_flows} |
| 62 | Wait Until Keyword Succeeds ${timeout} 2s Verify Eapol Flows Added ${k8s_node_ip} ${ONOS_SSH_PORT} ${flows_str} |
| 63 | Run Keyword If ${has_dataplane} Validate Authentication True ${src0['dp_iface_name']} |
| 64 | ... wpa_supplicant.conf ${src0['ip']} ${src0['user']} ${src0['pass']} |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 65 | ... ${src0['container_type']} ${src0['container_name']} |
Andy Bavier | ba9866b | 2019-10-11 07:11:53 -0700 | [diff] [blame] | 66 | Wait Until Keyword Succeeds ${timeout} 2s Verify Number of AAA-Users ${k8s_node_ip} ${ONOS_SSH_PORT} ${num_onus} |
| 67 | ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${onu_serial_number} ${of_id} |
| 68 | Wait Until Keyword Succeeds ${timeout} 2s Execute ONOS CLI Command ${k8s_node_ip} ${ONOS_SSH_PORT} |
| 69 | ... volt-add-subscriber-access ${of_id} ${onu_port} |
| 70 | Run Keyword If ${has_dataplane} Validate DHCP and Ping True True ${src0['dp_iface_name']} |
| 71 | ... ${src0['s_tag']} ${src0['c_tag']} ${dst0['dp_iface_ip_qinq']} ${src0['ip']} ${src0['user']} |
| 72 | ... ${src0['pass']} ${src0['container_type']} ${src0['container_name']} ${dst0['dp_iface_name']} |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 73 | ... ${dst0['ip']} ${dst0['user']} ${dst0['pass']} ${dst0['container_type']} ${dst0['container_name']} |
Andy Bavier | ba9866b | 2019-10-11 07:11:53 -0700 | [diff] [blame] | 74 | Wait Until Keyword Succeeds ${timeout} 2s Validate DHCP Allocations ${k8s_node_ip} ${ONOS_SSH_PORT} ${num_onus} |
Suchitra Vemuri | 65cd65f | 2019-08-30 14:39:22 -0700 | [diff] [blame] | 75 | |
| 76 | *** Keywords *** |
| 77 | Setup Suite |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 78 | [Documentation] Setup the whole test suite |
Andy Bavier | ba9866b | 2019-10-11 07:11:53 -0700 | [diff] [blame] | 79 | # BBSim sanity test doesn't need these imports from other repositories |
| 80 | Run Keyword If ${external_libs} Import Library ${CURDIR}/../../../voltha/tests/atests/common/testCaseUtils.py |
| 81 | Run Keyword If ${external_libs} Import Resource ${CURDIR}/../../../cord-tester/src/test/cord-api/Framework/Subscriber.robot |
| 82 | Run Keyword If ${external_libs} Import Resource ${CURDIR}/../../../cord-tester/src/test/cord-api/Framework/OLT.robot |
| 83 | Run Keyword If ${external_libs} Import Resource ${CURDIR}/../../../cord-tester/src/test/cord-api/Framework/DHCP.robot |
| 84 | Run Keyword If ${external_libs} Import Resource ${CURDIR}/../../../cord-tester/src/test/cord-api/Framework/Kubernetes.robot |
Suchitra Vemuri | 2adc07e | 2019-09-05 17:25:31 -0700 | [diff] [blame] | 85 | Set Global Variable ${KUBECTL_CONFIG} export KUBECONFIG=%{KUBECONFIG} |
Suchitra Vemuri | 65cd65f | 2019-08-30 14:39:22 -0700 | [diff] [blame] | 86 | Set Global Variable ${export_kubeconfig} export KUBECONFIG=${KUBERNETES_CONF} |
Suchitra Vemuri | 65cd65f | 2019-08-30 14:39:22 -0700 | [diff] [blame] | 87 | Set Global Variable ${VOLTCTL_CONFIG} export VOLTCONFIG=%{VOLTCONFIG} |
| 88 | ${k8s_node_ip}= Evaluate ${nodes}[0].get("ip") |
| 89 | ${k8s_node_user}= Evaluate ${nodes}[0].get("user") |
| 90 | ${k8s_node_pass}= Evaluate ${nodes}[0].get("pass") |
| 91 | Check CLI Tools Configured |
| 92 | ${onos_auth}= Create List karaf karaf |
| 93 | ${HEADERS} Create Dictionary Content-Type=application/json |
Suchitra Vemuri | 9c24d2b | 2019-09-30 10:28:25 -0700 | [diff] [blame] | 94 | 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] | 95 | Set Global Variable ${export_kubeconfig} export KUBECONFIG=${KUBERNETES_CONF} |
| 96 | ${olt_ip}= Evaluate ${olts}[0].get("ip") |
| 97 | ${olt_user}= Evaluate ${olts}[0].get("user") |
| 98 | ${olt_pass}= Evaluate ${olts}[0].get("pass") |
| 99 | ${olt_serial_number}= Evaluate ${olts}[0].get("serial") |
| 100 | ${onu_serial_number}= Evaluate ${onus}[0].get("serial") |
Suchitra Vemuri | 2adc07e | 2019-09-05 17:25:31 -0700 | [diff] [blame] | 101 | Set Suite Variable ${olt_serial_number} |
| 102 | Set Suite Variable ${onu_serial_number} |
Suchitra Vemuri | 65cd65f | 2019-08-30 14:39:22 -0700 | [diff] [blame] | 103 | Set Suite Variable ${olt_ip} |
| 104 | Set Suite Variable ${olt_user} |
| 105 | Set Suite Variable ${olt_pass} |
| 106 | Set Suite Variable ${k8s_node_ip} |
| 107 | Set Suite Variable ${k8s_node_user} |
| 108 | Set Suite Variable ${k8s_node_pass} |
| 109 | @{container_list}= Create List |
| 110 | Append To List ${container_list} adapter-open-olt |
| 111 | Append To List ${container_list} adapter-open-onu |
| 112 | Append To List ${container_list} voltha-api-server |
| 113 | Append To List ${container_list} voltha-ro-core |
| 114 | Append To List ${container_list} voltha-rw-core-11 |
| 115 | Append To List ${container_list} voltha-rw-core-12 |
| 116 | Append To List ${container_list} voltha-ofagent |
| 117 | Set Suite Variable ${container_list} |
Andy Bavier | ba9866b | 2019-10-11 07:11:53 -0700 | [diff] [blame] | 118 | # Set Deployment Config Variables seems like a candidate for refactoring. |
| 119 | # BBSim doesn't need it right now. |
| 120 | Run Keyword If ${external_libs} Set Deployment Config Variables |
| 121 | ${datetime}= Get Current Date |
Suchitra Vemuri | 65cd65f | 2019-08-30 14:39:22 -0700 | [diff] [blame] | 122 | Set Suite Variable ${datetime} |
| 123 | |
Andy Bavier | ba9866b | 2019-10-11 07:11:53 -0700 | [diff] [blame] | 124 | |
Suchitra Vemuri | 65cd65f | 2019-08-30 14:39:22 -0700 | [diff] [blame] | 125 | Setup |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 126 | [Documentation] Pre-test Setup |
Suchitra Vemuri | 65cd65f | 2019-08-30 14:39:22 -0700 | [diff] [blame] | 127 | #create/preprovision device |
Suchitra Vemuri | c59eb27 | 2019-09-18 17:59:33 -0700 | [diff] [blame] | 128 | ${olt_device_id}= Create Device ${olt_ip} ${OLT_PORT} |
| 129 | Set Suite Variable ${olt_device_id} |
Suchitra Vemuri | c59eb27 | 2019-09-18 17:59:33 -0700 | [diff] [blame] | 130 | Enable Device ${olt_device_id} |
Andy Bavier | ba9866b | 2019-10-11 07:11:53 -0700 | [diff] [blame] | 131 | Wait Until Keyword Succeeds ${timeout} 5s Validate Device ${olt_serial_number} ENABLED ACTIVE |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 132 | ... REACHABLE |
Andy Bavier | ba9866b | 2019-10-11 07:11:53 -0700 | [diff] [blame] | 133 | Wait Until Keyword Succeeds ${timeout} 5s Validate Device ${onu_serial_number} ENABLED ACTIVE |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 134 | ... REACHABLE onu=True onu_reason=tech-profile-config-download-success |
Suchitra Vemuri | 65cd65f | 2019-08-30 14:39:22 -0700 | [diff] [blame] | 135 | ${onu_device_id}= Get Device ID From SN ${onu_serial_number} |
| 136 | Set Suite Variable ${onu_device_id} |
Suchitra Vemuri | 00d147d | 2019-09-13 13:07:32 -0700 | [diff] [blame] | 137 | ${logical_id}= Get Logical Device ID From SN ${olt_serial_number} |
| 138 | Set Suite Variable ${logical_id} |
Suchitra Vemuri | 65cd65f | 2019-08-30 14:39:22 -0700 | [diff] [blame] | 139 | |
| 140 | Teardown |
| 141 | [Documentation] kills processes and cleans up interfaces on src+dst servers |
Suchitra Vemuri | 65e5fbb | 2019-09-27 15:23:52 -0700 | [diff] [blame] | 142 | Get Device Output from Voltha ${olt_device_id} |
| 143 | #Get Logical Device Output from Voltha ${logical_id} |
Andy Bavier | ba9866b | 2019-10-11 07:11:53 -0700 | [diff] [blame] | 144 | Run Keyword If ${external_libs} Get ONOS Status ${k8s_node_ip} |
| 145 | Run Keyword If ${has_dataplane} Clean Up Linux |
| 146 | Run Keyword If ${external_libs} Log Kubernetes Containers Logs Since Time ${datetime} ${container_list} |
| 147 | |
| 148 | Teardown Suite |
| 149 | [Documentation] Clean up device if desired |
| 150 | Run Keyword If ${teardown_device} Delete Device and Verify |
| 151 | Run Keyword If ${teardown_device} Execute ONOS CLI Command ${k8s_node_ip} ${ONOS_SSH_PORT} |
| 152 | ... device-remove ${of_id} |
Suchitra Vemuri | 65cd65f | 2019-08-30 14:39:22 -0700 | [diff] [blame] | 153 | |
| 154 | Clean Up Linux |
| 155 | [Documentation] Kill processes and clean up interfaces on src+dst servers |
Andy Bavier | ba9866b | 2019-10-11 07:11:53 -0700 | [diff] [blame] | 156 | Run Keyword And Ignore Error Kill Linux Process [w]pa_supplicant ${src0['ip']} |
| 157 | ... ${src0['user']} ${src0['pass']} ${src0['container_type']} ${src0['container_name']} |
| 158 | Run Keyword And Ignore Error Kill Linux Process [d]hclient ${src0['ip']} |
| 159 | ... ${src0['user']} ${src0['pass']} ${src0['container_type']} ${src0['container_name']} |
| 160 | Run Keyword If '${dst0['ip']}' != '${None}' Run Keyword And Ignore Error |
| 161 | ... Kill Linux Process [d]hcpd ${dst0['ip']} ${dst0['user']} |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 162 | ... ${dst0['pass']} ${dst0['container_type']} ${dst0['container_name']} |
Andy Bavier | ba9866b | 2019-10-11 07:11:53 -0700 | [diff] [blame] | 163 | Delete IP Addresses from Interface on Remote Host ${src0['dp_iface_name']} ${src0['ip']} |
| 164 | ... ${src0['user']} ${src0['pass']} ${src0['container_type']} ${src0['container_name']} |
| 165 | Run Keyword If '${dst0['ip']}' != '${None}' Delete Interface on Remote Host |
| 166 | ... ${dst0['dp_iface_name']}.${src0['s_tag']} ${dst0['ip']} ${dst0['user']} ${dst0['pass']} |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 167 | ... ${dst0['container_type']} ${dst0['container_name']} |
Andy Bavier | ba9866b | 2019-10-11 07:11:53 -0700 | [diff] [blame] | 168 | |
| 169 | Delete Device and Verify |
| 170 | [Documentation] Disable -> Delete devices via voltctl and verify its removed |
| 171 | ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device disable ${onu_device_id} |
| 172 | Should Be Equal As Integers ${rc} 0 |
| 173 | Wait Until Keyword Succeeds ${timeout} 5s Validate Device ${onu_serial_number} DISABLED UNKNOWN |
| 174 | ... REACHABLE |
| 175 | ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device delete ${onu_device_id} |
| 176 | Should Be Equal As Integers ${rc} 0 |
| 177 | Wait Until Keyword Succeeds ${timeout} 5s Validate Device Removed ${onu_device_id} |
| 178 | ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device disable ${olt_device_id} |
| 179 | Should Be Equal As Integers ${rc} 0 |
| 180 | Wait Until Keyword Succeeds ${timeout} 5s Validate Device ${olt_serial_number} DISABLED UNKNOWN |
| 181 | ... REACHABLE |
| 182 | ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device delete ${olt_device_id} |
| 183 | Should Be Equal As Integers ${rc} 0 |
| 184 | Wait Until Keyword Succeeds ${timeout} 5s Validate Device Removed ${olt_device_id} |