aboutsummaryrefslogtreecommitdiffstats
path: root/tools/pkt_gen/xena/xena.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/pkt_gen/xena/xena.py')
-rwxr-xr-xtools/pkt_gen/xena/xena.py49
1 files changed, 26 insertions, 23 deletions
diff --git a/tools/pkt_gen/xena/xena.py b/tools/pkt_gen/xena/xena.py
index 194de343..e76ebcbf 100755
--- a/tools/pkt_gen/xena/xena.py
+++ b/tools/pkt_gen/xena/xena.py
@@ -30,6 +30,8 @@ import sys
from time import sleep
import xml.etree.ElementTree as ET
from collections import OrderedDict
+# scapy imports
+import scapy.layers.inet as inet
# VSPerf imports
from conf import settings
@@ -48,10 +50,6 @@ from tools.pkt_gen.xena.XenaDriver import (
XenaManager,
)
-# scapy imports
-import scapy.layers.inet as inet
-
-
class Xena(ITrafficGenerator):
"""
Xena Traffic generator wrapper class
@@ -288,14 +286,23 @@ class Xena(ITrafficGenerator):
1, settings.getValue("TRAFFICGEN_XENA_PORT1_IP"),
settings.getValue("TRAFFICGEN_XENA_PORT1_CIDR"),
settings.getValue("TRAFFICGEN_XENA_PORT1_GATEWAY"))
- j_file.set_test_options(
- packet_sizes=self._params['traffic']['l2']['framesize'],
- iterations=trials, loss_rate=loss_rate,
- duration=self._duration, micro_tpld=True if self._params[
- 'traffic']['l2']['framesize'] == 64 else False)
+
if testtype == '2544_throughput':
+ j_file.set_test_options_tput(
+ packet_sizes=self._params['traffic']['l2']['framesize'],
+ iterations=trials, loss_rate=loss_rate,
+ duration=self._duration, micro_tpld=True if self._params[
+ 'traffic']['l2']['framesize'] == 64 else False)
j_file.enable_throughput_test()
+
elif testtype == '2544_b2b':
+ j_file.set_test_options_back2back(
+ packet_sizes=self._params['traffic']['l2']['framesize'],
+ iterations=trials, duration=self._duration,
+ startvalue=self._params['traffic']['frame_rate'],
+ endvalue=self._params['traffic']['frame_rate'],
+ micro_tpld=True if self._params[
+ 'traffic']['l2']['framesize'] == 64 else False)
j_file.enable_back2back_test()
j_file.set_header_layer2(
@@ -485,22 +492,18 @@ class Xena(ITrafficGenerator):
def send_burst_traffic(self, traffic=None, numpkts=100, duration=20):
"""Send a burst of traffic.
- Send a ``numpkts`` packets of traffic, using ``traffic``
- configuration, with a timeout of ``time``.
+ See ITrafficGenerator for description
+ """
+ self._duration = duration
- Attributes:
- :param traffic: Detailed "traffic" spec, i.e. IP address, VLAN tags
- :param numpkts: Number of packets to send
- :param duration: Time to wait to receive packets
+ self._params.clear()
+ self._params['traffic'] = self.traffic_defaults.copy()
+ if traffic:
+ self._params['traffic'] = merge_spec(self._params['traffic'],
+ traffic)
- :returns: dictionary of strings with following data:
- - List of Tx Frames,
- - List of Rx Frames,
- - List of Tx Bytes,
- - List of List of Rx Bytes,
- - Payload Errors and Sequence Errors.
- """
- raise NotImplementedError('Xena burst traffic not implemented')
+ self._start_traffic_api(numpkts)
+ return self._stop_api_traffic()
def send_cont_traffic(self, traffic=None, duration=20):
"""Send a continuous flow of traffic.