Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [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 suite that engages a larger number of ONU at the same which makes it a more realistic test |
| 17 | ... It is addaptable to either BBSim or Real H/W using a configuration file |
| 18 | Suite Setup Setup Suite |
| 19 | Suite Teardown Teardown Suite |
| 20 | Library Collections |
| 21 | Library String |
| 22 | Library OperatingSystem |
| 23 | Library XML |
| 24 | Library RequestsLibrary |
| 25 | Library ../../libraries/DependencyLibrary.py |
| 26 | Resource ../../libraries/onos.robot |
| 27 | Resource ../../libraries/voltctl.robot |
| 28 | Resource ../../libraries/utils.robot |
| 29 | Resource ../../libraries/k8s.robot |
| 30 | Resource ../../variables/variables.robot |
| 31 | |
| 32 | *** Variables *** |
| 33 | ${timeout} 60s |
| 34 | ${long_timeout} 420 |
| 35 | ${of_id} 0 |
| 36 | ${logical_id} 0 |
| 37 | ${has_dataplane} True |
| 38 | ${external_libs} True |
| 39 | ${teardown_device} False |
| 40 | |
| 41 | *** Test Cases *** |
| 42 | Activate Devices OLT/ONU |
| 43 | [Documentation] Validate deployment -> Empty Device List |
| 44 | ... create and enable device -> Preprovision and Enable |
| 45 | ... re-validate deployment -> Active OLT |
| 46 | [Tags] active |
| 47 | #test for empty device list |
| 48 | ${length}= Test Empty Device List |
| 49 | Should Be Equal As Integers ${length} 0 |
| 50 | #create/preprovision device |
| 51 | ${olt_device_id}= Create Device ${olt_ip} ${OLT_PORT} |
| 52 | Set Global Variable ${olt_device_id} |
| 53 | #validate olt states |
Andy Bavier | ac7e597 | 2019-11-14 15:35:48 -0700 | [diff] [blame] | 54 | Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device PREPROVISIONED UNKNOWN UNKNOWN ${EMPTY} |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 55 | ... ${olt_device_id} |
| 56 | #enable device |
| 57 | Enable Device ${olt_device_id} |
| 58 | #validate olt states |
Andy Bavier | ac7e597 | 2019-11-14 15:35:48 -0700 | [diff] [blame] | 59 | Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device ENABLED ACTIVE REACHABLE ${EMPTY} |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 60 | ... ${olt_device_id} |
| 61 | |
| 62 | ONU Discovery |
| 63 | [Documentation] Discover lists of ONUS, their Serial Numbers and device id |
| 64 | [Tags] active |
| 65 | #build onu sn list |
| 66 | ${List_ONU_Serial} Create List |
| 67 | Set Suite Variable ${List_ONU_Serial} |
| 68 | Build ONU SN List ${List_ONU_Serial} |
| 69 | Log ${List_ONU_Serial} |
| 70 | #validate onu states |
| 71 | Wait Until Keyword Succeeds ${long_timeout} 20s Validate ONU Devices ENABLED ACTIVE REACHABLE |
| 72 | ... ${List_ONU_Serial} |
| 73 | |
| 74 | Validate Device's Ports and Flows |
| 75 | [Documentation] Verify Ports and Flows listed for OLT and ONUs |
| 76 | ... For OLT we validate the port types and numbers and for flows we simply verify that their numbers > 0 |
| 77 | ... For each ONU, we validate the port types and numbers for each and for flows. |
| 78 | ... For flows they should be == 0 at this stage |
| 79 | [Tags] active |
| 80 | #validate olt port types |
| 81 | Validate OLT Port Types PON_OLT ETHERNET_NNI |
| 82 | #validate olt flows |
Andy Bavier | ac7e597 | 2019-11-14 15:35:48 -0700 | [diff] [blame] | 83 | Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Flows |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 84 | #validate onu port types |
| 85 | Validate ONU Port Types ${List_ONU_Serial} PON_ONU ETHERNET_UNI |
| 86 | #validate onu flows |
Andy Bavier | ac7e597 | 2019-11-14 15:35:48 -0700 | [diff] [blame] | 87 | Wait Until Keyword Succeeds ${timeout} 5s Validate ONU Flows ${List_ONU_Serial} ${num_onu_flows} |
Gilles Depatie | b5682f8 | 2019-10-31 10:39:45 -0400 | [diff] [blame] | 88 | |
| 89 | Validate Logical Device |
| 90 | [Documentation] Verify that logical device exists and then verify its ports and flows |
| 91 | [Tags] active |
| 92 | #Verify logical device exists |
| 93 | ${logical_device_id}= Validate Logical Device |
| 94 | #Verify logical device ports |
| 95 | Validate Logical Device Ports ${logical_device_id} |
| 96 | #Verify logical device flows |
| 97 | Validate Logical Device Flows ${logical_device_id} |
| 98 | |
| 99 | Validate Peer Devices |
| 100 | [Documentation] Verify that peer lists matches up between that of ${olt_device_id} |
| 101 | ... and individual ONU device ids |
| 102 | [Tags] active |
| 103 | #Retrieve peer list from OLT |
| 104 | ${olt_peer_list}= Create List |
| 105 | Retrieve Peer List From OLT ${olt_peer_list} |
| 106 | Log ${olt_peer_list} |
| 107 | #Validate OLT peer id list |
| 108 | Validate OLT Peer Id List ${olt_peer_list} |
| 109 | #Validate ONU peer ids |
| 110 | Validate ONU Peer Id ${olt_device_id} ${List_ONU_Serial} |
| 111 | |
| 112 | *** Keywords *** |
| 113 | Setup Suite |
| 114 | [Documentation] Setup the whole test suite |
| 115 | # BBSim sanity test doesn't need these imports from other repositories |
| 116 | Run Keyword If ${external_libs} Import Library |
| 117 | ... ${CURDIR}/../../../voltha/tests/atests/common/testCaseUtils.py |
| 118 | Run Keyword If ${external_libs} Import Resource |
| 119 | ... ${CURDIR}/../../../cord-tester/src/test/cord-api/Framework/Subscriber.robot |
| 120 | Run Keyword If ${external_libs} Import Resource |
| 121 | ... ${CURDIR}/../../../cord-tester/src/test/cord-api/Framework/OLT.robot |
| 122 | Run Keyword If ${external_libs} Import Resource |
| 123 | ... ${CURDIR}/../../../cord-tester/src/test/cord-api/Framework/DHCP.robot |
| 124 | Run Keyword If ${external_libs} Import Resource |
| 125 | ... ${CURDIR}/../../../cord-tester/src/test/cord-api/Framework/Kubernetes.robot |
| 126 | Set Global Variable ${KUBECTL_CONFIG} export KUBECONFIG=%{KUBECONFIG} |
| 127 | Set Global Variable ${VOLTCTL_CONFIG} export VOLTCONFIG=%{VOLTCONFIG} |
| 128 | ${k8s_node_ip}= Evaluate ${nodes}[0].get("ip") |
| 129 | ${k8s_node_user}= Evaluate ${nodes}[0].get("user") |
| 130 | ${k8s_node_pass}= Evaluate ${nodes}[0].get("pass") |
| 131 | Check CLI Tools Configured |
| 132 | ${onos_auth}= Create List karaf karaf |
| 133 | ${HEADERS} Create Dictionary Content-Type=application/json |
| 134 | Create Session ONOS http://${k8s_node_ip}:${ONOS_REST_PORT} auth=${ONOS_AUTH} |
| 135 | ${olt_ip}= Evaluate ${olts}[0].get("ip") |
| 136 | ${olt_user}= Evaluate ${olts}[0].get("user") |
| 137 | ${olt_pass}= Evaluate ${olts}[0].get("pass") |
| 138 | ${olt_serial_number}= Evaluate ${olts}[0].get("serial") |
| 139 | ${num_onus}= Get Length ${hosts.src} |
| 140 | ${num_onus}= Convert to String ${num_onus} |
| 141 | #send sadis file to onos |
| 142 | ${sadis_file}= Evaluate ${sadis}.get("file") |
| 143 | Log To Console \nSadis File:${sadis_file} |
| 144 | Run Keyword Unless '${sadis_file}' is '${None}' Send File To Onos ${sadis_file} apps/ |
| 145 | Set Suite Variable ${num_onus} |
| 146 | Set Suite Variable ${olt_serial_number} |
| 147 | Set Suite Variable ${olt_ip} |
| 148 | Set Suite Variable ${olt_user} |
| 149 | Set Suite Variable ${olt_pass} |
| 150 | Set Suite Variable ${k8s_node_ip} |
| 151 | Set Suite Variable ${k8s_node_user} |
| 152 | Set Suite Variable ${k8s_node_pass} |
| 153 | @{container_list}= Create List adapter-open-olt adapter-open-onu voltha-api-server |
| 154 | ... voltha-ro-core voltha-rw-core-11 voltha-rw-core-12 voltha-ofagent |
| 155 | Set Suite Variable ${container_list} |
| 156 | ${datetime}= Get Current Date |
| 157 | Set Suite Variable ${datetime} |
| 158 | |
| 159 | Teardown Suite |
| 160 | [Documentation] Clean up devices if desired |
| 161 | ... kills processes and cleans up interfaces on src+dst servers |
| 162 | Run Keyword If ${external_libs} Get ONOS Status ${k8s_node_ip} |
| 163 | Run Keyword If ${has_dataplane} Clean Up Linux |
| 164 | Run Keyword If ${external_libs} Log Kubernetes Containers Logs Since Time ${datetime} ${container_list} |
| 165 | Run Keyword If ${teardown_device} Delete Device and Verify |
| 166 | ${length}= Run Keyword If ${teardown_device} Run Keyword And Return Test Empty Device List |
| 167 | Run Keyword If ${teardown_device} Should Be Equal As Integers ${length} 0 |
| 168 | Run Keyword If ${teardown_device} Execute ONOS CLI Command ${k8s_node_ip} ${ONOS_SSH_PORT} |
| 169 | ... device-remove ${of_id} |
| 170 | |
| 171 | Clean Up Linux |
| 172 | [Documentation] Kill processes and clean up interfaces on src+dst servers |
| 173 | FOR ${I} IN RANGE 0 ${num_onus} |
| 174 | ${src}= Set Variable ${hosts.src[${I}]} |
| 175 | ${dst}= Set Variable ${hosts.dst[${I}]} |
| 176 | Run Keyword And Ignore Error Kill Linux Process [w]pa_supplicant ${src['ip']} |
| 177 | ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']} |
| 178 | Run Keyword And Ignore Error Kill Linux Process [d]hclient ${src['ip']} |
| 179 | ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']} |
| 180 | Run Keyword If '${dst['ip']}' != '${None}' Run Keyword And Ignore Error |
| 181 | ... Kill Linux Process [d]hcpd ${dst['ip']} ${dst['user']} |
| 182 | ... ${dst['pass']} ${dst['container_type']} ${dst['container_name']} |
| 183 | Delete IP Addresses from Interface on Remote Host ${src['dp_iface_name']} ${src['ip']} |
| 184 | ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']} |
| 185 | Run Keyword If '${dst['ip']}' != '${None}' Delete Interface on Remote Host |
| 186 | ... ${dst['dp_iface_name']}.${src['s_tag']} ${dst['ip']} ${dst['user']} ${dst['pass']} |
| 187 | ... ${dst['container_type']} ${dst['container_name']} |
| 188 | END |
| 189 | |
| 190 | Delete Device and Verify |
| 191 | [Documentation] Disable -> Delete devices via voltctl and verify its removed |
| 192 | ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device disable ${olt_device_id} |
| 193 | Should Be Equal As Integers ${rc} 0 |
| 194 | Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device DISABLED UNKNOWN REACHABLE |
| 195 | ... ${olt_serial_number} |
| 196 | ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device delete ${olt_device_id} |
| 197 | Should Be Equal As Integers ${rc} 0 |
| 198 | Wait Until Keyword Succeeds ${timeout} 5s Validate Device Removed ${olt_device_id} |