summaryrefslogtreecommitdiffstats
path: root/scripts/automation/trex_control_plane
diff options
context:
space:
mode:
authorIdo Barnea <ibarnea@cisco.com>2016-03-07 10:55:59 +0200
committerIdo Barnea <ibarnea@cisco.com>2016-03-07 10:55:59 +0200
commitca3f7e0f81f782638440353c456382b6e607c71e (patch)
tree8cd21cd54a2e1d55bae1799cc95315d498f0cddd /scripts/automation/trex_control_plane
parentd5047a7e044c681fffa436015fd9cd246e4ad1b2 (diff)
changed rx stats to flow stats everywhere
Diffstat (limited to 'scripts/automation/trex_control_plane')
-rw-r--r--scripts/automation/trex_control_plane/stl/examples/stl_flow_stats.py (renamed from scripts/automation/trex_control_plane/stl/examples/stl_rx_stream.py)10
-rw-r--r--scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_async_client.py2
-rw-r--r--scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py6
-rwxr-xr-xscripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_hltapi.py1
-rw-r--r--scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_stats.py36
-rw-r--r--scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_streams.py32
6 files changed, 43 insertions, 44 deletions
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()