diff options
15 files changed, 86 insertions, 86 deletions
diff --git a/scripts/automation/regression/unit_tests/functional_tests/hltapi_stream_builder_test.py b/scripts/automation/regression/unit_tests/functional_tests/hltapi_stream_builder_test.py index 54ffddb5..c6b477aa 100755 --- a/scripts/automation/regression/unit_tests/functional_tests/hltapi_stream_builder_test.py +++ b/scripts/automation/regression/unit_tests/functional_tests/hltapi_stream_builder_test.py @@ -53,7 +53,7 @@ class CTRexHltApi_Test(unittest.TestCase): packet: binary: AAAAAAAAAAABAAABCABFAAAyAAAAAEAGusUAAAAAwAAAAQQAAFAAAAABAAAAAVAAD+U1/QAAISEhISEhISEhIQ== meta: '' - rx_stats: + flow_stats: enabled: false self_start: true vm: @@ -109,7 +109,7 @@ TBD packet: binary: AAAAAAAAAAABAAABCABFAAAyAAAAAEAGrxPAqAEBBQUFBQQAAFAAAAABAAAAAVAAD+UqSwAAISEhISEhISEhIQ== meta: '' - rx_stats: + flow_stats: enabled: false self_start: true vm: @@ -168,7 +168,7 @@ TBD packet: binary: AAAAAAAAAAABAAABCABFAAAyAAAAAEAGusUAAAAAwAAAAQQABNIAAAABAAAAAVAAD+UxewAAISEhISEhISEhIQ== meta: '' - rx_stats: + flow_stats: enabled: false self_start: true vm: @@ -246,7 +246,7 @@ TBD packet: binary: AAAAAAAAAAABAAABCABFAAAyAAAAAEARuroAAAAAwAAAAQTSBNIAHsmgISEhISEhISEhISEhISEhISEhISEhIQ== meta: '' - rx_stats: + flow_stats: enabled: false self_start: true vm: @@ -307,7 +307,7 @@ TBD packet: binary: AAAAAAAAAAABAAABCABFAAuqAAAAAEAGr00AAAAAwAAAAQQAAFAAAAABAAAAAVAAD+UwiwAAISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEh meta: '' - rx_stats: + flow_stats: enabled: false self_start: true vm: @@ -353,7 +353,7 @@ TBD packet: binary: AAAAAAAAAAABAAABCABFAAGQAAAAAEARuVwAAAAAwAAAAQQAAFABfCaTISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEh meta: '' - rx_stats: + flow_stats: enabled: false self_start: true vm: @@ -407,7 +407,7 @@ TBD packet: binary: AAAAAAAAAAABAAABgQAwAAgARQAALgAAAABABrrJAAAAAMAAAAEEAABQAAAAAQAAAAFQAA/leEMAACEhISEhIQ== meta: '' - rx_stats: + flow_stats: enabled: false self_start: true vm: @@ -439,7 +439,7 @@ TBD packet: binary: AAAAAAAAAAABAAABgQAwAYEAMAKBADADgQAwBAgARQAARgAAAABABrqxAAAAAMAAAAEEAABQAAAAAQAAAAFQAA/l6p0AACEhISEhISEhISEhISEhISEhISEhISEhISEhISEhIQ== meta: '' - rx_stats: + flow_stats: enabled: false self_start: true vm: @@ -471,7 +471,7 @@ TBD packet: binary: AAAAAAAAAAABAAABgQAwAYEAMAKBADPogQAwBIEAMAUIAEUAAEIAAAAAQAa6tQAAAADAAAABBAAAUAAAAAEAAAABUAAP5SzkAAAhISEhISEhISEhISEhISEhISEhISEhISEhIQ== meta: '' - rx_stats: + flow_stats: enabled: false self_start: true vm: @@ -553,7 +553,7 @@ TBD packet: binary: AAAAAAAAAAABAAABht1gAAAAAG4GQP6AAAAAAAAAAAAAAAAAABL+gAAAAAAAAAAAAAAAAAAiBAAAUAAAAAEAAAABUAAP5ctLAAAhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISE= meta: '' - rx_stats: + flow_stats: enabled: false self_start: true vm: @@ -583,7 +583,7 @@ TBD packet: binary: AAAAAAAAAAABAAABht1gAAAAAG4RQBERIiIzM0REVVVmZnd3iIgRERERERERERERERERERERBAAAUABucjohISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISE= meta: '' - rx_stats: + flow_stats: enabled: false self_start: true vm: diff --git a/scripts/automation/trex_control_plane/stl/examples/stl_rx_stream.py b/scripts/automation/trex_control_plane/stl/examples/stl_flow_stats.py index 023b9a75..6fb33b22 100644 --- a/scripts/automation/trex_control_plane/stl/examples/stl_rx_stream.py +++ b/scripts/automation/trex_control_plane/stl/examples/stl_flow_stats.py @@ -18,7 +18,7 @@ def rx_example (tx_port, rx_port, burst_size): total_pkts = burst_size s1 = STLStream(name = 'rx', packet = pkt, - rx_stats = STLRxStats(user_id = 5), + flow_stats = STLRxStats(pg_id = 5), mode = STLTXSingleBurst(total_pkts = total_pkts, bps_L2 = 250000000)) # connect to server @@ -36,11 +36,11 @@ def rx_example (tx_port, rx_port, burst_size): c.wait_on_traffic(ports = [tx_port]) # no error check - just an example... should be 5 - rx_stats = c.get_stats()['rx_stats'][5] + flow_stats = c.get_stats()['flow_stats'][5] - tx_pkts = rx_stats['tx-pkts'][tx_port] - tx_bytes = rx_stats['tx-bytes'][tx_port] - rx_pkts = rx_stats['rx-pkts'][rx_port] + tx_pkts = flow_stats['tx_pkts'][tx_port] + tx_bytes = flow_stats['tx_bytes'][tx_port] + rx_pkts = flow_stats['rx_pkts'][rx_port] if tx_pkts != total_pkts: print "TX pkts mismatch - got: {0}, expected: {1}".format(tx_pkts, total_pkts) 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 f75d2003..36103cae 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 @@ -281,7 +281,7 @@ class CTRexAsyncClient(): elif name == "trex-barrier": self.handle_async_barrier(type, data) - elif name == "rx-stats": + elif name == "flow_stats": self.event_handler.handle_async_rx_stats_event(data) else: 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 6ff007b1..a4e0b519 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 @@ -156,7 +156,7 @@ class AsyncEventHandler(object): def handle_async_rx_stats_event (self, data): - self.client.rx_stats.update(data) + self.client.flow_stats.update(data) # handles an async stats update from the subscriber @@ -439,7 +439,7 @@ class STLClient(object): self.stats_generator = trex_stl_stats.CTRexInfoGenerator(self.global_stats, self.ports) - self.rx_stats = trex_stl_stats.CRxStats() + self.flow_stats = trex_stl_stats.CRxStats() ############# private functions - used by the class itself ########### @@ -746,7 +746,7 @@ class STLClient(object): stats['total'] = total - stats['rx_stats'] = self.rx_stats.get_stats() + stats['flow_stats'] = self.flow_stats.get_stats() return stats diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_hltapi.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_hltapi.py index 2f08cc48..a74824d2 100755 --- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_hltapi.py +++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_hltapi.py @@ -795,7 +795,6 @@ def STLHltStream(**user_kwargs): #enabled = True, #self_start = True, mode = transmit_mode_class, - #rx_stats = rx_stats, stream_id = kwargs['stream_id'], name = kwargs['name'], ) diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_stats.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_stats.py index eca7fd7a..c2e318bc 100644 --- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_stats.py +++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_stats.py @@ -131,10 +131,10 @@ class CTRexInfoGenerator(object): ("ipackets", []), ("obytes", []), ("ibytes", []), - ("tx-bytes", []), - ("rx-bytes", []), - ("tx-pkts", []), - ("rx-pkts", []), + ("tx_bytes", []), + ("rx_bytes", []), + ("tx_pkts", []), + ("rx_pkts", []), ("-----", []), ("oerrors", []), @@ -627,10 +627,10 @@ class CPortStats(CTRexStats): "obytes" : self.get_rel("obytes"), "ibytes" : self.get_rel("ibytes"), - "tx-bytes": self.get_rel("obytes", format = True, suffix = "B"), - "rx-bytes": self.get_rel("ibytes", format = True, suffix = "B"), - "tx-pkts": self.get_rel("opackets", format = True, suffix = "pkts"), - "rx-pkts": self.get_rel("ipackets", format = True, suffix = "pkts"), + "tx_bytes": self.get_rel("obytes", format = True, suffix = "B"), + "rx_bytes": self.get_rel("ibytes", format = True, suffix = "B"), + "tx_pkts": self.get_rel("opackets", format = True, suffix = "pkts"), + "rx_pkts": self.get_rel("ipackets", format = True, suffix = "pkts"), "oerrors" : format_num(self.get_rel("oerrors"), compact = False, @@ -645,28 +645,28 @@ class CPortStats(CTRexStats): class CRxStats(object): def __init__(self): - self.rx_stats = {} + self.flow_stats = {} def update (self, snapshot): - self.rx_stats = snapshot + self.flow_stats = snapshot def get_stats (self): stats = {} - for user_id, user_id_data in self.rx_stats.iteritems(): - # ignore non user ID keys + for pg_id, pg_id_data in self.flow_stats.iteritems(): + # ignore non pg ID keys try: - user_id = int(user_id) + pg_id = int(pg_id) except ValueError: continue - # handle user id - stats[user_id] = {} - for field, per_port_data in user_id_data.iteritems(): - stats[user_id][field] = {} + # handle pg id + stats[pg_id] = {} + for field, per_port_data in pg_id_data.iteritems(): + stats[pg_id][field] = {} for port, value in per_port_data.iteritems(): - stats[user_id][field][int(port)] = value + stats[pg_id][field][int(port)] = value return stats 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 5aa544ab..cc42c676 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 @@ -125,11 +125,11 @@ STLStreamDstMAC_ARP =2 # RX stats class class STLRxStats(object): - def __init__ (self, user_id): + def __init__ (self, pg_id): self.fields = {} self.fields['enabled'] = True - self.fields['stream_id'] = user_id + self.fields['stream_id'] = pg_id self.fields['seq_enabled'] = False self.fields['latency_enabled'] = False @@ -150,7 +150,7 @@ class STLStream(object): enabled = True, self_start = True, isg = 0.0, - rx_stats = None, + flow_stats = None, next = None, stream_id = None, action_count = 0, @@ -241,10 +241,10 @@ class STLStream(object): # this is heavy, calculate lazy self.packet_desc = None - if not rx_stats: - self.fields['rx_stats'] = STLRxStats.defaults() + if not flow_stats: + self.fields['flow_stats'] = STLRxStats.defaults() else: - self.fields['rx_stats'] = rx_stats.to_json() + self.fields['flow_stats'] = flow_stats.to_json() def __str__ (self): @@ -391,8 +391,8 @@ class STLStream(object): stream_params_list.append('self_start = %s' % self.fields['self_start']) if default_STLStream.fields['isg'] != self.fields['isg']: stream_params_list.append('isg = %s' % self.fields['isg']) - if default_STLStream.fields['rx_stats'] != self.fields['rx_stats']: - stream_params_list.append('rx_stats = STLRxStats(%s)' % self.fields['rx_stats']['stream_id']) + if default_STLStream.fields['flow_stats'] != self.fields['flow_stats']: + stream_params_list.append('flow_stats = STLRxStats(%s)' % self.fields['flow_stats']['stream_id']) if default_STLStream.next != self.next: stream_params_list.append('next = %s' % STLStream.__add_quotes(self.next)) if default_STLStream.id != self.id: @@ -513,17 +513,17 @@ class YAMLLoader(object): - def __parse_rx_stats (self, rx_stats_obj): + def __parse_flow_stats (self, flow_stats_obj): # no such object - if not rx_stats_obj or rx_stats_obj.get('enabled') == False: + if not flow_stats_obj or flow_stats_obj.get('enabled') == False: return None - user_id = rx_stats_obj.get('stream_id') - if user_id == None: + pg_id = flow_stats_obj.get('stream_id') + if pg_id == None: raise STLError("enabled RX stats section must contain 'stream_id' field") - return STLRxStats(user_id = user_id) + return STLRxStats(pg_id = pg_id) def __parse_stream (self, yaml_object): @@ -541,7 +541,7 @@ class YAMLLoader(object): mode = self.__parse_mode(s_obj.get('mode')) # rx stats - rx_stats = self.__parse_rx_stats(s_obj.get('rx_stats')) + flow_stats = self.__parse_flow_stats(s_obj.get('flow_stats')) defaults = default_STLStream @@ -549,7 +549,7 @@ class YAMLLoader(object): stream = STLStream(name = yaml_object.get('name'), packet = builder, mode = mode, - rx_stats = rx_stats, + flow_stats = flow_stats, enabled = s_obj.get('enabled', defaults.fields['enabled']), self_start = s_obj.get('self_start', defaults.fields['self_start']), isg = s_obj.get('isg', defaults.fields['isg']), @@ -762,4 +762,4 @@ def register(): def __len__ (self): return len(self.streams) -default_STLStream = STLStream()
\ No newline at end of file +default_STLStream = STLStream() diff --git a/scripts/stl/rx_stats.py b/scripts/stl/flow_stats.py index 892fe1a0..9248c691 100644 --- a/scripts/stl/rx_stats.py +++ b/scripts/stl/flow_stats.py @@ -6,8 +6,9 @@ class STLS1(object): def get_streams (self, direction = 0): return [STLStream(packet = STLPktBuilder(pkt ="stl/yaml/udp_64B_no_crc.pcap"), # path relative to pwd - mode = STLTXCont(pps=10), - rx_stats = STLRxStats(user_id = 7)) +# mode = STLTXCont(pps=10), + mode = STLTXSingleBurst(pps=1000, total_pkts=100000), + flow_stats = STLRxStats(pg_id = 7)) ] diff --git a/scripts/stl/yaml/imix_1pkt_2.yaml b/scripts/stl/yaml/imix_1pkt_2.yaml index dc1a457b..014ffdbc 100644 --- a/scripts/stl/yaml/imix_1pkt_2.yaml +++ b/scripts/stl/yaml/imix_1pkt_2.yaml @@ -8,7 +8,7 @@ mode: type: continuous pps: 100 - rx_stats: [] + flow_stats: [] vm: [] - name: udp_64B_2 stream: @@ -18,7 +18,7 @@ mode: type: continuous pps: 100 - rx_stats: [] + flow_stats: [] vm: [] - name: udp_64B_3 stream: @@ -28,7 +28,7 @@ mode: type: continuous pps: 100 - rx_stats: [] + flow_stats: [] vm: [] - name: udp_64B_4 stream: @@ -38,5 +38,5 @@ mode: type: continuous pps: 100 - rx_stats: [] + flow_stats: [] vm: [] diff --git a/scripts/stl/yaml/imix_1pkt_vm.yaml b/scripts/stl/yaml/imix_1pkt_vm.yaml index 698d3e60..5d9da5af 100644 --- a/scripts/stl/yaml/imix_1pkt_vm.yaml +++ b/scripts/stl/yaml/imix_1pkt_vm.yaml @@ -8,7 +8,7 @@ mode: type: continuous pps: 100 - rx_stats: [] + flow_stats: [] vm: instructions: [ diff --git a/scripts/stl/yaml/imix_1pkt_vm_minus.yaml b/scripts/stl/yaml/imix_1pkt_vm_minus.yaml index bf67c83c..e83cfdd0 100644 --- a/scripts/stl/yaml/imix_1pkt_vm_minus.yaml +++ b/scripts/stl/yaml/imix_1pkt_vm_minus.yaml @@ -8,7 +8,7 @@ mode: type: continuous pps: 100 - rx_stats: [] + flow_stats: [] vm: instructions: [ diff --git a/src/flow_stat.cpp b/src/flow_stat.cpp index 5c3c7462..700c584b 100644 --- a/src/flow_stat.cpp +++ b/src/flow_stat.cpp @@ -391,7 +391,7 @@ std::ostream& operator<<(std::ostream& os, const CFlowStatRuleMgr& cf) { int CFlowStatRuleMgr::compile_stream(const TrexStream * stream, Cxl710Parser &parser) { #ifdef __DEBUG_FUNC_ENTRY__ - std::cout << __METHOD_NAME__ << " user id:" << stream->m_rx_check.m_user_id << " en:"; + std::cout << __METHOD_NAME__ << " user id:" << stream->m_rx_check.m_pg_id << " en:"; std::cout << stream->m_rx_check.m_enabled << std::endl; #endif @@ -428,7 +428,7 @@ int CFlowStatRuleMgr::compile_stream(const TrexStream * stream, Cxl710Parser &pa int CFlowStatRuleMgr::add_stream(const TrexStream * stream) { #ifdef __DEBUG_FUNC_ENTRY__ - std::cout << __METHOD_NAME__ << " user id:" << stream->m_rx_check.m_user_id << std::endl; + std::cout << __METHOD_NAME__ << " user id:" << stream->m_rx_check.m_pg_id << std::endl; #endif if (! m_api ) { @@ -468,12 +468,12 @@ int CFlowStatRuleMgr::add_stream(const TrexStream * stream) { return -1; } - return m_user_id_map.add_stream(stream->m_rx_check.m_user_id, l4_proto); + return m_user_id_map.add_stream(stream->m_rx_check.m_pg_id, l4_proto); } int CFlowStatRuleMgr::del_stream(const TrexStream * stream) { #ifdef __DEBUG_FUNC_ENTRY__ - std::cout << __METHOD_NAME__ << " user id:" << stream->m_rx_check.m_user_id << std::endl; + std::cout << __METHOD_NAME__ << " user id:" << stream->m_rx_check.m_pg_id << std::endl; #endif if (no_stat_supported) @@ -483,7 +483,7 @@ int CFlowStatRuleMgr::del_stream(const TrexStream * stream) { return 0; } - return m_user_id_map.del_stream(stream->m_rx_check.m_user_id); + return m_user_id_map.del_stream(stream->m_rx_check.m_pg_id); } // called on all streams, when stream start to transmit @@ -494,7 +494,7 @@ int CFlowStatRuleMgr::del_stream(const TrexStream * stream) { // Might change the IP ID of the stream packet int CFlowStatRuleMgr::start_stream(TrexStream * stream, uint16_t &ret_hw_id) { #ifdef __DEBUG_FUNC_ENTRY__ - std::cout << __METHOD_NAME__ << " user id:" << stream->m_rx_check.m_user_id << std::endl; + std::cout << __METHOD_NAME__ << " user id:" << stream->m_rx_check.m_pg_id << std::endl; #endif Cxl710Parser parser; @@ -523,8 +523,8 @@ int CFlowStatRuleMgr::start_stream(TrexStream * stream, uint16_t &ret_hw_id) { } // from here, we know the stream need rx stat - if (m_user_id_map.is_started(stream->m_rx_check.m_user_id)) { - m_user_id_map.start_stream(stream->m_rx_check.m_user_id); // just increase ref count; + if (m_user_id_map.is_started(stream->m_rx_check.m_pg_id)) { + m_user_id_map.start_stream(stream->m_rx_check.m_pg_id); // just increase ref count; } else { uint16_t hw_id = m_hw_id_map.find_free_hw_id(); if (hw_id > m_max_hw_id) { @@ -534,14 +534,14 @@ int CFlowStatRuleMgr::start_stream(TrexStream * stream, uint16_t &ret_hw_id) { printf("Error: %s failed finding free hw_id\n", __func__); return -1; } else { - uint32_t user_id = stream->m_rx_check.m_user_id; + uint32_t user_id = stream->m_rx_check.m_pg_id; m_user_id_map.start_stream(user_id, hw_id); m_hw_id_map.map(hw_id, user_id); add_hw_rule(hw_id, m_user_id_map.l4_proto(user_id)); } } - uint16_t hw_id = m_user_id_map.get_hw_id(stream->m_rx_check.m_user_id); // can't fail if we got here + uint16_t hw_id = m_user_id_map.get_hw_id(stream->m_rx_check.m_pg_id); // can't fail if we got here parser.set_ip_id(IP_ID_RESERVE_BASE + hw_id); ret_hw_id = hw_id; @@ -563,7 +563,7 @@ int CFlowStatRuleMgr::add_hw_rule(uint16_t hw_id, uint8_t proto) { int CFlowStatRuleMgr::stop_stream(const TrexStream * stream) { #ifdef __DEBUG_FUNC_ENTRY__ - std::cout << __METHOD_NAME__ << " user id:" << stream->m_rx_check.m_user_id << std::endl; + std::cout << __METHOD_NAME__ << " user id:" << stream->m_rx_check.m_pg_id << std::endl; #endif if (no_stat_supported) return -ENOTSUP; @@ -572,11 +572,11 @@ int CFlowStatRuleMgr::stop_stream(const TrexStream * stream) { return 0; } - if (m_user_id_map.stop_stream(stream->m_rx_check.m_user_id) == 0) { + if (m_user_id_map.stop_stream(stream->m_rx_check.m_pg_id) == 0) { // last stream associated with the entry stopped transmittig. // remove user_id <--> hw_id mapping - uint8_t proto = m_user_id_map.l4_proto(stream->m_rx_check.m_user_id); - uint16_t hw_id = m_user_id_map.get_hw_id(stream->m_rx_check.m_user_id); + uint8_t proto = m_user_id_map.l4_proto(stream->m_rx_check.m_pg_id); + uint16_t hw_id = m_user_id_map.get_hw_id(stream->m_rx_check.m_pg_id); if (hw_id >= MAX_FLOW_STATS) { fprintf(stderr, "Error: %s got wrong hw_id %d from unmap\n", __func__, hw_id); return -1; @@ -592,7 +592,7 @@ int CFlowStatRuleMgr::stop_stream(const TrexStream * stream) { p_user_id->set_rx_counter(port, rx_counter); p_user_id->set_tx_counter(port, tx_counter); } - m_user_id_map.unmap(stream->m_rx_check.m_user_id); + m_user_id_map.unmap(stream->m_rx_check.m_pg_id); m_hw_id_map.unmap(hw_id); } } @@ -610,7 +610,7 @@ bool CFlowStatRuleMgr::dump_json(std::string & json) { if (m_user_id_map.is_empty()) { return false; } - root["name"] = "rx-stats"; + root["name"] = "flow_stats"; root["type"] = 0; Json::Value &data_section = root["data"]; @@ -650,12 +650,12 @@ bool CFlowStatRuleMgr::dump_json(std::string & json) { std::string str_port = static_cast<std::ostringstream*>( &(std::ostringstream() << int(port) ) )->str(); if (user_id_info->get_rx_counter(port) != 0) { - data_section[str_user_id]["rx-pkts"][str_port] = Json::Value::UInt64(user_id_info->get_rx_counter(port)); + data_section[str_user_id]["rx_pkts"][str_port] = Json::Value::UInt64(user_id_info->get_rx_counter(port)); ret = true; } if (user_id_info->get_tx_counter(port).get_pkts() != 0) { - data_section[str_user_id]["tx-pkts"][str_port] = Json::Value::UInt64(user_id_info->get_tx_counter(port).get_pkts()); - data_section[str_user_id]["tx-bytes"][str_port] = Json::Value::UInt64(user_id_info->get_tx_counter(port).get_bytes()); + data_section[str_user_id]["tx_pkts"][str_port] = Json::Value::UInt64(user_id_info->get_tx_counter(port).get_pkts()); + data_section[str_user_id]["tx_bytes"][str_port] = Json::Value::UInt64(user_id_info->get_tx_counter(port).get_bytes()); ret = true; } } diff --git a/src/gtest/rpc_test.cpp b/src/gtest/rpc_test.cpp index 34bb02a8..49a52071 100644 --- a/src/gtest/rpc_test.cpp +++ b/src/gtest/rpc_test.cpp @@ -462,7 +462,7 @@ create_simple_stream(Json::Value &obj) { } obj["vm"] = Json::arrayValue; - obj["rx_stats"]["enabled"] = false; + obj["flow_stats"]["enabled"] = false; } static bool diff --git a/src/rpc-server/commands/trex_rpc_cmd_stream.cpp b/src/rpc-server/commands/trex_rpc_cmd_stream.cpp index b56d3e13..68bebeb6 100644 --- a/src/rpc-server/commands/trex_rpc_cmd_stream.cpp +++ b/src/rpc-server/commands/trex_rpc_cmd_stream.cpp @@ -101,7 +101,7 @@ TrexRpcCmdAddStream::_run(const Json::Value ¶ms, Json::Value &result) { parse_vm(vm, stream, result); /* parse RX info */ - const Json::Value &rx = parse_object(section, "rx_stats", result); + const Json::Value &rx = parse_object(section, "flow_stats", result); stream->m_rx_check.m_enabled = parse_bool(rx, "enabled", result); @@ -114,7 +114,7 @@ TrexRpcCmdAddStream::_run(const Json::Value ¶ms, Json::Value &result) { generate_parse_err(result, "RX stats is not supported on this interface"); } - stream->m_rx_check.m_user_id = parse_int(rx, "stream_id", result); + stream->m_rx_check.m_pg_id = parse_int(rx, "stream_id", result); stream->m_rx_check.m_seq_enabled = parse_bool(rx, "seq_enabled", result); stream->m_rx_check.m_latency = parse_bool(rx, "latency_enabled", result); } diff --git a/src/stateless/cp/trex_stream.h b/src/stateless/cp/trex_stream.h index 1abf0c04..ded6363e 100644 --- a/src/stateless/cp/trex_stream.h +++ b/src/stateless/cp/trex_stream.h @@ -513,7 +513,7 @@ public: bool m_enabled; bool m_seq_enabled; bool m_latency; - uint32_t m_user_id; + uint32_t m_pg_id; uint16_t m_hw_id; } m_rx_check; |