From 32a2593e6b7735bcbd0e6e28cd57e93fb7dccb34 Mon Sep 17 00:00:00 2001 From: Martin Klozik Date: Thu, 10 Nov 2016 15:29:45 +0000 Subject: 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 Reviewed-by: Al Morton Reviewed-by: Christian Trautman Reviewed-by: Bill Michalowski Reviewed-by: Antonio Fischetti Reviewed-by: --- tools/pkt_gen/dummy/dummy.py | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) (limited to 'tools') 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)) -- cgit 1.2.3-korg