summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlec Hothan <ahothan@cisco.com>2020-05-29 14:40:08 +0000
committerGerrit Code Review <gerrit@opnfv.org>2020-05-29 14:40:08 +0000
commit2ea85358836ca305bb3082fe3732b1b13d201f29 (patch)
tree5b5a7c5ffb3631eaca6b6066ad575ba6d53a4997
parent143c4ff68068fd704e7eb4df1c82af29f087c871 (diff)
parentb8c9133ba8b6806093e9fa4b4668c965dc8073a5 (diff)
Merge "NFVBENCH-169: UDP port random step correction"
-rwxr-xr-xnfvbench/traffic_client.py7
-rw-r--r--nfvbench/traffic_gen/trex_gen.py14
2 files changed, 13 insertions, 8 deletions
diff --git a/nfvbench/traffic_client.py b/nfvbench/traffic_client.py
index 0247857..b70e8f9 100755
--- a/nfvbench/traffic_client.py
+++ b/nfvbench/traffic_client.py
@@ -246,11 +246,8 @@ class Device(object):
else:
self.ip_block = IpBlock(self.ip, step, self.ip_size)
- if generator_config.gen_config.udp_port_step == 'random':
- step = 1
- else:
- step = generator_config.gen_config.udp_port_step
- self.udp_ports = UdpPorts(src_min, src_max, dst_min, dst_max, step)
+ self.udp_ports = UdpPorts(src_min, src_max, dst_min, dst_max,
+ generator_config.gen_config.udp_port_step)
self.gw_ip_block = IpBlock(generator_config.gateway_ips[port],
generator_config.gateway_ip_addrs_step,
self.chain_count)
diff --git a/nfvbench/traffic_gen/trex_gen.py b/nfvbench/traffic_gen/trex_gen.py
index a4f992d..7220e4b 100644
--- a/nfvbench/traffic_gen/trex_gen.py
+++ b/nfvbench/traffic_gen/trex_gen.py
@@ -393,11 +393,19 @@ class TRex(AbstractTrafficGenerator):
udp_args = {}
if stream_cfg['udp_src_port']:
udp_args['sport'] = int(stream_cfg['udp_src_port'])
- udp_args['sport_step'] = int(stream_cfg['udp_port_step'])
+ if stream_cfg['udp_port_step'] == 'random':
+ step = 1
+ else:
+ step = stream_cfg['udp_port_step']
+ udp_args['sport_step'] = int(step)
udp_args['sport_max'] = int(stream_cfg['udp_src_port_max'])
if stream_cfg['udp_dst_port']:
udp_args['dport'] = int(stream_cfg['udp_dst_port'])
- udp_args['dport_step'] = int(stream_cfg['udp_port_step'])
+ if stream_cfg['udp_port_step'] == 'random':
+ step = 1
+ else:
+ step = stream_cfg['udp_port_step']
+ udp_args['dport_step'] = int(step)
udp_args['dport_max'] = int(stream_cfg['udp_dst_port_max'])
pkt_base /= IP(src=stream_cfg['ip_src_addr'], dst=stream_cfg['ip_dst_addr']) / \
@@ -444,7 +452,7 @@ class TRex(AbstractTrafficGenerator):
max_value=udp_args['sport_max'],
size=2,
seed=random.randint(0, 32767),
- limit=udp_args['udp_src_count'])
+ limit=stream_cfg['udp_src_count'])
dst_fv_port = STLVmFlowVarRepeatableRandom(
name="p_dst",
min_value=udp_args['dport'],