Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions data/variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@

from robot.libraries.BuiltIn import BuiltIn

BMC_ID = BuiltIn().get_variable_value("${BMC_ID}", default="bmc")
SYSTEM_ID = BuiltIn().get_variable_value("${SYSTEM_ID}", default="system")
CHASSIS_ID = BuiltIn().get_variable_value("${CHASSIS_ID}", default="chassis")
BMC_ID = BuiltIn().get_variable_value("${BMC_ID}", "bmc")
SYSTEM_ID = BuiltIn().get_variable_value("${SYSTEM_ID}", "system")
CHASSIS_ID = BuiltIn().get_variable_value("${CHASSIS_ID}", "chassis")

# Logging URI variables
REDFISH_BMC_LOGGING_ENTRY = (
Expand Down
2 changes: 1 addition & 1 deletion lib/bmc_redfish_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
MTLS_ENABLED = BuiltIn().get_variable_value("${MTLS_ENABLED}")
host = BuiltIn().get_variable_value("${BMC_HOST}")

BMC_ID = BuiltIn().get_variable_value("${BMC_ID}", default="bmc")
BMC_ID = BuiltIn().get_variable_value("${BMC_ID}", "bmc")


class bmc_redfish_utils(object):
Expand Down
52 changes: 18 additions & 34 deletions lib/bmc_ssh_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,10 @@ def bmc_execute_command(
"""

# Get global BMC variable values.
bmc_host = BuiltIn().get_variable_value("${BMC_HOST}", default="")
ssh_port = BuiltIn().get_variable_value("${SSH_PORT}", default="22")
bmc_username = BuiltIn().get_variable_value(
"${BMC_USERNAME}", default=""
)
bmc_password = BuiltIn().get_variable_value(
"${BMC_PASSWORD}", default=""
)
bmc_host = BuiltIn().get_variable_value("${BMC_HOST}", "")
ssh_port = BuiltIn().get_variable_value("${SSH_PORT}", "22")
bmc_username = BuiltIn().get_variable_value("${BMC_USERNAME}", "")
bmc_password = BuiltIn().get_variable_value("${BMC_PASSWORD}", "")

if not gv.valid_value(bmc_host):
return "", "", 1
Expand All @@ -88,9 +84,9 @@ def bmc_execute_command(
}
login_args = {"username": bmc_username, "password": bmc_password}

bmc_user_type = os.environ.get(
"USER_TYPE", ""
) or BuiltIn().get_variable_value("${USER_TYPE}", default="")
bmc_user_type = os.environ.get("USER_TYPE", "") or BuiltIn().get_variable_value(
"${USER_TYPE}", ""
)
if bmc_user_type == "sudo":
cmd_buf = "sudo -i " + cmd_buf
return grs.execute_ssh_command(
Expand Down Expand Up @@ -146,15 +142,11 @@ def os_execute_command(

# Get global OS variable values.
if os_host == "":
os_host = BuiltIn().get_variable_value("${OS_HOST}", default="")
os_host = BuiltIn().get_variable_value("${OS_HOST}", "")
if os_username == "":
os_username = BuiltIn().get_variable_value(
"${OS_USERNAME}", default=""
)
os_username = BuiltIn().get_variable_value("${OS_USERNAME}", "")
if os_password == "":
os_password = BuiltIn().get_variable_value(
"${OS_PASSWORD}", default=""
)
os_password = BuiltIn().get_variable_value("${OS_PASSWORD}", "")

if not gv.valid_value(os_host):
return "", "", 1
Expand Down Expand Up @@ -212,14 +204,10 @@ def xcat_execute_command(
"""

# Get global XCAT variable values.
xcat_host = BuiltIn().get_variable_value("${XCAT_HOST}", default="")
xcat_username = BuiltIn().get_variable_value(
"${XCAT_USERNAME}", default=""
)
xcat_password = BuiltIn().get_variable_value(
"${XCAT_PASSWORD}", default=""
)
xcat_port = BuiltIn().get_variable_value("${XCAT_PORT}", default="22")
xcat_host = BuiltIn().get_variable_value("${XCAT_HOST}", "")
xcat_username = BuiltIn().get_variable_value("${XCAT_USERNAME}", "")
xcat_password = BuiltIn().get_variable_value("${XCAT_PASSWORD}", "")
xcat_port = BuiltIn().get_variable_value("${XCAT_PORT}", "22")

if not gv.valid_value(xcat_host):
return "", "", 1
Expand Down Expand Up @@ -276,14 +264,10 @@ def device_write(cmd_buf, print_out=0, quiet=None, test_mode=None):
"""

# Get global DEVICE variable values.
device_host = BuiltIn().get_variable_value("${DEVICE_HOST}", default="")
device_username = BuiltIn().get_variable_value(
"${DEVICE_USERNAME}", default=""
)
device_password = BuiltIn().get_variable_value(
"${DEVICE_PASSWORD}", default=""
)
device_port = BuiltIn().get_variable_value("${DEVICE_PORT}", default="22")
device_host = BuiltIn().get_variable_value("${DEVICE_HOST}", "")
device_username = BuiltIn().get_variable_value("${DEVICE_USERNAME}", "")
device_password = BuiltIn().get_variable_value("${DEVICE_PASSWORD}", "")
device_port = BuiltIn().get_variable_value("${DEVICE_PORT}", "22")

if not gv.valid_value(device_host):
return "", "", 1
Expand Down
2 changes: 1 addition & 1 deletion lib/ipmi_shell_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
},
}

IPMI_CMD = BuiltIn().get_variable_value("${IPMI_INBAND_CMD}", default="ipmitool")
IPMI_CMD = BuiltIn().get_variable_value("${IPMI_INBAND_CMD}", "ipmitool")

def get_system_interface_capabilities():
r"""
Expand Down
10 changes: 5 additions & 5 deletions lib/obmc_boot_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
pgm_name = re.sub("\\.py$", "", os.path.basename(__file__))

# Set up boot data structures.
os_host = BuiltIn().get_variable_value("${OS_HOST}", default="")
os_host = BuiltIn().get_variable_value("${OS_HOST}", "")

boot_lists = read_boot_lists()

Expand All @@ -81,16 +81,16 @@

boot_success = 0

status_dir_path = os.environ.get(
"STATUS_DIR_PATH", ""
) or BuiltIn().get_variable_value("${STATUS_DIR_PATH}", default="")
status_dir_path = os.environ.get("STATUS_DIR_PATH", "") or BuiltIn().get_variable_value(
"${STATUS_DIR_PATH}", ""
)
if status_dir_path != "":
status_dir_path = os.path.normpath(status_dir_path) + os.sep
# For plugin expecting env gen_call_robot.py
os.environ["STATUS_DIR_PATH"] = status_dir_path

redfish_delete_sessions = int(
BuiltIn().get_variable_value("${REDFISH_DELETE_SESSIONS}", default=1)
BuiltIn().get_variable_value("${REDFISH_DELETE_SESSIONS}", 1)
)

redfish = BuiltIn().get_library_instance("redfish")
Expand Down
6 changes: 2 additions & 4 deletions lib/redfish_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,8 @@ def form_url(url):
url Url passed by user e.g. /redfish/v1/Systems/${SYSTEM_ID}.
"""

bmc_host = BuiltIn().get_variable_value(
"${BMC_HOST}", default=""
)
https_port = BuiltIn().get_variable_value("${HTTPS_PORT}", default="")
bmc_host = BuiltIn().get_variable_value("${BMC_HOST}", "")
https_port = BuiltIn().get_variable_value("${HTTPS_PORT}", "")
form_url = (
"https://" + str(bmc_host) + ":" + str(https_port) + str(url)
)
Expand Down