summaryrefslogtreecommitdiffstats
path: root/scripts/automation/trex_control_plane
diff options
context:
space:
mode:
authorimarom <imarom@cisco.com>2016-11-06 18:50:16 +0200
committerimarom <imarom@cisco.com>2016-11-06 18:50:16 +0200
commite85ea75669ea39e4f99519138a3a84e4df6eed2d (patch)
tree27e1563def12afc2ef03c369324aa2b03807cc76 /scripts/automation/trex_control_plane
parenta1ade6fd8e044b9866a8644db3519305539cfc61 (diff)
RX features
Signed-off-by: imarom <imarom@cisco.com>
Diffstat (limited to 'scripts/automation/trex_control_plane')
-rwxr-xr-xscripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py37
-rw-r--r--scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_port.py20
2 files changed, 53 insertions, 4 deletions
diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py
index b9143896..2d5a6379 100755
--- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py
+++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py
@@ -658,7 +658,7 @@ class STLClient(object):
return rc
-
+
def __add_streams(self, stream_list, port_id_list = None):
port_id_list = self.__ports(port_id_list)
@@ -830,6 +830,16 @@ class STLClient(object):
return rc
+ def __remove_rx_sniffer (self, port_id_list):
+ port_id_list = self.__ports(port_id_list)
+ rc = RC()
+
+ for port_id in port_id_list:
+ rc.add(self.ports[port_id].remove_rx_sniffer())
+
+ return rc
+
+
# connect to server
def __connect(self):
@@ -1875,7 +1885,13 @@ class STLClient(object):
self.stop(ports, rx_delay_ms = 0)
self.remove_all_streams(ports)
self.clear_stats(ports)
+ self.set_port_attr(ports,
+ promiscuous = False,
+ link_up = True,
+ rx_filter_mode = 'hw')
+ self.remove_rx_sniffer(ports)
+
@__api_check(True)
def remove_all_streams (self, ports = None):
@@ -2733,6 +2749,25 @@ class STLClient(object):
+ @__api_check(True)
+ def remove_rx_sniffer (self, ports = None, base_filename = 'rx_capture', limit = 1000):
+ """
+ Removes RX sniffer from port(s)
+
+ :raises:
+ + :exe:'STLError'
+
+ """
+ ports = ports if ports is not None else self.get_acquired_ports()
+ ports = self._validate_port_list(ports)
+
+ self.logger.pre_cmd("Removing RX sniffers on port(s) {0}:".format(ports))
+ rc = self.__remove_rx_sniffer(ports)
+ self.logger.post_cmd(rc)
+
+ if not rc:
+ raise STLError(rc)
+
def clear_events (self):
"""
Clear all events
diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_port.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_port.py
index 571a6e16..4e5778a6 100644
--- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_port.py
+++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_port.py
@@ -75,13 +75,13 @@ class Port(object):
# decorator to verify port is up
def up(func):
- def func_wrapper(*args):
+ def func_wrapper(*args, **kwargs):
port = args[0]
if not port.is_up():
return port.err("{0} - port is down".format(func.__name__))
- return func(*args)
+ return func(*args, **kwargs)
return func_wrapper
@@ -489,7 +489,7 @@ class Port(object):
return self.ok()
- @writeable
+ @owned
def set_rx_sniffer (self, pcap_filename, limit):
params = {"handler": self.handler,
@@ -506,6 +506,20 @@ class Port(object):
return self.ok()
@owned
+ def remove_rx_sniffer (self):
+ params = {"handler": self.handler,
+ "port_id": self.port_id,
+ "type": "capture",
+ "enabled": False}
+
+ rc = self.transmit("set_rx_feature", params)
+ if rc.bad():
+ return self.err(rc.err())
+
+ return self.ok()
+
+
+ @owned
def pause (self):
if (self.state == self.STATE_PCAP_TX) :