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/bin/plug_ins/Auto_reboot/cp_master b/bin/plug_ins/Auto_reboot/cp_master
index 50b3f42..c1cf6ed 100755
--- a/bin/plug_ins/Auto_reboot/cp_master
+++ b/bin/plug_ins/Auto_reboot/cp_master
@@ -109,11 +109,9 @@
print_var(enable_auto_reboot)
keyword_string = "Set Auto Reboot ${%i}" % enable_auto_reboot
- cmd_buf = create_robot_cmd_string("extended/run_keyword.robot",
- OPENBMC_HOST, REST_USERNAME,
- REST_PASSWORD, keyword_string,
- lib_file_path, quiet, test_mode, debug,
- outputdir, output, log, report)
+ cmd_buf = create_robot_cmd_string("extended/run_keyword.robot", OPENBMC_HOST, SSH_PORT, HTTPS_PORT,
+ REST_USERNAME, REST_PASSWORD, keyword_string, lib_file_path, quiet,
+ test_mode, debug, outputdir, output, log, report)
if not robot_cmd_fnc(cmd_buf):
print_error_report("Robot command execution failed.")
exit(1)
diff --git a/bin/plug_ins/Stop/cp_stop_check b/bin/plug_ins/Stop/cp_stop_check
index efbc733..5cad089 100755
--- a/bin/plug_ins/Stop/cp_stop_check
+++ b/bin/plug_ins/Stop/cp_stop_check
@@ -132,11 +132,9 @@
interval + " quiet=${1} ; Rpvar state"
set_mod_global(keyword_string)
- cmd_buf = create_robot_cmd_string("extended/run_keyword.robot",
- OPENBMC_HOST, REST_USERNAME,
- REST_PASSWORD, keyword_string,
- lib_file_path, quiet, test_mode, debug,
- outputdir, output, log, report, loglevel)
+ cmd_buf = create_robot_cmd_string("extended/run_keyword.robot", OPENBMC_HOST, SSH_PORT, HTTPS_PORT,
+ REST_USERNAME, REST_PASSWORD, keyword_string, lib_file_path, quiet,
+ test_mode, debug, outputdir, output, log, report, loglevel)
if not robot_cmd_fnc(cmd_buf):
print_timen("The caller wishes to stop test execution if REST" +
" commands are failing.")
diff --git a/extended/obmc_boot_test_resource.robot b/extended/obmc_boot_test_resource.robot
index de35f5d..45b655d 100644
--- a/extended/obmc_boot_test_resource.robot
+++ b/extended/obmc_boot_test_resource.robot
@@ -12,7 +12,7 @@
# Initialize program parameters variables.
# Create parm_list containing all of our program parameters. This is used by
# 'Rqprint Pgm Header'
-@{parm_list} openbmc_nickname openbmc_host openbmc_username
+@{parm_list} openbmc_nickname ssh_port https_port openbmc_host openbmc_username
... openbmc_password rest_username rest_password ipmi_username
... ipmi_password os_host os_username os_password pdu_host pdu_username
... pdu_password pdu_slot_no openbmc_serial_host openbmc_serial_port
@@ -24,6 +24,8 @@
# Initialize each program parameter.
${openbmc_host} ${EMPTY}
+${ssh_port} 22
+${https_port} 443
${openbmc_nickname} ${openbmc_host}
${openbmc_username} root
${openbmc_password} 0penBmc
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)