diff options
author | 2016-02-10 16:32:54 +0200 | |
---|---|---|
committer | 2016-02-10 16:32:54 +0200 | |
commit | 0f03cc467be9c0b37310b7e2a589a86a1771c96f (patch) | |
tree | 32983679b9033b0379d2036740b796d8fe557c3f /scripts/automation/trex_control_plane/stl/trex_stl_lib | |
parent | a69c4dd80e88b6fb4ebfae8d84366b11561d7660 (diff) |
update hltapi + functional regression + remove old packet_builder tests
Diffstat (limited to 'scripts/automation/trex_control_plane/stl/trex_stl_lib')
-rw-r--r-- | scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_port.py | 4 | ||||
-rw-r--r-- | scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_streams.py | 14 |
2 files changed, 13 insertions, 5 deletions
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 732cfc1e..b1cf9ebc 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 @@ -52,7 +52,7 @@ class Port(object): self.port_stats = trex_stl_stats.CPortStats(self) - self.next_available_id = 1 + self.next_available_id = long(1) def err(self, msg): @@ -132,7 +132,7 @@ class Port(object): # TODO: handle syncing the streams into stream_db - self.next_available_id = rc.data()['max_stream_id'] + self.next_available_id = long(rc.data()['max_stream_id']) return self.ok() 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 1ed55e4c..33e958dd 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 @@ -90,7 +90,7 @@ class STLTXMultiBurst(STLTXMode): class STLStream(object): def __init__ (self, - name = random_name(8), + name = None, packet = None, mode = STLTXCont(1), enabled = True, @@ -120,7 +120,7 @@ class STLStream(object): raise STLError("continuous stream cannot have a next stream ID") # tag for the stream and next - can be anything - self.name = name + self.name = name if name else random_name(8) self.next = next self.set_id(stream_id) @@ -179,7 +179,15 @@ class STLStream(object): def to_yaml (self): return {'name': self.name, 'stream': self.fields} + def dump_to_yaml (self, yaml_file = None): + yaml_dump = yaml.dump([self.to_yaml()], default_flow_style = False) + + # write to file if provided + if yaml_file: + with open(yaml_file, 'w') as f: + f.write(yaml_dump) + return yaml_dump class YAMLLoader(object): @@ -303,7 +311,7 @@ class STLProfile(object): streams = [streams] if not all([isinstance(stream, STLStream) for stream in streams]): - raise STLArgumentError('streams', streams) + raise STLArgumentError('streams', streams, valid_values = STLStream) self.streams = streams |