summaryrefslogtreecommitdiffstats
path: root/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_jsonrpc_client.py
diff options
context:
space:
mode:
authorYaroslav Brustinov <ybrustin@cisco.com>2016-12-11 10:30:22 +0200
committerYaroslav Brustinov <ybrustin@cisco.com>2016-12-11 10:30:22 +0200
commit266ac2d8209e9f63170e3ff32eefb331fca53300 (patch)
tree73cb1752586797b1a542f2870a3e4f7baa83ad02 /scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_jsonrpc_client.py
parent392ca5baf8c50c90e656981bde1571feaebc7a5a (diff)
STL API: fix split batch to chunks - one packet not being sent
Change-Id: Id2e96f2fe6a6c1bb0438198675a61f3c73d53072 Signed-off-by: Yaroslav Brustinov <ybrustin@cisco.com>
Diffstat (limited to 'scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_jsonrpc_client.py')
-rw-r--r--scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_jsonrpc_client.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_jsonrpc_client.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_jsonrpc_client.py
index fbad9f7f..51e93f5a 100644
--- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_jsonrpc_client.py
+++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_jsonrpc_client.py
@@ -41,10 +41,9 @@ class BatchMessage(object):
size = 0
new_batch = []
for msg in self.batch_list:
- if size < chunk_size:
- size += len(json.dumps(msg))
- new_batch.append(msg)
- else:
+ size += len(json.dumps(msg))
+ new_batch.append(msg)
+ if size > chunk_size:
batch_json = json.dumps(new_batch)
response = self.rpc_client.send_msg(batch_json)
if not response: