diff options
-rw-r--r-- | samples/pktgen.yaml | 1 | ||||
-rw-r--r-- | yardstick/benchmark/scenarios/networking/pktgen.py | 28 | ||||
-rw-r--r-- | yardstick/benchmark/scenarios/networking/pktgen_benchmark.bash | 8 |
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() |