ip6lisp: Do not fail on string overhead value
[csit.git] / resources / libraries / robot / performance / performance_vars.robot
index 130237e..4f2cc50 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (c) 2020 Cisco and/or its affiliates.
+# Copyright (c) 2021 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:
 | | Return From Keyword If | ${max_rate} | ${max_rate}
 | | Fail | \${max_rate} is not defined. Call Set Max Rate And Jumbo keyword.
 
-| Get Min Rate
+| Get Min Rate Hard
 | | [Documentation]
-| | ... | Return a hardcoded value. This is an abstraction, useful in case
-| | ... | we start allowing various other overrides or computations.
-| | ... | Call this just before calling a Python keyword,
-| | ... | as those have restricted access to Robot variables.
-| |
-| | ... | The return value controls the minimal unidirectional packet rate.
-| | ... | The value is also usable for minimal TPS value for ASTF tests.
+| | ... | Return a hardcoded value.
+| | ... | The return value controls the minimal unidirectional packet rate,
+| | ... | to be used anywhere, including latency measurements at 0% load.
 | | ... | The current value is the smallest one permitted
 | | ... | by STL profiles with latency streams.
 | | ... | Return type: float.
 | |
 | | ... | *Example:*
 | |
-| | ... | \| \${min_rate} = \| Get Min Rate \|
+| | ... | \| \${min_rate_hard} = \| Get Min Rate Hard \|
 | |
 | | Return From Keyword | ${9001.0}
 
+| Get Min Rate Soft
+| | [Documentation]
+| | ... | If ramp up rate is not defined, return the hard min value.
+| | ... | If ramp up rate is defined (and larger than hard min), return that.
+| | ... | The reason is, ramp up rate should already guarantee no loss.
+| |
+| | ... | The return value controls the minimal unidirectional packet rate,
+| | ... | to be used in various search algorithms.
+| | ... | Latency measurements may want even lower loads, use hard min for that.
+| |
+| | ... | The value is also usable for minimal TPS value for ASTF tests.
+| | ... | Return type: float.
+| |
+| | ... | Currently, undefined ramp up rate is reported as zero,
+| | ... | so we return the maximum of ramp up rate and the hard min rate.
+| |
+| | ... | *Example:*
+| |
+| | ... | \| \${min_rate_soft} = \| Get Min Rate Soft \|
+| |
+| | ${min_rate_hard} = | Get Min Rate Hard
+| | ${ramp_up_rate} = | Get Ramp Up Rate
+| | ${min_rate_soft} = | Evaluate | max(${ramp_up_rate}, ${min_rate_hard})
+| | Return From Keyword | ${min_rate_soft}
+
 | Get Mrr Trial Duration
 | | [Documentation]
 | | ... | Return value from Constants. This is an abstraction, useful in case
 | |
 | | ... | The return value determines the required duration of ramp-up phase.
 | | ... | Typically used to prepare a specific state on DUT.
-| | ... | If the value is zero, ramp-up phase is skipped.
+| | ... | If the value is zero, ramp-up phase is either skipped or size-limited.
 | | ... | Return type: float.
 | |
 | | ... | *Example:*
 | Get Ramp Up Rate
 | | [Documentation]
 | | ... | Return value of \${ramp_up_rate},
-| | ... | if not defined return \${max_rate}.
+| | ... | if not defined, return zero.
 | |
 | | ... | The return value determines the rate for ramp-up phase.
 | | ... | Typically used to limit the rate when max rate
 | | ... | would lose packets in the ramp up phase, thus not setting
 | | ... | the DUT state correctly.
+| | ... | If the value is zero, ramp-up phase should be skipped.
 | | ... | Return type: float.
 | |
 | | ... | *Example:*
 | | ... | \| \${ramp_up_rate} = \| Get Ramp Up Rate \|
 | |
 | | ${ramp_up_rate} = | Get Variable Value | \${ramp_up_rate} | ${0.0}
-| | Return From Keyword If | ${ramp_up_rate} | ${ramp_up_rate}
-| | Run Keyword And Return | Get Max Rate
+| | Return From Keyword | ${ramp_up_rate}
 
 | Get Rate For Teardown
 | | [Documentation]
 | | ... | Return value of \${rate_for_teardown},
-| | ... | if not defined (or zero) return the min rate.
+| | ... | if not defined (or zero) return the soft min rate.
 | |
 | | ... | The return value determines the rate for teardown trial,
 | | ... | that is executed if a perf test fails.
 | |
 | | ${rate_for_teardown} = | Get Variable Value | \${rate_for_teardown} | ${0.0}
 | | Return From Keyword If | ${rate_for_teardown} | ${rate_for_teardown}
-| | Run Keyword And Return | Get Min Rate
+| | Run Keyword And Return | Get Min Rate Soft
 
 | Get Resetter
 | | [Documentation]
 | | ${bps_limit} = | Get From Dictionary
 | | ... | ${NIC_NAME_TO_BPS_LIMIT} | ${nic_name}
 | | Set Numeric Frame Sizes
+| | # We need to add 20B (Ethernet preamble and inter-frame gap)
+| | # to avg_frame_size
 | | ${rate} = | Evaluate | ${bps_limit} / ((${avg_frame_size} + 20.0) * 8)
 | | ${max_rate} = | Set Variable If | ${rate} > ${pps_limit}
 | | ... | ${pps_limit} | ${rate}
 | | ... | Set Variable | ${353.83333}
 | | ... | ELSE
 | | ... | Convert To Number | ${frame_size}
-| | ${avg_frame_size} = | Evaluate | $bare_avg_frame_size + $max_overhead
+| | # Do not use $max_overhead (without braces), that does not tolerate string.
+| | ${avg_frame_size} = | Evaluate | ${bare_avg_frame_size} + ${max_overhead}
 | | Set Test Variable | \${avg_frame_size}
 | | ${bare_max_frame_size} = | Run Keyword If | '${frame_size}' == 'IMIX_v4_1'
 | | ... | Set Variable | ${1518}