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 | |
| 58 | *** Test Cases *** |
| 59 | |
| 60 | Test Perform BBSim Sanity |
| 61 | [Documentation] Validates the BBSim Functionality for ATT, DT and TT workflows |
| 62 | ... 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] | 63 | [Tags] bbsimSanity |
Matteo Scandolo | 4f92039 | 2021-03-02 15:15:47 -0800 | [diff] [blame] | 64 | [Setup] Run Keyword Start Logging BBSimSanity |
| 65 | FOR ${I} IN RANGE 0 ${iteration_count} |
| 66 | Perform BBSim Sanity Test |
Matteo Scandolo | a80b473 | 2020-09-04 13:51:10 -0700 | [diff] [blame] | 67 | END |
| 68 | [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs |
| 69 | ... AND Stop Logging BBSimSanity |
| 70 | |
| 71 | *** Keywords *** |
| 72 | |
| 73 | Perform ONU Igmp Join and Leave |
| 74 | [Documentation] This keyword performs Igmp Leave and Join for ONU |
| 75 | [Arguments] ${bbsim_pod} ${of_id} ${onu} ${onu_port} |
| 76 | FOR ${Z} IN RANGE 0 ${igmp_join_leave_count} |
| 77 | List Service ${NAMESPACE} ${bbsim_pod} |
| 78 | JoinOrLeave Igmp ${NAMESPACE} ${bbsim_pod} ${onu} join |
| 79 | Sleep 2s |
| 80 | List Service ${NAMESPACE} ${bbsim_pod} |
| 81 | List ONUs ${NAMESPACE} ${bbsim_pod} |
| 82 | Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s |
| 83 | ... Verify ONU in Groups ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id} ${onu_port} |
| 84 | JoinOrLeave Igmp ${NAMESPACE} ${bbsim_pod} ${onu} leave |
| 85 | Sleep 2s |
| 86 | List Service ${NAMESPACE} ${bbsim_pod} |
| 87 | List ONUs ${NAMESPACE} ${bbsim_pod} |
| 88 | Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s |
| 89 | ... Verify ONU in Groups ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id} ${onu_port} False |
| 90 | END |
| 91 | |
Matteo Scandolo | 4f92039 | 2021-03-02 15:15:47 -0800 | [diff] [blame] | 92 | Perform BBSim Sanity Test |
| 93 | [Documentation] Runs the sanity test on multiple OLTs |
| 94 | |
| 95 | Run Keyword Setup |
| 96 | FOR ${J} IN RANGE 0 ${num_olts} |
| 97 | ${olt_serial_number}= Set Variable ${list_olts}[${J}][sn] |
| 98 | ${onu_count}= Set Variable ${list_olts}[${J}][onucount] |
| 99 | ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS |
| 100 | ... ${olt_serial_number} |
| 101 | ${bbsim_rel}= Catenate SEPARATOR= bbsim ${J} |
| 102 | ${bbsim_pod}= Get Pod Name By Label ${NAMESPACE} release ${bbsim_rel} |
| 103 | Perform BBSim Sanity Test Per OLT ${bbsim_pod} ${of_id} ${olt_serial_number} ${onu_count} |
| 104 | END |
| 105 | Run Keyword Delete All Devices and Verify |
| 106 | |
Matteo Scandolo | a80b473 | 2020-09-04 13:51:10 -0700 | [diff] [blame] | 107 | Perform BBSim Sanity Test Per OLT |
| 108 | [Documentation] Validates the BBSim Functionality for ATT, DT and TT workflows |
| 109 | ... Also Restart Auth (ATT), Restart Dhcp (ATT and TT), Igmp Join and Leave (TT) |
| 110 | [Arguments] ${bbsim_pod} ${of_id} ${olt_serial_number} ${num_onus} |
| 111 | FOR ${I} IN RANGE 0 ${num_all_onus} |
| 112 | ${src}= Set Variable ${hosts.src[${I}]} |
| 113 | ${dst}= Set Variable ${hosts.dst[${I}]} |
| 114 | Continue For Loop If "${olt_serial_number}"!="${src['olt']}" |
| 115 | ${onu_device_id}= Get Device ID From SN ${src['onu']} |
| 116 | ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s |
| 117 | ... Get ONU Port in ONOS ${src['onu']} ${of_id} |
| 118 | # Check ONU port is Enabled in ONOS |
| 119 | Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s |
| 120 | ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']} |
| 121 | Run Keyword If "${workflow}"=="ATT" |
| 122 | ... Run Keywords |
| 123 | # Verify ONU in AAA-Users (valid only for ATT) |
| 124 | ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2 |
| 125 | ... Verify ONU in AAA-Users ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port} |
| 126 | ... AND List ONUs ${NAMESPACE} ${bbsim_pod} |
| 127 | # Restart Auth and Verify (valid only for ATT) |
| 128 | ... AND Execute ONOS CLI Command on open connection ${onos_ssh_connection} |
| 129 | ... aaa-reset-all-devices |
| 130 | ... AND Restart Auth ${NAMESPACE} ${bbsim_pod} ${src['onu']} |
| 131 | ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2 |
| 132 | ... Verify ONU in AAA-Users ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port} |
| 133 | ... AND List ONUs ${NAMESPACE} ${bbsim_pod} |
| 134 | # Add Subscriber |
| 135 | Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2 |
| 136 | ... Execute ONOS CLI Command on open connection ${onos_ssh_connection} |
| 137 | ... volt-add-subscriber-access ${of_id} ${onu_port} |
| 138 | # Verify that no pending flows exist for the ONU port |
| 139 | Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s |
| 140 | ... Verify No Pending Flows For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port} |
| 141 | # Verify subscriber dhcp allocations (valid only for ATT and TT) |
| 142 | Run Keyword If "${workflow}"=="ATT" or "${workflow}"=="TT" |
| 143 | ... Run Keywords |
| 144 | ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s |
| 145 | ... Validate Subscriber DHCP Allocation ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port} |
| 146 | ... AND List ONUs ${NAMESPACE} ${bbsim_pod} |
| 147 | # Restart Dhcp and Verify (valid only for ATT and TT) |
| 148 | ... AND Execute ONOS CLI Command on open connection ${onos_ssh_connection} |
| 149 | ... dhcpl2relay-remove-allocation ${of_id} ${onu_port} |
| 150 | ... AND Restart DHCP ${NAMESPACE} ${bbsim_pod} ${src['onu']} |
| 151 | ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s |
| 152 | ... Validate Subscriber DHCP Allocation ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port} |
| 153 | ... AND List ONUs ${NAMESPACE} ${bbsim_pod} |
| 154 | # Perform Igmp Join and Leave (valid only for TT) |
| 155 | Run Keyword If "${workflow}"=="TT" |
| 156 | ... Perform ONU Igmp Join and Leave ${bbsim_pod} ${of_id} ${src['onu']} ${onu_port} |
| 157 | END |
| 158 | |
| 159 | Setup Suite |
| 160 | [Documentation] Set up the test suite |
| 161 | Common Test Suite Setup |
| 162 | #send igmp file to onos (valid only for TT) |
| 163 | ${onos_netcfg_file}= Get Variable Value ${onos_netcfg.file} |
| 164 | Run Keyword If '${workflow}'=='TT' and '${has_dataplane}'=='False' and '${onos_netcfg_file}'!='${None}' |
| 165 | ... Send File To Onos ${onos_netcfg_file} apps/ |
| 166 | ${onos_ssh_connection} Open ONOS SSH Connection ${ONOS_SSH_IP} ${ONOS_SSH_PORT} |
| 167 | Set Suite Variable ${onos_ssh_connection} |
| 168 | |
| 169 | Teardown Suite |
| 170 | [Documentation] Replaces the Suite Teardown in utils.robot. |
| 171 | ... Cleans up and checks all ONU ports disabled in ONOS. |
Matteo Scandolo | a80b473 | 2020-09-04 13:51:10 -0700 | [diff] [blame] | 172 | Close All ONOS SSH Connections |