From 08bbc38c19ec8cd65ba7ac7548ef5686b025f9ca Mon Sep 17 00:00:00 2001 From: Vratko Polak Date: Mon, 11 Feb 2019 17:37:05 +0100 Subject: Fix argument order in unidirection related KWs The original unidirection Chhange [0] has changed the order, breaking some call sites. Also, use different indentation to save some vertical space. [0] https://gerrit.fd.io/r/#/c/16696/3/resources/libraries/python/TrafficGenerator.py@551 Change-Id: Ife9bd994da73f0afcd24fc16794f822a831c4353 Signed-off-by: Vratko Polak (cherry picked from commit ca7b37a18d420b6033adbdf64d0115b554b85726) --- resources/libraries/python/TrafficGenerator.py | 37 +++++++++++----------- .../robot/performance/performance_utils.robot | 37 ++++++++++++---------- 2 files changed, 38 insertions(+), 36 deletions(-) diff --git a/resources/libraries/python/TrafficGenerator.py b/resources/libraries/python/TrafficGenerator.py index 60915117fc..6123b8753a 100644 --- a/resources/libraries/python/TrafficGenerator.py +++ b/resources/libraries/python/TrafficGenerator.py @@ -458,10 +458,9 @@ class TrafficGenerator(AbstractMeasurer): self._latency.append(self._result.split(', ')[4].split('=')[1]) self._latency.append(self._result.split(', ')[5].split('=')[1]) - def trex_stl_start_unidirection(self, duration, rate, framesize, - traffic_type, tx_port=0, rx_port=1, - async_call=False, latency=False, - warmup_time=5.0): + def trex_stl_start_unidirection( + self, duration, rate, framesize, traffic_type, async_call=False, + latency=False, warmup_time=5.0, tx_port=0, rx_port=1): """Execute script on remote node over ssh to start unidirection traffic. The purpose of this function is to support performance test that need to measure unidirectional traffic, e.g. Load balancer maglev mode and l3dsr @@ -472,21 +471,20 @@ class TrafficGenerator(AbstractMeasurer): :param framesize: L2 frame size to send (without padding and IPG). :param traffic_type: Module name as a traffic type identifier. See resources/traffic_profiles/trex for implemented modules. - :param tx_port: Traffic generator transmit port. - :param rx_port: Traffic generator receive port. :param latency: With latency measurement. :param async_call: If enabled then don't wait for all incomming trafic. :param warmup_time: Warmup time period. + :param tx_port: Traffic generator transmit port. + :param rx_port: Traffic generator receive port. :type duration: float :type rate: str :type framesize: str :type traffic_type: str - :type tx_port: integer - :type rx_port: integer :type latency: bool :type async_call: bool :type warmup_time: float - :returns: Nothing + :type tx_port: integer + :type rx_port: integer :raises RuntimeError: In case of TG driver issue. """ ssh = SSH() @@ -548,9 +546,10 @@ class TrafficGenerator(AbstractMeasurer): if self._node['subtype'] == NodeSubTypeTG.TREX: self.trex_stl_stop_remote_exec(self._node) - def send_traffic_on_tg(self, duration, rate, framesize, traffic_type, - unidirection=False, tx_port=0, rx_port=1, - warmup_time=5, async_call=False, latency=True): + def send_traffic_on_tg( + self, duration, rate, framesize, traffic_type, warmup_time=5, + async_call=False, latency=True, unidirection=False, tx_port=0, + rx_port=1): """Send traffic from all configured interfaces on TG. :param duration: Duration of test traffic generation in seconds. @@ -558,22 +557,22 @@ class TrafficGenerator(AbstractMeasurer): :param framesize: Frame size (L2) in Bytes. :param traffic_type: Module name as a traffic type identifier. See resources/traffic_profiles/trex for implemented modules. - :param unidirection: Traffic is unidirectional. - :param tx_port: Traffic generator transmit port. - :param rx_port: Traffic generator receive port. :param warmup_time: Warmup phase in seconds. :param async_call: Async mode. :param latency: With latency measurement. + :param unidirection: Traffic is unidirectional. + :param tx_port: Traffic generator transmit port. + :param rx_port: Traffic generator receive port. :type duration: str :type rate: str :type framesize: str :type traffic_type: str - :type unidirection: bool - :type tx_port: integer - :type rx_port: integer :type warmup_time: float :type async_call: bool :type latency: bool + :type unidirection: bool + :type tx_port: integer + :type rx_port: integer :returns: TG output. :rtype: str :raises RuntimeError: If TG is not set, or if node is not TG, @@ -687,7 +686,7 @@ class TrafficGenerator(AbstractMeasurer): unit_rate = str(transmit_rate / 2.0) + "pps" self.send_traffic_on_tg( duration, unit_rate, self.frame_size, self.traffic_type, - self.warmup_time, latency=True) + warmup_time=self.warmup_time, latency=True) transmit_count = int(self.get_sent()) loss_count = int(self.get_loss()) measurement = ReceiveRateMeasurement( diff --git a/resources/libraries/robot/performance/performance_utils.robot b/resources/libraries/robot/performance/performance_utils.robot index b98d103beb..409a500634 100644 --- a/resources/libraries/robot/performance/performance_utils.robot +++ b/resources/libraries/robot/performance/performance_utils.robot @@ -425,6 +425,7 @@ | | [Arguments] | ${duration} | ${rate} | ${framesize} | ${topology_type} | | ... | | Return From Keyword If | ${rate} <= 10000 | ${-1} +| | # TODO: Remove this keyword, or suport unidirectional traffic. | | Send traffic on tg | ${duration} | ${rate}pps | ${framesize} | | ... | ${topology_type} | warmup_time=0 | | Run keyword and return | Get latency @@ -462,27 +463,27 @@ | | ... | - 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 -| | ... | - unidirection - False if traffic is bidirectional. Type: boolean -| | ... | - tx_port - TX port of TG, default 0. Type: integer -| | ... | - rx_port - RX port of TG, default 1. Type: integer | | ... | - 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 +| | ... | - unidirection - False if traffic is bidirectional. Type: boolean +| | ... | - tx_port - TX port of TG, default 0. Type: integer +| | ... | - rx_port - RX port of TG, default 1. Type: integer | | ... | | ... | *Example:* | | ... | | ... | \| Traffic should pass with maximum rate \| 4.0mpps \| 64 \ -| | ... | \| 3-node-IPv4 \| ${False} \| ${0} | ${1} \| -| | ... | \| ${1} \| ${10.0} \| ${False} \| +| | ... | \| 3-node-IPv4 \| ${1} \| ${10.0} \| ${False} +| | ... | \| ${False} \| ${0} | ${1} \| | | ... | | [Arguments] | ${rate} | ${framesize} | ${topology_type} -| | ... | ${unidirection}=${False} | ${tx_port}=${0} | ${rx_port}=${1} | | ... | ${trial_duration}=${perf_trial_duration} | ${fail_no_traffic}=${True} | | ... | ${subsamples}=${perf_trial_multiplicity} +| | ... | ${unidirection}=${False} | ${tx_port}=${0} | ${rx_port}=${1} | | ... | | ${results} = | Send traffic at specified rate | ${trial_duration} | ${rate} -| | ... | ${framesize} | ${topology_type} | ${unidirection} -| | ... | ${tx_port} | ${rx_port} | ${subsamples} +| | ... | ${framesize} | ${topology_type} | ${subsamples} | ${unidirection} +| | ... | ${tx_port} | ${rx_port} | | Set Test Message | ${\n}Maximum Receive Rate trial results | | Set Test Message | in packets per second: ${results} | | ... | append=yes @@ -500,19 +501,19 @@ | | ... | - rate - Rate for sending packets. Type: string | | ... | - framesize - L2 Frame Size [B]. Type: integer/string | | ... | - topology_type - Topology type. Type: string +| | ... | - subsamples - How many trials in this measurement. Type: int | | ... | - unidirection - False if traffic is bidirectional. Type: boolean | | ... | - tx_port - TX port of TG, default 0. Type: integer | | ... | - rx_port - RX port of TG, default 1. Type: integer -| | ... | - subsamples - How many trials in this measurement. Type: int | | ... | | ... | *Example:* | | ... | | ... | \| Send traffic at specified rate \| ${1.0} \| 4.0mpps \| 64 \ -| | ... | \| 3-node-IPv4 \| ${False} \| ${0} | ${1} \| ${10} \| +| | ... | \| 3-node-IPv4 \| ${10} \| ${False} \| ${0} | ${1} \| | | ... | | [Arguments] | ${trial_duration} | ${rate} | ${framesize} -| | ... | ${topology_type} | ${unidirection}=${False} | ${tx_port}=${0} -| | ... | ${rx_port}=${1} | ${subsamples}=${1} +| | ... | ${topology_type} | ${subsamples}=${1} | ${unidirection}=${False} +| | ... | ${tx_port}=${0} | ${rx_port}=${1} | | ... | | Clear and show runtime counters with running traffic | ${trial_duration} | | ... | ${rate} | ${framesize} | ${topology_type} @@ -524,9 +525,11 @@ | | ... | VPP enable elog traces on all DUTs | ${nodes} | | ${results} = | Create List | | :FOR | ${i} | IN RANGE | ${subsamples} +| | | # The following line is skipping some default arguments, +| | | # that is why subsequent arguments have to be named. | | | Send traffic on tg | ${trial_duration} | ${rate} | ${framesize} -| | | ... | ${topology_type} | ${unidirection} | ${tx_port} -| | | ... | ${rx_port} | warmup_time=0 +| | | ... | ${topology_type} | warmup_time=${0} | unidirection=${unidirection} +| | | ... | tx_port=${tx_port} | rx_port=${rx_port} | | | ${rx} = | Get Received | | | ${rr} = | Evaluate | ${rx} / ${trial_duration} | | | Append To List | ${results} | ${rr} @@ -561,9 +564,9 @@ | | [Arguments] | ${duration} | ${rate} | ${framesize} | ${topology_type} | | ... | ${unidirection}=${False} | ${tx_port}=${0} | ${rx_port}=${1} | | ... -| | Send traffic on tg | -1 | ${rate} | ${framesize} | ${topology_type} -| | ... | ${unidirection} | ${tx_port} | ${rx_port} -| | ... | warmup_time=0 | async_call=${True} | latency=${False} +| | Send traffic on tg | ${-1} | ${rate} | ${framesize} | ${topology_type} +| | ... | warmup_time=${0} | async_call=${True} | latency=${False} +| | ... | unidirection=${unidirection} | tx_port=${tx_port} | rx_port=${rx_port} | | Run Keyword If | ${dut_stats}==${True} | | ... | Clear runtime counters on all DUTs | ${nodes} | | Sleep | ${duration} -- cgit 1.2.3-korg