summaryrefslogtreecommitdiffstats
path: root/core/traffic_controller_rfc2544.py
diff options
context:
space:
mode:
Diffstat (limited to 'core/traffic_controller_rfc2544.py')
-rw-r--r--core/traffic_controller_rfc2544.py18
1 files changed, 14 insertions, 4 deletions
diff --git a/core/traffic_controller_rfc2544.py b/core/traffic_controller_rfc2544.py
index aae3ef81..e8f1e2a0 100644
--- a/core/traffic_controller_rfc2544.py
+++ b/core/traffic_controller_rfc2544.py
@@ -39,10 +39,20 @@ class TrafficControllerRFC2544(ITrafficController, IResults):
self._traffic_gen_class = traffic_gen_class()
self._traffic_started = False
self._traffic_started_call_count = 0
- self._packet_sizes = settings.getValue('TRAFFICGEN_PKT_SIZES')
self._trials = get_test_param('rfc2544_trials', 1)
+ self._duration = get_test_param('duration', 30)
self._results = []
+ # If set, comma separated packet_sizes value from --test_params
+ # on cli takes precedence over value in settings file.
+ self._packet_sizes = None
+ packet_sizes_cli = get_test_param('pkt_sizes')
+ if packet_sizes_cli:
+ self._packet_sizes = [int(x.strip())
+ for x in packet_sizes_cli.split(',')]
+ else:
+ self._packet_sizes = settings.getValue('TRAFFICGEN_PKT_SIZES')
+
def __enter__(self):
"""Call initialisation function.
"""
@@ -85,14 +95,14 @@ class TrafficControllerRFC2544(ITrafficController, IResults):
if traffic['traffic_type'] == 'back2back':
result = self._traffic_gen_class.send_rfc2544_back2back(
traffic, trials=int(self._trials),
- duration=int(get_test_param('rfc2544_duration', 20)))
+ duration=self._duration)
elif traffic['traffic_type'] == 'continuous':
result = self._traffic_gen_class.send_cont_traffic(
traffic, time=int(get_test_param('rfc2544_duration', 30)))
else:
result = self._traffic_gen_class.send_rfc2544_throughput(
traffic, trials=int(self._trials),
- duration=int(get_test_param('rfc2544_duration', 20)))
+ duration=self._duration)
result = TrafficControllerRFC2544._append_results(result,
packet_size)
@@ -109,7 +119,7 @@ class TrafficControllerRFC2544(ITrafficController, IResults):
self._traffic_gen_class.start_rfc2544_throughput(
traffic,
trials=int(self._trials),
- duration=int(get_test_param('rfc2544_duration', 20)))
+ duration=self._duration)
self._traffic_started = True
if len(function['args']) > 0:
function['function'](function['args'])