# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
:raises RuntimeError: TCP/UDP Rx timeout.
:raises RuntimeError: ARP reply timeout.
:raises RuntimeError: Traffic script execution failed.
"""
:raises RuntimeError: TCP/UDP Rx timeout.
:raises RuntimeError: ARP reply timeout.
:raises RuntimeError: Traffic script execution failed.
"""
"export PYTHONPATH=${{PWD}}; " +
". ${{PWD}}/env/bin/activate; " +
"resources/traffic_scripts/{} {}") \
.format(Constants.REMOTE_FW_DIR, script_file_name,
script_args)
"export PYTHONPATH=${{PWD}}; " +
". ${{PWD}}/env/bin/activate; " +
"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)),
if ret_code != 0:
if "RuntimeError: ICMP echo Rx timeout" in stderr:
raise RuntimeError("ICMP echo Rx timeout")
elif "RuntimeError: DHCP REQUEST Rx timeout" in stderr:
raise RuntimeError("DHCP REQUEST Rx timeout")
if ret_code != 0:
if "RuntimeError: ICMP echo Rx timeout" in stderr:
raise RuntimeError("ICMP echo Rx timeout")
elif "RuntimeError: DHCP REQUEST Rx timeout" in stderr:
raise RuntimeError("DHCP REQUEST Rx timeout")
elif "RuntimeError: TCP/UDP Rx timeout" in stderr:
raise RuntimeError("TCP/UDP Rx timeout")
elif "Error occurred: ARP reply timeout" in stdout:
raise RuntimeError("ARP reply timeout")
elif "RuntimeError: TCP/UDP Rx timeout" in stderr:
raise RuntimeError("TCP/UDP Rx timeout")
elif "Error occurred: ARP reply timeout" in stdout:
raise RuntimeError("ARP reply timeout")