summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorimarom <imarom@cisco.com>2016-01-26 09:53:21 -0500
committerimarom <imarom@cisco.com>2016-01-26 09:53:21 -0500
commitdb6254e3c59ef887ff41ff2aff44349010bd6bad (patch)
tree358193ec39ef4c6b1f404795f2dce71799c750c7 /scripts
parent2828fc9aab33b742c59a499dbf06ea2239ec6220 (diff)
packet is now base64 encoded
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/automation/trex_control_plane/client/trex_stateless_client.py5
-rw-r--r--scripts/automation/trex_control_plane/client/trex_stateless_sim.py2
-rwxr-xr-xscripts/automation/trex_control_plane/client_utils/jsonrpc_client.py7
-rwxr-xr-xscripts/automation/trex_control_plane/client_utils/packet_builder.py10
4 files changed, 14 insertions, 10 deletions
diff --git a/scripts/automation/trex_control_plane/client/trex_stateless_client.py b/scripts/automation/trex_control_plane/client/trex_stateless_client.py
index 886edb61..65e69938 100755
--- a/scripts/automation/trex_control_plane/client/trex_stateless_client.py
+++ b/scripts/automation/trex_control_plane/client/trex_stateless_client.py
@@ -636,20 +636,19 @@ class STLClient(object):
self.connected = False
# connect sync channel
- self.logger.pre_cmd("connecting to RPC server on {0}:{1}".format(self.connection_info['server'], self.connection_info['sync_port']))
+ self.logger.pre_cmd("Connecting to RPC server on {0}:{1}".format(self.connection_info['server'], self.connection_info['sync_port']))
rc = self.comm_link.connect()
self.logger.post_cmd(rc)
if not rc:
return rc
-
-
# version
rc = self._transmit("get_version")
if not rc:
return rc
+
self.server_version = rc.data()
self.global_stats.server_version = rc.data()
diff --git a/scripts/automation/trex_control_plane/client/trex_stateless_sim.py b/scripts/automation/trex_control_plane/client/trex_stateless_sim.py
index 3196c666..a8f24d65 100644
--- a/scripts/automation/trex_control_plane/client/trex_stateless_sim.py
+++ b/scripts/automation/trex_control_plane/client/trex_stateless_sim.py
@@ -247,7 +247,7 @@ def setParserOptions():
parser.add_argument('-m', '--multiplier',
help = parsing_opts.match_multiplier_help,
dest = 'mult',
- default = {'type':'raw', 'value':1, 'op': 'abs'},
+ default = "1",
type = parsing_opts.match_multiplier_strict)
group = parser.add_mutually_exclusive_group()
diff --git a/scripts/automation/trex_control_plane/client_utils/jsonrpc_client.py b/scripts/automation/trex_control_plane/client_utils/jsonrpc_client.py
index 05a32bc4..9c351175 100755
--- a/scripts/automation/trex_control_plane/client_utils/jsonrpc_client.py
+++ b/scripts/automation/trex_control_plane/client_utils/jsonrpc_client.py
@@ -81,7 +81,7 @@ class JsonRpcClient(object):
return pretty_str
def verbose_msg (self, msg):
- self.logger.log("[verbose] " + msg, level = self.logger.VERBOSE_HIGH)
+ self.logger.log("\n\n[verbose] " + msg, level = self.logger.VERBOSE_HIGH)
# batch messages
@@ -215,6 +215,11 @@ class JsonRpcClient(object):
self.connected = True
+ rc = self.invoke_rpc_method('ping')
+ if not rc:
+ self.connected = False
+ return rc
+
return RC_OK()
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 fe96789e..c7d3308e 100755
--- a/scripts/automation/trex_control_plane/client_utils/packet_builder.py
+++ b/scripts/automation/trex_control_plane/client_utils/packet_builder.py
@@ -12,7 +12,7 @@ import re
import itertools
from abc import ABCMeta, abstractmethod
from collections import namedtuple
-
+import base64
class CTRexPktBuilder(object):
"""
@@ -332,6 +332,7 @@ class CTRexPktBuilder(object):
def load_packet_from_byte_list(self, byte_list):
# convert byte array into buffer
+ byte_list = [ord(c) for c in base64.b64decode(byte_list)]
buf = struct.pack('B'*len(byte_list), *byte_list)
# thn, load it based on dpkt parsing
@@ -480,11 +481,10 @@ class CTRexPktBuilder(object):
"""
if self._packet is None:
raise CTRexPktBuilder.EmptyPacketError()
- pkt_in_hex = binascii.hexlify(str(self._packet))
- return {"binary": [int(pkt_in_hex[i:i+2], 16)
- for i in range(0, len(pkt_in_hex), 2)],
+
+ return {"binary": base64.b64encode(str(self._packet)),
"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):
"""