diff options
author | Dan Klein <danklei@cisco.com> | 2015-10-18 16:12:26 +0300 |
---|---|---|
committer | Dan Klein <danklei@cisco.com> | 2015-10-18 16:12:40 +0300 |
commit | 80bd7895112cba0b3cbb6d56995def6ffbdccf33 (patch) | |
tree | fe212025be5db80477ccf0ea4c17f0de11989c16 /scripts/automation/trex_control_plane/client_utils | |
parent | 4a8d34c7548e85e97426bc1d85c670003b1f5870 (diff) |
Progress in trex_streams and in yaml_utils.
Next, start working on StreamList object
Diffstat (limited to 'scripts/automation/trex_control_plane/client_utils')
-rwxr-xr-x | scripts/automation/trex_control_plane/client_utils/packet_builder.py | 6 | ||||
-rwxr-xr-x | scripts/automation/trex_control_plane/client_utils/yaml_utils.py | 3 |
2 files changed, 6 insertions, 3 deletions
diff --git a/scripts/automation/trex_control_plane/client_utils/packet_builder.py b/scripts/automation/trex_control_plane/client_utils/packet_builder.py index c687126b..caa6eab3 100755 --- a/scripts/automation/trex_control_plane/client_utils/packet_builder.py +++ b/scripts/automation/trex_control_plane/client_utils/packet_builder.py @@ -33,6 +33,7 @@ class CTRexPktBuilder(object): self._max_pkt_size = max_pkt_size self.payload_gen = CTRexPktBuilder.CTRexPayloadGen(self._packet, self._max_pkt_size) self.vm = CTRexPktBuilder.CTRexVM() + self.metadata = "" def add_pkt_layer(self, layer_name, pkt_layer): """ @@ -441,8 +442,9 @@ class CTRexPktBuilder(object): if self._packet is None: raise CTRexPktBuilder.EmptyPacketError() pkt_in_hex = binascii.hexlify(str(self._packet)) - return [int(pkt_in_hex[i:i+2], 16) - for i in range(0, len(pkt_in_hex), 2)] + return {"binary": [int(pkt_in_hex[i:i+2], 16) + for i in range(0, len(pkt_in_hex), 2)], + "meta": self.metadata} # return [pkt_in_hex[i:i+2] for i in range(0, len(pkt_in_hex), 2)] def dump_pkt_to_pcap(self, file_path, ts=None): diff --git a/scripts/automation/trex_control_plane/client_utils/yaml_utils.py b/scripts/automation/trex_control_plane/client_utils/yaml_utils.py index 0d808880..024b73c2 100755 --- a/scripts/automation/trex_control_plane/client_utils/yaml_utils.py +++ b/scripts/automation/trex_control_plane/client_utils/yaml_utils.py @@ -77,7 +77,8 @@ class CTRexYAMLLoader(object): if isinstance(evaluated_obj, dict) and evaluated_obj.keys() == [root_obj]: evaluated_obj = evaluated_obj.get(root_obj) if not self.ref_obj: - self.ref_obj = load_yaml_to_obj(self.yaml_path) # load reference object to class attribute. + self.ref_obj = load_yaml_to_any_obj(self.yaml_path) + # self.load_reference() ref_item = self.ref_obj.get(root_obj) if ref_item is not None: try: |