summaryrefslogtreecommitdiffstats
path: root/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_streams.py
diff options
context:
space:
mode:
authorYaroslav Brustinov <ybrustin@cisco.com>2016-02-23 11:23:38 -0500
committerYaroslav Brustinov <ybrustin@cisco.com>2016-02-23 11:23:38 -0500
commit275a53b9cc7ce4effc5d450861b390ec618a310e (patch)
treeac800fee256a28ee9a843b48fffc274b2ed6fb83 /scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_streams.py
parent301d6ca6e36efdc5a1534615d57f3527560befad (diff)
parent0e70a929c610f07cda2271313cb5f4c1bac4f148 (diff)
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_streams.py')
-rw-r--r--scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_streams.py44
1 files changed, 26 insertions, 18 deletions
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 df30db5f..90dd9657 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
@@ -155,9 +155,7 @@ class STLStream(object):
self.name = name
self.next = next
- # ID
- self.set_id(stream_id)
- self.set_next_id(None)
+ self.id = stream_id
self.fields = {}
@@ -236,14 +234,6 @@ class STLStream(object):
def get_id (self):
return self.id
- def set_id (self, id):
- self.id = id
-
- def get_next_id (self):
- return self.next_id
-
- def set_next_id (self, next_id):
- self.next_id = next_id
def get_name (self):
return self.name
@@ -251,26 +241,44 @@ class STLStream(object):
def get_next (self):
return self.next
- def get_pkt_type (self):
- if self.packet_desc == None:
- self.packet_desc = CScapyTRexPktBuilder.pkt_layers_desc_from_buffer(self.get_pkt())
-
- return self.packet_desc
def get_pkt (self):
return self.pkt
def get_pkt_len (self, count_crc = True):
- pkt_len = len(base64.b64decode(self.get_pkt()))
+ pkt_len = len(self.get_pkt())
if count_crc:
pkt_len += 4
return pkt_len
+ def get_pkt_type (self):
+ if self.packet_desc == None:
+ self.packet_desc = CScapyTRexPktBuilder.pkt_layers_desc_from_buffer(self.get_pkt())
+
+ return self.packet_desc
+
def get_mode (self):
return self.mode_desc
+ @staticmethod
+ def get_rate_from_field (rate_json):
+ t = rate_json['type']
+ v = rate_json['value']
+
+ if t == "pps":
+ return format_num(v, suffix = "pps")
+ elif t == "bps_L1":
+ return format_num(v, suffix = "bps (L1)")
+ elif t == "bps_L2":
+ return format_num(v, suffix = "bps (L2)")
+ elif t == "percentage":
+ return format_num(v, suffix = "%")
+
+ def get_rate (self):
+ return self.get_rate_from_field(self.fields['mode']['rate'])
+
def to_yaml (self):
y = {}
@@ -520,7 +528,7 @@ class STLProfile(object):
streams.append(STLStream(name = i,
packet = CScapyTRexPktBuilder(pkt_buffer = cap, vm = vm),
- mode = STLTXSingleBurst(total_pkts = 1),
+ mode = STLTXSingleBurst(total_pkts = 1, percentage = 100),
self_start = True if (i == 1) else False,
isg = (ts_usec - last_ts_usec), # seconds to usec
action_count = action_count,