Add Pktgen test step duration 12/912/1
authorKristian Hunt <kristian.hunt@gmail.com>
Fri, 26 Jun 2015 08:53:33 +0000 (10:53 +0200)
committerKristian Hunt <kristian.hunt@gmail.com>
Mon, 29 Jun 2015 11:08:07 +0000 (13:08 +0200)
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>
samples/pktgen.yaml
yardstick/benchmark/scenarios/networking/pktgen.py
yardstick/benchmark/scenarios/networking/pktgen_benchmark.bash

index 000a7cd..fa01342 100644 (file)
@@ -10,6 +10,7 @@ scenarios:
   options:
     packetsize: 60
     number_of_ports: 10
+    duration: 20
 
   host: client.demo
   target: server.demo
index 430c959..e6d6893 100644 (file)
@@ -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)
 
index f5df50f..4224c5a 100644 (file)
@@ -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()