openbmctool deprecated code support removal
Changes:
- Remove openbmctool related codes from repository
Tested:
- For sanity, ran from sandbox HW CI test bucket
Change-Id: I0a5e3db2bcbcdbc9680dfd69743f1d397a1f08b3
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/lib/gen_call_robot.py b/lib/gen_call_robot.py
index e873c52..91231bf 100755
--- a/lib/gen_call_robot.py
+++ b/lib/gen_call_robot.py
@@ -164,22 +164,10 @@
# Use to the apollo dir path.
ROBOT_TEST_BASE_DIR_PATH = apollo_dir_path + suffix
- OBMC_TOOLS_BASE_DIR_PATH = (
- os.path.dirname(ROBOT_TEST_BASE_DIR_PATH.rstrip("/"))
- + "/openbmc-tools/"
- )
- OPENBMCTOOL_DIR_PATH = OBMC_TOOLS_BASE_DIR_PATH + "openbmctool/"
- JSON_CHECKER_TOOLS_DIR_PATH = (
- OBMC_TOOLS_BASE_DIR_PATH + "expectedJsonChecker/"
- )
-
gv.valid_value(ROBOT_TEST_BASE_DIR_PATH)
gp.dprint_vars(
ROBOT_TEST_RUNNING_FROM_SB,
ROBOT_TEST_BASE_DIR_PATH,
- OBMC_TOOLS_BASE_DIR_PATH,
- OPENBMCTOOL_DIR_PATH,
- JSON_CHECKER_TOOLS_DIR_PATH,
)
gv.valid_dir_path(ROBOT_TEST_BASE_DIR_PATH)
@@ -190,17 +178,6 @@
gm.set_mod_global(ROBOT_TEST_RUNNING_FROM_SB)
os.environ["ROBOT_TEST_RUNNING_FROM_SB"] = str(ROBOT_TEST_RUNNING_FROM_SB)
- gm.set_mod_global(OBMC_TOOLS_BASE_DIR_PATH)
- os.environ["OBMC_TOOLS_BASE_DIR_PATH"] = str(OBMC_TOOLS_BASE_DIR_PATH)
-
- gm.set_mod_global(OPENBMCTOOL_DIR_PATH)
- os.environ["OPENBMCTOOL_DIR_PATH"] = str(OPENBMCTOOL_DIR_PATH)
-
- gm.set_mod_global(JSON_CHECKER_TOOLS_DIR_PATH)
- os.environ["JSON_CHECKER_TOOLS_DIR_PATH"] = str(
- JSON_CHECKER_TOOLS_DIR_PATH
- )
-
raw_robot_file_search_path = (
"${ROBOT_TEST_BASE_DIR_PATH}:"
@@ -467,7 +444,6 @@
ROBOT_TEST_RUNNING_FROM_SB = gm.get_mod_global(
"ROBOT_TEST_RUNNING_FROM_SB"
)
- OPENBMCTOOL_DIR_PATH = gm.get_mod_global("OPENBMCTOOL_DIR_PATH")
if robot_jail == "":
if ROBOT_TEST_RUNNING_FROM_SB:
@@ -511,7 +487,6 @@
"/usr/bin",
"/sbin",
"/bin",
- OPENBMCTOOL_DIR_PATH.rstrip("/"),
]
)
PATH = ":".join(NEW_PATH_LIST)
@@ -523,12 +498,7 @@
+ "lib"
)
PATH = (
- os.environ.get("PATH", "")
- + ":"
- + ROBOT_TEST_BASE_DIR_PATH
- + "bin"
- + ":"
- + OPENBMCTOOL_DIR_PATH.rstrip("/")
+ os.environ.get("PATH", "") + ":" + ROBOT_TEST_BASE_DIR_PATH + "bin"
)
os.environ["PYTHONPATH"] = PYTHONPATH
diff --git a/lib/openbmctool_utils.py b/lib/openbmctool_utils.py
deleted file mode 100755
index f89683d..0000000
--- a/lib/openbmctool_utils.py
+++ /dev/null
@@ -1,625 +0,0 @@
-#!/usr/bin/env python3
-
-r"""
-This module provides many valuable openbmctool.py functions such as
-openbmctool_execute_command.
-"""
-
-import collections
-import json
-import re
-import tempfile
-
-import gen_cmd as gc
-import gen_misc as gm
-import gen_print as gp
-import gen_valid as gv
-import utils as utils
-import var_funcs as vf
-from robot.libraries.BuiltIn import BuiltIn
-
-
-def openbmctool_execute_command(command_string, *args, **kwargs):
- r"""
- Run the command string as an argument to the openbmctool.py program and
- return the stdout and the return code.
-
- This function provides several benefits versus calling shell_cmd directly:
- - This function will obtain the global values for OPENBMC_HOST,
- OPENBMC_USERNAME, etc.
- - This function will compose the openbmctool.py command string which
- includes the caller's command_string.
- - The openbmctool.py produces additional text that clutters the output.
- This function will remove such text. Example:
- Attempting login...
- <actual output>
- User root has been logged out
-
- NOTE: If you have pipe symbols in your command_string, they must be
- surrounded by a single space on each side (see example below).
-
- Example code:
- ${rc} ${output}= Openbmctool Execute Command fru status | head -n 2
-
- Example output:
- #(CDT) 2018/09/19 15:16:58 - Issuing: set -o pipefail ; openbmctool.py -H hostname -U root -P ********
- ... fru status | tail -n +1 | egrep -v 'Attempting login|User [^ ]+ hasbeen logged out' | head -n 2
- Component | Is a FRU | Present | Functional | Has Logs
- cpu0 | Yes | Yes | Yes | No
-
- Description of arguments:
- command_string The command string to be passed to the
- openbmctool.py program.
- All remaining arguments are passed directly to shell_cmd. See the
- shell_cmd prolog for details on allowable arguments. The caller may code
- them directly as in this example:
- openbmctool_execute_command("my command", quiet=1, max_attempts=2).
- Python will do the work of putting these values into args/kwargs.
- """
-
- if not gv.valid_value(command_string):
- return "", "", 1
-
- # 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}", default=""
- )
- if not gv.valid_value(openbmc_host):
- return "", "", 1
- if not gv.valid_value(openbmc_username):
- 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
- # would be broken into 2 list elements. We will also break on ">"
- # (re-direct).
- pipeline = list(
- map(str.strip, re.split(r" ([\|>]) ", str(command_string)))
- )
- # The "tail" command below prevents a "egrep: write error: Broken pipe"
- # error if the user is piping the output to a sub-process.
- # Use "egrep -v" to get rid of editorial output from openbmctool.py.
- pipeline.insert(
- 1,
- (
- "| tail -n +1 | egrep -v 'Attempting login|User [^ ]+"
- " has been logged out'"
- ),
- )
-
- command_string = (
- "set -o pipefail ; python3 $(which openbmctool.py) -H "
- + openbmc_host
- + ":"
- + https_port
- + " -U "
- + openbmc_username
- + " -P "
- + openbmc_password
- + " "
- + " ".join(pipeline)
- )
-
- return gc.shell_cmd(command_string, *args, **kwargs)
-
-
-def openbmctool_execute_command_json(command_string, *args, **kwargs):
- r"""
- Run the command string as an argument to the openbmctool.py program, parse
- the JSON output into a dictionary and return the dictionary.
-
- This function is a wrapper for openbmctool_execute_command (defined
- above). The caller may provide any command string where the output will
- be JSON data. This function will convert the JSON data to a python
- object, verify that the 'status' field = "ok" and return the 'data'
- sub-field to the caller.
-
- See openbmctool_execute_command (above) for all field descriptions.
- """
-
- rc, output = openbmctool_execute_command(command_string, *args, **kwargs)
- try:
- json_object = utils.to_json_ordered(output)
- except json.JSONDecodeError:
- BuiltIn().fail(gp.sprint_error(output))
-
- if json_object["status"] != "ok":
- err_msg = "Error found in JSON data returned by the openbmctool.py "
- err_msg += "command. Expected a 'status' field value of \"ok\":\n"
- err_msg += gp.sprint_var(json_object, 1)
- BuiltIn().fail(gp.sprint_error(err_msg))
-
- return json_object["data"]
-
-
-def get_fru_status():
- r"""
- Get the fru status and return as a list of dictionaries.
-
- Example robot code:
-
- ${fru_status}= Get Fru Status
- Rprint Vars fru_status fmt=1
-
- Example result (excerpt):
-
- fru_status:
- fru_status[0]:
- [component]: cpu0
- [is_a]: Yes
- [fru]: Yes
- [present]: Yes
- [functional]: No
- fru_status[1]:
- [component]: cpu0-core0
- [is_a]: No
- [fru]: Yes
- [present]: Yes
- [functional]: No
- ...
- """
- rc, output = openbmctool_execute_command(
- "fru status", print_output=False, ignore_err=False
- )
- # Example value for output (partial):
- # Component | Is a FRU | Present | Functional | Has Logs
- # cpu0 | Yes | Yes | Yes | No
- # cpu0-core0 | No | Yes | Yes | No
- # ...
-
- # Replace spaces with underscores in field names (e.g. "Is a FRU" becomes
- # "Is_a_FRU").
- output = re.sub("([^ \\|])[ ]([^ ])", "\\1_\\2", output)
- output = re.sub("([^ \\|])[ ]([^ ])", "\\1_\\2", output)
-
- return vf.outbuf_to_report(output, field_delim="|")
-
-
-def get_fru_print(parse_json=True):
- r"""
- Get the output of the fru print command and return it either as raw JSON
- data or as a list of dictionaries.
-
- Example robot code:
-
- ${fru_print}= Get Fru Print parse_json=${False}
- Log to Console ${fru_print}
-
- Example result (excerpt):
-
- {
- "data": {
- "/xyz/openbmc_project/inventory/system": {
- "AssetTag": "",
- "BuildDate": "",
- "Cached": false,
- "FieldReplaceable": false,
- "Manufacturer": "",
- "Model": "xxxxxxxx",
- "PartNumber": "",
- "Present": true,
- "PrettyName": "",
- "SerialNumber": "13183FA"
- },
- "/xyz/openbmc_project/inventory/system/chassis": {
- "AirCooled": true,
- "WaterCooled": false
- },
- ...
-
- Example robot code:
-
- ${fru_print}= Get Fru Print
- Rprint Vars fru_print fmt=1
-
- Example result (excerpt):
-
- fru_print:
- fru_print[0]:
- [data]:
- [/xyz/openbmc_project/inventory/system]:
- [AssetTag]: <blank>
- [BuildDate]: <blank>
- [Cached]: False
- [FieldReplaceable]: False
- [Manufacturer]: <blank>
- [Model]: xxxxxxxx
- [PartNumber]: <blank>
- [Present]: True
- [PrettyName]: <blank>
- [SerialNumber]: 13183FA
- [/xyz/openbmc_project/inventory/system/chassis]:
- [AirCooled]: True
- [WaterCooled]: False
- ...
-
- Description of argument(s):
- parse_json Indicates that the raw JSON data should
- parsed into a list of dictionaries.
- """
-
- rc, output = openbmctool_execute_command(
- "fru print", print_output=False, ignore_err=False
- )
- if parse_json:
- return gm.json_loads_multiple(output)
- else:
- return output
-
-
-def get_fru_list(parse_json=True):
- r"""
- Get the output of the fru list command and return it either as raw JSON
- data or as a list of dictionaries.
-
- Example robot code:
-
- ${fru_list}= Get Fru List parse_json=${False}
- Log to Console ${fru_list}
-
- Example result (excerpt):
-
- {
- "data": {
- "/xyz/openbmc_project/inventory/system": {
- "AssetTag": "",
- "BuildDate": "",
- "Cached": false,
- "FieldReplaceable": false,
- "Manufacturer": "",
- "Model": "xxxxxxxx",
- "PartNumber": "",
- "Present": true,
- "PrettyName": "",
- "SerialNumber": "13183FA"
- },
- "/xyz/openbmc_project/inventory/system/chassis": {
- "AirCooled": true,
- "WaterCooled": false
- },
- ...
-
- Example robot code:
-
- ${fru_list}= Get Fru List
- Rprint Vars fru_list fmt=1
-
- Example result (excerpt):
-
- fru_list:
- fru_list[0]:
- [data]:
- [/xyz/openbmc_project/inventory/system]:
- [AssetTag]: <blank>
- [BuildDate]: <blank>
- [Cached]: False
- [FieldReplaceable]: False
- [Manufacturer]: <blank>
- [Model]: xxxxxxxx
- [PartNumber]: <blank>
- [Present]: True
- [PrettyName]: <blank>
- [SerialNumber]: 13183FA
- [/xyz/openbmc_project/inventory/system/chassis]:
- [AirCooled]: True
- [WaterCooled]: False
- ...
-
- Description of argument(s):
- parse_json Indicates that the raw JSON data should
- parsed into a list of dictionaries.
- """
-
- rc, output = openbmctool_execute_command(
- "fru list", print_output=False, ignore_err=False
- )
- if parse_json:
- return gm.json_loads_multiple(output)
- else:
- return output
-
-
-def get_sensors_print():
- r"""
- Get the output of the sensors print command and return as a list of
- dictionaries.
-
- Example robot code:
-
- ${sensors_print}= Get Sensors Print
- Rprint Vars sensors_print fmt=1
-
- Example result (excerpt):
-
- sensors_print:
- sensors_print[0]:
- [sensor]: OCC0
- [type]: Discrete
- [units]: N/A
- [value]: Active
- [target]: Active
- sensors_print[1]:
- [sensor]: OCC1
- [type]: Discrete
- [units]: N/A
- [value]: Active
- [target]: Active
- ...
- """
- rc, output = openbmctool_execute_command(
- "sensors print", print_output=False, ignore_err=False
- )
- # Example value for output (partial):
- # sensor | type | units | value | target
- # OCC0 | Discrete | N/A | Active | Active
- # OCC1 | Discrete | N/A | Active | Active
-
- return vf.outbuf_to_report(output, field_delim="|")
-
-
-def get_sensors_list():
- r"""
- Get the output of the sensors list command and return as a list of
- dictionaries.
-
- Example robot code:
-
- ${sensors_list}= Get Sensors List
- Rprint Vars sensors_list fmt=1
-
- Example result (excerpt):
-
- sensors_list:
- sensors_list[0]:
- [sensor]: OCC0
- [type]: Discrete
- [units]: N/A
- [value]: Active
- [target]: Active
- sensors_list[1]:
- [sensor]: OCC1
- [type]: Discrete
- [units]: N/A
- [value]: Active
- [target]: Active
- ...
- """
- rc, output = openbmctool_execute_command(
- "sensors list", print_output=False, ignore_err=False
- )
- # Example value for output (partial):
- # sensor | type | units | value | target
- # OCC0 | Discrete | N/A | Active | Active
- # OCC1 | Discrete | N/A | Active | Active
-
- return vf.outbuf_to_report(output, field_delim="|")
-
-
-def get_openbmctool_version():
- r"""
- Get the openbmctool.py version and return it.
-
- Example robot code:
- ${openbmctool_version}= Get Openbmctool Version
- Rprint Vars openbmctool_version
-
- Example result (excerpt):
- openbmctool_version: 1.06
- """
- rc, output = openbmctool_execute_command(
- "-V | cut -f 2 -d ' '", print_output=False, ignore_err=False
- )
- return output
-
-
-def service_data_files():
- r"""
- Return a complete list of file names that are expected to be created by
- the collect_service_data command.
- """
-
- return [
- "inventory.txt",
- "sensorReadings.txt",
- "ledStatus.txt",
- "SELshortlist.txt",
- "parsedSELs.txt",
- "bmcFullRaw.txt",
- ]
-
-
-def collect_service_data(verify=False):
- r"""
- Run the collect_service_data command and return a list of files generated
- by the command.
-
- Description of argument(s):
- verify If set, verify that all files which can be
- created by collect_service_data did, in
- fact, get created.
- """
-
- # Route the output of collect_service_data to a file for easier parsing.
- temp = tempfile.NamedTemporaryFile()
- temp_file_path = temp.name
- openbmctool_execute_command(
- "collect_service_data > " + temp_file_path, ignore_err=False
- )
- # Isolate the file paths in the collect_service_data output. We're
- # looking for output lines like this from which to extract the file paths:
- # Inventory collected and stored in /tmp/dummy--2018-09-26_17.59.18/inventory.txt
- rc, file_paths = gc.shell_cmd(
- "egrep 'collected and' " + temp_file_path
- # + " | sed -re 's#.*/tmp#/tmp#g'",
- + " | sed -re 's#[^/]*/#/#'",
- quiet=1,
- print_output=0,
- )
- # Example file_paths value:
- # /tmp/dummy--2018-09-26_17.59.18/inventory.txt
- # /tmp/dummy--2018-09-26_17.59.18/sensorReadings.txt
- # etc.
- # Convert from output to list.
- collect_service_data_file_paths = list(
- filter(None, file_paths.split("\n"))
- )
- if int(verify):
- # Create a list of files by stripping the dir names from the elements
- # of collect_service_data_file_paths.
- files_obtained = [
- re.sub(r".*/", "", file_path)
- for file_path in collect_service_data_file_paths
- ]
- files_expected = service_data_files()
- files_missing = list(set(files_expected) - set(files_obtained))
- if len(files_missing) > 0:
- gp.printn(
- "collect_service_data output:\n"
- + gm.file_to_str(temp_file_path)
- )
- err_msg = "The following files are missing from the list of files"
- err_msg += " returned by collect_service_data:\n"
- err_msg += gp.sprint_var(files_missing)
- err_msg += gp.sprint_var(collect_service_data_file_paths)
- BuiltIn().fail(gp.sprint_error(err_msg))
-
- return collect_service_data_file_paths
-
-
-def health_check_fields():
- r"""
- Return a complete list of field names returned by the health_check command.
- """
-
- return ["hardware_status", "performance"]
-
-
-def get_health_check(verify=False):
- r"""
- Get the health_check information and return as a dictionary.
-
- Example robot code:
-
- ${health_check}= Get Health Check
- Rprint Vars health_check fmt=1
-
- Example result:
-
- health_check:
- [hardware_status]: OK
- [performance]: OK
-
- Description of argument(s):
- verify If set, verify that all all expected
- field_names are generated by the
- health_check command.
- """
-
- rc, output = openbmctool_execute_command(
- "health_check", print_output=False, ignore_err=False
- )
- health_check = vf.key_value_outbuf_to_dict(output, delim=":")
- if int(verify):
- err_msg = gv.valid_dict(health_check, health_check_fields())
- if err_msg != "":
- BuiltIn().fail(gp.sprint_error(err_msg))
-
- return health_check
-
-
-def remote_logging_view_fields():
- r"""
- Return a complete list of field names returned by the logging
- remote_logging view command.
- """
-
- return ["Address", "Port"]
-
-
-def get_remote_logging_view(verify=False):
- r"""
- Get the remote_logging view information and return as a dictionary.
-
- Example robot code:
-
- ${remote_logging_view}= Get Remote Logging View
- Rprint Vars remote_logging_view fmt=1
-
- Example result:
-
- remote_logging_view:
- [Address]: <blank>
- [AddressFamily]: xyz.openbmc_project.Network.Client.IPProtocol.IPv4
- [Port]: 0
-
- Description of argument(s):
- verify If set, verify that all all expected field
- names are generated by the 'logging
- remote_logging view' command.
- """
-
- remote_logging_view = openbmctool_execute_command_json(
- "logging remote_logging view", print_output=False, ignore_err=False
- )
-
- if int(verify):
- err_msg = gv.valid_dict(
- remote_logging_view, remote_logging_view_fields()
- )
- if err_msg != "":
- BuiltIn().fail(gp.sprint_error(err_msg))
-
- return remote_logging_view
-
-
-def network(sub_command, **options):
- r"""
- Run an openbmctool.py network command and return the results as a dictionary.
-
- Note that any valid network argument may be specified as a function argument.
-
- Example robot code:
-
- ${ip_records}= Network getIP I=eth0
- Rprint Vars ip_records
-
- Resulting output:
-
- ip_records:
- [/xyz/openbmc_project/network/eth0/ipv4/23d41d48]:
- [Address]: n.n.n.n
- [Gateway]:
- [Origin]: xyz.openbmc_project.Network.IP.AddressOrigin.Static
- [PrefixLength]: 24
- [Type]: xyz.openbmc_project.Network.IP.Protocol.IPv4
- [/xyz/openbmc_project/network/eth0/ipv4/24ba5feb]:
- [Address]: n.n.n.n
- (etc.)
-
- Description of argument(s):
- sub_command The sub-command accepted by the network
- command (e.g. "view-config", "getIP",
- etc.).
- options Zero or more options accepted by the network command.
- """
-
- if gm.python_version < gm.ordered_dict_version:
- new_options = collections.OrderedDict(options)
- else:
- new_options = options
-
- command_string = gc.create_command_string(
- "network " + sub_command, new_options
- )
- return openbmctool_execute_command_json(
- command_string, print_output=False, ignore_err=False
- )
diff --git a/openpower/tests_openbmctool/test_openbmctool.robot b/openpower/tests_openbmctool/test_openbmctool.robot
deleted file mode 100755
index ae9582b..0000000
--- a/openpower/tests_openbmctool/test_openbmctool.robot
+++ /dev/null
@@ -1,290 +0,0 @@
-*** Settings ***
-Documentation Verify openbmctool.py functionality.
-
-# This module tests the functionality of openbmctool.py.
-# The following tests are performed:
-#
-# FRU status
-# FRU print
-# FRU list
-# FRU list of a single FRU
-# sensors print
-# sensors list
-# sensors list of a single sensor
-# health check
-# service data
-# remote logging
-# local_users queryenabled
-#
-# It is the responsibility of the user to include openbmctool.py's
-# directory PATH in $PATH.
-#
-# Test Parameters:
-# OPENBMC_HOST The BMC host name or IP address.
-# OPENBMC_USERNAME The username to login to the BMC.
-# OPENBMC_PASSWORD Password for OPENBMC_USERNAME.
-# LOGGING_HOST The hostname or IP address of the remote
-# logging server. The default value is
-# '10.10.10.10'.
-# LOGGING_PORT The port number for remote logging on the
-# LOGGING_HOST. The default value is '514'.
-
-
-Library String
-Library OperatingSystem
-Library ../../lib/gen_print.py
-Library ../../lib/gen_robot_print.py
-Library ../../lib/openbmctool_utils.py
-Library ../../lib/gen_misc.py
-Library ../../lib/gen_robot_valid.py
-Resource ../../syslib/utils_os.robot
-Resource ../../lib/resource.robot
-
-
-Suite Setup Suite Setup Execution
-Test Setup Printn
-
-*** Variables ***
-
-${min_number_items} ${30}
-${min_number_sensors} ${15}
-${LOGGING_HOST} 10.10.10.10
-${LOGGING_PORT} 514
-
-
-
-*** Test Cases ***
-
-Verify Openbmctool FRU Commands
- [Documentation] Verify FRU commands work.
- [Tags] Verify_Openbmctool_FRU_Commands
-
- Verify FRU Status
- Verify FRU Print
- Verify FRU List
- # Verify FRU List With Single FRU
- # Known issue - openbmctool.py FRU list with single FRU is not working yet.
- # See https://github.com/openbmc/openbmc-tools/issues/32.
-
-
-Verify Openbmctool Sensors Commands
- [Documentation] Verify sensors commands work.
- [Tags] Verify_Openbmctool_Sensors_Commands
-
- Verify Sensors Print
- Verify Sensors List
- # Verify Sensors List With Single Sensor
- # Known issue - openbmctool.py sensors list with single sensor is
- # not working yet. See https://github.com/openbmc/openbmc-tools/issues/33.
-
-
-Verify Openbmctool Health Check Commands
- [Documentation] Verify health check command works.
- [Tags] Verify_Openbmctool_Health_Check_Commands
-
- ${health_results}= Get Health Check verify=${1}
- Rprint Vars health_results
-
-
-Verify Openbmctool Service Data Commands
- [Documentation] Verify collect service data command works.
- [Tags] Verify_Openbmctool_Service_Data_Commands
-
- ${service_paths}= Collect Service Data verify=${1}
- Rprint Vars service_paths
-
-
-Verify Openbmctool Remote Logging Operations
- [Documentation] Verify logging commands work.
- [Tags] Verify_Openbmctool_Remote_Logging_Operations
-
- # Verify Logging View
- ${remote_logging_view}= Get Remote Logging View verify=${True}
-
- # Save previous remote logging settings, if any.
- ${remote_config}= Get Remote Logging Settings
-
- # Enable remote logging and verify.
- Verify Logging Parameters ${LOGGING_HOST} ${LOGGING_PORT}
-
- # Disable remote logging and verify. Disable will clear any
- # previous settings.
- Verify Logging Disable ${LOGGING_HOST}
-
- # Set original parameters back, if any.
- Run Keyword If ${remote_config}
- ... Verify Logging Parameters
- ... ${remote_config['Address']} ${remote_config['Port']}
-
-
-Verify Openbmctool Local Users Queryenabled
- [Documentation] Verify "local_users queryenabled" function.
- [Tags] Verify_Openbmctool_Local_Users_Queryenabled
-
- # Example output from "queryenabled":
- # User: root Enabled: 1
- # User: freddy Enabled: 1
- # User: ldap4 Enabled: {'description': "The ..."
-
- ${rc} ${num_users}= Openbmctool Execute Command
- ... local_users queryenabled | grep -c 'User.*Enabled'
- Rprint Vars num_users
- Check Greater Than Minimum ${num_users} ${0} local users
-
-
-*** Keywords ***
-
-
-Verify FRU Status
- [Documentation] Verify that the 'fru status' command works.
-
- ${fru_status}= Get Fru Status
- ${num_frus}= Get Length ${fru_status}
- Rprint Vars num_frus
- Check Greater Than Minimum ${num_frus} ${min_number_items} frus
-
-
-Verify FRU Print
- [Documentation] Verify that the 'fru print' command works.
-
- ${rc} ${num_frus}= Openbmctool Execute Command
- ... fru print | wc -l
- Rprint Vars num_frus
- Check Greater Than Minimum ${num_frus} ${min_number_items} frus
-
-
-Verify FRU List
- [Documentation] Verify that the 'fru list' command works.
-
- # Note: The output from 'fru list' is the same as 'fru print'.
- ${rc} ${num_frus}= Openbmctool Execute Command
- ... fru list | wc -l
- Rprint Vars num_frus
- Check Greater Than Minimum ${num_frus} ${min_number_items} frus
-
-
-Verify FRU List With Single FRU
- [Documentation] Verify that 'fru list' with parameter works.
-
- # Get the name of one FRU, in this case the first one listed.
- ${fru_status}= Get Fru Status
- ${fruname}= Set Variable ${fru_status[0]['component']}
- Rprint Vars fruname
- Should Not Be Empty ${fruname} msg=Could not find a FRU.
- # Get a fru list specifying just the FRU.
- ${rc} ${output}= Openbmctool Execute Command
- ... fru list ${fruname} | wc -l
- ${fru_detail}= Convert to Integer ${output}
- Rprint Vars fru_detail
- Should Be True ${fru_detail} <= ${min_number_items}
- ... msg=Too many lines reported for fru status ${fruname}
- Should Be True ${fru_detail} > ${4}
- ... msg=Too few lines reported for fru status ${fruname}
-
-
-Verify Sensors Print
- [Documentation] Verify that sensors print works.
-
- ${sensor_status}= Get Sensors Print
- ${num_sensors}= Get Length ${sensor_status}
- Rprint Vars num_sensors
- Check Greater Than Minimum ${num_sensors} ${min_number_sensors} sensors
-
-
-Verify Sensors List
- [Documentation] Verify that sensors list works.
-
- # Note: The output from 'sensors list' is the same as 'sensors print'.
- ${sensor_status}= Get Sensors List
- ${num_sensors}= Get Length ${sensor_status}
- Rprint Vars num_sensors
- Check Greater Than Minimum ${num_sensors} ${min_number_sensors} sensors
-
-
-Verify Sensors List With Single Sensor
- [Documentation] Verify that sensors list with parameter works.
-
- ${sensor}= Set Variable ambient
- ${rc} ${num_sensors}= Openbmctool Execute Command
- ... sensors list ${sensor} | wc -l
- Rprint Vars sensor num_sensors
- ${num_sensors}= Convert to Integer ${num_sensors}
- Should Be True ${num_sensors} < ${10}
- ... msg=Too many lines reported for list sensor ${sensor}
-
-
-Verify Logging Parameters
- [Documentation] Verify remote_logging_config.
- [Arguments] ${log_host} ${log_port}
-
- # Description of argument(s):
- # log_host The host name or IP address of remote logging server.
- # log_port The port number for remote logging on log_host.
-
- ${rc} ${result}= Openbmctool Execute Command JSON
- ... logging remote_logging_config -a ${log_host} -p ${log_port}
- ... print_output=${False} ignore_err=${False}
-
- ${remote_logging_view}= Get Remote Logging View verify=${True}
-
- Valid Value remote_logging_view['Address'] valid_values=['${log_host}']
- Valid Value remote_logging_view['Port'] valid_values=[int(${log_port})]
-
-
-Verify Logging Disable
- [Documentation] Verify remote_logging disable
- [Arguments] ${log_host}
-
- # Description of argument(s):
- # log_host The host name or IP address of remote logging server.
-
- ${rc} ${result}= Openbmctool Execute Command JSON
- ... logging remote_logging disable
-
- ${remote_logging_view}= Get Remote Logging View verify=${True}
- Valid Value remote_logging_view['Address'] valid_values=['']
-
-
-Get Remote Logging Settings
- [Documentation] Return the remote config settings as a dictionary
- ... if active. Otherwise, return ${False}.
-
- ${remote_config}= Read Properties ${BMC_LOGGING_URI}config/remote
- Return From Keyword If
- ... '${remote_config["Address"]}' == '' or '${remote_config["Port"]}' == '0'
- ... ${False}
-
- [Return] ${remote_config}
-
-
-Check Greater Than Minimum
- [Documentation] Value should be greater than minimum, otherwise fail.
- [Arguments] ${value_to_test} ${minimum_value} ${label}
-
- # Description of argument(s):
- # value_to_test Value to compare to the minimum.
- # minimum_value The minimum acceptable value.
- # label Name to print if failure.
-
- ${value_to_test}= Convert to Integer ${value_to_test}
- Should Be True ${value_to_test} > ${minimum_value}
- ... msg=There should be at least ${minimum_value} ${label}.
-
-
-Suite Setup Execution
- [Documentation] Verify connectivity to run openbmctool commands.
-
- # Verify connectivity to the BMC host.
- ${bmc_version}= Run Keyword And Ignore Error Get BMC Version
- Run Keyword If '${bmc_version[0]}' == 'FAIL' Fail
- ... msg=Could not connect to BMC ${OPENBMC_HOST} to get firmware version.
-
- # Verify can find the openbmctool.
- ${openbmctool_file_path}= which openbmctool.py
- Printn
- Rprint Vars openbmctool_file_path
-
- # Get the version number from openbmctool.
- ${openbmctool_version}= Get Openbmctool Version
-
- Rprint Vars openbmctool_version OPENBMC_HOST bmc_version[1]
diff --git a/openpower/tests_openbmctool/test_openbmctool_network.robot b/openpower/tests_openbmctool/test_openbmctool_network.robot
deleted file mode 100755
index f154c9f..0000000
--- a/openpower/tests_openbmctool/test_openbmctool_network.robot
+++ /dev/null
@@ -1,242 +0,0 @@
-*** Settings ***
-Documentation Verify OBMC tool's network functionality.
-
-
-Library String
-Library OperatingSystem
-Library ../../lib/bmc_network_utils.py
-Library ../../lib/gen_print.py
-Library ../../lib/gen_robot_print.py
-Library ../../lib/openbmctool_utils.py
-Library ../../lib/gen_misc.py
-Library ../../lib/gen_robot_valid.py
-Resource ../../syslib/utils_os.robot
-Resource ../../lib/resource.robot
-Resource ../../lib/bmc_network_utils.robot
-Resource ../../lib/utils.robot
-Resource ../../lib/common_utils.robot
-
-
-Suite Setup Suite Setup Execution
-Test Setup Printn
-
-*** Variables ***
-
-${ip} 10.5.5.5
-${dns_ip} 10.10.10.10
-${domain_name} randomName.com
-${mac_address} 76:e2:84:14:87:91
-${ntp_server} pool.ntp.org
-${parser} |grep "ipv4"|awk -F/ 'NR==1{print$5}'
-${ignore_err} ${0}
-
-
-*** Test Cases ***
-
-Verify GetIP
- [Documentation] Verify that openbmctool can run the getIP command.
- [Tags] Verify_GetIP
-
- ${ip_records}= Network getIP I=eth0
- ${addresses}= Nested Get Address ${ip_records}
- Verify IP On BMC ${addresses}[${0}]
-
-
-Verify AddIP
- [Documentation] Verify that openbmctool can run the addIP command.
- [Tags] Verify_AddIP
-
- Network addIP I=${interface} a=${ip} l=24 p=ipv4
- Wait And Verify IP On BMC ${ip}
-
-
-Verify GetDefaultGW
- [Documentation] Verify that openbmctool can run the getDefaultGW command.
- [Tags] Verify_GetDefaultGW
-
- ${default_gw}= Network getDefaultGW
- Verify Gateway On BMC ${default_gw}
-
-
-Verify RemoveIP
- [Documentation] Verify that openbmctool can run the rmIP command.
- [Tags] Verify_RemoveIP
-
- Network addIP I=${interface} a=${ip} l=24 p=ipv4
- Wait And Verify IP On BMC ${ip}
- Network rmIP I=${interface} a=${ip}
- ${status}= Run Keyword And Return Status Wait And Verify IP On BMC ${ip}
- Should Be Equal ${status} ${False}
-
-
-Verify SetDNS
- [Documentation] Verify that openbmctool can run the setDNS command.
- [Tags] Verify_SetDNS
-
- Network setDNS I=eth0 d=${dns_ip}
- ${dns_config}= CLI Get Nameservers
- Should Contain ${dns_config} ${dns_ip}
-
-
-Verify GetDNS
- [Documentation] Verify that openbmctool can run the getDNS command.
- [Tags] Verify_GetDNS
-
- Network setDNS I=eth0 d=${dns_ip}
- ${dns_data}= Network getDNS I=eth0
- ${dns_config}= CLI Get Nameservers
- Should Contain ${dns_config} ${dns_data}[${0}]
-
-
-Verify SetHostName
- [Documentation] Verify that openbmctool can run the setHostName command.
- [Tags] Verify_SetHostName
-
- Network setHostName H=randomName
- ${bmc_hostname}= Get BMC Hostname
- Should Be Equal As Strings ${bmc_hostname} randomName
-
-
-Verify GetHostName
- [Documentation] Verify that openbmctool can run the getHostName command.
- [Tags] Verify_GetHostName
-
- ${tool_hostname}= Network getHostName
- ${bmc_hostname}= Get BMC Hostname
- Should Be Equal As Strings ${bmc_hostname} ${tool_hostname}
-
-
-Verify SetMACAddress
- [Documentation] Verify that openbmctool can set a new MAC address.
- [Tags] Verify_SetMACAddress
-
- Network setMACAddress I=eth0 MA=${mac_address}
- Validate MAC On BMC ${mac_address}
-
-
-Verify GetMACAddress
- [Documentation] Verify that openbmctool can get the MAC address.
- [Tags] Verify_GetMACAddress
-
- ${mac_addr}= Network getMACAddress I=eth0
- Validate MAC On BMC ${mac_addr}
-
-
-Verify SetNTP
- [Documentation] Verify that openbmctool can run the setNTP command.
- [Tags] Verify_SetNTP
-
- Network setNTP I=eth0 N=${ntp_server}
- # Get NTP server details via REDFISH.
- ${eth0}= Redfish.Get Properties ${REDFISH_NW_PROTOCOL_URI}
- Valid Value eth0['NTP']['NTPServers'][0] ['${ntp_server}']
-
-
-Verify GetNTP
- [Documentation] Verify that openbmctool can run the getNTP command.
- [Tags] Verify_GetNTP
-
- Network setNTP I=eth0 N=${ntp_server}
- # Get NTP server details via REDFISH.
- ${eth0}= Redfish.Get Properties ${REDFISH_NW_PROTOCOL_URI}
- ${tool_ntp}= Network getNTP I=eth0
- Valid Value eth0['NTP']['NTPServers'][0] ['${tool_ntp}']
-
-
-Verify SetDomainName
- [Documentation] Verify set domain name via openbmctool.
- [Tags] Verify_SetDomainName
-
- Network setDomainName I=eth0 D=${domain_name}
- ${eth0}= Redfish.Get Properties ${REDFISH_NW_ETH0_URI}
- ${eth0_domain_name}= Strip String ${eth0['FQDN']}
- ... characters=${eth0['HostName']}. mode=left
- Valid Value eth0_domain_name ['${domain_name}']
-
-
-Verify GetDomainName
- [Documentation] Verify get domain name via openbmctool.
- [Tags] Verify_GetDomainName
-
- Network setDomainName I=eth0 D=${domain_name}
- ${eth0}= Redfish.Get Properties ${REDFISH_NW_ETH0_URI}
- ${eth0_domain_name}= Strip String ${eth0['FQDN']}
- ... characters=${eth0['HostName']}. mode=left
- ${tool_domain_name}= Network getDomainName I=eth0
- Valid Value eth0_domain_name ['${tool_domain_name}']
-
-
-Verify Add VLAN
- [Documentation] Verify add VLAN via openbmctool.
- [Tags] Verify_Add_VLAN
- [Teardown] Network deleteVLAN I=eth0_35
-
- Network addVLAN I=eth0 n=35
- ${eth0_vlan}= Redfish.Get Properties ${REDFISH_NW_ETH0_URI}VLANs/eth0_35
- Valid Value eth0_vlan['Id'] ['eth0_35']
-
-
-Verify Delete VLAN
- [Documentation] Verify delete VLAN via openbmctool.
- [Tags] Verify_Delete_VLAN
-
- Network addVLAN I=eth0 n=35
- ${eth0_vlan}= Redfish.Get Properties ${REDFISH_NW_ETH0_URI}VLANs/eth0_35
- Valid Value eth0_vlan['Id'] ['eth0_35']
- Network deleteVLAN I=eth0_35
- Redfish.Get Properties
- ... ${REDFISH_NW_ETH0_URI}VLANs/eth0_35 valid_status_codes=[${HTTP_NOT_FOUND}]
-
-
-*** Keywords ***
-
-Suite Setup Execution
- [Documentation] Verify connectivity to run openbmctool commands.
-
- Valid Value OPENBMC_HOST
- Valid Value OPENBMC_USERNAME
- Valid Value OPENBMC_PASSWORD
- Redfish.Login
-
- # Verify connectivity to the BMC host.
- ${bmc_version}= Get BMC Version
-
- # Verify can find the openbmctool.
- ${openbmctool_file_path}= which openbmctool.py
- Printn
- Rprint Vars openbmctool_file_path
-
- # Get the version number from openbmctool.
- ${openbmctool_version}= Get Openbmctool Version
-
- ${rc} ${res}= Openbmctool Execute Command network view-config${parser}
- Set Suite Variable ${interface} ${res.strip()}
-
- Rprint Vars openbmctool_version OPENBMC_HOST bmc_version[1]
-
-
-Validate Non Existence Of IP On BMC
- [Documentation] Verify that IP address is not present in set of IP addresses.
- [Arguments] ${ip_address} ${ip_data}
-
- # Description of argument(s):
- # ip_address IP address to check (e.g. xx.xx.xx.xx).
- # ip_data Set of the IP addresses present.
-
- Should Not Contain Match ${ip_data} ${ip_address}/*
- ... msg=${ip_address} found in the list provided.
-
-
-Wait And Verify IP On BMC
- [Documentation] Wait and verify if system IP exists.
- [Arguments] ${ip}
-
- # Description of argument(s):
- # ip IP address to verify (e.g. xx.xx.xx.xx).
-
- # Note:Network restart takes around 15-18s after network-config with openbmctool.
-
- Sleep ${NETWORK_TIMEOUT}s
- Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT}
-
- Verify IP On BMC ${ip}