@@ -64,10 +64,17 @@ class PacketGenerator(object):
self.tester = tester
self.__streams = []
self._ports_map = []
+ self.pktgen_type = None
+
+ def _prepare_generator(self):
+ raise NotImplementedError
def prepare_generator(self):
self._prepare_generator()
+ def _get_port_pci(self, port_id):
+ raise NotImplementedError
+
def _convert_pktgen_port(self, port_id):
'''
:param port_id:
@@ -94,6 +101,9 @@ class PacketGenerator(object):
return port
+ def _get_gen_port(self, tester_pci):
+ raise NotImplementedError
+
def _convert_tester_port(self, port_id):
'''
:param port_id:
@@ -143,6 +153,9 @@ class PacketGenerator(object):
def get_streams(self):
return self.__streams
+ def _clear_streams(self):
+ raise NotImplementedError
+
def clear_streams(self):
''' clear streams '''
self._clear_streams()
@@ -525,7 +538,7 @@ class PacketGenerator(object):
break
pps = (traffic_pps_max - traffic_pps_min)/2 + traffic_pps_min
- self.logger.info("zero loss pps is %f" % last_no_lost_mult)
+ self.logger.info("zero loss pps is %f" % pps)
# use last result as return data to keep the same with dts/etgen format
# In fact, multiple link peer have multiple loss rate value,
# here only pick one
@@ -1082,7 +1082,7 @@ class Ixia(SSHConnection):
Tells IXIA to prepare the internal buffers were the frames were captured.
"""
ixia_port = self.get_ixia_port(port_number)
- command = 'capture get {0} {1} {2}'.format(ixia_port)
+ command = 'capture get {0}'.format(ixia_port)
self.send_expect(command, '% ', 30)
def stat_get_rate_stat_all_stats(self, port_number):
@@ -1369,6 +1369,7 @@ class IxiaPacketGenerator(PacketGenerator):
Ixia packet generator
"""
def __init__(self, tester):
+ super(IxiaPacketGenerator, self).__init__(tester)
# ixia management
self.pktgen_type = PKTGEN_IXIA
self._conn = None
@@ -1388,7 +1389,6 @@ class IxiaPacketGenerator(PacketGenerator):
self.ip_keys = ['start', 'end','action', 'step', 'mask',]
self.vlan_keys = ['start', 'end', 'action', 'step', 'count',]
- super(IxiaPacketGenerator, self).__init__(tester)
self.tester = tester
def get_ports(self):
@@ -41,6 +41,7 @@ class IxNetworkPacketGenerator(PacketGenerator):
ixNetwork packet generator
"""
def __init__(self, tester):
+ super(IxNetworkPacketGenerator, self).__init__(tester)
self.pktgen_type = PKTGEN_IXIA_NETWORK
self._conn = None
# ixNetwork configuration information of dts
@@ -51,7 +52,6 @@ class IxNetworkPacketGenerator(PacketGenerator):
self._ports = []
self._rx_ports = []
- super(IxNetworkPacketGenerator, self).__init__(tester)
def get_ports(self):
''' used for ixNetwork packet generator '''
@@ -35,6 +35,9 @@ import sys
import time
from pprint import pformat
+from scapy.layers.inet import IP
+from scapy.layers.l2 import Ether
+
from .pktgen_base import (
PKTGEN,
PKTGEN_TREX,
@@ -414,6 +417,7 @@ class TrexPacketGenerator(PacketGenerator):
https://trex-tgn.cisco.com/trex/doc/trex_manual.html
"""
def __init__(self, tester):
+ super(TrexPacketGenerator, self).__init__(tester)
self.pktgen_type = PKTGEN_TREX
self.trex_app = "t-rex-64"
self._conn = None
@@ -432,7 +436,6 @@ class TrexPacketGenerator(PacketGenerator):
self.ip_keys = ['start', 'end','action', 'mask', 'step']
self.vlan_keys = ['start', 'end', 'action', 'step', 'count']
- super(TrexPacketGenerator, self).__init__(tester)
# check trex binary file
trex_bin = os.sep.join([self.conf.get('trex_root_path'), self.trex_app])