summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKristian Hunt <kristian.hunt@gmail.com>2015-06-26 10:53:33 +0200
committerKristian Hunt <kristian.hunt@gmail.com>2015-06-29 13:08:07 +0200
commita56e63d45362104919c9de89fb8b6da0c89e4a3b (patch)
treee1ed9b0920254443dc1eff8072cc6f4f6ca6556f
parentd7fd300e9a9bd480ad9f1500494021c42ec6ecee (diff)
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 <kristian.hunt@gmail.com>
-rw-r--r--samples/pktgen.yaml1
-rw-r--r--yardstick/benchmark/scenarios/networking/pktgen.py28
-rw-r--r--yardstick/benchmark/scenarios/networking/pktgen_benchmark.bash8
3 files changed, 29 insertions, 8 deletions
diff --git a/samples/pktgen.yaml b/samples/pktgen.yaml
index 000a7cd92..fa0134299 100644
--- a/samples/pktgen.yaml
+++ b/samples/pktgen.yaml
@@ -10,6 +10,7 @@ scenarios:
options:
packetsize: 60
number_of_ports: 10
+ duration: 20
host: client.demo
target: server.demo
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()