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 *** |
| 16 | Suite Setup Setup Suite |
| 17 | Suite Teardown Teardown Suite |
| 18 | Test Setup Setup |
| 19 | Test Teardown Teardown |
| 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/voltha.robot |
| 29 | Resource ../../libraries/utils.robot |
| 30 | Resource ../../libraries/k8s.robot |
| 31 | Resource ../../libraries/bbsim.robot |
| 32 | Resource ../../variables/variables.robot |
| 33 | |
| 34 | *** Variables *** |
| 35 | ${NAMESPACE} voltha |
| 36 | ${timeout} 60s |
| 37 | ${of_id} 0 |
| 38 | ${logical_id} 0 |
| 39 | ${has_dataplane} False |
| 40 | ${external_libs} True |
| 41 | ${teardown_device} True |
| 42 | ${scripts} ../../scripts |
| 43 | # determines the environment workflow: DT, TT or ATT (default) |
| 44 | # example: -v workflow:TT |
| 45 | ${workflow} ATT |
| 46 | # logging flag to enable Collect Logs, can be passed via the command line too |
| 47 | # example: -v logging:True |
| 48 | ${logging} False |
| 49 | # Per-test logging on failure is turned off by default; set this variable to enable |
| 50 | ${container_log_dir} ${None} |
| 51 | # Number of times to perform ONU Igmp Join and Leave (valid only for TT) |
| 52 | ${igmp_join_leave_count} 1 |
| 53 | |
| 54 | *** Test Cases *** |
| 55 | |
| 56 | Test Perform BBSim Sanity |
| 57 | [Documentation] Validates the BBSim Functionality for ATT, DT and TT workflows |
| 58 | ... Also Restart Auth (ATT), Restart Dhcp (ATT and TT), Igmp Join and Leave (TT) |
| 59 | ... NOTE: Currently works only for single ONU in case of ATT |
| 60 | [Tags] bbsimSanity |
| 61 | [Setup] Run Keywords Start Logging BBSimSanity |
| 62 | ... AND Setup |
| 63 | FOR ${J} IN RANGE 0 ${num_olts} |
| 64 | ${olt_serial_number}= Set Variable ${list_olts}[${J}][sn] |
| 65 | ${onu_count}= Set Variable ${list_olts}[${J}][onucount] |
| 66 | ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS |
| 67 | ... ${olt_serial_number} |
| 68 | ${bbsim_rel}= Catenate SEPARATOR= bbsim ${J} |
| 69 | ${bbsim_pod}= Get Pod Name By Label ${NAMESPACE} release ${bbsim_rel} |
| 70 | Perform BBSim Sanity Test Per OLT ${bbsim_pod} ${of_id} ${olt_serial_number} ${onu_count} |
| 71 | END |
| 72 | [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs |
| 73 | ... AND Stop Logging BBSimSanity |
| 74 | |
| 75 | *** Keywords *** |
| 76 | |
| 77 | Perform ONU Igmp Join and Leave |
| 78 | [Documentation] This keyword performs Igmp Leave and Join for ONU |
| 79 | [Arguments] ${bbsim_pod} ${of_id} ${onu} ${onu_port} |
| 80 | FOR ${Z} IN RANGE 0 ${igmp_join_leave_count} |
| 81 | List Service ${NAMESPACE} ${bbsim_pod} |
| 82 | JoinOrLeave Igmp ${NAMESPACE} ${bbsim_pod} ${onu} join |
| 83 | Sleep 2s |
| 84 | List Service ${NAMESPACE} ${bbsim_pod} |
| 85 | List ONUs ${NAMESPACE} ${bbsim_pod} |
| 86 | Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s |
| 87 | ... Verify ONU in Groups ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id} ${onu_port} |
| 88 | JoinOrLeave Igmp ${NAMESPACE} ${bbsim_pod} ${onu} leave |
| 89 | Sleep 2s |
| 90 | List Service ${NAMESPACE} ${bbsim_pod} |
| 91 | List ONUs ${NAMESPACE} ${bbsim_pod} |
| 92 | Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s |
| 93 | ... Verify ONU in Groups ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id} ${onu_port} False |
| 94 | END |
| 95 | |
| 96 | Perform BBSim Sanity Test Per OLT |
| 97 | [Documentation] Validates the BBSim Functionality for ATT, DT and TT workflows |
| 98 | ... Also Restart Auth (ATT), Restart Dhcp (ATT and TT), Igmp Join and Leave (TT) |
| 99 | [Arguments] ${bbsim_pod} ${of_id} ${olt_serial_number} ${num_onus} |
| 100 | FOR ${I} IN RANGE 0 ${num_all_onus} |
| 101 | ${src}= Set Variable ${hosts.src[${I}]} |
| 102 | ${dst}= Set Variable ${hosts.dst[${I}]} |
| 103 | Continue For Loop If "${olt_serial_number}"!="${src['olt']}" |
| 104 | ${onu_device_id}= Get Device ID From SN ${src['onu']} |
| 105 | ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s |
| 106 | ... Get ONU Port in ONOS ${src['onu']} ${of_id} |
| 107 | # Check ONU port is Enabled in ONOS |
| 108 | Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s |
| 109 | ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']} |
| 110 | Run Keyword If "${workflow}"=="ATT" |
| 111 | ... Run Keywords |
| 112 | # Verify ONU in AAA-Users (valid only for ATT) |
| 113 | ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2 |
| 114 | ... Verify ONU in AAA-Users ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port} |
| 115 | ... AND List ONUs ${NAMESPACE} ${bbsim_pod} |
| 116 | # Restart Auth and Verify (valid only for ATT) |
| 117 | ... AND Execute ONOS CLI Command on open connection ${onos_ssh_connection} |
| 118 | ... aaa-reset-all-devices |
| 119 | ... AND Restart Auth ${NAMESPACE} ${bbsim_pod} ${src['onu']} |
| 120 | ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2 |
| 121 | ... Verify ONU in AAA-Users ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port} |
| 122 | ... AND List ONUs ${NAMESPACE} ${bbsim_pod} |
| 123 | # Add Subscriber |
| 124 | Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2 |
| 125 | ... Execute ONOS CLI Command on open connection ${onos_ssh_connection} |
| 126 | ... volt-add-subscriber-access ${of_id} ${onu_port} |
| 127 | # Verify that no pending flows exist for the ONU port |
| 128 | Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s |
| 129 | ... Verify No Pending Flows For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port} |
| 130 | # Verify subscriber dhcp allocations (valid only for ATT and TT) |
| 131 | Run Keyword If "${workflow}"=="ATT" or "${workflow}"=="TT" |
| 132 | ... Run Keywords |
| 133 | ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s |
| 134 | ... Validate Subscriber DHCP Allocation ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port} |
| 135 | ... AND List ONUs ${NAMESPACE} ${bbsim_pod} |
| 136 | # Restart Dhcp and Verify (valid only for ATT and TT) |
| 137 | ... AND Execute ONOS CLI Command on open connection ${onos_ssh_connection} |
| 138 | ... dhcpl2relay-remove-allocation ${of_id} ${onu_port} |
| 139 | ... AND Restart DHCP ${NAMESPACE} ${bbsim_pod} ${src['onu']} |
| 140 | ... AND Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s |
| 141 | ... Validate Subscriber DHCP Allocation ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port} |
| 142 | ... AND List ONUs ${NAMESPACE} ${bbsim_pod} |
| 143 | # Perform Igmp Join and Leave (valid only for TT) |
| 144 | Run Keyword If "${workflow}"=="TT" |
| 145 | ... Perform ONU Igmp Join and Leave ${bbsim_pod} ${of_id} ${src['onu']} ${onu_port} |
| 146 | END |
| 147 | |
| 148 | Setup Suite |
| 149 | [Documentation] Set up the test suite |
| 150 | Common Test Suite Setup |
| 151 | #send igmp file to onos (valid only for TT) |
| 152 | ${onos_netcfg_file}= Get Variable Value ${onos_netcfg.file} |
| 153 | Run Keyword If '${workflow}'=='TT' and '${has_dataplane}'=='False' and '${onos_netcfg_file}'!='${None}' |
| 154 | ... Send File To Onos ${onos_netcfg_file} apps/ |
| 155 | ${onos_ssh_connection} Open ONOS SSH Connection ${ONOS_SSH_IP} ${ONOS_SSH_PORT} |
| 156 | Set Suite Variable ${onos_ssh_connection} |
| 157 | |
| 158 | Teardown Suite |
| 159 | [Documentation] Replaces the Suite Teardown in utils.robot. |
| 160 | ... Cleans up and checks all ONU ports disabled in ONOS. |
| 161 | Run Keyword If ${teardown_device} Delete All Devices and Verify |
| 162 | Close All ONOS SSH Connections |