aboutsummaryrefslogtreecommitdiffstats
path: root/tools/pkt_gen/dummy
diff options
context:
space:
mode:
authorMartin Klozik <martinx.klozik@intel.com>2016-11-10 15:29:45 +0000
committerMartin Klozik <martinx.klozik@intel.com>2016-11-30 15:46:40 +0000
commit32a2593e6b7735bcbd0e6e28cd57e93fb7dccb34 (patch)
tree125212e88155d55e83b56233901d7607ff0cb09f /tools/pkt_gen/dummy
parentefdc282f4b08e96f3e09d43f94ba0508e4f26090 (diff)
yardstick: CLI params support for yardstick TCs
Vswitchperf specific class in yardstick was updated to reflect new functionality of --test-params. These changes have impact on vsperf documentation and yardstick samples. As part of this fix following changes were made: * trafficgen mode can be executed with default configuration * yardstick specific TC samples were updated * dummy traffic generator was enhanced to support back2back * dummy traffic generator was enhanced to accept traffic results from configuration JIRA: VSPERF-422 JIRA: VSPERF-205 Change-Id: Ibeaa6ef46bde453e3ca5dee6e4568fc8c3853521 Signed-off-by: Martin Klozik <martinx.klozik@intel.com> Reviewed-by: Al Morton <acmorton@att.com> Reviewed-by: Christian Trautman <ctrautma@redhat.com> Reviewed-by: Bill Michalowski <bmichalo@redhat.com> Reviewed-by: Antonio Fischetti <antonio.fischetti@intel.com> Reviewed-by: <sridhar.rao@spirent.com>
Diffstat (limited to 'tools/pkt_gen/dummy')
-rwxr-xr-xtools/pkt_gen/dummy/dummy.py35
1 files changed, 34 insertions, 1 deletions
diff --git a/tools/pkt_gen/dummy/dummy.py b/tools/pkt_gen/dummy/dummy.py
index 3324824c..528b5902 100755
--- a/tools/pkt_gen/dummy/dummy.py
+++ b/tools/pkt_gen/dummy/dummy.py
@@ -25,6 +25,7 @@ own.
import json
+from conf import settings
from tools.pkt_gen import trafficgen
from core.results.results_constants import ResultsConstants
@@ -76,7 +77,10 @@ def get_user_traffic(traffic_type, traffic_conf, flow_conf, traffic_stats):
% (traffic_type, traffic_conf, json.dumps(flow_conf, indent=4)))
for stat in traffic_stats:
- results.append(_get_user_traffic_stat(stat))
+ if stat in settings.getValue('TRAFFICGEN_DUMMY_RESULTS'):
+ results.append(settings.getValue('TRAFFICGEN_DUMMY_RESULTS')[stat])
+ else:
+ results.append(_get_user_traffic_stat(stat))
return results
@@ -206,6 +210,33 @@ class Dummy(trafficgen.ITrafficGenerator):
result[ResultsConstants.FRAME_LOSS_PERCENT] = float(results[7])
return result
+ def send_rfc2544_back2back(self, traffic=None, tests=1, duration=2,
+ lossrate=0.0):
+ """
+ Send traffic per RFC2544 back2back test specifications.
+ """
+ traffic_ = self.traffic_defaults.copy()
+ result = {}
+
+ if traffic:
+ traffic_ = trafficgen.merge_spec(traffic_, traffic)
+
+ results = get_user_traffic(
+ 'back2back',
+ '%d tests, %d seconds iterations, %f packet loss, multistream '
+ '%s' % (tests, duration, lossrate, traffic['multistream']),
+ traffic_,
+ ('b2b frames', 'b2b frame loss %'))
+
+ framesize = traffic_['l2']['framesize']
+
+ # builds results by using user-supplied values
+ # and guessing remainder using available info
+ result[ResultsConstants.B2B_FRAMES] = float(results[0])
+ result[ResultsConstants.B2B_FRAME_LOSS_PERCENT] = float(results[1])
+ return result
+
+
if __name__ == '__main__':
TRAFFIC = {
@@ -219,4 +250,6 @@ if __name__ == '__main__':
with Dummy() as dev:
print(dev.send_burst_traffic(traffic=TRAFFIC))
print(dev.send_cont_traffic(traffic=TRAFFIC))
+ print(dev.send_rfc2544_throughput(traffic=TRAFFIC))
+ print(dev.send_rfc2544_back2back(traffic=TRAFFIC))
print(dev.send_rfc(traffic=TRAFFIC))