diff options
author | 2016-03-03 16:34:20 +0200 | |
---|---|---|
committer | 2016-03-03 18:11:08 +0200 | |
commit | 13cfb2c4ea55b7e0dab40155d8d51e7955ae4681 (patch) | |
tree | 7887702e364d3aa1917e3f9ca073602b88cae8c5 /scripts/automation/trex_control_plane/stl/trex_stl_lib | |
parent | 0a10805acc189a36eecb4d49b858bd911bc45f4e (diff) |
RX stats API
Diffstat (limited to 'scripts/automation/trex_control_plane/stl/trex_stl_lib')
4 files changed, 12 insertions, 3 deletions
diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_async_client.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_async_client.py index 410482b9..f75d2003 100644 --- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_async_client.py +++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_async_client.py @@ -280,6 +280,10 @@ class CTRexAsyncClient(): # barriers elif name == "trex-barrier": self.handle_async_barrier(type, data) + + elif name == "rx-stats": + self.event_handler.handle_async_rx_stats_event(data) + else: pass 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 04dd77ec..8da7c411 100644 --- 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 @@ -155,6 +155,10 @@ class AsyncEventHandler(object): pass + def handle_async_rx_stats_event (self, data): + self.client.rx_stats = data + + # handles an async stats update from the subscriber def handle_async_stats_update(self, dump_data): global_stats = {} @@ -435,7 +439,7 @@ class STLClient(object): self.stats_generator = trex_stl_stats.CTRexInfoGenerator(self.global_stats, self.ports) - + self.rx_stats = {} ############# private functions - used by the class itself ########### @@ -741,6 +745,8 @@ class STLClient(object): stats['total'] = total + stats['rx_stats'] = copy.deepcopy(self.rx_stats) + return stats diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_packet_builder_scapy.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_packet_builder_scapy.py index 42d648a5..b2843ac3 100644 --- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_packet_builder_scapy.py +++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_packet_builder_scapy.py @@ -668,7 +668,7 @@ class CTRexVmDescTupleGen(CTRexVmDescBase): class CScapyTRexPktBuilder(CTrexPktBuilderInterface): """ - This class defines the TRex API of building a packet using dpkt package. + This class defines the TRex API of building a packet using scapy package. Using this class the user can also define how TRex will handle the packet by specifying the VM setting. pkt could be Scapy pkt or pcap file name diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_streams.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_streams.py index b56d8708..2dfc5f29 100644 --- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_streams.py +++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_streams.py @@ -6,7 +6,6 @@ from trex_stl_packet_builder_interface import CTrexPktBuilderInterface from trex_stl_packet_builder_scapy import CScapyTRexPktBuilder, Ether, IP, UDP, TCP, RawPcapReader from collections import OrderedDict, namedtuple -from dpkt import pcap import random import yaml import base64 |