summaryrefslogtreecommitdiffstats
path: root/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_sim.py
diff options
context:
space:
mode:
authorimarom <imarom@cisco.com>2016-02-15 03:12:29 -0500
committerimarom <imarom@cisco.com>2016-02-15 07:11:26 -0500
commitec369cd722a400130b9b754c2c965ec60beb9d56 (patch)
tree0b6f3bcaaa957983fd148548f09bd1ae4b900cfd /scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_sim.py
parent1f60016f591ebd2e260e501c8c5da10c11d0c7ad (diff)
many bugs uncovered by the PCAP injection:
1. NamedTuple constructor 2. Scappy 3. zlib for server
Diffstat (limited to 'scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_sim.py')
-rw-r--r--scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_sim.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_sim.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_sim.py
index 4d720aac..086e46af 100644
--- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_sim.py
+++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_sim.py
@@ -27,7 +27,8 @@ from trex_stl_client import STLClient
import re
import json
-
+import zlib
+import struct
import argparse
@@ -221,7 +222,12 @@ class STLSim(object):
# write to temp file
f = tempfile.NamedTemporaryFile(delete = False)
- f.write(json.dumps(cmds_json))
+
+ msg = json.dumps(cmds_json)
+ compressed = zlib.compress(msg)
+ new_msg = struct.pack(">II", 0xABE85CEA, len(msg)) + compressed
+
+ f.write(new_msg)
f.close()
# launch bp-sim