From a56e63d45362104919c9de89fb8b6da0c89e4a3b Mon Sep 17 00:00:00 2001 From: Kristian Hunt Date: Fri, 26 Jun 2015 10:53:33 +0200 Subject: Add Pktgen test step duration JIRA: YARDSTICK-48 Step duration for Pktgen can be configured for each step. Change-Id: Ida6e2f7d8a1c7d86fb2e65389b5b56d5958d3ad9 Signed-off-by: Kristian Hunt --- yardstick/benchmark/scenarios/networking/pktgen.py | 28 +++++++++++++++++++--- .../scenarios/networking/pktgen_benchmark.bash | 8 +++---- 2 files changed, 28 insertions(+), 8 deletions(-) (limited to 'yardstick/benchmark/scenarios') diff --git a/yardstick/benchmark/scenarios/networking/pktgen.py b/yardstick/benchmark/scenarios/networking/pktgen.py index 430c95905..e6d6893c9 100644 --- a/yardstick/benchmark/scenarios/networking/pktgen.py +++ b/yardstick/benchmark/scenarios/networking/pktgen.py @@ -21,7 +21,18 @@ class Pktgen(base.Scenario): """Execute pktgen between two hosts Parameters - TBD + packetsize - packet size in bytes without the CRC + type: int + unit: bytes + default: 60 + number_of_ports - number of UDP ports to test + type: int + unit: na + default: 10 + duration - duration of the test + type: int + unit: seconds + default: 20 """ __scenario_type__ = "Pktgen" @@ -87,11 +98,22 @@ class Pktgen(base.Scenario): options = args['options'] packetsize = options.get("packetsize", 60) self.number_of_ports = options.get("number_of_ports", 10) + # if run by a duration runner + duration_time = self.context.get("duration", None) + # if run by an arithmetic runner + arithmetic_time = options.get("duration", None) + + if duration_time: + duration = duration_time + elif arithmetic_time: + duration = arithmetic_time + else: + duration = 20 self._iptables_setup() - cmd = "sudo bash pktgen.sh %s %s %s" \ - % (ipaddr, self.number_of_ports, packetsize) + cmd = "sudo bash pktgen.sh %s %s %s %s" \ + % (ipaddr, self.number_of_ports, packetsize, duration) LOG.debug("Executing command: %s", cmd) status, stdout, stderr = self.client.execute(cmd) diff --git a/yardstick/benchmark/scenarios/networking/pktgen_benchmark.bash b/yardstick/benchmark/scenarios/networking/pktgen_benchmark.bash index f5df50f0f..4224c5abf 100644 --- a/yardstick/benchmark/scenarios/networking/pktgen_benchmark.bash +++ b/yardstick/benchmark/scenarios/networking/pktgen_benchmark.bash @@ -13,17 +13,15 @@ set -e # Commandline arguments DST_IP=$1 # destination IP address -shift -NUM_PORTS=$1 # number of source ports -shift -PKT_SIZE=$1 # packet size +NUM_PORTS=$2 # number of source ports +PKT_SIZE=$3 # packet size +DURATION=$4 # test duration (seconds) # Configuration UDP_SRC_MIN=1000 # UDP source port min UDP_SRC_MAX=$(( UDP_SRC_MIN + NUM_PORTS - 1 )) # UDP source port max UDP_DST_MIN=1000 # UDP destination port min UDP_DST_MAX=$(( UDP_DST_MIN + NUM_PORTS )) # UDP destination port max -DURATION=20 # test duration (seconds) # helper function to send commands to pktgen pgset() -- cgit 1.2.3-korg