X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=resources%2Flibraries%2Frobot%2Fperformance%2Fperformance_utils.robot;h=a43f38e2fef05d163cde5f27386674c177cad615;hb=f4dbca1c0390d1702737db97869c54d997fd4525;hp=638a834fc196c6f8a8dd4d52799d99490450fc6c;hpb=b26fe6de7965f6621b54a80a938f82afe95aa585;p=csit.git diff --git a/resources/libraries/robot/performance/performance_utils.robot b/resources/libraries/robot/performance/performance_utils.robot index 638a834fc1..a43f38e2fe 100644 --- a/resources/libraries/robot/performance/performance_utils.robot +++ b/resources/libraries/robot/performance/performance_utils.robot @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Cisco and/or its affiliates. +# Copyright (c) 2023 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -13,11 +13,12 @@ *** Settings *** | Library | Collections +| Library | resources.libraries.python.model.ExportResult | Library | resources.libraries.python.topology.Topology | Library | resources.libraries.python.NodePath -| Library | resources.libraries.python.PerfUtil | Library | resources.libraries.python.InterfaceUtil | Library | resources.libraries.python.Iperf3 +| Library | resources.libraries.python.TelemetryUtil | Library | resources.libraries.python.TrafficGenerator | Library | resources.libraries.python.TrafficGenerator.OptimizedSearch | Library | resources.libraries.python.TrafficGenerator.TGDropRateSearchImpl @@ -38,53 +39,6 @@ | ${heap_size_mult}= | ${1} *** Keywords *** -| Clear and show runtime counters with running traffic -| | [Documentation] -| | ... | Start traffic at specified rate then clear runtime counters on all -| | ... | DUTs. Wait for specified amount of time and capture runtime counters -| | ... | on all DUTs. Finally stop traffic. -| | -| | ... | TODO: Support resetter if this is not the first trial-ish action? -| | -| | ... | *Example:* -| | -| | ... | \| Clear and show runtime counters with running traffic \| -| | -| | ${ppta} = | Get Packets Per Transaction Aggregated -| | ${ramp_up_duration} = | Get Ramp Up Duration -| | ${ramp_up_rate} = | Get Ramp Up Rate -| | ${runtime_duration} = | Get Runtime Duration -| | ${runtime_rate} = | Get Runtime Rate -| | ${traffic_directions} = | Get Traffic Directions -| | ${transaction_duration} = | Get Transaction Duration -| | ${transaction_scale} = | Get Transaction Scale -| | ${transaction_type} = | Get Transaction Type -| | ${use_latency} = | Get Use Latency -| | # Duration of -1 means we will stop traffic manually. -| | Send traffic on tg -| | ... | duration=${-1} -| | ... | rate=${runtime_rate} -| | ... | frame_size=${frame_size} -| | ... | traffic_profile=${traffic_profile} -| | ... | async_call=${True} -| | ... | ppta=${ppta} -| | ... | use_latency=${use_latency} -| | ... | traffic_directions=${traffic_directions} -| | ... | transaction_duration=${transaction_duration} -| | ... | transaction_scale=${transaction_scale} -| | ... | transaction_type=${transaction_type} -| | ... | duration_limit=${0.0} -| | ... | ramp_up_duration=${ramp_up_duration} -| | ... | ramp_up_rate=${ramp_up_rate} -| | FOR | ${action} | IN | @{pre_run_stats} -| | | Run Keyword | Additional Statistics Action For ${action} -| | END -| | Sleep | ${runtime_duration} -| | FOR | ${action} | IN | @{post_run_stats} -| | | Run Keyword | Additional Statistics Action For ${action} -| | END -| | Stop traffic on tg - | Find critical load using PLRsearch | | [Documentation] | | ... | Find boundaries for troughput (of hardcoded target loss ratio) @@ -92,7 +46,7 @@ | | ... | Display results as formatted test message. | | ... | Fail if computed lower bound is 110% of the minimal rate or less. | | ... | Input rates are unidirectional, in transaction per second. -| | ... | Reported result may contain aggregate pps rates, depending on test. +| | ... | Reported result may contain aggregated pps rates, depending on test. | | ... | Call \${resetter} (if defined) to reset DUT state before each trial. | | | | ... | *Test (or broader scope) variables read:* @@ -119,6 +73,23 @@ | | ${transaction_scale} = | Get Transaction Scale | | ${transaction_type} = | Get Transaction Type | | ${use_latency} = | Get Use Latency +| | # TRex needs a warmup to avoid unsent packets at half-max rate. +| | Send traffic on tg +| | ... | duration=1.0 +| | ... | rate=${max_rate} +| | ... | frame_size=${frame_size} +| | ... | traffic_profile=${traffic_profile} +| | ... | async_call=${False} +| | ... | duration_limit=${1.0} +| | ... | ppta=${ppta} +| | ... | traffic_directions=${traffic_directions} +| | ... | transaction_duration=${transaction_duration} +| | ... | transaction_scale=${transaction_scale} +| | ... | transaction_type=${transaction_type} +| | ... | use_latency=False +| | ... | ramp_up_duration=${0.0} +| | ... | ramp_up_rate=${0.0} +| | # Ready for main search. | | ${average} | ${stdev} = | Perform soak search | | ... | frame_size=${frame_size} | | ... | traffic_profile=${traffic_profile} @@ -141,6 +112,14 @@ | | ${lower} | ${upper} = | Display result of soak search | | ... | ${average} | ${stdev} | | Set Test Variable | \${rate for teardown} | ${lower} +| | # Stats at the discovered critical rate. +| | Set Test Variable | ${telemetry_rate} | plr +| | Send traffic at specified rate +| | ... | rate=${lower} +| | ... | trial_duration=${1.0} +| | ... | trial_multiplicity=${1} +| | ... | use_latency=${use_latency} +| | ... | duration_limit=${1.0} | | Should Not Be True | 1.1 * ${min_rate_soft} > ${lower} | | ... | Lower bound ${lower} too small for unidir minimum ${min_rate_soft}. @@ -149,9 +128,9 @@ | | ... | Find boundaries for RFC2544 compatible NDR and PDR values | | ... | using an optimized search algorithm. | | ... | Display findings as a formatted test message. -| | ... | Fail if a resulting lower bound has too high loss fraction. +| | ... | Fail if a resulting lower bound has too high loss ratio. | | ... | Input rates are unidirectional, in transaction per second. -| | ... | Reported result may contain aggregate pps rates, depending on test. +| | ... | Reported result may contain aggregated pps rates, depending on test. | | ... | Additional latency measurements are performed for smaller loads, | | ... | even if latency stream is disabled in search. Their results | | ... | are also displayed. @@ -201,8 +180,7 @@ | | ... | final_trial_duration=${30.0} | | ... | initial_trial_duration=${1.0} | | ... | number_of_intermediate_phases=${2} -| | ... | timeout=${720.0} -| | ... | doublings=${2} +| | ... | timeout=${1200.0} | | ... | ppta=${ppta} | | ... | resetter=${resetter} | | ... | traffic_directions=${traffic_directions} @@ -213,18 +191,20 @@ | | ... | ramp_up_duration=${ramp_up_duration} | | ... | ramp_up_rate=${ramp_up_rate} | | Display result of NDRPDR search | ${result} -| | Check NDRPDR interval validity | ${result.pdr_interval} +| | Check NDRPDR interval validity | ${result[1]} | | ... | ${packet_loss_ratio} -| | Check NDRPDR interval validity | ${result.ndr_interval} -| | ${pdr} = | Set Variable | ${result.pdr_interval.measured_low.target_tr} -| | ${ndr} = | Set Variable | ${result.ndr_interval.measured_low.target_tr} +| | Check NDRPDR interval validity | ${result[0]} +| | ${pdr} = | Set Variable | ${result[1].measured_low.target_tr} +| | ${ndr} = | Set Variable | ${result[0].measured_low.target_tr} | | # We expect NDR and PDR to have different-looking stats. +| | Set Test Variable | ${telemetry_rate} | pdr | | Send traffic at specified rate | | ... | rate=${pdr} | | ... | trial_duration=${1.0} | | ... | trial_multiplicity=${1} | | ... | use_latency=${use_latency} | | ... | duration_limit=${1.0} +| | Set Test Variable | ${telemetry_rate} | ndr | | Run Keyword If | ${ndr} != ${pdr} | | ... | Send traffic at specified rate | | ... | rate=${ndr} @@ -289,8 +269,7 @@ | | ... | final_trial_duration=${10.0} | | ... | initial_trial_duration=${1.0} | | ... | number_of_intermediate_phases=${1} -| | ... | timeout=${720} -| | ... | doublings=${2} +| | ... | timeout=${1200} | | ... | ppta=${ppta} | | ... | resetter=${resetter} | | ... | traffic_directions=${traffic_directions} @@ -300,9 +279,8 @@ | | ... | use_latency=${use_latency} | | ... | ramp_up_duration=${ramp_up_duration} | | ... | ramp_up_rate=${ramp_up_rate} -| | Check NDRPDR interval validity | ${result.pdr_interval} -| | ... | ${0.0} -| | Return From Keyword | ${result.pdr_interval.measured_low.target_tr} +| | Check NDRPDR interval validity | ${result[0]} +| | Return From Keyword | ${result[0].measured_low.target_tr} | Measure and show latency at specified rate | | [Documentation] @@ -351,6 +329,7 @@ | | ... | ramp_up_rate=${ramp_up_rate} | | ${latency} = | Get Latency Int | | Set Test Message | ${\n}${message_prefix} ${latency} | append=${True} +| | Export Ndrpdr Latency | ${message_prefix} | ${latency} | Send ramp-up traffic | | [Documentation] @@ -378,7 +357,7 @@ | | ... | \| Send ramp-up traffic \| | | | | ${ramp_up_rate} = | Get Ramp Up Rate -| | Run Keyword Unless | ${ramp_up_rate} > 0.0 | Fail | Ramp up rate missing! +| | Run Keyword If | ${ramp_up_rate} <= 0.0 | Fail | Ramp up rate missing! | | ${ramp_up_duration} = | Get Ramp Up Duration | | ${ppta} = | Get Packets Per Transaction Aggregated | | ${traffic_directions} = | Get Traffic Directions @@ -421,14 +400,17 @@ | | ... | Type: boolean | | ... | - duration_limit - Hard limit for trial duration, overriding duration | | ... | computed from transaction_scale. Default 0.0 means no limit. +| | ... | - export_mrr_unit - Use this unit when exporting MRR values, +| | ... | or empty string for no export. | | | | ... | *Example:* | | | | ... | \| Send traffic at specified rate \| \${1.0} \| ${4000000.0} \ -| | ... | \| \${10} \| ${False} \| ${1.0} \| +| | ... | \| \${10} \| ${False} \| ${1.0} \| pps \| | | | | [Arguments] | ${trial_duration} | ${rate} | ${trial_multiplicity} | | ... | ${use_latency}=${False} | ${duration_limit}=${0.0} +| | ... | ${export_mrr_unit}=${Empty} | | | | ${ppta} = | Get Packets Per Transaction Aggregated | | ${ramp_up_duration} = | Get Ramp Up Duration @@ -438,13 +420,17 @@ | | ${transaction_scale} = | Get Transaction Scale | | ${transaction_type} = | Get Transaction Type | | Set Test Variable | \${rate_for_teardown} | ${rate} -| | FOR | ${action} | IN | @{pre_stats} +| | Set Test Variable | \${runtime_rate} | ${rate} +| | FOR | ${action} | IN | @{stat_runtime} +| | | Run Keyword | Additional Statistics Action For ${action} +| | END +| | FOR | ${action} | IN | @{stat_pre_trial} | | | Run Keyword | Additional Statistics Action For ${action} | | END | | ${results} = | Create List | | FOR | ${i} | IN RANGE | ${trial_multiplicity} | | | Call Resetter -| | | ${result}= | Send traffic on tg +| | | ${result} = | Send traffic on tg | | | ... | duration=${trial_duration} | | | ... | rate=${rate} | | | ... | frame_size=${frame_size} @@ -461,46 +447,16 @@ | | | ... | ramp_up_rate=${ramp_up_rate} | | | # Out of several quantities for aborted traffic (duration stretching), | | | # the approximated receive rate is the best estimate we have. -| | | Append To List | ${results} | ${result.approximated_receive_rate} +| | | ${value} = | Set Variable | ${result.approximated_receive_rate} +| | | # TODO: Add correct bandwidth computation. +| | | Append Mrr Value | ${value} | ${export_mrr_unit} +| | | Append To List | ${results} | ${value} | | END -| | FOR | ${action} | IN | @{post_stats} +| | FOR | ${action} | IN | @{stat_post_trial} | | | Run Keyword | Additional Statistics Action For ${action} | | END | | Return From Keyword | ${results} -| Clear and show runtime counters with running iperf3 -| | [Documentation] -| | ... | Start traffic at specified rate then clear runtime counters on all -| | ... | DUTs. Wait for specified amount of time and capture runtime counters -| | ... | on all DUTs. Finally stop traffic. -| | -| | ... | *Example:* -| | -| | ... | \| Clear and show runtime counters with running traffic \| -| | -| | ${runtime_duration} = | Get Runtime Duration -| | ${pids}= | iPerf Client Start Remote Exec -| | | ... | ${nodes['${iperf_client_node}']} -| | | ... | duration=${-1} -| | | ... | rate=${None} -| | | ... | frame_size=${None} -| | | ... | async_call=True -| | | ... | warmup_time=0 -| | | ... | traffic_directions=${1} -| | | ... | namespace=${iperf_client_namespace} -| | | ... | udp=${iperf_client_udp} -| | | ... | host=${iperf_server_bind} -| | | ... | bind=${iperf_client_bind} -| | | ... | affinity=${iperf_client_affinity} -| | FOR | ${action} | IN | @{pre_run_stats} -| | | Run Keyword | Additional Statistics Action For ${action} -| | END -| | Sleep | ${runtime_duration} -| | FOR | ${action} | IN | @{post_run_stats} -| | | Run Keyword | Additional Statistics Action For ${action} -| | END -| | iPerf Client Stop Remote Exec | ${nodes['${iperf_client_node}']} | ${pids} - | Traffic should pass with maximum rate on iPerf3 | | [Documentation] | | ... | Send traffic at maximum rate on iPerf3. @@ -522,6 +478,7 @@ | | ... | ${trial_multiplicity}=${trial_multiplicity} | | ... | ${traffic_directions}=${1} | | +| | Set Test Variable | ${telemetry_rate} | mrr | | ${results}= | Send iPerf3 traffic at specified rate | | ... | ${trial_duration} | ${None} | ${None} | | ... | ${trial_multiplicity} | ${traffic_directions} @@ -539,7 +496,7 @@ | | ... | *Arguments:* | | ... | - trial_duration - Duration of single trial [s]. | | ... | Type: float -| | ... | - rate - Target aggregate transmit rate [bps] / Bits per second +| | ... | - rate - Target aggregated transmit rate [bps] / Bits per second. | | ... | Type: float | | ... | - frame_size - L2 Frame Size [B]. | | ... | Type: integer or string @@ -566,7 +523,7 @@ | | ${smt_used}= | Is SMT enabled | ${nodes['${iperf_server_node}']['cpuinfo']} | | ${vm_status} | ${value}= | Run Keyword And Ignore Error | | ... | Get Library Instance | vnf_manager -| | ${vth}= | Evaluate | (${thr_count_int} + 1) +| | ${vth}= | Evaluate | (${dp_count_int} + 1) | | ${cpu_skip_cnt}= | Set Variable If | '${vm_status}' == 'PASS' | | ... | ${CPU_CNT_SYSTEM} | | ... | ${${CPU_CNT_SYSTEM} + ${CPU_CNT_MAIN} + ${cpu_count_int} + ${vth}} @@ -580,22 +537,26 @@ | | ... | bind_mask=${iperf_server_bind_mask} | | ... | namespace=${iperf_server_namespace} | | ... | cpu_skip_cnt=${cpu_skip_cnt} -| | Run Keyword If | '${iperf_client_namespace}' is not '${None}' +| | Run Keyword If | '${iperf_client_namespace}' != '${None}' | | ... | Set Linux Interface IP | | ... | ${nodes['${iperf_client_node}']} | | ... | interface=${iperf_client_interface} | | ... | ip_addr=${iperf_client_bind} | | ... | prefix=${iperf_client_bind_mask} | | ... | namespace=${iperf_client_namespace} -| | Run Keyword If | '${iperf_client_namespace}' is not '${None}' +| | Run Keyword If | '${iperf_client_namespace}' != '${None}' | | ... | Add Default Route To Namespace | | ... | ${nodes['${iperf_client_node}']} | | ... | namespace=${iperf_client_namespace} | | ... | default_route=${iperf_client_bind_gw} -| | ${pre_stats}= | Create List -| | ... | clear-show-runtime-with-iperf3 -| | ... | vpp-clear-stats | vpp-enable-packettrace | vpp-enable-elog -| | FOR | ${action} | IN | @{pre_stats} +| | ${stat_runtime}= | Create List +| | ... | vpp-runtime-iperf3 +| | ${stat_pre_trial}= | Create List +| | ... | vpp-runtime-iperf3 | vpp-clear-stats | vpp-enable-packettrace +| | FOR | ${action} | IN | @{stat_runtime} +| | | Run Keyword | Additional Statistics Action For ${action} +| | END +| | FOR | ${action} | IN | @{stat_pre_trial} | | | Run Keyword | Additional Statistics Action For ${action} | | END | | ${results} = | Create List @@ -619,7 +580,7 @@ | | | Append To List | | | ... | ${results} | ${conv} | | END -| | FOR | ${action} | IN | @{post_stats} +| | FOR | ${action} | IN | @{stat_post_trial} | | | Run Keyword | Additional Statistics Action For ${action} | | END | | Return From Keyword | ${results} @@ -670,7 +631,6 @@ | | ... | transaction_scale=${transaction_scale} | | ... | transaction_type=${transaction_type} | | ... | use_latency=${use_latency} -| | # TODO: Ramp-up? | Stop Running Traffic | | [Documentation] @@ -712,16 +672,20 @@ | | ${trial_duration} = | Get Mrr Trial Duration | | ${trial_multiplicity} = | Get Mrr Trial Multiplicity | | ${use_latency} = | Get Use Latency +| | ${unit} = | Set Variable If | """_cps""" in """${transaction_type}""" +| | ... | cps | pps | | # The following also sets \${rate_for_teardown} +| | Set Test Variable | ${telemetry_rate} | mrr | | ${results} = | Send traffic at specified rate | | ... | rate=${max_rate} | | ... | trial_duration=${trial_duration} | | ... | trial_multiplicity=${trial_multiplicity} | | ... | use_latency=${use_latency} | | ... | duration_limit=${0.0} -| | ${unit} = | Set Variable If | """_cps""" in """${transaction_type}""" +| | ... | export_mrr_unit=${unit} +| | ${unit_text} = | Set Variable If | """_cps""" in """${transaction_type}""" | | ... | estimated connections per second | packets per second | | Set Test Message | ${\n}Maximum Receive Rate trial results -| | Set Test Message | in ${unit}: ${results} +| | Set Test Message | in ${unit_text}: ${results} | | ... | append=yes | | Fail if no traffic forwarded