Matteo Scandolo | a80b473 | 2020-09-04 13:51:10 -0700 | [diff] [blame] | 1 | # Copyright 2020 - 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 *** |
Matteo Scandolo | 4f92039 | 2021-03-02 15:15:47 -0800 | [diff] [blame] | 16 | Documentation Run tests On BBSim |
Matteo Scandolo | a80b473 | 2020-09-04 13:51:10 -0700 | [diff] [blame] | 17 | Suite Setup Setup Suite |
| 18 | Suite Teardown Teardown Suite |
| 19 | Test Setup Setup |
| 20 | Test Teardown Teardown |
| 21 | Library Collections |
| 22 | Library String |
| 23 | Library OperatingSystem |
| 24 | Library XML |
| 25 | Library RequestsLibrary |
| 26 | Library ../../libraries/DependencyLibrary.py |
| 27 | Resource ../../libraries/onos.robot |
| 28 | Resource ../../libraries/voltctl.robot |
| 29 | Resource ../../libraries/voltha.robot |
| 30 | Resource ../../libraries/utils.robot |
| 31 | Resource ../../libraries/k8s.robot |
| 32 | Resource ../../libraries/bbsim.robot |
| 33 | Resource ../../variables/variables.robot |
| 34 | |
| 35 | *** Variables *** |
| 36 | ${NAMESPACE} voltha |
| 37 | ${timeout} 60s |
| 38 | ${of_id} 0 |
| 39 | ${logical_id} 0 |
| 40 | ${has_dataplane} False |
| 41 | ${external_libs} True |
| 42 | ${teardown_device} True |
| 43 | ${scripts} ../../scripts |
| 44 | # determines the environment workflow: DT, TT or ATT (default) |
| 45 | # example: -v workflow:TT |
| 46 | ${workflow} ATT |
| 47 | # logging flag to enable Collect Logs, can be passed via the command line too |
| 48 | # example: -v logging:True |
| 49 | ${logging} False |
| 50 | # Per-test logging on failure is turned off by default; set this variable to enable |
| 51 | ${container_log_dir} ${None} |
| 52 | # Number of times to perform ONU Igmp Join and Leave (valid only for TT) |
| 53 | ${igmp_join_leave_count} 1 |
Matteo Scandolo | 4f92039 | 2021-03-02 15:15:47 -0800 | [diff] [blame] | 54 | # Number of times the Sanity test needs to be repeated as |
| 55 | # we want to make sure you can disable/delete the device without needing to restart BBSim |
| 56 | ${iteration_count} 2 |
Matteo Scandolo | a80b473 | 2020-09-04 13:51:10 -0700 | [diff] [blame] | 57 | |
Matteo Scandolo | bfb7438 | 2021-05-10 15:45:16 -0700 | [diff] [blame] | 58 | |
Matteo Scandolo | a80b473 | 2020-09-04 13:51:10 -0700 | [diff] [blame] | 59 | *** Test Cases *** |
| 60 | |
| 61 | Test Perform BBSim Sanity |
| 62 | [Documentation] Validates the BBSim Functionality for ATT, DT and TT workflows |
| 63 | ... Also Restart Auth (ATT), Restart Dhcp (ATT and TT), Igmp Join and Leave (TT) |
Matteo Scandolo | a80b473 | 2020-09-04 13:51:10 -0700 | [diff] [blame] | 64 | [Tags] bbsimSanity |
Matteo Scandolo | 4f92039 | 2021-03-02 15:15:47 -0800 | [diff] [blame] | 65 | [Setup] Run Keyword Start Logging BBSimSanity |
| 66 | FOR ${I} IN RANGE 0 ${iteration_count} |
| 67 | Perform BBSim Sanity Test |
Matteo Scandolo | a80b473 | 2020-09-04 13:51:10 -0700 | [diff] [blame] | 68 | END |
| 69 | [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs |
| 70 | ... AND Stop Logging BBSimSanity |
| 71 | |
| 72 | *** Keywords *** |
| 73 | |
| 74 | Perform ONU Igmp Join and Leave |
| 75 | [Documentation] This keyword performs Igmp Leave and Join for ONU |
| 76 | [Arguments] ${bbsim_pod} ${of_id} ${onu} ${onu_port} |
| 77 | FOR ${Z} IN RANGE 0 ${igmp_join_leave_count} |
| 78 | List Service ${NAMESPACE} ${bbsim_pod} |
| 79 | JoinOrLeave Igmp ${NAMESPACE} ${bbsim_pod} ${onu} join |
| 80 | Sleep 2s |
| 81 | List Service ${NAMESPACE} ${bbsim_pod} |
| 82 | List ONUs ${NAMESPACE} ${bbsim_pod} |
| 83 | Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s |
| 84 | ... Verify ONU in Groups ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id} ${onu_port} |
| 85 | JoinOrLeave Igmp ${NAMESPACE} ${bbsim_pod} ${onu} leave |
| 86 | Sleep 2s |
| 87 | List Service ${NAMESPACE} ${bbsim_pod} |
| 88 | List ONUs ${NAMESPACE} ${bbsim_pod} |
| 89 | Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s |
| 90 | ... Verify ONU in Groups ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id} ${onu_port} False |
| 91 | END |
| 92 | |
Matteo Scandolo | 4f92039 | 2021-03-02 15:15:47 -0800 | [diff] [blame] | 93 | Perform BBSim Sanity Test |
| 94 | [Documentation] Runs the sanity test on multiple OLTs |
| 95 | |
| 96 | Run Keyword Setup |
| 97 | FOR ${J} IN RANGE 0 ${num_olts} |
| 98 | ${olt_serial_number}= Set Variable ${list_olts}[${J}][sn] |
| 99 | ${onu_count}= Set Variable ${list_olts}[${J}][onucount] |
| 100 | ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS |
| 101 | ... ${olt_serial_number} |
| 102 | ${bbsim_rel}= Catenate SEPARATOR= bbsim ${J} |
| 103 | ${bbsim_pod}= Get Pod Name By Label ${NAMESPACE} release ${bbsim_rel} |
| 104 | Perform BBSim Sanity Test Per OLT ${bbsim_pod} ${of_id} ${olt_serial_number} ${onu_count} |
| 105 | END |
| 106 | Run Keyword Delete All Devices and Verify |
| 107 | |
Matteo Scandolo | a80b473 | 2020-09-04 13:51:10 -0700 | [diff] [blame] | 108 | Perform BBSim Sanity Test Per OLT |
| 109 | [Documentation] Validates the BBSim Functionality for ATT, DT and TT workflows |
| 110 | ... Also Restart Auth (ATT), Restart Dhcp (ATT and TT), Igmp Join and Leave (TT) |
Matteo Scandolo | bfb7438 | 2021-05-10 15:45:16 -0700 | [diff] [blame] | 111 | ... Once the ONU tests are completed perform a SoftReboot on the OLT. |
Matteo Scandolo | a80b473 | 2020-09-04 13:51:10 -0700 | [diff] [blame] | 112 | [Arguments] ${bbsim_pod} ${of_id} ${olt_serial_number} ${num_onus} |
| 113 | FOR ${I} IN RANGE 0 ${num_all_onus} |
| 114 | ${src}= Set Variable ${hosts.src[${I}]} |
| 115 | ${dst}= Set Variable ${hosts.dst[${I}]} |
| 116 | Continue For Loop If "${olt_serial_number}"!="${src['olt']}" |
| 117 | ${onu_device_id}= Get Device ID From SN ${src['onu']} |
| 118 | ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s |
| 119 | ... Get ONU Port in ONOS ${src['onu']} ${of_id} |
| 120 | # Check ONU port is Enabled in ONOS |
| 121 | Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s |
| 122 | ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']} |
| 123 | Run Keyword If "${workflow}"=="ATT" |
| 124 | ... Run Keywords |
| 125 | # Verify ONU in AAA-Users (valid only for ATT) |
| 126 | ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2 |
| 127 | ... Verify ONU in AAA-Users ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port} |
| 128 | ... AND List ONUs ${NAMESPACE} ${bbsim_pod} |
| 129 | # Restart Auth and Verify (valid only for ATT) |
| 130 | ... AND Execute ONOS CLI Command on open connection ${onos_ssh_connection} |
| 131 | ... aaa-reset-all-devices |
| 132 | ... AND Restart Auth ${NAMESPACE} ${bbsim_pod} ${src['onu']} |
| 133 | ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2 |
| 134 | ... Verify ONU in AAA-Users ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port} |
| 135 | ... AND List ONUs ${NAMESPACE} ${bbsim_pod} |
| 136 | # Add Subscriber |
| 137 | Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2 |
| 138 | ... Execute ONOS CLI Command on open connection ${onos_ssh_connection} |
| 139 | ... volt-add-subscriber-access ${of_id} ${onu_port} |
| 140 | # Verify that no pending flows exist for the ONU port |
| 141 | Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s |
| 142 | ... Verify No Pending Flows For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port} |
| 143 | # Verify subscriber dhcp allocations (valid only for ATT and TT) |
| 144 | Run Keyword If "${workflow}"=="ATT" or "${workflow}"=="TT" |
| 145 | ... Run Keywords |
| 146 | ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s |
| 147 | ... Validate Subscriber DHCP Allocation ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port} |
| 148 | ... AND List ONUs ${NAMESPACE} ${bbsim_pod} |
| 149 | # Restart Dhcp and Verify (valid only for ATT and TT) |
| 150 | ... AND Execute ONOS CLI Command on open connection ${onos_ssh_connection} |
| 151 | ... dhcpl2relay-remove-allocation ${of_id} ${onu_port} |
| 152 | ... AND Restart DHCP ${NAMESPACE} ${bbsim_pod} ${src['onu']} |
| 153 | ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s |
| 154 | ... Validate Subscriber DHCP Allocation ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port} |
| 155 | ... AND List ONUs ${NAMESPACE} ${bbsim_pod} |
| 156 | # Perform Igmp Join and Leave (valid only for TT) |
| 157 | Run Keyword If "${workflow}"=="TT" |
| 158 | ... Perform ONU Igmp Join and Leave ${bbsim_pod} ${of_id} ${src['onu']} ${onu_port} |
| 159 | END |
Matteo Scandolo | bfb7438 | 2021-05-10 15:45:16 -0700 | [diff] [blame] | 160 | # Clean ONOS state before rebooting |
| 161 | Execute ONOS CLI Command on open connection ${onos_ssh_connection} aaa-reset-all-devices |
| 162 | Execute ONOS CLI Command on open connection ${onos_ssh_connection} dhcpl2relay-clear-allocations |
| 163 | # Perform OLT SoftReboot test |
| 164 | ${olt_device_id}= Get OLTDeviceID From OLT List ${olt_serial_number} |
| 165 | Reboot Device ${olt_device_id} |
| 166 | Run Keyword And Continue On Failure Wait Until Keyword Succeeds 360s 5s |
| 167 | ... Validate OLT Device ENABLED ACTIVE |
| 168 | ... REACHABLE ${olt_serial_number} |
| 169 | Run Keyword If "${workflow}"=="DT" Perform Sanity Test DT |
| 170 | ... ELSE IF "${workflow}"=="TT" Perform Sanity Tests TT |
| 171 | ... ELSE Perform Sanity Test |
| 172 | # Perform GRPC Disconnect test |
| 173 | Restart Grpc Server ${NAMESPACE} ${bbsim_pod} 5 |
| 174 | Run Keyword If "${workflow}"=="DT" Perform Sanity Test DT |
| 175 | ... ELSE IF "${workflow}"=="TT" Perform Sanity Tests TT |
| 176 | ... ELSE Perform Sanity Test |
| 177 | |
Matteo Scandolo | a80b473 | 2020-09-04 13:51:10 -0700 | [diff] [blame] | 178 | |
| 179 | Setup Suite |
| 180 | [Documentation] Set up the test suite |
| 181 | Common Test Suite Setup |
| 182 | #send igmp file to onos (valid only for TT) |
| 183 | ${onos_netcfg_file}= Get Variable Value ${onos_netcfg.file} |
| 184 | Run Keyword If '${workflow}'=='TT' and '${has_dataplane}'=='False' and '${onos_netcfg_file}'!='${None}' |
| 185 | ... Send File To Onos ${onos_netcfg_file} apps/ |
| 186 | ${onos_ssh_connection} Open ONOS SSH Connection ${ONOS_SSH_IP} ${ONOS_SSH_PORT} |
| 187 | Set Suite Variable ${onos_ssh_connection} |
| 188 | |
| 189 | Teardown Suite |
| 190 | [Documentation] Replaces the Suite Teardown in utils.robot. |
| 191 | ... Cleans up and checks all ONU ports disabled in ONOS. |
Matteo Scandolo | a80b473 | 2020-09-04 13:51:10 -0700 | [diff] [blame] | 192 | Close All ONOS SSH Connections |