Use SSH_PORT/HTTPS_PORT in basic functions
- In order to improve the code base's ability to run with simulated
machines, specified SSH_PORT and HTTPS_PORT in basic functions that
communicate with the OBMC machine.
- Also adjusted some calls to set or pass SSH_PORT and HTTPS_PORT.
Change-Id: If3a8b317eda80ac9c071c51084ede20ce3023484
Signed-off-by: Michael Walsh <micwalsh@us.ibm.com>
diff --git a/lib/bmc_redfish_resource.robot b/lib/bmc_redfish_resource.robot
index ef38830..3fd13ac 100644
--- a/lib/bmc_redfish_resource.robot
+++ b/lib/bmc_redfish_resource.robot
@@ -3,7 +3,7 @@
Resource resource.robot
Resource rest_response_code.robot
-Library bmc_redfish.py https://${OPENBMC_HOST} ${OPENBMC_USERNAME}
+Library bmc_redfish.py https://${OPENBMC_HOST}:${HTTPS_PORT} ${OPENBMC_USERNAME}
... ${OPENBMC_PASSWORD} WITH NAME Redfish
Library bmc_redfish_utils.py WITH NAME redfish_utils
Library disable_warning_urllib.py
diff --git a/lib/bmc_ssh_utils.py b/lib/bmc_ssh_utils.py
index f5759fe..f9aaeb6 100755
--- a/lib/bmc_ssh_utils.py
+++ b/lib/bmc_ssh_utils.py
@@ -43,6 +43,7 @@
# Get global BMC variable values.
openbmc_host = BuiltIn().get_variable_value("${OPENBMC_HOST}", default="")
+ ssh_port = BuiltIn().get_variable_value("${SSH_PORT}", default="22")
openbmc_username = BuiltIn().get_variable_value("${OPENBMC_USERNAME}",
default="")
openbmc_password = BuiltIn().get_variable_value("${OPENBMC_PASSWORD}",
@@ -54,9 +55,11 @@
return "", "", 1
if not gv.valid_value(openbmc_password):
return "", "", 1
+ if not gv.valid_value(ssh_port):
+ return "", "", 1
open_connection_args = {'host': openbmc_host, 'alias': 'bmc_connection',
- 'timeout': '25.0', 'prompt': '# '}
+ 'timeout': '25.0', 'prompt': '# ', 'port': ssh_port}
login_args = {'username': openbmc_username, 'password': openbmc_password}
return grs.execute_ssh_command(cmd_buf, open_connection_args, login_args,
diff --git a/lib/openbmctool_utils.py b/lib/openbmctool_utils.py
index 17595c4..7f98963 100755
--- a/lib/openbmctool_utils.py
+++ b/lib/openbmctool_utils.py
@@ -63,6 +63,7 @@
# Get global BMC variable values.
openbmc_host = BuiltIn().get_variable_value("${OPENBMC_HOST}", default="")
+ https_port = BuiltIn().get_variable_value("${HTTPS_PORT}", default="443")
openbmc_username = BuiltIn().get_variable_value("${OPENBMC_USERNAME}",
default="")
openbmc_password = BuiltIn().get_variable_value("${OPENBMC_PASSWORD}",
@@ -73,6 +74,8 @@
return "", "", 1
if not gv.valid_value(openbmc_password):
return "", "", 1
+ if not gv.valid_value(https_port):
+ return "", "", 1
# Break the caller's command up into separate piped commands. For
# example, the user may have specified "fru status | head -n 2" which
@@ -87,7 +90,7 @@
" has been logged out'")
command_string = "set -o pipefail ; python3 $(which openbmctool.py) -H "\
- + openbmc_host + " -U " + openbmc_username + " -P " + openbmc_password\
+ + openbmc_host + ":" + https_port + " -U " + openbmc_username + " -P " + openbmc_password\
+ " " + " ".join(pipeline)
return gc.shell_cmd(command_string, *args, **kwargs)