aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries
diff options
context:
space:
mode:
Diffstat (limited to 'resources/libraries')
-rw-r--r--resources/libraries/robot/performance/performance_utils.robot74
-rw-r--r--resources/libraries/robot/robot_enhancements.robot55
2 files changed, 87 insertions, 42 deletions
diff --git a/resources/libraries/robot/performance/performance_utils.robot b/resources/libraries/robot/performance/performance_utils.robot
index f48003ff14..2cb8d07cb4 100644
--- a/resources/libraries/robot/performance/performance_utils.robot
+++ b/resources/libraries/robot/performance/performance_utils.robot
@@ -585,30 +585,6 @@
| | ... | ${\n}LOSS_ACCEPTANCE: ${loss_acceptance} ${loss_acceptance_type}
| | ... | append=yes
-| Display raw results
-| | [Documentation]
-| | ... | Display raw results from TG in total received/send packets over trial
-| | ... | duration in seconds.
-| | ...
-| | ... | *Arguments:*
-| | ... | - framesize - L2 Frame Size [B]. Type: integer
-| | ... | - results - Measured results. Type: string
-| | ...
-| | ... | *Example:*
-| | ...
-| | ... | \| Display raw results \| 64 \| results \|
-| | ...
-| | [Arguments] | ${framesize} | ${results}
-| | ...
-| | ${framesize}= | Get Frame Size | ${framesize}
-| | @{tokens}= | Split String | ${results} | ,
-| | @{received}= | Split String | @{tokens}[1] | =
-| | @{sent}= | Split String | @{tokens}[2] | =
-| | ${total_received} = | Set Variable | @{received}[1]
-| | ${total_sent} = | Set Variable | @{sent}[1]
-| | Set Test Message | MaxReceivedRate_Results [pkts/${perf_trial_duration}sec]:
-| | Set Test Message | tx ${total_sent}, rx ${total_received} | append=yes
-
| Measure latency pps
| | [Documentation]
| | ... | Send traffic at specified rate. Measure min/avg/max latency
@@ -687,51 +663,65 @@
| | ... | Send traffic at maximum rate.
| | ...
| | ... | *Arguments:*
-| | ... | - duration - Duration of traffic run [s]. Type: integer
| | ... | - rate - Rate for sending packets. Type: string
| | ... | - framesize - L2 Frame Size [B] or IMIX_v4_1. Type: integer/string
| | ... | - topology_type - Topology type. Type: string
-| | ... | Type: boolean
+| | ... | - subsamples - How many trials in this measurement. Type:int
+| | ... | - trial_duration - Duration of single trial [s]. Type: float
+| | ... | - fail_no_traffic - Whether to fail on zero receive count. Type: boolean
| | ...
| | ... | *Example:*
| | ...
-| | ... | \| Traffic should pass with maximum rate \| 10 \| 4.0mpps \| 64 \
-| | ... | \| 3-node-IPv4 \|
+| | ... | \| Traffic should pass with maximum rate \| 4.0mpps \| 64 \
+| | ... | \| 3-node-IPv4 \| ${1} \| ${10.0} | ${False}
| | ...
-| | [Arguments] | ${duration} | ${rate} | ${framesize} | ${topology_type}
-| | ... | ${fail_no_traffic}=${True}
+| | [Arguments] | ${rate} | ${framesize} | ${topology_type}
+| | ... | ${trial_duration}=${perf_trial_duration} | ${fail_no_traffic}=${True}
+| | ... | ${subsamples}=${perf_trial_multiplicity}
| | ...
-| | ${results}= | Send traffic at specified rate | ${duration} | ${rate}
-| | ... | ${framesize} | ${topology_type}
-| | Display raw results | ${framesize} | ${results}
+| | ${results} = | Send traffic at specified rate | ${trial_duration} | ${rate}
+| | ... | ${framesize} | ${topology_type} | ${subsamples}
+| | Set Test Message | ${\n}Maximum Receive Rate trial results
+| | Set Test Message | in packets per second: ${results}
+| | ... | append=yes
+| | # TODO: Should we also report the percentage relative to transmit rate,
+| | # so that people looking at console can decide how close to 100% it is?
| | Run Keyword If | ${fail_no_traffic} | Fail if no traffic forwarded
| Send traffic at specified rate
| | [Documentation]
| | ... | Send traffic at specified rate.
+| | ... | Return list of measured receive rates.
| | ...
| | ... | *Arguments:*
-| | ... | - duration - Duration of traffic run [s]. Type: integer
+| | ... | - trial_duration - Duration of single trial [s]. Type: float
| | ... | - rate - Rate for sending packets. Type: string
| | ... | - framesize - L2 Frame Size [B]. Type: integer/string
| | ... | - topology_type - Topology type. Type: string
-| | ... | Type: boolean
+| | ... | - subsamples - How many trials in this measurement. Type: int
| | ...
| | ... | *Example:*
| | ...
-| | ... | \| Send traffic at specific rate \| 10 \| 4.0mpps \| 64 \
-| | ... | \| 3-node-IPv4 \|
+| | ... | \| Send traffic at specified rate \| ${1.0} \| 4.0mpps \| 64 \
+| | ... | \| 3-node-IPv4 \| ${10}
| | ...
-| | [Arguments] | ${duration} | ${rate} | ${framesize} | ${topology_type}
+| | [Arguments] | ${trial_duration} | ${rate} | ${framesize}
+| | ... | ${topology_type} | ${subsamples}=${1}
| | ...
-| | Clear and show runtime counters with running traffic | ${duration}
+| | Clear and show runtime counters with running traffic | ${trial_duration}
| | ... | ${rate} | ${framesize} | ${topology_type}
| | Run Keyword If | ${dut_stats}==${True} | Clear all counters on all DUTs
| | Run Keyword If | ${dut_stats}==${True} and ${pkt_trace}==${True}
| | ... | VPP Enable Traces On All DUTs | ${nodes}
-| | ${results} = | Send traffic on tg | ${duration} | ${rate} | ${framesize}
-| | ... | ${topology_type} | warmup_time=0
-| | Run Keyword If | ${dut_stats}==${True} | Show statistics on all DUTs | ${nodes}
+| | ${results} = | Create List
+| | :FOR | ${i} | IN RANGE | ${subsamples}
+| | | Send traffic on tg | ${trial_duration} | ${rate} | ${framesize}
+| | | ... | ${topology_type} | warmup_time=0
+| | | ${rx} = | Get Received
+| | | ${rr} = | Evaluate | ${rx} / ${trial_duration}
+| | | Append To List | ${results} | ${rr}
+| | Run Keyword If | ${dut_stats}==${True} | Show statistics on all DUTs
+| | ... | ${nodes}
| | Run Keyword If | ${dut_stats}==${True} and ${pkt_trace}==${True}
| | ... | Show Packet Trace On All Duts | ${nodes} | maximum=${100}
| | Return From Keyword | ${results}
diff --git a/resources/libraries/robot/robot_enhancements.robot b/resources/libraries/robot/robot_enhancements.robot
new file mode 100644
index 0000000000..7b337eafeb
--- /dev/null
+++ b/resources/libraries/robot/robot_enhancements.robot
@@ -0,0 +1,55 @@
+# Copyright (c) 2018 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:
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+*** Settings ***
+| Documentation
+| ... | Place to store general keywords, similar to ones in BuiltIn library.
+| Library | OperatingSystem
+| Library | String
+
+*** Keywords ***
+| Ensure Global Variable
+| | [Documentation] | Give default value (from environment or code) to variable.
+| | ...
+| | ... | Ideally we would just use Variables table to set global variables.
+| | ... | Unfortunately, __init__ files are special (among other things)
+| | ... | by the fact that variables set in the table are not available
+| | ... | for (sub)directory suites.
+| | ... | Therefore we are using BuiltIn.Set_Global_Variable explicitly.
+| | ... | While we are running code here, we allow environment variables
+| | ... | to override the default values.
+| | ... | If environment variable name is not specified (or empty),
+| | ... | the upper case of the variable name is used, prefixed by "CSIT_".
+| | ... | The --variable parameter to pybot takes precedence to environment.
+| | ...
+| | ... | *Arguments:*
+| | ... | - variable_name - Name of global variable to set. Type: string
+| | ... | - default_value - Value to set if not set otherwise. Type: string
+| | ... | - env_var_name - Name of environment variable to read. Type: string
+| | ... | - application - Prefix for default environment variable. Type: string
+| | ...
+| | ... | *Example:*
+| | ... | \| Ensure Global Variable \| perf_trial_duration \| 10.0 \| TRIAL_DUR
+| | ...
+| | [Arguments] | ${variable_name} | ${default_value} | ${env_var_name}=${EMPTY}
+| | ... | ${application}=CSIT
+| | ...
+| | ${env_var_length} = | Get Length | ${env_var_name}
+| | ${default_env_var} = | Convert To Uppercase | ${variable_name}
+| | ${env_var} = | Set Variable If | ${env_var_length}
+| | ... | ${env_var_name} | ${application}_${default_env_var}
+| | ${updated_default} = | Get Environment Variable
+| | ... | ${env_var} | ${default_value}
+| | ${final_value} = | Get Variable Value
+| | ... | \${${variable_name}} | ${updated_default}
+| | Set Global Variable | \${${variable_name}} | ${final_value}