aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xnfvbench/traffic_client.py11
-rw-r--r--nfvbench/traffic_gen/dummy.py2
-rw-r--r--nfvbench/traffic_gen/traffic_base.py2
-rw-r--r--nfvbench/traffic_gen/trex_gen.py50
4 files changed, 50 insertions, 15 deletions
diff --git a/nfvbench/traffic_client.py b/nfvbench/traffic_client.py
index 469b922..75c40c1 100755
--- a/nfvbench/traffic_client.py
+++ b/nfvbench/traffic_client.py
@@ -577,8 +577,8 @@ class TrafficClient(object):
LOG.info('Starting traffic generator to ensure end-to-end connectivity')
# send 2pps on each chain and each direction
rate_pps = {'rate_pps': str(self.config.service_chain_count * 2)}
- self.gen.create_traffic('64', [rate_pps, rate_pps], bidirectional=True, latency=False)
-
+ self.gen.create_traffic('64', [rate_pps, rate_pps], bidirectional=True, latency=False,
+ e2e=True)
# ensures enough traffic is coming back
retry_count = (self.config.check_traffic_time_sec +
self.config.generic_poll_sec - 1) / self.config.generic_poll_sec
@@ -658,7 +658,12 @@ class TrafficClient(object):
self.run_config['rates'][idx] = {'rate_pps': self.__convert_rates(rate)['rate_pps']}
self.gen.clear_streamblock()
- self.gen.create_traffic(frame_size, self.run_config['rates'], bidirectional, latency=True)
+ if not self.config.vxlan:
+ self.gen.create_traffic(frame_size, self.run_config['rates'], bidirectional,
+ latency=True)
+ else:
+ self.gen.create_traffic(frame_size, self.run_config['rates'], bidirectional,
+ latency=False)
def _modify_load(self, load):
self.current_total_rate = {'rate_percent': str(load)}
diff --git a/nfvbench/traffic_gen/dummy.py b/nfvbench/traffic_gen/dummy.py
index 9beea28..120a99b 100644
--- a/nfvbench/traffic_gen/dummy.py
+++ b/nfvbench/traffic_gen/dummy.py
@@ -95,7 +95,7 @@ class DummyTG(AbstractTrafficGenerator):
ports = list(self.traffic_client.generator_config.ports)
self.port_handle = ports
- def create_traffic(self, l2frame_size, rates, bidirectional, latency=True):
+ def create_traffic(self, l2frame_size, rates, bidirectional, latency=True, e2e=False):
self.rates = [utils.to_rate_str(rate) for rate in rates]
self.l2_frame_size = l2frame_size
diff --git a/nfvbench/traffic_gen/traffic_base.py b/nfvbench/traffic_gen/traffic_base.py
index 0360591..434fdae 100644
--- a/nfvbench/traffic_gen/traffic_base.py
+++ b/nfvbench/traffic_gen/traffic_base.py
@@ -68,7 +68,7 @@ class AbstractTrafficGenerator(object):
return None
@abc.abstractmethod
- def create_traffic(self, l2frame_size, rates, bidirectional, latency=True):
+ def create_traffic(self, l2frame_size, rates, bidirectional, latency=True, e2e=False):
# Must be implemented by sub classes
return None
diff --git a/nfvbench/traffic_gen/trex_gen.py b/nfvbench/traffic_gen/trex_gen.py
index 10937de..bbb67c1 100644
--- a/nfvbench/traffic_gen/trex_gen.py
+++ b/nfvbench/traffic_gen/trex_gen.py
@@ -349,7 +349,8 @@ class TRex(AbstractTrafficGenerator):
return STLPktBuilder(pkt=pkt_base / pad, vm=STLScVmRaw(vm_param))
- def generate_streams(self, port, chain_id, stream_cfg, l2frame, latency=True):
+ def generate_streams(self, port, chain_id, stream_cfg, l2frame, latency=True,
+ e2e=False):
"""Create a list of streams corresponding to a given chain and stream config.
port: port where the streams originate (0 or 1)
@@ -357,15 +358,26 @@ class TRex(AbstractTrafficGenerator):
stream_cfg: stream configuration
l2frame: L2 frame size (including 4-byte FCS) or 'IMIX'
latency: if True also create a latency stream
+ e2e: True if performing "end to end" connectivity check
"""
streams = []
pg_id, lat_pg_id = self.get_pg_id(port, chain_id)
if l2frame == 'IMIX':
for ratio, l2_frame_size in zip(IMIX_RATIOS, IMIX_L2_SIZES):
pkt = self._create_pkt(stream_cfg, l2_frame_size)
- streams.append(STLStream(packet=pkt,
- flow_stats=STLFlowStats(pg_id=pg_id),
- mode=STLTXCont(pps=ratio)))
+ if e2e:
+ streams.append(STLStream(packet=pkt,
+ mode=STLTXCont(pps=ratio)))
+ else:
+ if stream_cfg['vxlan'] is True:
+ streams.append(STLStream(packet=pkt,
+ flow_stats=STLFlowStats(pg_id=pg_id,
+ vxlan=True),
+ mode=STLTXCont(pps=ratio)))
+ else:
+ streams.append(STLStream(packet=pkt,
+ flow_stats=STLFlowStats(pg_id=pg_id),
+ mode=STLTXCont(pps=ratio)))
if latency:
# for IMIX, the latency packets have the average IMIX packet size
@@ -374,9 +386,19 @@ class TRex(AbstractTrafficGenerator):
else:
l2frame_size = int(l2frame)
pkt = self._create_pkt(stream_cfg, l2frame_size)
- streams.append(STLStream(packet=pkt,
- flow_stats=STLFlowStats(pg_id=pg_id),
- mode=STLTXCont()))
+ if e2e:
+ streams.append(STLStream(packet=pkt,
+ mode=STLTXCont()))
+ else:
+ if stream_cfg['vxlan'] is True:
+ streams.append(STLStream(packet=pkt,
+ flow_stats=STLFlowStats(pg_id=pg_id,
+ vxlan=True),
+ mode=STLTXCont()))
+ else:
+ streams.append(STLStream(packet=pkt,
+ flow_stats=STLFlowStats(pg_id=pg_id),
+ mode=STLTXCont()))
# for the latency stream, the minimum payload is 16 bytes even in case of vlan tagging
# without vlan, the min l2 frame size is 64
# with vlan it is 68
@@ -385,6 +407,7 @@ class TRex(AbstractTrafficGenerator):
pkt = self._create_pkt(stream_cfg, 68)
if latency:
+ # TRex limitation: VXLAN skip is not supported for latency stream
streams.append(STLStream(packet=pkt,
flow_stats=STLFlowLatencyStats(pg_id=lat_pg_id),
mode=STLTXCont(pps=self.LATENCY_PPS)))
@@ -581,7 +604,7 @@ class TRex(AbstractTrafficGenerator):
return {'result': True}
- def create_traffic(self, l2frame_size, rates, bidirectional, latency=True):
+ def create_traffic(self, l2frame_size, rates, bidirectional, latency=True, e2e=False):
"""Program all the streams in Trex server.
l2frame_size: L2 frame size or IMIX
@@ -589,6 +612,7 @@ class TRex(AbstractTrafficGenerator):
each rate is a dict like {'rate_pps': '10kpps'}
bidirectional: True if bidirectional
latency: True if latency measurement is needed
+ e2e: True if performing "end to end" connectivity check
"""
r = self.__is_rate_enough(l2frame_size, rates, bidirectional, latency)
if not r['result']:
@@ -612,15 +636,21 @@ class TRex(AbstractTrafficGenerator):
chain_id,
fwd_stream_cfg,
l2frame_size,
- latency=latency))
+ latency=latency,
+ e2e=e2e))
if len(self.rates) > 1:
streamblock[1].extend(self.generate_streams(self.port_handle[1],
chain_id,
rev_stream_cfg,
l2frame_size,
- latency=bidirectional and latency))
+ latency=bidirectional and latency,
+ e2e=e2e))
for port in self.port_handle:
+ if self.config.vxlan:
+ self.client.set_port_attr(ports=port, vxlan_fs=[4789])
+ else:
+ self.client.set_port_attr(ports=port, vxlan_fs=None)
self.client.add_streams(streamblock[port], ports=port)
LOG.info('Created %d traffic streams for port %s.', len(streamblock[port]), port)