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