Hardik Windlass | 2013d0c | 2021-05-20 13:37:25 +0000 | [diff] [blame] | 1 | # Copyright 2021 - 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 | # FIXME Can we use the same test against BBSim and Hardware? |
| 15 | |
| 16 | *** Settings *** |
| 17 | Documentation Test various functional end-to-end scenarios for TT workflow |
| 18 | Suite Setup Setup Suite |
| 19 | Test Setup Setup |
| 20 | Test Teardown Teardown |
| 21 | Suite Teardown Teardown Suite |
| 22 | Library Collections |
| 23 | Library String |
| 24 | Library OperatingSystem |
| 25 | Library XML |
| 26 | Library RequestsLibrary |
| 27 | Library ../../libraries/DependencyLibrary.py |
| 28 | Resource ../../libraries/onos.robot |
| 29 | Resource ../../libraries/voltctl.robot |
| 30 | Resource ../../libraries/voltha.robot |
| 31 | Resource ../../libraries/utils.robot |
| 32 | Resource ../../libraries/k8s.robot |
| 33 | Resource ../../variables/variables.robot |
| 34 | Resource ../../libraries/power_switch.robot |
| 35 | |
| 36 | *** Variables *** |
| 37 | ${POD_NAME} flex-ocp-cord |
| 38 | ${KUBERNETES_CONF} ${KUBERNETES_CONFIGS_DIR}/${POD_NAME}.conf |
| 39 | ${KUBERNETES_CONFIGS_DIR} ~/pod-configs/kubernetes-configs |
| 40 | #${KUBERNETES_CONFIGS_DIR} ${KUBERNETES_CONFIGS_DIR}/${POD_NAME}.conf |
| 41 | ${KUBERNETES_YAML} ${KUBERNETES_CONFIGS_DIR}/${POD_NAME}.yml |
| 42 | ${HELM_CHARTS_DIR} ~/helm-charts |
| 43 | ${VOLTHA_POD_NUM} 8 |
| 44 | ${NAMESPACE} voltha |
| 45 | # For below variable value, using deployment name as using grep for |
| 46 | # parsing radius pod name, we can also use full radius pod name |
| 47 | ${RESTART_POD_NAME} radius |
| 48 | ${timeout} 60s |
| 49 | ${of_id} 0 |
| 50 | ${logical_id} 0 |
| 51 | ${has_dataplane} True |
| 52 | ${teardown_device} True |
| 53 | ${scripts} ../../scripts |
| 54 | |
| 55 | # Per-test logging on failure is turned off by default; set this variable to enable |
| 56 | ${container_log_dir} ${None} |
| 57 | |
| 58 | # For dataplane bandwidth testing |
| 59 | ${lower_margin_pct} 90 # Allow 10% under the limit |
| 60 | |
| 61 | *** Test Cases *** |
Girish Gowdra | cb8482a | 2021-05-27 09:06:13 -0700 | [diff] [blame] | 62 | Test that the BW is limited to Limiting Bandwidth |
Hardik Windlass | 2013d0c | 2021-05-20 13:37:25 +0000 | [diff] [blame] | 63 | [Documentation] Verify support for Tcont type 1. |
Girish Gowdra | cb8482a | 2021-05-27 09:06:13 -0700 | [diff] [blame] | 64 | ... Verify that traffic is limited to Limiting Bandwidth (eir+cir+air) configured for the service/onu. |
Hardik Windlass | 2013d0c | 2021-05-20 13:37:25 +0000 | [diff] [blame] | 65 | ... Pump 500Mbps in the upstream from RG and verify that the received traffic is only 200Mbps at the BNG. |
| 66 | ... Note: Currently, only Flex Pod supports the deployment configuration required to test this scenario. |
| 67 | [Tags] functionalTT VOL-4093 |
| 68 | [Setup] Run Keywords Start Logging TcontType1Onu1 |
| 69 | ... AND Setup |
| 70 | [Teardown] Run Keywords Collect Logs |
| 71 | ... AND Stop Logging TcontType1Onu1 |
Hardik Windlass | 35db2aa | 2021-06-03 12:41:26 +0000 | [diff] [blame] | 72 | ... AND Delete All Devices and Verify |
Hardik Windlass | 2013d0c | 2021-05-20 13:37:25 +0000 | [diff] [blame] | 73 | Run Keyword If ${has_dataplane} Clean Up Linux |
| 74 | Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Tests TT |
| 75 | # Find the ONU as required for this test |
| 76 | ${test_onu}= Set Variable ${multi_tcont_tests.tcont1[0]} |
| 77 | ${test_onu_sn}= Set Variable ${test_onu['onu']} |
| 78 | ${test_service_type}= Set Variable ${test_onu['service_type']} |
| 79 | ${test_us_bw_profile}= Set Variable ${test_onu['us_bw_profile']} |
| 80 | ${matched} ${src} ${dst}= Get ONU details with Given Sn and Service ${test_onu_sn} ${test_service_type} |
| 81 | ... ${test_us_bw_profile} |
| 82 | Pass Execution If '${matched}' != 'True' |
| 83 | ... Skipping test: No ONU found with sn '${test_onu_sn}', service '${test_service_type}' and us_bw '${test_us_bw_profile}' |
| 84 | # Check for iperf3 and jq tools |
| 85 | ${stdout} ${stderr} ${rc}= Execute Remote Command which iperf3 jq |
| 86 | ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']} |
| 87 | Pass Execution If ${rc} != 0 Skipping test: iperf3 / jq not found on the RG |
Girish Gowdra | cb8482a | 2021-05-27 09:06:13 -0700 | [diff] [blame] | 88 | ${limiting_bw_value_upstream}= Get Limiting Bandwidth Details ${test_us_bw_profile} |
Hardik Windlass | 2013d0c | 2021-05-20 13:37:25 +0000 | [diff] [blame] | 89 | # Stream UDP packets from RG to server |
| 90 | ${updict}= Run Iperf3 Test Client ${src} server=${dst['dp_iface_ip_qinq']} |
| 91 | ... args=-u -b 500M -t 30 -p 5201 |
| 92 | # With UDP test, bits per second is the sending rate. Multiply by the loss rate to get the throughput. |
| 93 | ${actual_upstream_bw_used}= Evaluate |
| 94 | ... (100 - ${updict['end']['sum']['lost_percent']})*${updict['end']['sum']['bits_per_second']}/100000 |
Girish Gowdra | cb8482a | 2021-05-27 09:06:13 -0700 | [diff] [blame] | 95 | ${pct_limit_up}= Evaluate 100*${actual_upstream_bw_used}/${limiting_bw_value_upstream} |
Hardik Windlass | 2013d0c | 2021-05-20 13:37:25 +0000 | [diff] [blame] | 96 | Should Be True ${pct_limit_up} >= ${lower_margin_pct} |
| 97 | ... The upstream bandwidth guarantee was not met (${pct_limit_up}% of resv) |
| 98 | |
Hardik Windlass | d388b46 | 2021-05-27 05:40:00 +0000 | [diff] [blame] | 99 | Test that assured BW is allocated as needed on the PON |
| 100 | [Documentation] Verify support for Tcont type 2 and 4. |
| 101 | ... Verify that the BW from tcont type 4 is bequeathed to type2 as needed. |
| 102 | ... 1) Pump 1Gbps in the upstream from the RG for HSIA service and verify that no more than 1Gbps is received at the BNG. |
| 103 | ... 2) Pump 500Mbps from the RG for the VoD service and verify that close to 500Mbps is received at the BNG. |
| 104 | ... Also, verify that the HSI rate is now truncated to 500Mbps at BNG. |
| 105 | ... Note: Currently, only Flex Pod supports the deployment configuration required to test this scenario. |
| 106 | [Tags] functionalTT VOL-4095 |
| 107 | [Setup] Run Keywords Start Logging TcontType2Type4Onu1 |
| 108 | ... AND Setup |
| 109 | [Teardown] Run Keywords Collect Logs |
| 110 | ... AND Stop Logging TcontType2Type4Onu1 |
| 111 | ... AND Delete All Devices and Verify |
| 112 | Run Keyword If ${has_dataplane} Clean Up Linux |
| 113 | Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test TT |
| 114 | |
| 115 | # The test expects the first entry in multi_tcont_tests.tcont2tcont4 input will be for service: vod and tcont: 2 |
| 116 | # The test expects the second entry in multi_tcont_tests.tcont2tcont4 input will be for service: hsia and tcont: 4 |
| 117 | ${list_onus_ut}= Create List |
| 118 | ${num_multi_tcont_input}= Get Length ${multi_tcont_tests.tcont2tcont4} |
| 119 | FOR ${I} IN RANGE 0 ${num_multi_tcont_input} |
| 120 | ${onu}= Set Variable ${multi_tcont_tests.tcont2tcont4[${I}]} |
| 121 | ${onu_sn}= Set Variable ${onu['onu']} |
| 122 | ${service}= Set Variable ${onu['service_type']} |
| 123 | ${us_bw}= Set Variable ${onu['us_bw_profile']} |
| 124 | ${matched} ${src} ${dst}= Get ONU details with Given Sn and Service ${onu_sn} |
| 125 | ... ${service} ${us_bw} |
| 126 | Pass Execution If '${matched}' != 'True' |
| 127 | ... Skipping test: No ONU found with sn '${onu_sn}', service '${service}' and us_bw '${us_bw}' |
| 128 | # Check for iperf3 and jq tools |
| 129 | ${stdout} ${stderr} ${rc}= Execute Remote Command which iperf3 jq |
| 130 | ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']} |
| 131 | Pass Execution If ${rc} != 0 Skipping test: iperf3 / jq not found on the RG |
| 132 | # Get Upstream BW Profile details |
| 133 | ${limiting_bw_us}= Get Limiting Bandwidth Details ${us_bw} |
| 134 | ${onu_ut} Create Dictionary src ${src} dst ${dst} limiting_bw_us ${limiting_bw_us} |
| 135 | Append To List ${list_onus_ut} ${onu_ut} |
| 136 | END |
| 137 | |
| 138 | # Case 1: Verify only for HSIA service |
| 139 | ${dst}= Set Variable ${list_onus_ut}[1][dst] |
| 140 | ${updict}= Run Iperf3 Test Client ${list_onus_ut}[1][src] server=${dst['dp_iface_ip_qinq']} |
| 141 | ... args=-t 30 -p 5202 |
| 142 | ${actual_upstream_bw_used}= Evaluate ${updict['end']['sum_received']['bits_per_second']}/1000 |
| 143 | ${pct_limit_up}= Evaluate 100*${actual_upstream_bw_used}/${list_onus_ut}[1][limiting_bw_us] |
| 144 | Should Be True ${pct_limit_up} >= ${lower_margin_pct} |
| 145 | ... The upstream bandwidth guarantee was not met (${pct_limit_up}% of resv) |
| 146 | |
| 147 | # Case 2: Verify for VOD (with index [0]) and HSIA (with index [1]) service combined |
| 148 | ${out_file_0}= Set Variable ${CURDIR}/../../tests/data/out_tcont2 |
| 149 | ${dst_0}= Set Variable ${list_onus_ut}[0][dst] |
| 150 | Run Iperf3 Test Client in Background ${list_onus_ut}[0][src] server=${dst_0['dp_iface_ip_qinq']} |
| 151 | ... args=-t 30 -p 5201 out_file=${out_file_0} |
| 152 | ${out_file_1}= Set Variable ${CURDIR}/../../tests/data/out_tcont4 |
| 153 | ${dst_1}= Set Variable ${list_onus_ut}[1][dst] |
| 154 | Run Iperf3 Test Client in Background ${list_onus_ut}[1][src] server=${dst_1['dp_iface_ip_qinq']} |
| 155 | ... args=-t 30 -p 5202 out_file=${out_file_1} |
| 156 | # Wait for the above iperf commands to finish (sleep time depends on -t arg value passed in iperf command) |
| 157 | Sleep 35s |
| 158 | ${out_0}= Read Output File on System ${out_file_0} |
| 159 | ${out_1}= Read Output File on System ${out_file_1} |
| 160 | ${actual_upstream_bw_used_0}= Evaluate ${out_0['end']['sum_received']['bits_per_second']}/1000 |
| 161 | ${pct_limit_up_0}= Evaluate 100*${actual_upstream_bw_used_0}/${list_onus_ut}[0][limiting_bw_us] |
| 162 | Should Be True ${pct_limit_up_0} >= ${lower_margin_pct} |
| 163 | ... The upstream bandwidth guarantee was not met (${pct_limit_up_0}% of resv) |
| 164 | ${actual_upstream_bw_used_1}= Evaluate ${out_1['end']['sum_received']['bits_per_second']}/1000 |
| 165 | ${pct_limit_up_1}= Evaluate |
| 166 | ... 100*${actual_upstream_bw_used_1}/(${list_onus_ut}[1][limiting_bw_us]-${list_onus_ut}[0][limiting_bw_us]) |
| 167 | Should Be True ${pct_limit_up_1} >= ${lower_margin_pct} |
| 168 | ... The upstream bandwidth guarantee was not met (${pct_limit_up_1}% of resv) |
| 169 | |
Hardik Windlass | 2013d0c | 2021-05-20 13:37:25 +0000 | [diff] [blame] | 170 | *** Keywords *** |
Hardik Windlass | d388b46 | 2021-05-27 05:40:00 +0000 | [diff] [blame] | 171 | Read Output File on System |
| 172 | [Arguments] ${file} |
| 173 | [Documentation] Reads the content of ${file}. |
| 174 | ${output}= OperatingSystem.Get File ${file} |
| 175 | Log ${output} |
| 176 | ${object}= Evaluate json.loads(r'''${output}''') json |
| 177 | [Return] ${object} |
| 178 | |
| 179 | Run Iperf3 Test Client in Background |
| 180 | [Arguments] ${src} ${server} ${args} ${out_file} |
| 181 | [Documentation] Login to ${src} and run the iperf3 client against ${server} using ${args} in background. |
| 182 | ... Stores the results of the test in ${out_file}. |
| 183 | ${output} ${stderr} ${rc}= Execute Remote Command iperf3 -J -c ${server} ${args} > ${out_file} & |
| 184 | ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']} |
| 185 | Should Be Equal As Integers ${rc} 0 |
| 186 | |
Hardik Windlass | 2013d0c | 2021-05-20 13:37:25 +0000 | [diff] [blame] | 187 | Get ONU details with Given Sn and Service |
| 188 | [Documentation] This keyword finds the ONU details (as required for multi-tcont test) |
| 189 | ... with given serial number and service type |
| 190 | ... The keyword, additionally, also verifies the associated upstream bandwidth profile |
| 191 | [Arguments] ${onu_sn} ${service_type} ${us_bw_profile} |
| 192 | ${matched}= Set Variable False |
| 193 | FOR ${I} IN RANGE 0 ${num_all_onus} |
| 194 | ${src}= Set Variable ${hosts.src[${I}]} |
| 195 | ${dst}= Set Variable ${hosts.dst[${I}]} |
| 196 | ${service}= Get Variable Value ${src['service_type']} "null" |
| 197 | ${onu}= Get Variable Value ${src['onu']} "null" |
| 198 | Continue For Loop If '${onu}' != '${onu_sn}' or '${service}' != '${service_type}' |
| 199 | # Additional verification to check upstream bandwidth profile |
| 200 | ${of_id}= Get ofID From OLT List ${src['olt']} |
| 201 | ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']} ${of_id} |
| 202 | ${subscriber_id}= Set Variable ${of_id}/${onu_port} |
| 203 | ${us_bw} Get Bandwidth Profile Name For Given Subscriber ${subscriber_id} upstreamBandwidthProfile |
Hardik Windlass | 35db2aa | 2021-06-03 12:41:26 +0000 | [diff] [blame] | 204 | ... ${service_type} |
Hardik Windlass | 2013d0c | 2021-05-20 13:37:25 +0000 | [diff] [blame] | 205 | ${matched}= Set Variable If |
| 206 | ... '${onu}' == '${onu_sn}' and '${service}' == '${service_type}' and ${us_bw} == '${us_bw_profile}' |
| 207 | ... True False |
| 208 | Exit For Loop If ${matched} |
| 209 | END |
| 210 | [Return] ${matched} ${src} ${dst} |
| 211 | |
| 212 | Setup Suite |
| 213 | [Documentation] Set up the test suite |
| 214 | Common Test Suite Setup |
| 215 | ${switch_type}= Get Variable Value ${web_power_switch.type} |
| 216 | Run Keyword If "${switch_type}"!="" Set Global Variable ${powerswitch_type} ${switch_type} |
| 217 | |
| 218 | |
| 219 | Clear All Devices Then Create New Device |
| 220 | [Documentation] Remove any devices from VOLTHA and ONOS |
| 221 | # Remove all devices from voltha and nos |
| 222 | Delete All Devices and Verify |
| 223 | # Execute normal test Setup Keyword |
| 224 | Setup |
| 225 | |
| 226 | |
| 227 | Teardown Suite |
| 228 | [Documentation] Tear down steps for the suite |
| 229 | Run Keyword If ${has_dataplane} Clean Up Linux |
| 230 | Run Keyword If ${teardown_device} Delete All Devices And Verify |