GSO: Add export of results to json files.
[csit.git] / resources / libraries / robot / performance / performance_utils.robot
index 1eb6710..34b9ab6 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (c) 2022 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:
 | | ... | ${average} | ${stdev}
 | | Set Test Variable | \${rate for teardown} | ${lower}
 | | # Stats at the discovered critical rate.
-| | Set Test Variable | ${telemetry_oload} | plr
+| | Set Test Variable | ${telemetry_rate} | plr
+| | Set Test Variable | ${telemetry_export} | ${True}
 | | Send traffic at specified rate
 | | ... | rate=${lower}
 | | ... | trial_duration=${1.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_oload} | pdr
+| | Set Test Variable | ${telemetry_rate} | pdr
+| | Set Test Variable | ${telemetry_export} | ${True}
 | | 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_oload} | ndr
+| | Set Test Variable | ${telemetry_rate} | ndr
+| | Set Test Variable | ${telemetry_export} | ${True}
 | | Run Keyword If | ${ndr} != ${pdr}
 | | ... | Send traffic at specified rate
 | | ... | rate=${ndr}
 | | ... | ${trial_multiplicity}=${trial_multiplicity}
 | | ... | ${traffic_directions}=${1}
 | |
+| | Set Test Variable | ${telemetry_rate} | mrr
+| | Set Test Variable | ${telemetry_export} | ${True}
 | | ${results}= | Send iPerf3 traffic at specified rate
 | | ... | ${trial_duration} | ${None} | ${None}
 | | ... | ${trial_multiplicity} | ${traffic_directions}
+| | ... | export_mrr_unit=bps
 | | Set Test Message | ${\n}iPerf3 trial results
 | | Set Test Message | in Gbits per second: ${results}
 | | ... | append=yes
 | | ... | Type: integer
 | | ... | - extended_debug - True to enable extended debug.
 | | ... | Type: boolean
+| | ... | - export_mrr_unit - Use this unit when exporting MRR values,
+| | ... | or empty string for no export.
+| | ... | Type: string
 | |
 | | ... | *Example:*
 | |
 | | [Arguments] | ${trial_duration} | ${rate} | ${frame_size}
 | | ... | ${trial_multiplicity}=${trial_multiplicity}
 | | ... | ${traffic_directions}=${1} | ${extended_debug}=${extended_debug}
+| | ... | ${export_mrr_unit}=${Empty}
 | |
 | | Set Test Variable | ${extended_debug}
 | | Set Test Variable | ${rate}
 | | | ... | bind=${iperf_client_bind}
 | | | ... | affinity=${iperf_client_affinity}
 | | | ${conv} = | Convert To Number | ${rr['sum_received']['bits_per_second']}
+| | | Append Mrr Value | ${conv} | ${export_mrr_unit}
 | | | ${conv} = | Evaluate | ${conv} / ${1000} / ${1000} / ${1000}
 | | | ${conv} = | Evaluate | "{:.3f}".format(${conv})
 | | | Append To List
 | |
 | | ... | \| Traffic should pass with maximum rate \|
 | |
+| | Set Test Variable | ${telemetry_rate} | mrr
+| | Set Test Variable | ${telemetry_export} | ${True}
 | | ${max_rate} = | Get Max Rate
 | | ${transaction_type} = | Get Transaction Type
 | | ${trial_duration} = | Get Mrr Trial Duration
 | | ${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_oload} | mrr
 | | ${results} = | Send traffic at specified rate
 | | ... | rate=${max_rate}
 | | ... | trial_duration=${trial_duration}