aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rwxr-xr-xtools/pkt_gen/dummy/dummy.py35
-rw-r--r--tools/pkt_gen/moongen/moongen.py4
2 files changed, 36 insertions, 3 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))
diff --git a/tools/pkt_gen/moongen/moongen.py b/tools/pkt_gen/moongen/moongen.py
index fe3aca52..7fd67661 100644
--- a/tools/pkt_gen/moongen/moongen.py
+++ b/tools/pkt_gen/moongen/moongen.py
@@ -222,7 +222,7 @@ class Moongen(ITrafficGenerator):
"@" + self._moongen_host_ip_addr
cmd_find_moongen = connect_moongen + " ls " + \
- self._moongen_base_dir + "/examples/opnfv-vsperf.lua"
+ self._moongen_base_dir + "/trafficgen.lua"
find_moongen = subprocess.Popen(cmd_find_moongen,
shell=True,
@@ -367,7 +367,7 @@ class Moongen(ITrafficGenerator):
self._moongen_host_ip_addr
cmd_moongen = " 'cd " + self._moongen_base_dir + \
- "; ./build/MoonGen examples/opnfv-vsperf.lua | tee moongen_log.txt'"
+ "; ./MoonGen/build/MoonGen trafficgen.lua | tee moongen_log.txt'"
cmd_start_moongen = connect_moongen + cmd_moongen