Programming Guide

Generic Classes/Modules

Exceptions

op-test Exceptions

These exceptions are used throughout op-test to help testing error conditions as well as failing tests when unexpected errors occur.

When subclassing Exceptions be aware to use ‘message’ as the embedded variable so that e.message can be retrieved and searched for filtering if desired in future use cases.

exception common.Exceptions.AES(**kwargs)[source]

We tried to setup with Automated Environment Sharing (AES) and something happened.

exception common.Exceptions.BMCDisconnected(notice)[source]

BMC Cosnole was disconnected unexpectedly. e.g. it may have crashed

exception common.Exceptions.CommandFailed(command, output, exitcode)[source]

Running a command (BMC or Host) failed with non-zero exit code.

exception common.Exceptions.ConsoleSettings(**kwargs)[source]

We need special handling per case so give back desired data.

exception common.Exceptions.HTTPCheck(**kwargs)[source]

HTTP Server related and something happened.

exception common.Exceptions.HostLocker(**kwargs)[source]

We tried to setup with HostLocker and something happened.

exception common.Exceptions.HostbootShutdown[source]

We detected that Hostboot got an IPMI shutdown request.

exception common.Exceptions.KernelBug(state, log)[source]
exception common.Exceptions.KernelConfigNotSet(opt)[source]

A kernel config option needed by the test was not set for the running kernel.

exception common.Exceptions.KernelCrashUnknown(state, log)[source]

Kernel crashed but it didn’t reach the end failure condition (i.e a timeout occured)

exception common.Exceptions.KernelFADUMP(state, log)[source]

We observe a kernel crash and follwed by MPIPL boot to dump opalcore/vmcore for debug.

exception common.Exceptions.KernelHardLockup(state, log)[source]

We detected a hard lockup from the running kernel.

exception common.Exceptions.KernelKdump(state, log)[source]

We observe a Kdump kernel booting after a kernel crash, to dump vmcore for debug.

exception common.Exceptions.KernelModuleNotLoaded(module)[source]

Kernel module needed to run test wasn’t loaded

exception common.Exceptions.KernelOOPS(state, log)[source]

We detected a kernel OOPS. Mostly this will mean we need to fail the test and reboot. Some test cases may intentionally cause these, so they can catch them and act appropriately.

exception common.Exceptions.KernelPanic(state, log)[source]

Kernel got panic due to high seveirty conditions

exception common.Exceptions.KernelSoftLockup(state, log)[source]

We caught a soft lockup. Mostly this will mean we need to fail the test and reboot. Some test cases may intentionally cause these, so they can catch them and act appropriately.

exception common.Exceptions.NoKernelConfig(kernel, path)[source]

We needed to grep host kernel config for a config option, but could not find the needed config file

exception common.Exceptions.OpExit(**kwargs)[source]

We are exiting and want to set an exit code. SystemExit will bubble up and out. Callers must use atexit to register cleanup

exception common.Exceptions.ParameterCheck(**kwargs)[source]

We think something is not properly setup.

exception common.Exceptions.PlatformError(state, log)[source]

We detected a system reboot due to platform error (i.e checkstop, machine check, MCE, etc)

exception common.Exceptions.RecoverFailed(**kwargs)[source]

We tried to recover and did not succeed.

exception common.Exceptions.SSHSessionDisconnected(notice)[source]

SSH session/console was disconnected unexpectedly. e.g. it may have crashed

exception common.Exceptions.SkibootAssert(state, log)[source]

We detected an assert from OPAL (skiboot) firmware.

exception common.Exceptions.SkibootException(state, log)[source]

We detected an exception from OPAL (skiboot) firmware.

exception common.Exceptions.StoppingSystem[source]

We have either set the system to stop for some condition or reached the kill_cord limit and stopping.

exception common.Exceptions.UnexpectedCase(**kwargs)[source]

We detected something we should not have.

exception common.Exceptions.UnknownStateTransition(**kwargs)[source]

We tried to transition to UNKNOWN, something happened.

exception common.Exceptions.WaitForIt(**kwargs)[source]

We need special handling per case so give back desired data.

OpTestError

A catch-all exception.

Use of this exception is DEPRECATED and will be removed in the future.

Some existing code uses this, and it should be gradually converted to use more specialized exceptions.

exception common.OpTestError.OpTestError[source]

OPExpect

The OPexpect module is a wrapper around the standard Python pexpect module that will always look for certain error conditions for OpenPOWER machines.

This is to enable op-test test cases to fail quickly in the event of errors such as kernel panics, RCU stalls, machine checks, firmware crashes etc.

In the event of error, the failure_callback function will be called, which typically will be set up to set the machine state to UNKNOWN, so that when the next test starts executing, we re-IPL the system to get back to a clean slate.

When developing test cases, use OPexpect over pexpect. If you intend for certain error conditions to occur, you can catch the exceptions that OPexpect throws.

class common.OPexpect.spawn(command, args=[], maxread=8000, searchwindowsize=None, logfile=None, cwd=None, env=None, ignore_sighup=False, echo=True, preexec_fn=None, encoding='utf-8', codec_errors='ignore', dimensions=None, failure_callback=None, failure_callback_data=None)[source]
expect(pattern, timeout=- 1, searchwindowsize=- 1)[source]

This seeks through the stream until a pattern is matched. The pattern is overloaded and may take several types. The pattern can be a StringType, EOF, a compiled re, or a list of any of those types. Strings will be compiled to re types. This returns the index into the pattern list. If the pattern was not a list this returns index 0 on a successful match. This may raise exceptions for EOF or TIMEOUT. To avoid the EOF or TIMEOUT exceptions add EOF or TIMEOUT to the pattern list. That will cause expect to match an EOF or TIMEOUT condition instead of raising an exception.

If you pass a list of patterns and more than one matches, the first match in the stream is chosen. If more than one pattern matches at that point, the leftmost in the pattern list is chosen. For example:

# the input is 'foobar'
index = p.expect(['bar', 'foo', 'foobar'])
# returns 1('foo') even though 'foobar' is a "better" match

Please note, however, that buffering can affect this behavior, since input arrives in unpredictable chunks. For example:

# the input is 'foobar'
index = p.expect(['foobar', 'foo'])
# returns 0('foobar') if all input is available at once,
# but returns 1('foo') if parts of the final 'bar' arrive late

When a match is found for the given pattern, the class instance attribute match becomes an re.MatchObject result. Should an EOF or TIMEOUT pattern match, then the match attribute will be an instance of that exception class. The pairing before and after class instance attributes are views of the data preceding and following the matching pattern. On general exception, class attribute before is all data received up to the exception, while match and after attributes are value None.

When the keyword argument timeout is -1 (default), then TIMEOUT will raise after the default value specified by the class timeout attribute. When None, TIMEOUT will not be raised and may block indefinitely until match.

When the keyword argument searchwindowsize is -1 (default), then the value specified by the class maxread attribute is used.

A list entry may be EOF or TIMEOUT instead of a string. This will catch these exceptions and return the index of the list entry instead of raising the exception. The attribute ‘after’ will be set to the exception type. The attribute ‘match’ will be None. This allows you to write code like this:

index = p.expect(['good', 'bad', pexpect.EOF, pexpect.TIMEOUT])
if index == 0:
    do_something()
elif index == 1:
    do_something_else()
elif index == 2:
    do_some_other_thing()
elif index == 3:
    do_something_completely_different()

instead of code like this:

try:
    index = p.expect(['good', 'bad'])
    if index == 0:
        do_something()
    elif index == 1:
        do_something_else()
except EOF:
    do_some_other_thing()
except TIMEOUT:
    do_something_completely_different()

These two forms are equivalent. It all depends on what you want. You can also just expect the EOF if you are waiting for all output of a child to finish. For example:

p = pexpect.spawn('/bin/ls')
p.expect(pexpect.EOF)
print p.before

If you are trying to optimize for speed then see expect_list().

On Python 3.4, or Python 3.3 with asyncio installed, passing async_=True will make this return an asyncio coroutine, which you can yield from to get the same result that this method would normally give directly. So, inside a coroutine, you can replace this code:

index = p.expect(patterns)

With this non-blocking form:

index = yield from p.expect(patterns, async_=True)
set_system(system)[source]

OpTestSystem

OpTestConstants

OpTestConstants

BMC package which contains all BMC related constants

This class encapsulates commands and constants which deals with the BMC in OpenPower systems

class common.OpTestConstants.OpTestConstants[source]
ACTIVATE_POWER_LIMIT = ' dcmi power activate '
ACTIVATE_POWER_LIMIT_SUCCESS = 'Power limit successfully activated'
BMC_ACTIVE_SIDE = ' sensor list|grep -i golden'
BMC_BIOS_GOLDEN_SENSOR_TO_GOLDEN = 'raw 0x04 0x30 xx 0x01 0x00 0x01 0 0 0 0 0 0'
BMC_BIOS_GOLDEN_SENSOR_TO_PRIMARY = 'raw 0x04 0x30 xx 0x01 0x00 0x00 0 0 0 0 0 0'
BMC_BOOT_COUNT_2 = 'raw 0x04 0x30 xx 0x01 0x00 0x2 0x00'
BMC_BOOT_GOLDEN = '/etc/init.d/boot_into_golden'
BMC_BOOT_PRIMARY = '/etc/init.d/boot_into_primary'
BMC_COLD_RESET = ' mc reset cold'
BMC_COLD_RESET_DELAY = 150
BMC_DISABLE_OCC = ' 0x01 0x00 0x01'
BMC_ENABLE_OCC = ' 0x01 0x00 0x02'
BMC_ERROR_LAN = 'Unable to establish LAN session'
BMC_FLASH_IMAGE = 'echo y | ipmitool -H '
BMC_FWANDPNOR_IMAGE_UPDATE = '-z 15000 force'
BMC_FW_IMAGE_UPDATE = 'component 1 -z 30000 force'
BMC_HPM_UPDATE = ' hpm upgrade '
BMC_IPMITOOL_H = 'ipmitool -H '
BMC_LANPLUS = ' -I lanplus'
BMC_MCHBLD = ' raw 0x3a 0x0b 0x56 0x45 0x52 0x53 0x49 0x4f 0x4e 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 | xxd -r -p'
BMC_OCC_SENSOR = 'raw 0x04 0x30 0x'
BMC_PASS_COLD_RESET = 'Sent cold reset command to MC'
BMC_PASS_WARM_RESET = 'Sent warm reset command to MC'
BMC_PNOR_IMAGE_UPDATE = 'component 2 -z 30000'
BMC_PRESRV_LAN = ' raw 0x32 0xba 0x18 0x00'
BMC_SDR_ELIST = 'sdr elist'
BMC_SEL_LIST = 'sel list'
BMC_SOL_ACTIVATE = ' sol activate'
BMC_SOL_DEACTIVATE = ' sol deactivate'
BMC_WARM_RESET = ' mc reset warm'
BMC_WARM_RESET_DELAY = 20
CHASSIS_POWER_OFF = 'Chassis Power is off'
CHASSIS_POWER_ON = 'Chassis Power is on'
CHASSIS_POWER_RESET = 'Chassis Power Control: Reset'
CHASSIS_SOFT_OFF = 'S5/G2: soft-off'
CHECKSTOP_ERROR_DELAY = 150
CLEAR_GARD_CMD = '/gard clear all'
CLONE_SKIBOOT_DIR = '/tmp/skiboot'
CMD_NOT_FOUND = 'command not found'
CMD_RETRY_BMC = 2
CONFIG_IPMI_DEVICE_INTERFACE = 'CONFIG_IPMI_DEVICE_INTERFACE'
CONFIG_IPMI_HANDLER = 'CONFIG_IPMI_HANDLER'
CONFIG_IPMI_POWERNV = 'CONFIG_IPMI_POWERNV'
CPU_DISABLE_STATE = '1'
CPU_ENABLE_STATE = '0'
CPU_IDLEMODE_STATE1 = '/sys/devices/system/cpu/cpu*/cpuidle/state1/disable'
CPU_IDLEMODE_STATE2 = '/sys/devices/system/cpu/cpu*/cpuidle/state2/disable'
DCMI_POWER_ACTIVATE = 'dcmi power activate'
DCMI_POWER_DEACTIVATE = 'dcmi power deactivate'
DISABLE_CPU_SLEEP_STATE1 = 'for i in /sys/devices/system/cpu/cpu*/cpuidle/state1/disable; do echo 1 > $i; done'
DISABLE_CPU_SLEEP_STATE2 = 'for i in /sys/devices/system/cpu/cpu*/cpuidle/state2/disable; do echo 1 > $i; done'
ERROR_SELENIUM_HEADLESS = "Host doesn't have selenium installed"
FAULT_ISOLATION_REGISTER_CONTENT = '0000000000000000'
FIRESTONE = 'firestone'
FIRESTONE_POWER_LIMIT_HIGH = '1820'
FIRESTONE_POWER_LIMIT_LOW = '1240'
FSM_STATE_PARITY_ERROR = '0000000020000000'
FW_FAILED = 1
FW_INVALID = 2
FW_PARAMETER = 4
FW_SUCCESS = 0
GARD_CLEAR_SUCCESSFUL = 'Clearing the entire gard partition...done'
GARD_TOOL_DIR = '/tmp/skiboot/external/gard'
GARRISON = 'garrison'
GARRISON_POWER_LIMIT_HIGH = '2880'
GARRISON_POWER_LIMIT_LOW = '1240'
GET_CPU_SLEEP_STATE0 = 'cat /sys/devices/system/cpu/cpu*/cpuidle/state0/disable'
GET_CPU_SLEEP_STATE1 = 'cat /sys/devices/system/cpu/cpu*/cpuidle/state1/disable'
GET_CPU_SLEEP_STATE2 = 'cat /sys/devices/system/cpu/cpu*/cpuidle/state2/disable'
GET_POWER_LIMIT = ' dcmi power get_limit '
GOLDEN_SIDE = '0x0180'
HABANERO = 'habanero'
HABANERO_POWER_LIMIT_HIGH = '1100'
HABANERO_POWER_LIMIT_LOW = '1000'
HMI_HYPERVISOR_RESOURCE_ERROR = 4
HMI_MALFUNCTION_ALERT = 3
HMI_PROC_RECV_DONE = 1
HMI_PROC_RECV_ERROR_MASKED = 2
HMI_TEST_CASE_SLEEP_TIME = 30
HOST_ADD_SEL_ENTRY = 'ipmitool raw 0x0a 0x44 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00'
HOST_BRINGUP_TIME = 80
HOST_CHASSIS_POWER_ON = 'ipmitool raw 0x00 0x02 0x01'
HOST_CLEAR_MESSAGE_FLAGS = 'ipmitool raw 0x06 0x30 0xeb'
HOST_COLD_RESET = 'ipmitool -I usb mc reset cold'
HOST_CONNECTION_LOST = 'closed by remote host'
HOST_GET_ACPI_POWER_STATE = 'ipmitool raw 0x06 0x07'
HOST_GET_BMC_GLOBAL_ENABLES = 'ipmitool mc getenables'
HOST_GET_BMC_GLOBAL_ENABLES_RAW = 'ipmitool raw 0x06 0x2f'
HOST_GET_BT_CAPABILITIES = 'ipmitool raw 0x06 0x36'
HOST_GET_CHANNEL_AUTH_CAP = 'ipmitool raw 0x06 0x38 0x81 0x04'
HOST_GET_DEVICE_GUID = 'ipmitool raw 0x06 0x08'
HOST_GET_DEVICE_ID = 'ipmitool raw 0x06 0x01'
HOST_GET_LAN_PARAMETERS = 'ipmitool raw 0x0c 0x02 0x01 0x00 0x00 0x00'
HOST_GET_MESSAGE_FLAGS = 'ipmitool raw 0x06 0x31'
HOST_GET_SEL_INFO = 'ipmitool raw 0x0a 0x40'
HOST_GET_SEL_TIME = 'ipmitool sel time get'
HOST_GET_SEL_TIME_RAW = 'ipmitool raw 0x0a 0x48'
HOST_GET_SENSOR_READING = 'ipmitool raw 0x04 0x2d'
HOST_GET_SENSOR_TYPE_FOR_WATCHDOG = 'ipmitool raw 0x04 0x2f'
HOST_GET_SYSTEM_BOOT_OPTIONS = 'ipmitool raw 0x00 0x09 0x05 0x00 0x00'
HOST_GET_SYSTEM_GUID = 'ipmitool raw 0x06 0x37'
HOST_GET_SYSTEM_INTERFACE_CAPABILITIES_KCS = 'ipmitool raw 0x06 0x57 0x01'
HOST_GET_SYSTEM_INTERFACE_CAPABILITIES_SSIF = 'ipmitool raw 0x06 0x57 0x00'
HOST_IPMI_REPROVISION_PROGRESS = 'ipmitool raw 0x3A 0x1D'
HOST_IPMI_REPROVISION_REQUEST = 'ipmitool raw 0x3A 0x1C'
HOST_PLATFORM_EVENT = 'ipmitool raw 0x04 0x02 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00'
HOST_PNOR_ACCESS_RESPONSE = 'ipmitool raw 0x3a 0x08'
HOST_PNOR_ACCESS_STATUS_DENY = 'ipmitool raw 0x3a 0x07 0x00'
HOST_PNOR_ACCESS_STATUS_GRANT = 'ipmitool raw 0x3a 0x07 0x01'
HOST_REBOOT_DELAY = 100
HOST_RESERVE_SEL = 'ipmitool raw 0x0a 0x42'
HOST_RESET_WATCHDOG = 'ipmitool raw 0x06 0x22'
HOST_SET_ACPI_POWER_STATE = 'ipmitool raw 0x06 0x06 0xaa 0x00'
HOST_SET_BMC_GLOBAL_ENABLES_SEL_OFF = 'ipmitool mc setenables system_event_log=off'
HOST_SET_BMC_GLOBAL_ENABLES_SEL_ON = 'ipmitool mc setenables system_event_log=on'
HOST_SET_SEL_TIME = 'ipmitool sel time set'
HOST_SET_SYTEM_BOOT_OPTIONS = 'ipmitool raw 0x00 0x08 0x05'
HOST_SET_WATCHDOG = 'ipmitool raw 0x06 0x24 0x44 0x00 0x00 0x10 0xc8 0x00'
HOST_WARM_RESET = 'ipmitool -I usb mc reset warm'
HTTP_RETRY = 10
INTERNAL_PATH_CONTROL_REGISTER = '0080000000000000'
INTERNAL_PATH_OR_PARITY_ERROR = '0000020000000000'
IPMITOOL_OPEN = 'ipmitool '
IPMITOOL_USB = 'ipmitool -I usb '
IPMI_CHANNEL_AUTHCAP = 'channel authcap 1 4'
IPMI_CHANNEL_INFO = 'channel info'
IPMI_CHASSIS_IDENTIFY = 'chassis identify'
IPMI_CHASSIS_IDENTIFY_5 = 'chassis identify 5'
IPMI_CHASSIS_IDENTIFY_FORCE = 'chassis identify force'
IPMI_CHASSIS_POH = 'chassis poh'
IPMI_CHASSIS_POLICY_ALWAYS_OFF = 'chassis policy always-off'
IPMI_CHASSIS_POLICY_ALWAYS_ON = 'chassis policy always-on'
IPMI_CHASSIS_POLICY_LIST = 'chassis policy list'
IPMI_CHASSIS_RESTART_CAUSE = 'chassis restart_cause'
IPMI_CHASSIS_STATUS = 'chassis status'
IPMI_CONSOLE_EXPECT_ENTER_OUTPUT = ['login: ', '#', '/ #', 'Petitboot', <class 'pexpect.exceptions.TIMEOUT'>, <class 'pexpect.exceptions.EOF'>, '$']
IPMI_CONSOLE_EXPECT_LOGIN = 0
IPMI_CONSOLE_EXPECT_PASSWORD = 0
IPMI_CONSOLE_EXPECT_PETITBOOT = [2, 3]
IPMI_CONSOLE_EXPECT_RANDOM_STATE = [4, 5]
IPMI_DCMI_DISCOVER = 'dcmi discover'
IPMI_DCMI_GET_CONF_PARAM = 'dcmi get_conf_param'
IPMI_DCMI_GET_MC_ID_STRING = 'dcmi get_mc_id_string'
IPMI_DCMI_GET_TEMP_READING = 'dcmi get_temp_reading'
IPMI_DCMI_OOB_DISCOVER = 'dcmi oob_discover'
IPMI_DCMI_POWER_GET_LIMIT = 'dcmi power get_limit'
IPMI_DCMI_POWER_READING = 'dcmi power reading'
IPMI_DCMI_SENSORS = 'dcmi sensors'
IPMI_DEV_INTF = 'ipmi_devintf'
IPMI_DISABLE_FAN_CONTROL_TASK_THREAD = 'raw 0x3a 0x12 0x00'
IPMI_ECHO_DONE = 'echo Done'
IPMI_ENABLE_FAN_CONTROL_TASK_THREAD = 'raw 0x3a 0x12 0x01'
IPMI_EVENT_1 = 'event 1'
IPMI_EVENT_2 = 'event 2'
IPMI_EVENT_3 = 'event 3'
IPMI_FAN_CONTROL_TASK_THREAD_STATE = 'raw 0x3a 0x13'
IPMI_FAN_CONTROL_THREAD_NOT_RUNNING = '00'
IPMI_FAN_CONTROL_THREAD_RUNNING = '01'
IPMI_FIREWALL_INFO = 'firewall info channel 1 lun 0'
IPMI_FRU_PRINT = 'fru print'
IPMI_FRU_READ = 'fru read 0 file_fru'
IPMI_GET_BMC_GOLDEN_SIDE_VERSION = 'raw 0x3a 0x1a'
IPMI_GET_BOOTKERNEL_PARTITION_SIZE = 'raw 0x3a 0x0c 0x42 0x4f 0x4f 0x54 0x4b 0x45 0x52 0x4e 0x45 0x4c 0x00 0x00 0x00 0x00 0x0 0x0 0x0'
IPMI_GET_GUARD_PARTITION_SIZE = 'raw 0x3a 0x0c 0x47 0x55 0x41 0x52 0x44 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x0 0x0 0x0'
IPMI_GET_LED_STATE_CHASSIS_IDENTIFY = 'raw 0x3a 0x02 0x03'
IPMI_GET_LED_STATE_FAULT_ROLLUP = 'raw 0x3a 0x02 0x00'
IPMI_GET_LED_STATE_HOST_STATUS = 'raw 0x3a 0x02 0x02'
IPMI_GET_LED_STATE_POWER_ON = 'raw 0x3a 0x02 0x01'
IPMI_GET_NVRAM_PARTITION_SIZE = 'raw 0x3a 0x0c 0x4e 0x56 0x52 0x41 0x4d 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x0 0x0 0x0'
IPMI_HAS_BMC_BOOT_COMPLETED = 'raw 0x3a 0x0a'
IPMI_LAN_PRINT = 'lan print'
IPMI_LAN_STATS_GET = 'lan stats get'
IPMI_MC_GETENABLES = 'mc getenables'
IPMI_MC_GETSYS_INFO = ' mc getsysinfo system_name'
IPMI_MC_GUID = 'mc guid'
IPMI_MC_INFO = 'mc info'
IPMI_MC_SELFTEST = 'mc selftest'
IPMI_MC_SETENABLES_OEM_0_OFF = 'mc setenables oem_0=off'
IPMI_MC_SETENABLES_OEM_0_ON = 'mc setenables oem_0=on'
IPMI_MC_WATCHDOG_GET = 'mc watchdog get'
IPMI_MC_WATCHDOG_OFF = 'mc watchdog off'
IPMI_MC_WATCHDOG_RESET = 'mc watchdog reset'
IPMI_MSG_HANDLER = 'ipmi_msghandler'
IPMI_PEF_INFO = 'pef info'
IPMI_PEF_LIST = 'pef policy list'
IPMI_PEF_POLICY = 'pef policy help'
IPMI_PEF_STATUS = 'pef status'
IPMI_POWERNV = 'ipmi_powernv'
IPMI_RAW_POH = '-v raw 0x0 0xf'
IPMI_READ_FIRDATA_PARTITION_DATA = 'raw 0x3a 0x0b 0x46 0x49 0x52 0x44 0x41 0x54 0x41 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x01 0x00 0x00 0x00'
IPMI_READ_NVRAM_PARTITION_DATA = 'raw 0x3a 0x0b 0x4e 0x56 0x52 0x41 0x4d 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x01 0x00 0x00 0x00'
IPMI_SDR_ELIST = 'sdr elist'
IPMI_SDR_ELIST_ALL = 'sdr elist all'
IPMI_SDR_ELIST_COMPACT = 'sdr elist compact'
IPMI_SDR_ELIST_EVENT = 'sdr elist event'
IPMI_SDR_ELIST_FRU = 'sdr elist fru'
IPMI_SDR_ELIST_FULL = 'sdr elist full'
IPMI_SDR_ELIST_GENERIC = 'sdr elist generic'
IPMI_SDR_ELIST_MCLOC = 'sdr elist mcloc'
IPMI_SDR_GET = 'sdr get '
IPMI_SDR_INFO = 'sdr info'
IPMI_SDR_LIST = 'sdr list'
IPMI_SDR_LIST_ALL = 'sdr list all'
IPMI_SDR_LIST_COMPACT = 'sdr list compact'
IPMI_SDR_LIST_EVENT = 'sdr list event'
IPMI_SDR_LIST_FRU = 'sdr list fru'
IPMI_SDR_LIST_FULL = 'sdr list full'
IPMI_SDR_LIST_GENERIC = 'sdr list generic'
IPMI_SDR_LIST_MCLOC = 'sdr list mcloc'
IPMI_SDR_TYPE_FAN = 'sdr type Fan'
IPMI_SDR_TYPE_LIST = 'sdr type list'
IPMI_SDR_TYPE_POWER_SUPPLY = "sdr type 'Power Supply'"
IPMI_SDR_TYPE_TEMPERATURE = 'sdr type Temperature'
IPMI_SEL_CLEAR = 'sel clear'
IPMI_SEL_ELIST = 'sel elist'
IPMI_SEL_INFO = 'sel info'
IPMI_SEL_LIST = 'sel list'
IPMI_SEL_LIST_ENTRIES = '3'
IPMI_SEL_TIME_GET = 'sel time get'
IPMI_SENSOR_LIST = 'sensor list'
IPMI_SOL_ACTIVATE_TIME = 5
IPMI_SOL_CONSOLE_ACTIVATE_OUTPUT = ['[SOL Session operational. Use ~? for help]\r\n', 'Error: Unable to establish IPMI v2 / RMCP+ session', <class 'pexpect.exceptions.TIMEOUT'>, <class 'pexpect.exceptions.EOF'>]
IPMI_SOL_DEACTIVATE_TIME = 10
LIST_GARD_CMD = '/gard list'
LONG_WAIT_IPL = 50
MASTER_PATH_CONTROL_REGISTER = '8000000000000000'
MIHAWK = 'mihawk'
MIHAWK_POWER_LIMIT_HIGH = '2500'
MIHAWK_POWER_LIMIT_LOW = '1945'
NO_GARD_RECORDS = 'No GARD entries to display'
NVRAM_DISABLE_FAST_RESET_MODE = 'nvram -p ibm,skiboot --update-config experimental-fast-reset='
NVRAM_PRINT_CFG = 'nvram --print-config'
NVRAM_PRINT_FAST_RESET_VALUE = 'nvram --print-config=experimental-fast-reset -p ibm,skiboot'
NVRAM_SET_FAST_RESET_MODE = 'nvram -p ibm,skiboot --update-config experimental-fast-reset=feeling-lucky'
NVRAM_TEST_DATA = 'test-name=test-value'
NVRAM_UPDATE_CONFIG_TEST_DATA = 'nvram --update-config test-name=test-value'
OCC_DEVICE_ENABLED = 'Device Enabled'
OCC_DISABLE = 'opal-prd occ disable'
OCC_ENABLE = 'opal-prd occ enable'
OCC_ENABLE_WAIT = 200
OCC_QUERY_RESET_COUNTS = 'opal-prd --expert-mode htmgt-passthru 1'
OCC_RESET = 'opal-prd occ reset'
OCC_RESET_RELOAD_COUNT = 15
OCC_SET_RESET_RELOAD_COUNT = 'opal-prd --expert-mode htmgt-passthru 4'
OPAL_DUMP_DIR = '/var/log/dump/'
OPAL_DUMP_NODE = '/proc/device-tree/ibm,opal/dump/'
OPAL_DUMP_SYSFS_DIR = '/sys/firmware/opal/dump'
OPAL_ELOG_DIR = '/var/log/opal-elog'
OPAL_ELOG_SYSFS_DIR = '/sys/firmware/opal/elog'
OPAL_MSG_LOG = 'cat /sys/firmware/opal/msglog'
OP_CHECK_CPU = 'sensor list|grep -i cpu'
OP_CHECK_DIMM = 'sensor list|grep -i dimm'
OP_CHECK_FAN = 'sensor list|grep -i fan'
OP_CHECK_OCC = "sdr elist |grep -i 'OCC'"
OP_CHECK_PROCESSOR = 'sensor list|grep -i proc'
OP_CHECK_SENSOR_LIST = 'sensor list'
OP_GET_POWER = 'dcmi power reading'
OP_GET_TEMP = 'dcmi get_temp_reading'
OS_BOOT_COMPLETE = 'boot completed'
OS_GETSCOM_LIST = '/getscom -l'
OS_PRESERVE_NETWORK = 'ipmitool -I usb raw 0x32 0xba 0x18 0x00'
OS_PUTSCOM_ERROR = '/putscom -c '
OS_READ_MSGLOG_CORE = 'cat /sys/firmware/opal/msglog | grep -i chip | grep -i core'
OS_TELNET_WAIT = 20
P9DSU = 'p9dsu'
P9DSU_POWER_LIMIT_HIGH = '1650'
P9DSU_POWER_LIMIT_LOW = '1550'
PALMETTO = 'palmetto'
PETITBOOT_TIMEOUT = 1500
PFLASH_TOOL_DIR = '/tmp/'
PING_FAILED = 0
PING_RETRY_FOR_STABILITY = 5
PING_RETRY_POWERCYCLE = 7
PING_SUCCESS = 2
PING_UNDETERMINED = 1
PNOR_BOOTKERNEL_PART = 'BOOTKERNEL'
PNOR_GUARD_PART = 'GUARD'
PNOR_NVRAM_PART = 'NVRAM'
PORT_0_PRIMARY_CONFIGURATION_REGISTER = '1000000000000000'
PORT_0_SECONDARY_CONFIGURATION_REGISTER = '0400000000000000'
PORT_1_PRIMARY_CONFIGURATION_REGISTER = '0800000000000000'
PORT_1_SECONDARY_CONFIGURATION_REGISTER = '0200000000000000'
POWER_ACTIVATE_SUCCESS = 'Power limit successfully activated'
POWER_DEACTIVATE_SUCCESS = 'Power limit successfully deactivated'
PRIMARY_SIDE = '0x0080'
PROC_CMDLINE = 'cat /proc/cmdline'
PR_SC_MS_SL_CONTROL_REGISTER = '0040000000000000'
PSS_HAMMING_DISTANCE = '0000200000000000'
SCP_TO_LOCAL = 2
SCP_TO_REMOTE = 1
SENSOR_HOST_STATUS = 'Host Status'
SENSOR_OCC_ACTIVE = 'OCC Active'
SENSOR_OS_BOOT = 'OS Boot'
SET_POWER_LIMIT = ' dcmi power set_limit limit '
SHORT_WAIT_IPL = 10
SHORT_WAIT_STANDBY_DELAY = 5
SKIBOOT_WORKING_DIR = '/root/skiboot'
SLAVE_PATH_CONTROL_REGISTER = '0100000000000000'
SUDO_COMMAND = 'sudo '
SYSTEM_STANDBY_STATE_DELAY = 120
TB_PARITY_ERROR = '0003080000000000'
TFMR_DEC_PARITY_ERROR = '0006080000000000'
TFMR_ERRORS = 6
TFMR_HDEC_PARITY_ERROR = '0002080000000000'
TFMR_PARITY_ERROR = '0001080000000000'
TFMR_PURR_PARITY_ERROR = '0004080000000000'
TFMR_SPURR_PARITY_ERROR = '0005080000000000'
TOD_DATA_PARITY_ERROR = '0000000080000000'
TOD_ERRORS = 5
TOD_ERROR_REG = 40031
TOD_SYNC_CHECK_ERROR = '0000000040000000'
UPDATE_BMC = 1
UPDATE_BMCANDPNOR = 3
UPDATE_PNOR = 2
WEB_DRIVER_WAIT = 20
WEB_UPDATE_DELAY = 600
WITHERSPOON = 'witherspoon'
WITHERSPOON_POWER_LIMIT_HIGH = '3050'
WITHERSPOON_POWER_LIMIT_LOW = '1550'

OpTestHost

Host package which contains all functions related to HOST communication

This class encapsulates all function which deals with the Host in OpenPower systems

class common.OpTestHost.OpTestHost(i_hostip, i_hostuser, i_hostpasswd, i_bmcip, i_results_dir, scratch_disk='', proxy='', logfile=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>, check_ssh_keys=False, known_hosts_file=None, conf=None)[source]

An object to manipulate and run things on the host.

copy_files_from_host(sourcepath='', destpath='/tmp/')[source]
copy_test_file_to_host(filename, sourcedir='test_binaries', dstdir='/tmp/')[source]
get_new_ssh_connection(name='temp')[source]
get_proxy()[source]
get_scratch_disk()[source]
get_scratch_disk_size(console=None)[source]
get_ssh_connection()[source]
host_build_cxl_tests(i_dir, console=0)[source]
host_build_libocxl(i_dir, console=0)[source]
host_check_binary(i_dir, i_file, console=0)[source]
host_check_command(*i_cmd, **kwargs)[source]

Check if one or more binaries are present on host

host_check_config(i_kernel, i_config, console=0)[source]

This function will checks first for config file for a given kernel version on host, if available then check for config option value and return that value whether it is y or m…etc.

sample config option values:

CONFIG_CRYPTO_ZLIB=m
CONFIG_CRYPTO_LZO=y
# CONFIG_CRYPTO_842 is not set
i_kernel

kernel version

i_config

Which config option want to check in config file. e.g. CONFIG_SENSORS_IBMPOWERNV

It will return config option value y or m, or raise OpTestError if config file is not available on host or raise OpTestError if config option is not set in file.

host_check_dt_node_exist(node_path, console=0)[source]
host_check_pkg_for_utility(i_oslevel, i_cmd, console=0)[source]

Check if a package is installed on the host. The i_oslevel is used to determine if we should use dpkg or rpm to search for the package name.

host_check_pkg_installed(i_oslevel, package, console=0)[source]

This function will check whether particular package is installed or not The i_oslevel is used to determine if we should use dpkg or rpm to search for the package name.

host_check_pkg_kdump(i_oslevel, console=0)[source]

This function will check whether kdump package is installed or not

host_check_sysfs_path_availability(path, console=0)[source]
host_clear_all_dumps(console=0)[source]

This function clears/acknowledges all dumps in host.

host_clear_error_logs(console=0)[source]

This function clears/acknowledges all error logs in host

host_clone_cxl_tests(i_dir, console=0)[source]

Clone latest cxl-tests git repository in i_dir directory.

i_dir

directory where cxl-tests will be cloned

host_clone_libocxl(i_dir, console=0)[source]

Clone latest libocxl git repository in i_dir directory.

i_dir

directory where libocxl will be cloned

host_clone_linux_source(i_dir)[source]

It will clone latest linux git repository in i_dir directory.

i_dir

directory where linux source will be cloned.

host_clone_skiboot_source(i_dir, console=0)[source]

It will clone latest skiboot git repository in i_dir directory

i_dir

directory where skiboot source will be cloned

host_code_update(i_image, imagecomponent)[source]

Flash firmware (HPM image) using ipmitool.

i_image

hpm file

i_imagecomponent

component to be updated from the HPM file. Probably BMC_CONST.BMC_FW_IMAGE_UPDATE or BMC_CONST.BMC_PNOR_IMAGE

host_cold_reset()[source]

Cold reboot the host

host_copy_fake_gard()[source]
host_disable_kdump_service(os_level, console=0)[source]

This function disables kdump service. Needs the OS version (from /etc/os-release) to know if we should use systemd commands or not.

host_enable_all_cores(console=0)[source]

Enables all cores

host_enable_kdump_service(os_level, console=0)[source]

disables kdump service, needs /etc/os-release to work out service name.

host_enable_single_core(console=0)[source]

This function enable only a single core

host_gather_debug_logs(console=0)[source]
host_gather_kernel_log(console=0)[source]

It will gather kernel dmesg logs and store the copy in a logfile which will be stored in results dir.

host_gather_opal_msg_log(console=0)[source]

Gather OPAL logs (from the host) and store in a file

host_get_OS_Level(console=0)[source]

Get the OS version.

host_get_core_count(console=0)[source]
host_get_cores(console=0)[source]
host_get_kernel_version(console=0)[source]

Get Linux kernel version running on the host (using uname).

host_get_list_of_chips(console=0)[source]
host_get_list_of_pci_domains(console=0)[source]

This function is used to get list of PCI PHB domains.

host_get_number_of_errorlogs(console=0)[source]

This function gets the number of error logs

host_get_proc_gen(console=0)[source]
host_get_root_phb(console=0)[source]

This function is used to get the PHB domain of root port where the filesystem is mounted(We need to skip this in EEH tests as recovery will fail on this domain is expected)

host_get_smt(console=0)[source]
host_get_status_of_opal_errd_daemon(console=0)[source]

This function gets the status of opal_errd daemon. Raises an exception if not running.

host_has_capi_fpga_card(console=0)[source]

Check that host has a CAPI FPGA card

host_has_opencapi_fpga_card(console=0)[source]

Check that host has an OpenCAPI FPGA card

host_is_kdump_active(os_level, console=0)[source]

This function will check whether the kdump service is running/active or not.

host_list_all_errorlogs(console=0)[source]

This function lists all error logs in host

host_list_all_service_action_logs(console=0)[source]

This function lists all service action logs in host.

host_load_ibmpowernv(i_oslevel)[source]

This function loads ibmpowernv driver only on powernv platform and also this function works only in root user mode

host_load_module(i_module, console=0)[source]

It will load the module using modprobe and verify whether it is loaded or not

host_load_module_based_on_config(i_kernel, i_config, i_module, console=0)[source]

This function will load driver module on host based on the config option if config value

m

built as a module

y

driver built into kernel itself

else

raises OpTestError

i_kernel

kernel version to get config file

i_config

config option to check in config file

i_module

driver module to load on host based on config value

host_pflash_get_partition(partition, console=0)[source]
host_prd_supported(bmc_type, console=0)[source]
host_read_hwclock(console=0)[source]

This function will read real time clock(RTC) time using hwclock utility.

host_read_systime(console=0)[source]

This function will read system time using date utility (This will be mantained by kernel).

host_run_command(i_cmd, timeout=1500, retry=0, console=0)[source]
host_set_hwclock_time(i_time, console=0)[source]

This function will set hwclock time using the –date option format should be “2015-01-01 12:12:12”

host_start_lm_sensor_svc(i_oslevel, console=0)[source]

This function restarts the lm_sensors service on host using systemctl utility systemctl utility is not present in ubuntu, This function will work in remaining all other OS’es i.e redhat, sles and PowerKVM

host_start_opal_errd_daemon(console=0)[source]

starts opal_errd daemon

host_stop_opal_errd_daemon(console=0)[source]

stops opal_errd daemon

hostname()[source]
password()[source]
set_system(system)[source]
username()[source]
class common.OpTestHost.OpTestLPAR(i_hostip, i_hostuser, i_hostpasswd, i_bmcip, i_results_dir, scratch_disk='', proxy='', logfile=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>, check_ssh_keys=False, known_hosts_file=None, conf=None)[source]

An object to manipulate and run things on the LPAR. Methods not applicable for an LPAR are overridden here

host_clear_all_dumps(*args)[source]

This function clears/acknowledges all dumps in host.

host_clear_error_logs(*args)[source]

This function clears/acknowledges all error logs in host

host_clone_skiboot_source(*args)[source]

It will clone latest skiboot git repository in i_dir directory

i_dir

directory where skiboot source will be cloned

host_code_update(*args)[source]

Flash firmware (HPM image) using ipmitool.

i_image

hpm file

i_imagecomponent

component to be updated from the HPM file. Probably BMC_CONST.BMC_FW_IMAGE_UPDATE or BMC_CONST.BMC_PNOR_IMAGE

host_cold_reset(*args)[source]

Cold reboot the host

host_copy_fake_gard(*args)[source]
host_gather_debug_logs(*args)[source]
host_gather_opal_msg_log(*args)[source]

Gather OPAL logs (from the host) and store in a file

host_get_list_of_chips(*args)[source]
host_get_number_of_errorlogs(*args)[source]

This function gets the number of error logs

host_get_status_of_opal_errd_daemon(*args)[source]

This function gets the status of opal_errd daemon. Raises an exception if not running.

host_list_all_errorlogs(*args)[source]

This function lists all error logs in host

host_list_all_service_action_logs(*args)[source]

This function lists all service action logs in host.

host_load_ibmpowernv(*args)[source]

This function loads ibmpowernv driver only on powernv platform and also this function works only in root user mode

host_pflash_get_partition(*args)[source]
host_prd_supported(*args)[source]
host_start_lm_sensor_svc(*args)[source]

This function restarts the lm_sensors service on host using systemctl utility systemctl utility is not present in ubuntu, This function will work in remaining all other OS’es i.e redhat, sles and PowerKVM

host_start_opal_errd_daemon(*args)[source]

starts opal_errd daemon

host_stop_opal_errd_daemon(*args)[source]

stops opal_errd daemon

OpTestIPMI

OpTestIPMI

IPMI package which contains all BMC related IPMI commands

This class encapsulates all function which deals with the BMC over IPMI in OpenPower systems

class common.OpTestIPMI.IPMIConsole(ipmitool=None, logfile=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>, prompt=None, block_setup_term=None, delaybeforesend=None)[source]
close()[source]
connect(logger=None)[source]
disable_setup_term_quiet()[source]
enable_setup_term_quiet()[source]
get_block_setup_term()[source]
get_console(logger=None)[source]
get_system_setup_term()[source]
run_command(command, timeout=60, retry=0)[source]
run_command_ignore_fail(command, timeout=60, retry=0)[source]
set_block_setup_term(flag)[source]
set_system(system)[source]
set_system_setup_term(flag)[source]
class common.OpTestIPMI.IPMIConsoleState[source]
CONNECTED = 1
DISCONNECTED = 0
class common.OpTestIPMI.IPMITool(method='lanplus', binary='ipmitool', ip=None, username=None, password=None, logfile=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>)[source]

Run (locally) some command using ipmitool.

This wrapper class takes care of all the login/method details for the caller.

arguments()[source]
binary_name()[source]
run(cmd, background=False, cmdprefix=None)[source]

Run a ipmitool cmd.

Throws

common.Execptions.CommandFailed

class common.OpTestIPMI.OpTestIPMI(i_bmcIP, i_bmcUser, i_bmcPwd, logfile=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>, host=None, delaybeforesend=None, host_console_command=None)[source]
clear_tpm_required()[source]
enter_ipmi_lockdown_mode()[source]
exit_ipmi_lockdown_mode()[source]
get_host_console()[source]

Get the IPMIConsole object, to run commands on the host etc.

ipl_wait_for_working_state(timeout=10)[source]

This function starts the sol capture and waits for the IPL to end. The marker for IPL completion is the Host Status sensor which reflects the ACPI power state of the system. When it reads S0/G0: working it means that the petitboot is has began loading. The overall timeout for the IPL is defined in the test configuration options.

Parameters

timeout (int) – The number of minutes to wait for IPL to complete, i.e. How long to poll the ACPI sensor for working state before giving up.

ipmi_activate_power_limit()[source]

Activates the power limit of the target bmc

ipmi_code_update(i_image, i_imagecomponent)[source]

Flashes image using ipmitool

Parameters
  • i_image – hpm file including location

  • i_imagecomponent – component to be updated from the hpm file BMC_CONST.BMC_FW_IMAGE_UPDATE or BMC_CONST.BMC_PNOR_IMAGE

ipmi_cold_reset()[source]

Performs a cold reset onto the bmc

ipmi_deactivate_power_limit()[source]

Deactivates the power limit of the target bmc

ipmi_disable_all_occ_sensor()[source]

Disable OCC Sensor

ipmi_disable_fan_control_task_command()[source]

This function is used to disable Fan control Task thread running on BMC Ex: ipmitool raw 0x3a 0x12 0x00

Returns

return code of command or raise OpTestError when fails

Completion Code:

00h

success

cch

Invalid Request Data

83h

File not created in start case.

80h

Invalid Operation Mode

ipmi_enable_all_occ_sensor()[source]

Enable OCC Sensor

ipmi_enable_fan_control_task_command()[source]

This function is used to enable Fan control Task thread running on BMC Ex: ipmitool raw 0x3a 0x12 0x01

Returns

return code of command or raise OpTestError when fails

Completion Code:

00h

success

cch

Invalid Request Data

83h

File not created in start case.

80h

Invalid Operation Mode

ipmi_get_PNOR_level()[source]

Get PNOR level

ipmi_get_bmc_boot_completion_status()[source]

This function is used to check whether BMC Completed Booting.

BMC Booting Status:

00h

Booting Completed.

C0h

Still Booting.

Returns

output of command or raise OpTestError

ipmitool -I lanplus -H <BMC-IP> -U ADMIN -P admin raw 0x3a 0x0a
  00

It returns 00 if BMC completed booting else it gives C0

ipmi_get_bmc_golden_side_version()[source]

This function gets the BMC golden side firmware version. Below are the fields to decode the version of firmware

  1. Completion code

    • 0x00 – success

    • 0x81 – Not a valid image in golden SPI.

    • 0xff – Reading Golden side SPI failed.

  2. Device ID (0x02)

  3. IPMI Dev version (0x01)

  4. Firmware Revision 1 (Major )

  5. Firmware Revision 2 (Minor)

  6. IPMI Version

  7. Additional Device support refer IPMI spec.

  8. Manufacture ID

  9. Manufacture ID

  10. Manufacture ID

  11. Product ID

  12. Product ID

  13. Auxiliary Firmware Revision

  14. Auxiliary Firmware Revision

  15. Auxiliary Firmware Revision

  16. Auxiliary Firmware Revision

Returns

BMC golden side firmware version

ipmitool -I lanplus -H <BMC-IP> -U ADMIN -P admin raw 0x3a 0x1a
          20 01 02 16 02 bf 00 00 00 bb aa 4d 4c 01 00
ipmi_get_boot_count_sensor_id()[source]
ipmi_get_chassis_identify_led_state()[source]

This command is used to get the State of Chassis Identify LED.

Chassis Identify LED  0x03
Returns

output of command or raise OpTestError

ipmitool -I lanplus -H <BMC-IP> -U ADMIN -P admin raw 0x3a 0x02 0x03
  00

LED State Table: Below are the states it can get
         0x0  LED OFF
         0x1  LED ON
         0x2  LED Standby Blink Rate
         0x3  LED Slow Blink rate.
ipmi_get_fan_control_task_state_command()[source]

This function is used to get the state of fan control task thread. Ex: ipmitool -I lanplus -U admin -P admin -H <BMC IP> raw 0x3a 0x13

returns 00 or 01, depending on state.

Returns

IPMI_FAN_CONTROL_THREAD_RUNNING = “01”, IPMI_FAN_CONTROL_THREAD_NOT_RUNNING = “00” If fan control loop is running it will return “01” else it will return “00”

ipmi_get_fault_led_state()[source]

This command is used to get the State of Fault RollUP LED.

Fault RollUP LED      0x00
Returns

output of command or raise OpTestError

::
ipmitool -I lanplus -H <BMC-IP> -U ADMIN -P admin raw 0x3a 0x02 0x00

00

LED State Table: Below are the states it can get

0x0 LED OFF 0x1 LED ON 0x2 LED Standby Blink Rate 0x3 LED Slow Blink rate.

ipmi_get_golden_side_sensor_id()[source]
ipmi_get_host_status_led_state()[source]

This command is used to get the State of Host Status LED.

Host Status LED       0x02
Returns

output of command or raise OpTestError

ipmitool -I lanplus -H <BMC-IP> -U ADMIN -P admin raw 0x3a 0x02 0x02
  00

LED State Table: Below are the states it can get
         0x0  LED OFF
         0x1  LED ON
         0x2  LED Standby Blink Rate
         0x3  LED Slow Blink rate.
ipmi_get_occ_status()[source]

Get OCC status

example:

OCC 1 Active     | 08h | ok  | 210.0 | Device Enabled
OCC 2 Active     | 09h | ok  | 210.1 | Device Enabled
Returns

OCC sensor status or raise OpTestError

ipmi_get_pnor_partition_size(i_part)[source]

This function gets the size of pnor partition

Parameters

i_part – partition name to retrieve the size. partition can be NVRAM, GUARD and BOOTKERNEL

TODO: Add support for remaining partitions.

Returns

size of partition raise OpTestError when fails

::

ipmitool -I lanplus -H <BMC-IP> -U ADMIN -P admin raw 0x3a 0x0c 0x42 0x4f 0x4f 0x54 0x4b 0x45 0x52 0x4e 0x45 0x4c 0x00 0x00 0x00 0x00 0x0 0x0 0x0 00 00 f0 00

This function will return “00 00 f0 00”

ipmi_get_power_limit()[source]

Determines the power limit on the bmc

Returns

current power limit on bmc

ipmi_get_power_on_led_state()[source]

This command is used to get the State of Power ON LED.

Power ON LED      0x01
Returns

output of command or raise OpTestError

ipmitool -I lanplus -H <BMC-IP> -U ADMIN -P admin raw 0x3a 0x02 0x01
  01

LED State Table: Below are the states it can get
         0x0  LED OFF
         0x1  LED ON
         0x2  LED Standby Blink Rate
         0x3  LED Slow Blink rate.
ipmi_get_sdr_list()[source]

This function gets the sdr list

ipmi_get_sel_list()[source]

This function gets the sel log

ipmi_get_side_activated()[source]

Get information on active sides for both BMC and PNOR

  • 0x0080 indicates primary side is activated

  • 0x0180 indicates golden side is activated

Returns

the active sides for BMC and PNOR chip (that are either primary of golden) l_bmc_side, l_pnor_side

ipmi_ipl_wait_for_working_state_v1(timeout=10)[source]

This function waits for the IPL to end. The marker for IPL completion is the Host Status sensor which reflects the ACPI power state of the system. When it reads S0/G0: working it means that the petitboot is has began loading.

Parameters

timeout (int) – The number of minutes to wait for IPL to complete, i.e. How long to poll the ACPI sensor for working state before giving up.

ipmi_power_cycle()[source]

This function sends the chassis power cycle ipmitool command

ipmi_power_diag()[source]

This function sends the chassis power diag ipmitool command.

ipmi_power_off()[source]

This function sends the chassis power off ipmitool command.

ipmi_power_on()[source]

This function sends the chassis power on ipmitool command

ipmi_power_reset()[source]

This function sends the chassis power reset ipmitool command.

ipmi_power_soft()[source]

This function sends the chassis power soft ipmitool command

ipmi_power_status()[source]

Determines the power status of the bmc

Returns

string: Power status of bmc “Chassis Power is on” or “Chassis Power is off”

ipmi_preserve_network_setting()[source]

Preserves the network setting

ipmi_sdr_clear()[source]

This function clears the sensor data.

ipmi_sel_check(i_string='Transition to Non-recoverable')[source]

This function dumps the sel log and looks for specific hostboot error log string

ipmi_sel_elist(dump=False)[source]

This function dumps the sel elist

ipmi_set_boot_to_disk()[source]

Set boot device to be boot to disk (i.e. OS)

ipmi_set_boot_to_petitboot()[source]

Set boot device to be boot to BIOS (i.e. petitboot)

ipmi_set_led_state(i_led, i_state)[source]

This function is used to set the state of a given LED.

Parameters
  • i_led

    led number to set the state. e.g.: LED Number Table to use.

    Fault RollUP LED

    0x00

    Power ON LED

    0x01

    Host Status LED

    0x02

    Chassis Identify LED

    0x03

  • i_state

    state of led to set. LED State to be set.

    0x0

    LED OFF

    0x1

    LED ON

    0x2

    LED Standby Blink Rate

    0x3

    LED Slow Blink rate.

ipmi_set_no_override()[source]

Set no boot override so that local config will be effective

ipmi_set_pnor_golden_side(i_bios_sensor, i_boot_sensor)[source]

Sets BIOS sensor and BOOT count to boot pnor from the golden side

Parameters
  • i_bios_sensor – Id for BIOS Golden Sensor (example habanero=0x5c)

  • i_boot_sensor – Id for BOOT Count Sensor (example habanero=80)

ipmi_set_pnor_primary_side(i_bios_sensor, i_boot_sensor)[source]

Sets BIOS sensor and BOOT count to boot pnor from the primary side

Parameters
  • i_bios_sensor – Id for BIOS Golden Sensor (example habanero=0x5c)

  • i_boot_sensor – Id for BOOT Count Sensor (example habanero=80)

ipmi_set_power_limit(i_powerlimit)[source]

set power limit of bmc

Parameters

i_powerlimit (int) – power limit to be set at BMC

ipmi_set_power_policy(i_policy)[source]

Sets auto-reboot policy with given policy(i_policy)

Parameters

i_policy

type of policy to be set(chassis policy <i_policy>)

  • always-off

  • always-on

  • previous

ipmi_wait_for_bmc_runtime(i_timeout=10)[source]

This function waits until BMC Boot finishes after a BMC Cold reset

0x00

Boot Complete

0xC0

Not Complete

Here AMI systems returns 00 and SMC Systems return NULL for success

ipmi_wait_for_os_boot_complete(i_timeout=10)[source]

This function waits for the Host OS Boot(IPL) to end. The marker for IPL completion is the OS Boot sensor which reflects status of host OS Boot. When it reads boot completed it means that the Host OS Booted successfully. The overall timeout for the IPL is defined in the test configuration options.

Parameters

i_timeout (int) – The number of minutes to wait for IPL to complete or Boot time, i.e. How long to poll the OS Boot sensor for working state before giving up.

ipmi_wait_for_os_boot_complete_v1(i_timeout=10)[source]

This function waits for the Host OS Boot(IPL) to end. The marker for IPL completion is the OS Boot sensor which reflects status of host OS Boot. When it reads boot completed it means that the Host OS Booted successfully.

Parameters

i_timeout (int) – The number of minutes to wait for IPL to complete or Boot time, i.e. How long to poll the OS Boot sensor for working state before giving up.

ipmi_wait_for_standby_state(i_timeout=120)[source]

This function waits for system to reach standby state or soft off. The marker for standby state is the Host Status sensor which reflects the ACPI power state of the system. When it reads S5/G2: soft-off it means that the system reached standby or soft-off state. The overall timeout for the standby is defined in the test configuration options.

Parameters

i_timeout (int) – The number of seconds to wait for system to reach standby, i.e. How long to poll the ACPI sensor for soft-off state before giving up.

ipmi_warm_reset()[source]

Performs a warm reset onto the bmc

is_tpm_enabled()[source]
last_sel()[source]
mc_get_watchdog()[source]
sdr_get_watchdog()[source]
set_system(system)[source]
set_tpm_required()[source]
class common.OpTestIPMI.OpTestSMCIPMI(i_bmcIP, i_bmcUser, i_bmcPwd, logfile=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>, host=None, delaybeforesend=None, host_console_command=None)[source]
clear_tpm_required()[source]
enter_ipmi_lockdown_mode()[source]
exit_ipmi_lockdown_mode()[source]
is_tpm_enabled()[source]
set_tpm_required()[source]
class common.OpTestIPMI.pUpdate(method='lan', binary='pUpdate', ip=None, username=None, password=None)[source]
arguments()[source]
binary_name()[source]
run(cmd, background=False, cmdprefix=None)[source]
set_binary(binary)[source]
common.OpTestIPMI.set_system_to_UNKNOWN_BAD(system)[source]

BMC/Machine Specific

OPTestASM

OpTestASM: Advanced System Management (FSP Web UI)

This class can contains common functions which are useful for FSP ASM Web page. Some functionality is only accessible through the FSP Web UI (such as progress codes), so we scrape it.

class common.OpTestASM.OpTestASM(i_fspIP, i_fspUser, i_fspPasswd)[source]
clearlogs()[source]
disablefirewall()[source]
enable_err_injct_policy()[source]
execommand(cmd)[source]
getcsrf(form)[source]
getpage(form)[source]
login()[source]
logout()[source]
powerstat()[source]
setforms()[source]
start_debugvtty_session(partitionId='0', sessionId='0', sessionTimeout='600')[source]
submit(form, param)[source]
ver()[source]

OpTestBMC

OpTestBMC

BMC package which contains all BMC related interfaces/function.

This class encapsulates all function which deals with the BMC in OpenPower systems

class common.OpTestBMC.OpTestBMC(ip=None, username=None, password=None, logfile=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>, ipmi=None, rest=None, web=None, check_ssh_keys=False, known_hosts_file=None)[source]

The main object for communicating with a BMC and taking actions with it.

bmc_host()[source]
flash_part_ami(i_pflash_dir, i_imageName, i_partName)[source]
flash_part_openbmc(i_imageName, i_partName)[source]
get_host_console()[source]
get_ipmi()[source]

Get an object that can be used to do things over IPMI

get_rest_api()[source]

OpenBMC specific REST API.

has_host_status_sensor()[source]
has_inband_bootdev()[source]
has_ipmi_sel()[source]
has_occ_active_sensor()[source]
has_os_boot_sensor()[source]
image_transfer(i_imageName, copy_as=None)[source]

This function copies the given image to the BMC /tmp dir.

Parameters
  • i_imageName – Local file to copy across

  • copy_as – file name to copy to (in /tmp)

Returns

Exit code of scp or rsync process

pnor_img_flash_ami(i_pflash_dir, i_imageName)[source]

This function flashes the PNOR image using pflash tool, And this function will work based on the assumption that pflash tool available in i_pflash_dir. Depending on the BMC type (and even version of BMC firmware) we may have had to copy over pflash ourselves.

Parameters
  • i_pflash_dir (str) – directory where pflash tool is present.

  • i_imageName (str) – Name of the image file. e.g. firestone.pnor or firestone_update.pnor

Returns

pflash command return code

pnor_img_flash_openbmc(i_imageName)[source]

on openbmc systems pflash tool available

reboot()[source]

This function issues the reboot command on the BMC console. It then pings the BMC until it responds, which presumably means that it is done rebooting.

Raises

common.OpTestError

reboot_nowait()[source]

This function issues the reboot command on the BMC console. But it will not wait for BMC to come back.

run_command(command, timeout=60, retry=0)[source]

Run a command on the BMC itself.

set_system(system)[source]
skiboot_img_flash_ami(i_pflash_dir, i_imageName)[source]
skiboot_img_flash_openbmc(i_imageName)[source]
skiroot_img_flash_ami(i_pflash_dir, i_imageName)[source]
skiroot_img_flash_openbmc(i_imageName)[source]
supports_ipmi_dcmi()[source]
validate_pflash_tool(i_dir='')[source]

This function validates presence of pflash tool, which will be used for pnor image flash

Parameters

i_dir – directory where pflash tool should be present.

Returns

True/False

class common.OpTestBMC.OpTestSMC(ip=None, username=None, password=None, logfile=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>, ipmi=None, rest=None, web=None, check_ssh_keys=False, known_hosts_file=None)[source]
flash_part_smc(i_pflash_dir, i_imageName, i_partName)[source]
has_host_status_sensor()[source]
has_occ_active_sensor()[source]
has_os_boot_sensor()[source]
image_transfer(i_imageName, copy_as=None)[source]

This function copies the given image to the BMC /tmp dir.

Parameters
  • i_imageName – Local file to copy across

  • copy_as – file name to copy to (in /tmp)

Returns

Exit code of scp or rsync process

pnor_img_flash_smc(i_pflash_dir, i_imageName)[source]
skiboot_img_flash_smc(i_pflash_dir, i_imageName)[source]
skiroot_img_flash_smc(i_pflash_dir, i_imageName)[source]
supports_ipmi_dcmi()[source]
validate_pflash_tool(i_dir='')[source]

This function validates presence of pflash tool, which will be used for pnor image flash

Parameters

i_dir – directory where pflash tool should be present.

Returns

True/False

OpTestOpenBMC

class common.OpTestOpenBMC.HostManagement(conf=None, ip=None, username=None, password=None)[source]

HostManagement Class OpenBMC methods to manage the Host

activate_image(id, minutes=10)[source]

Activate An Image PUT https://bmcip/xyz/openbmc_project/software/<image id>/attr/RequestedActivation “data”: “xyz.openbmc_project.Software.Activation.RequestedActivations.Active”

bmc_image_ids()[source]

Get List of BMC Image IDs

bmc_reset(minutes=10)[source]

BMC reset PUT https://bmcip/xyz/openbmc_project/state/bmc0/attr/RequestedBMCTransition “data” : “xyz.openbmc_project.State.BMC.Transition.Reboot”

clear_gard_records(minutes=10)[source]

POST https://bmcip/org/open_power/control/gard/action/Reset

clear_sel(minutes=10)[source]

Clear ALL SELs POST https://bmcip/xyz/openbmc_project/logging/action/DeleteAll “data” : []

clear_sel_by_id(minutes=10)[source]

Clear SEL by ID POST https://bmcip/xyz/openbmc_project/logging/entry/<id>/action/Delete “data” : []

configure_tpm_enable(bit, minutes=10)[source]

Configure TPM Enable - 0=disable 1=enable PUT https://bmcip/xyz/openbmc_project/control/host0/TPMEnable/attr/TPMEnable “data” : 1

convert_esels_to_list(id_list=None, dict_list=None)[source]
create_new_dump(minutes=None)[source]

Create new Dump POST https://bmcip/xyz/openbmc_project/dump/action/CreateDump “data” : []

delete_all_dumps(minutes=10)[source]

Delete all Dumps

delete_dump(dump_id, minutes=10)[source]

Delete dump POST https://bmcip/xyz/openbmc_project/dump/entry/<dump_id>/action/Delete

delete_image(id, minutes=10)[source]

Delete An Image POST https://bmcip/xyz/openbmc_project/software/<id>/action/delete “data” : []

disable_tpm(minutes=10)[source]

Disable TPM

download_dump(dump_id, minutes=10)[source]

Download Dump GET https://bmcip/download/dump/<id>

enable_power_cap(enable, minutes=10)[source]

Enable Power Cap : 0=disabled by default 1=enabled PUT https://bmcip/xyz/openbmc_project/control/host0/power_cap/attr/PowerCapEnable “data” : 0

enable_tpm(minutes=10)[source]

Enable TPM

factory_reset_network(minutes=10)[source]

POST https://bmcip/xyz/openbmc_project/network/action/Reset “data”: []”

factory_reset_software(minutes=10)[source]

POST https://bmcip/xyz/openbmc_project/software/action/Reset “data”: []”

get_bmc_state()[source]

Get BMC State

get_boot_progress(minutes=10)[source]

Boot Progress Info GET https://bmcip//xyz/openbmc_project/state/host0/attr/BootProgress

get_current_bootdev(minutes=10)[source]

Current Boot Device Info GET https://bmcip/xyz/openbmc_project/control/host0/boot/attr/BootMode

get_dump_ids(minutes=10)[source]

Get Dump IDs

get_host_state(minutes=10)[source]

Get Host State GET https://bmcip/xyz/openbmc_project/state/host0/attr/CurrentHostState

get_image_priority(id, minutes=10)[source]

Get Image Priority - 0=primary, boot side of the image

get_inventory(minutes=10)[source]

Inventory Enumerate GET https://bmcip/xyz/openbmc_project/inventory/enumerate

get_list_of_image_ids(minutes=10)[source]

Get list of image IDs GET https://bmcip/xyz/openbmc_project/software

get_occ_ids(minutes=10)[source]

GET https://bmcip/org/open_power/control/enumerate

get_power_cap_settings(minutes=10)[source]

GET https://bmcip/xyz/openbmc_project/control/host0/power_cap

get_power_state(minutes=10)[source]

Get Current Host Power State GET https://bmcip/xyz/openbmc_project/state/host0/attr/CurrentHost

get_sel_ids(dump=False, minutes=10)[source]

Build a sorted id_list from the SELs and also build a list of dictionary items containing the SEL and ESEL information

Parameters

dump (Boolean) – Set to True if a printed output is desired.

hard_reboot(minutes=10)[source]

Reboot Server Immediately PUT https://bmcip/xyz/openbmc_project/state/host0/attr/RequestedHostTransition “data”: “xyz.openbmc_project.State.Host.Transition.Reboot”

has_field_mode_set(minutes=10)[source]

Field Mode Enabled : 0=disabled 1=enabled

host_image_ids()[source]

Get List of Host Image IDs

image_data(id, minutes=10)[source]

Get Image Info By ID GET https://bmcip/xyz/openbmc_project/software/id

image_ids(purpose=None, minutes=10)[source]

Get List of Image IDs

image_ready_for_activation(id, timeout=10)[source]

Image Activation Ready IS THIS USED ? CAN IT BE REMOVED ?

is_image_already_active(id, minutes=10)[source]

Check if Image is Active

is_occ_active(id, minutes=10)[source]

Get state of OCC’s GET https://bmcip/org/open_power/control/occ0

is_tpm_enabled(minutes=10)[source]

TPM Enablement Check 0=TPMEnable cleared 1=TPMEnable set GET https://bmcip/xyz/openbmc_project/control/host0/TPMEnable

list_available_dumps(minutes=10)[source]

Listing available Dumps: GET https://bmcip/xyz/openbmc_project/dump/list

list_sel(minutes=10)[source]

List SEL GET https://bmcip/xyz/openbmc_project/logging/enumerate “data” : []

power_cap_disable(minutes=10)[source]

Disables the Power Cap

power_cap_enable(minutes=10)[source]

Enables the Power Cap

power_off(minutes=10)[source]

Power Off Server PUT https://bmcip/xyz/openbmc_project/state/chassis0/attr/RequestedPowerTransition “data”: “xyz.openbmc_project.State.Chassis.Transition.Off”

power_on(minutes=10)[source]

Power On Server PUT https://bmcip/xyz/openbmc_project/state/host0/attr/RequestedHostTransition “data”: “xyz.openbmc_project.State.Host.Transition.On”

power_soft(minutes=10)[source]

Power Soft Server PUT https://bmcip/xyz/openbmc_project/state/chassis0/attr/RequestedPowerTransition “data”: “xyz.openbmc_project.State.Chassis.Transition.Off”

pull_ids(sels=None)[source]

Pull SEL IDs

sensors(minutes=10)[source]

Sensor Enumerate GET https://bmcip/xyz/openbmc_project/sensors/enumerate

set_bootdev_to_none(minutes=10)[source]

Set boot device to regular/default PUT https://bmcip/xyz/openbmc_project/control/host0/boot/attr/BootMode “data”: “xyz.openbmc_project.Control.Boot.Mode.Modes.Regular”

https://bmcip/xyz/openbmc_project/control/host0/boot/one_time/attr/Enabled “data”: 0

set_bootdev_to_setup(minutes=10)[source]

Set boot device to setup PUT https://bmcip/xyz/openbmc_project/control/host0/boot/attr/BootMode “data”: “xyz.openbmc_project.Control.Boot.Mode.Modes.Setup”

https://bmcip/xyz/openbmc_project/control/host0/boot/one_time/attr/Enabled “data”: 0

set_field_mode(mode, minutes=10)[source]

Set field mode : 0=disable 1=enable PUT https://bmcip/xyz/openbmc_project/software/attr/FieldModeEnabled “data”: 0

set_image_priority(id, level, minutes=10)[source]

Set Image Priority PUT https://bmcip/xyz/openbmc_project/software/<id>/attr/Priority “data” : 0

soft_reboot(minutes=10)[source]

Reboot Server Gracefully PUT https://bmcip/xyz/openbmc_project/state/host0/attr/RequestedHostTransition “data”: “xyz.openbmc_project.State.Host.Transition.Reboot”

software_enumerate(minutes=10)[source]

Software Enumerate GET https://bmcip/xyz/openbmc_project/software

update_root_password(password, minutes=10)[source]

Update Root Password POST https://bmcip/xyz/openbmc_project/user/root/action/SetPassword “data” : [“abc123”]

upload_image(image, minutes=10)[source]

Upload an image, OpenBMC imposes validation on files uploaded POST https://bmcip/upload/image “file” : file-like-object

validate_functional_bootside(id, minutes=10)[source]

Functional Boot Side Validation for both BMC and PNOR GET https://bmcip/xyz/openbmc_project/software/functional {

“data”: { “endpoints”: [ “/xyz/openbmc_project/software/061c4bdb”, “/xyz/openbmc_project/software/608e9ebe” ]

}

verify_clear_sel(minutes=10)[source]

Verify SEL is Cleared

wait_bmc(key=None, value_target=None, token=None, minutes=10)[source]

Wait on BMC Given a token, target, key wait for a match

wait_for_bmc_runtime(timeout=10)[source]

Wait for BMC Runtime

wait_for_dump_finish(dump_id, counter=30)[source]

Wait for Dump to Finish

wait_for_host_state(target_state, host=0, minutes=10)[source]

Wait for OpenBMC Host state GET https://bmcip//xyz/openbmc_project/state/host0 “data” : []

wait_for_image_active_complete(id, timeout=10)[source]

Wait For Image Active Complete

wait_for_runtime(timeout=10)[source]

Wait for Runtime

wait_for_standby(timeout=10)[source]

Wait for Standby

class common.OpTestOpenBMC.OpTestOpenBMC(ip=None, username=None, password=None, ipmi=None, rest_api=None, logfile=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>, check_ssh_keys=False, known_hosts_file=None)[source]
bmc_host()[source]
clear_field_mode()[source]
flash_part_openbmc(lid_name, part_name)[source]
get_host_console()[source]
get_ipmi()[source]
get_rest_api()[source]
has_host_status_sensor()[source]
has_inband_bootdev()[source]
has_ipmi_sel()[source]
has_occ_active_sensor()[source]
has_os_boot_sensor()[source]
image_transfer(i_imageName, copy_as=None)[source]
pnor_img_flash_openbmc(pnor_name)[source]
query_vpnor(minutes=10)[source]
reboot()[source]
reboot_nowait()[source]
run_command(command, timeout=10, retry=0)[source]
set_system(system)[source]
skiboot_img_flash_openbmc(lid_name)[source]
skiroot_img_flash_openbmc(lid_name)[source]
supports_ipmi_dcmi()[source]

OpTestFSP

OpTestFSP: talk to the FSP

This class can contains common functions which are useful for FSP platforms, mostly things that execute shell commands on the FSP itself. There is (currently) no differentiation between commands that require the NFS mount and ones that don’t, we assume (and check for) the NFS mount.

class common.OpTestFSP.OpTestFSP(i_fspIP, i_fspUser, i_fspPasswd, ipmi=None, hmc=None, rest=None)[source]

Contains most of the common methods to interface with FSP.

bmc_host()[source]
clear_all_fipsdumps_in_fsp()[source]

Clear all FIPS dumps

clear_errorlogs_in_fsp()[source]

Clear all error logs from fsp. Throws exception on error.

clear_fsp_errors()[source]

Clear all FSP errors: error logs, gards, fipsdumps, and sysdumps.

enable_system_dump()[source]
fsp_get_console()[source]

Get FSP telnet console

fsp_issue_power_on()[source]

Issue Power On for system from FSP (IPL type 0x01).

fsp_reset()[source]

FSP Tool Reset.

fsp_run_command(command)[source]

Execute and return the output of an FSP command

generate_error_log_from_fsp()[source]

Generate a sample error log from fsp. Returns True on success or raises exception on error.

get_hmc()[source]
get_host_console()[source]
get_ipmi()[source]
get_opal_console_log()[source]

Get OPAL log from in memory console (using getmemproc on FSP).

get_progress_code()[source]

Get IPL progress code

get_raw_mtm()[source]

Get MTM (Machine Type Model) from FSP from FSP registry.

get_rest_api()[source]
get_sys_status()[source]

Get current system status (same as ‘smgr mfgState’ on FSP).

has_host_status_sensor()[source]
has_inband_bootdev()[source]
has_ipmi_sel()[source]
has_occ_active_sensor()[source]
has_os_boot_sensor()[source]
is_sys_powered_on()[source]

Check for system runtime state. Returns True if runtime, else False.

is_sys_standby()[source]

Check for system standby state. Returns True if system is in standby state else False.

list_all_errorlogs_in_fsp()[source]

List all error logs on FSP.

list_all_fipsdumps_in_fsp()[source]

List all FSP dumps (FIPS dumps) on FSP

mount_exists()[source]

Checks for NFS mount on FSP. Returns True/False.

power_off_sys()[source]

Power off the system and wait for standby state. Returns True if successfully powered off, False if for some reason we failed to power off the system.

power_on_sys()[source]

Power on the system and wait for system to reach runtime in OPAL mode (will switch HypMode before IPL if needed). Returns True if we reach Runtime state, False otherwise.

progress_line()[source]
reboot()[source]

Currently a no-op. FSP “reset-reload” (i.e. reboot) tests are covered in the fspresetReload test, as the process for rebooting an FSP isn’t a simple ‘reboot’ (because reasons).

supports_ipmi_dcmi()[source]
trigger_fipsdump_in_fsp()[source]

Initiate a FIPS dump (fsp dump). Returns (name of dump, size of dump).

trigger_system_dump()[source]

Trigger a system dump from FSP, by writing a magic value to a memory location looked at by OPAL.

wait_for_dump_to_start()[source]
wait_for_ipling(timeout=10)[source]

Wait for system to reach ipling state. Throws exception on error.

wait_for_runtime(timeout=10)[source]

Wait for system to reach runtime. Throws exception on error.

wait_for_standby(timeout=10)[source]

Wait for system standby state. Returns 0 on success, throws exception on error.

wait_for_systemdump_to_finish()[source]

Wait for a system dump to finish. Throws exception on error/timeout.

OpTestQemu

Support testing against Qemu simulator

class common.OpTestQemu.ConsoleState[source]
CONNECTED = 1
DISCONNECTED = 0
class common.OpTestQemu.OpTestQemu(conf=None, qemu_binary=None, pnor=None, skiboot=None, kernel=None, initramfs=None, cdrom=None, logfile=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>)[source]
add_temporary_disk(size)[source]
cleanup()[source]
get_host_console()[source]
get_ipmi()[source]
get_rest_api()[source]
has_host_status_sensor()[source]
has_inband_bootdev()[source]
has_ipmi_sel()[source]
has_occ_active_sensor()[source]
has_os_boot_sensor()[source]
power_off()[source]
power_on()[source]
run_command(command, timeout=10, retry=0)[source]
set_system(system)[source]
supports_ipmi_dcmi()[source]
class common.OpTestQemu.QemuConsole(qemu_binary=None, pnor=None, skiboot=None, prompt=None, kernel=None, initramfs=None, block_setup_term=None, delaybeforesend=None, logfile=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>, disks=None, cdrom=None)[source]

A ‘connection’ to the Qemu Console involves launching qemu. Closing a connection will terminate the qemu process.

close()[source]
connect()[source]
disable_setup_term_quiet()[source]
enable_setup_term_quiet()[source]
get_block_setup_term()[source]
get_console()[source]
get_system_setup_term()[source]
run_command(command, timeout=60, retry=0)[source]
run_command_ignore_fail(command, timeout=60, retry=0)[source]
set_block_setup_term(flag)[source]
set_system(system)[source]
set_system_setup_term(flag)[source]
update_disks(disks)[source]
class common.OpTestQemu.QemuIPMI(console)[source]

Qemu has fairly limited IPMI capability, and we probably need to extend the capability checks so that more of the IPMI test suite gets skipped.

ipmi_power_off()[source]

For Qemu, this just kills the simulator

ipmi_sel_check(i_string='Transition to Non-recoverable')[source]
ipmi_sel_elist(dump=False)[source]
ipmi_set_boot_to_petitboot()[source]
ipmi_set_no_override()[source]
ipmi_wait_for_standby_state(i_timeout=10)[source]

For Qemu, we just kill the simulator

sys_set_bootdev_no_override()[source]

Firmware Flashing

OpTestFlash

Firmware flash tests for OpenPower testing.

This class contains the OpenPower Firmware flashing scripts for all the OPAL PowerNV platforms(AMI, FSP, SMC and OpenBMC).

  • Host PNOR Firmware Updates

  • OPAL Lid Updates(Both Skiboot and Skiroot lids flashing)

  • Out-of-band HPM Update

  • In-band HPM Update

Tools needed (can vary per platform):

  • ipmitool

  • pflash

  • pUpdate

class testcases.OpTestFlash.BmcImageFlash(methodName='runTest')[source]

Flashes the BMC with BMC firmware. This enables a single op-test incantation to test with a specific BMC firmware build.

Currently supports SuperMicro (SMC) BMCs and OpenBMC. FSP systems need to use a separate mechanism.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

class testcases.OpTestFlash.FSPFWImageFLASH(methodName='runTest')[source]
setUp()[source]

Hook method for setting up the test fixture before exercising it.

class testcases.OpTestFlash.InbandHpmFLASH(methodName='runTest')[source]
setUp()[source]

Hook method for setting up the test fixture before exercising it.

class testcases.OpTestFlash.OOBHpmFLASH(methodName='runTest')[source]
setUp()[source]

Hook method for setting up the test fixture before exercising it.

class testcases.OpTestFlash.OpTestFlashBase(methodName='runTest')[source]
setUp()[source]

Hook method for setting up the test fixture before exercising it.

class testcases.OpTestFlash.OpalLidsFLASH(methodName='runTest')[source]

Flash specific LIDs (partitions). Can be combined with a full PNOR flash to test a base firmware image plus new code. For example, if testing a new skiboot (before incorporating it into upstream) you can test a base image plus new skiboot.

Compatible with AMI, SMC, OpenBMC and FSP.

This just flashes the raw file you provide, so you need to provide it with the correct format for the system.

e.g. for skiboot: FSP systems needs raw skiboot.lid AMI,SMC,OpenBMC systems need skiboot.lid.xz unless secure boot is enabled, and then they need skiboot.lid.xz.stb

setUp()[source]

Hook method for setting up the test fixture before exercising it.

class testcases.OpTestFlash.PNORFLASH(methodName='runTest')[source]

Flash full PNOR image

For OpenBMC, uses REST image upload For SMC, uses pUpdate for regular images or pflash for upstream images For AMI, relies on pflash

op-test needs to be provided locations of pUpdate and pflash binaries to successfully flash machines that need them.

Supports SMC, AMI and OpenBMC based BMCs.

FSP systems use a different mechanism.

setUp()[source]

Hook method for setting up the test fixture before exercising it.