aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/python/TrafficScriptExecutor.py
diff options
context:
space:
mode:
authorPeter Mikus <pmikus@cisco.com>2018-04-25 08:36:52 +0200
committerPeter Mikus <pmikus@cisco.com>2018-04-25 08:10:04 +0000
commitd1d8f2b387d3fd625ac98bc5bc37ff344b98ead8 (patch)
tree7f72d5b8523d9df358b6e59f8461a911a2a71d5b /resources/libraries/python/TrafficScriptExecutor.py
parentd420e98c6838831877f1aad6aa924844fc009195 (diff)
FIX: SSH socket reading error
Currently if the command timeouts due to the nature of script execution we are trying to again read from socket after timeout on seesion expired. This patch is supposed to fix the behaviour and eliminate the second read from channel after it was cloed. Change-Id: Ib0028e901eb6ff4d10ca77d2ea19f9e770e6cef4 Signed-off-by: Peter Mikus <pmikus@cisco.com>
Diffstat (limited to 'resources/libraries/python/TrafficScriptExecutor.py')
-rw-r--r--resources/libraries/python/TrafficScriptExecutor.py10
1 files changed, 2 insertions, 8 deletions
diff --git a/resources/libraries/python/TrafficScriptExecutor.py b/resources/libraries/python/TrafficScriptExecutor.py
index 58d48d3ca9..13696dee8d 100644
--- a/resources/libraries/python/TrafficScriptExecutor.py
+++ b/resources/libraries/python/TrafficScriptExecutor.py
@@ -13,8 +13,6 @@
"""Traffic script executor library."""
-from robot.api import logger
-
from resources.libraries.python.constants import Constants
from resources.libraries.python.ssh import SSH
@@ -55,7 +53,6 @@ class TrafficScriptExecutor(object):
:raises RuntimeError: ARP reply timeout.
:raises RuntimeError: Traffic script execution failed.
"""
- logger.trace("{}".format(timeout))
ssh = SSH()
ssh.connect(node)
cmd = ("cd {}; " +
@@ -65,12 +62,9 @@ class TrafficScriptExecutor(object):
"resources/traffic_scripts/{} {}") \
.format(Constants.REMOTE_FW_DIR, script_file_name,
script_args)
- (ret_code, stdout, stderr) = ssh.exec_command_sudo(
- 'sh -c "{}"'.format(TrafficScriptExecutor._escape(cmd)),
+ ret_code, stdout, stderr = ssh.exec_command_sudo(
+ 'sh -c "{cmd}"'.format(cmd=TrafficScriptExecutor._escape(cmd)),
timeout=timeout)
- logger.debug("stdout: {}".format(stdout))
- logger.debug("stderr: {}".format(stderr))
- logger.debug("ret_code: {}".format(ret_code))
if ret_code != 0:
if "RuntimeError: ICMP echo Rx timeout" in stderr:
raise RuntimeError("ICMP echo Rx timeout")