summaryrefslogtreecommitdiffstats
path: root/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_sim.py
diff options
context:
space:
mode:
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