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 *** |
| 62 | Test that the BW is limited to GIR |
| 63 | [Documentation] Verify support for Tcont type 1. |
| 64 | ... Verify that traffic is limited to GIR configured for the service/onu. |
| 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 |
| 72 | Run Keyword If ${has_dataplane} Clean Up Linux |
| 73 | Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Tests TT |
| 74 | # Find the ONU as required for this test |
| 75 | ${test_onu}= Set Variable ${multi_tcont_tests.tcont1[0]} |
| 76 | ${test_onu_sn}= Set Variable ${test_onu['onu']} |
| 77 | ${test_service_type}= Set Variable ${test_onu['service_type']} |
| 78 | ${test_us_bw_profile}= Set Variable ${test_onu['us_bw_profile']} |
| 79 | ${matched} ${src} ${dst}= Get ONU details with Given Sn and Service ${test_onu_sn} ${test_service_type} |
| 80 | ... ${test_us_bw_profile} |
| 81 | Pass Execution If '${matched}' != 'True' |
| 82 | ... Skipping test: No ONU found with sn '${test_onu_sn}', service '${test_service_type}' and us_bw '${test_us_bw_profile}' |
| 83 | # Check for iperf3 and jq tools |
| 84 | ${stdout} ${stderr} ${rc}= Execute Remote Command which iperf3 jq |
| 85 | ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']} |
| 86 | Pass Execution If ${rc} != 0 Skipping test: iperf3 / jq not found on the RG |
| 87 | ${us_cir} ${us_cbs} ${us_pir} ${us_pbs} ${us_gir}= Get Bandwidth Profile Details Ietf Rest |
| 88 | ... ${test_us_bw_profile} |
| 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 |
| 95 | ${pct_limit_up}= Evaluate 100*${actual_upstream_bw_used}/${us_gir} |
| 96 | Should Be True ${pct_limit_up} >= ${lower_margin_pct} |
| 97 | ... The upstream bandwidth guarantee was not met (${pct_limit_up}% of resv) |
| 98 | |
| 99 | *** Keywords *** |
| 100 | Get ONU details with Given Sn and Service |
| 101 | [Documentation] This keyword finds the ONU details (as required for multi-tcont test) |
| 102 | ... with given serial number and service type |
| 103 | ... The keyword, additionally, also verifies the associated upstream bandwidth profile |
| 104 | [Arguments] ${onu_sn} ${service_type} ${us_bw_profile} |
| 105 | ${matched}= Set Variable False |
| 106 | FOR ${I} IN RANGE 0 ${num_all_onus} |
| 107 | ${src}= Set Variable ${hosts.src[${I}]} |
| 108 | ${dst}= Set Variable ${hosts.dst[${I}]} |
| 109 | ${service}= Get Variable Value ${src['service_type']} "null" |
| 110 | ${onu}= Get Variable Value ${src['onu']} "null" |
| 111 | Continue For Loop If '${onu}' != '${onu_sn}' or '${service}' != '${service_type}' |
| 112 | # Additional verification to check upstream bandwidth profile |
| 113 | ${of_id}= Get ofID From OLT List ${src['olt']} |
| 114 | ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']} ${of_id} |
| 115 | ${subscriber_id}= Set Variable ${of_id}/${onu_port} |
| 116 | ${us_bw} Get Bandwidth Profile Name For Given Subscriber ${subscriber_id} upstreamBandwidthProfile |
| 117 | ${matched}= Set Variable If |
| 118 | ... '${onu}' == '${onu_sn}' and '${service}' == '${service_type}' and ${us_bw} == '${us_bw_profile}' |
| 119 | ... True False |
| 120 | Exit For Loop If ${matched} |
| 121 | END |
| 122 | [Return] ${matched} ${src} ${dst} |
| 123 | |
| 124 | Setup Suite |
| 125 | [Documentation] Set up the test suite |
| 126 | Common Test Suite Setup |
| 127 | ${switch_type}= Get Variable Value ${web_power_switch.type} |
| 128 | Run Keyword If "${switch_type}"!="" Set Global Variable ${powerswitch_type} ${switch_type} |
| 129 | |
| 130 | |
| 131 | Clear All Devices Then Create New Device |
| 132 | [Documentation] Remove any devices from VOLTHA and ONOS |
| 133 | # Remove all devices from voltha and nos |
| 134 | Delete All Devices and Verify |
| 135 | # Execute normal test Setup Keyword |
| 136 | Setup |
| 137 | |
| 138 | |
| 139 | Teardown Suite |
| 140 | [Documentation] Tear down steps for the suite |
| 141 | Run Keyword If ${has_dataplane} Clean Up Linux |
| 142 | Run Keyword If ${teardown_device} Delete All Devices And Verify |