def ReadCpuTemperatures(interfaceParams):

    # Initialize Variables
    readPassOrFail = True
    cpuTemps = []

    # Get CPU 0 Temperature
    sensorPassOrFail, sensorReading = \
        IpmiUtil.GetIpmiUtilSensorReading(interfaceParams, \
        cpu0SensorId, cpu0SensorName)
    if sensorPassOrFail:
        UtilLogger.verboseLogger.info("ReadCpuTemperatures: " + \
            "successfully read Cpu 0 temperature as " + \
            str(sensorReading) + " degrees Celsius.")
        cpuTemps.append(float(sensorReading))
    else:
        UtilLogger.verboseLogger.error("ReadCpuTemperatures: " + \
            "unable to read Cpu 0 temperatuer.")
        readPassOrFail = False

    # Get CPU 1 Temperature
    sensorPassOrFail, sensorReading = \
        IpmiUtil.GetIpmiUtilSensorReading(interfaceParams, \
        cpu1SensorId, cpu1SensorName)
    if sensorPassOrFail:
        UtilLogger.verboseLogger.info("ReadCpuTemperatures: " + \
            "successfully read Cpu 1 temperature as " + \
            str(sensorReading) + " degrees Celsius.")
        cpuTemps.append(float(sensorReading))
    else:
        UtilLogger.verboseLogger.error("ReadCpuTemperatures: " + \
            "unable to read Cpu 1 temperature.")
        readPassOrFail = False

    return readPassOrFail, cpuTemps
def Execute(interfaceParams):

    # Define Test variables
    testPassOrFail = False
    cmdPassOrFail = False
    respData = None

    # Define SetPowerCycleInterval variables
    cmdName = 'SetPowerCycleInterval'
    cmdNum = Config.cmdSetPowerCycleInterval
    netFn = Config.netFnChassis

    # Define sample raw bytes for Set Power Cycle Interval
    # Raw bytes defined as 10 seconds delay
    rawBytesList = \
        [ '0A' ]
        
    # Send raw bytes via IpmiUtil
    cmdPassOrFail, respData = IpmiUtil.SendRawCmd(interfaceParams, \
        netFn, cmdNum, rawBytesList)

    # Verify response
    if cmdPassOrFail:
        UtilLogger.verboseLogger.info(cmdName + \
            ": Command passed for 10 second interval: " + str(respData))
        testPassOrFail = True
    else:
        UtilLogger.verboseLogger.error(cmdName + \
            ": Command failed. Completion Code: " + str(respData))

    # Define sample raw bytes for Set Power Cycle Interval
    # Raw bytes defined as no delay (expected response: 0xCC)
    rawBytesList = \
        [ '00' ]
        
    # Send raw bytes via IpmiUtil
    cmdPassOrFail, respData = IpmiUtil.SendRawCmd(interfaceParams, \
        netFn, cmdNum, rawBytesList)

    # Verify response
    if cmdPassOrFail:
        UtilLogger.verboseLogger.info(cmdName + \
            ": Command failed with Success completion code and raw bytes: " + \
            str(respData) + \
            ". Expected 0xCC completion code for no delay power cycle interval.")
        testPassOrFail = False
    elif not cmdPassOrFail and respData == 'cc':
        UtilLogger.verboseLogger.info(cmdName + \
            ". Command passed for no delay power cycle interval. Completion code: " + \
            str(respData))
    else:
        UtilLogger.verboseLogger.error(cmdName + \
            ": Command failed. Completion Code: " + str(respData))
        testPassOrFail = False

    return testPassOrFail
Beispiel #3
0
def Execute(interfaceParams):

    # Define Test variables
    cmdPassOrFail = True
    respData = None

    # Define SetTpmPhysicalPresence variables
    cmdName = 'SetTpmPhysicalPresence'
    cmdNum = Config.cmdSetTpmPhysicalPresence
    netFn = Config.netFnOem38

    # Define sample raw byte for
    # TPM Physical Presence to
    # not asserted (0x00 == flag is false)
    rawBytesList = ['00']

    # Send raw bytes via IpmiUtil
    tpmPassOrFail, respData = IpmiUtil.SendRawCmd(interfaceParams, \
        netFn, cmdNum, rawBytesList)

    # Verify response
    if tpmPassOrFail:
        UtilLogger.verboseLogger.info(cmdName + \
            ": Command passed for Physical Presence not asserted: "\
            + str(respData))
    else:
        UtilLogger.verboseLogger.error(cmdName + \
            ": Command failed for Physical Presence not asserted."\
            + " Completion Code: " + str(respData))

    cmdPassOrFail &= tpmPassOrFail

    # Define sample raw byte for
    # TPM Physical Presence to
    # asserted (0x01 == flag is true)
    rawBytesList = ['01']

    # Send raw bytes via IpmiUtil
    tpmPassOrFail, respData = IpmiUtil.SendRawCmd(interfaceParams, \
        netFn, cmdNum, rawBytesList)

    # Verify response
    if tpmPassOrFail:
        UtilLogger.verboseLogger.info(cmdName + \
            ": Command passed for Physical Presence asserted: "\
            + str(respData))
    else:
        UtilLogger.verboseLogger.error(cmdName + \
            ": Command failed for Physical Presence asserted."\
            + " Completion Code: " + str(respData))

    cmdPassOrFail &= tpmPassOrFail

    return cmdPassOrFail
def Setup(interfaceParams):

    # Get Sel entries
    processCmd = ['sel', '-u']
    for interfaceParam in interfaceParams:
        processCmd.append(interfaceParam)
    out, err = IpmiUtil.RunIpmiUtil(processCmd)
    if err:
        UtilLogger.verboseLogger.error("IpmiOverLanOrKcsConcurrentStressTest.py: " + \
            "setup SEL entries error: " + str(err))
        setupSuccess = False
    else:
        UtilLogger.verboseLogger.info("IpmiOverLanOrKcsConcurrentStressTest.py: " + \
            "setup SEL entries: \n" + str(out))

    # Reserve Sel
    reservationId = []
    cmdPassOrFail, respData = IpmiUtil.SendRawCmd(\
        interfaceParams, Config.netFnStorage,\
        Config.cmdReserveSel, [])
    if cmdPassOrFail:
        UtilLogger.verboseLogger.info("ReserveSel" + \
            ": Command passed: " + str(respData))
        reservationId = respData
    else:
        UtilLogger.verboseLogger.error("ReserveSel" + \
            ": Command failed. Completion Code: " + \
            str(respData))
    
    # Define sample raw bytes for Clear Sel
    # Raw bytes defined as Initiate Erase
    rawBytesList = []
    for appendByte in reservationId:
        rawBytesList.append(appendByte)
    rawBytesList.append('43')
    rawBytesList.append('4C')
    rawBytesList.append('52')
    rawBytesList.append('AA')

    # Clear Sel
    cmdPassOrFail, respData = IpmiUtil.SendRawCmd(\
        interfaceParams, Config.netFnStorage,\
        Config.cmdClearSel,\
        rawBytesList)
    if cmdPassOrFail:
        UtilLogger.verboseLogger.info("ClearSel" + \
            ": Command passed: " + str(respData))
    else:
        UtilLogger.verboseLogger.error("ClearSel" + \
            ": Command failed. Completion Code: " + \
            str(respData))
    
    return True
def Execute(interfaceParams):

    # Define Test variables
    cmdPassOrFail = True
    respData = None

    # Define ChassisIdentify variables
    cmdName = 'ChassisIdentify'
    cmdNum = Config.cmdChassisIdentify
    netFn = Config.netFnChassis

    # Define sample raw bytes for
    # identify off
    rawBytesList = ['00', '00']

    # Send raw bytes via IpmiUtil
    chassisIdentifyPassOrFail, respData = IpmiUtil.SendRawCmd(\
        interfaceParams, netFn, cmdNum, rawBytesList)

    # Verify response
    if chassisIdentifyPassOrFail:
        UtilLogger.verboseLogger.info(cmdName + \
            ": Command passed for identify off: "\
            + str(respData))
    else:
        UtilLogger.verboseLogger.error(cmdName + \
            ": Command failed for identify off."\
            + " Completion Code: " + str(respData))

    cmdPassOrFail &= chassisIdentifyPassOrFail

    # Define sample raw bytes for
    # identify on
    rawBytesList = ['00', '01']

    # Send raw bytes via IpmiUtil
    chassisIdentifyPassOrFail, respData = IpmiUtil.SendRawCmd(interfaceParams, \
        netFn, cmdNum, rawBytesList)

    # Verify response
    if chassisIdentifyPassOrFail:
        UtilLogger.verboseLogger.info(cmdName + \
            ": Command passed for identify on: "\
            + str(respData))
    else:
        UtilLogger.verboseLogger.error(cmdName + \
            ": Command failed for identify on."\
            + " Completion Code: " + str(respData))

    cmdPassOrFail &= chassisIdentifyPassOrFail

    return cmdPassOrFail
Beispiel #6
0
def Execute(interfaceParams):

    # Define Test variables
    cmdPassOrFail = True
    respData = None

    # Define GetBiosCode variables
    cmdName = 'GetBiosCode'
    cmdNum = Config.cmdGetBiosCode
    netFn = Config.netFnOem32

    # Define sample raw bytes for
    # Current (0x00) BIOS POST code
    rawBytesList = ['00']

    # Send raw bytes via IpmiUtil
    biosPassOrFail, respData = IpmiUtil.SendRawCmd(interfaceParams, \
        netFn, cmdNum, rawBytesList)

    # Verify response
    if biosPassOrFail:
        UtilLogger.verboseLogger.info(cmdName + \
            ": Command passed for current BIOS Code: "\
            + str(respData))
    else:
        UtilLogger.verboseLogger.error(cmdName + \
            ": Command failed for current BIOS Code."\
            + " Completion Code: " + str(respData))

    cmdPassOrFail &= biosPassOrFail

    # Define sample raw bytes for
    # Previous (0x01) BIOS POST code
    rawBytesList = ['01']

    # Send raw bytes via IpmiUtil
    biosPassOrFail, respData = IpmiUtil.SendRawCmd(interfaceParams, \
        netFn, cmdNum, rawBytesList)

    # Verify response
    if biosPassOrFail:
        UtilLogger.verboseLogger.info(cmdName + \
            ": Command passed for previous BIOS Code: "\
            + str(respData))
    else:
        UtilLogger.verboseLogger.error(cmdName + \
            ": Command failed for previous BIOS Code."\
            + " Completion Code: " + str(respData))

    cmdPassOrFail &= biosPassOrFail

    return cmdPassOrFail
def Execute(interfaceParams):

    # Define Test variables
    cmdPassOrFail = False
    respData = None

    # Define SetBiosVersion variables
    cmdName = 'SetBiosVersion'
    cmdNum = Config.cmdSetBiosVersion
    netFn = Config.netFnOem30

    # Define sample raw bytes for Set Bios Version
    # Setting BIOS version to: 'C2000.BS.1B02.GN1'
    rawBytesList = \
        [ '49', '4D', '41', '00', '00', '11', '43', '32',\
        '30', '30', '30', '2e', '42', '53', '2e', '31',\
        '42', '30', '32', '2e', '47', '4e', '31' ]

    # Send raw bytes via IpmiUtil
    cmdPassOrFail, respData = IpmiUtil.SendRawCmd(interfaceParams, \
        netFn, cmdNum, rawBytesList)

    # Verify response
    if cmdPassOrFail:
        UtilLogger.verboseLogger.info(cmdName + \
            ": Command passed: " + str(respData))
    else:
        UtilLogger.verboseLogger.error(cmdName + \
            ": Command failed. Completion Code: " + str(respData))

    return cmdPassOrFail
def Execute(interfaceParams):

    # Define Test variables
    cmdPassOrFail = False
    respData = None

    # Define MasterWriteRead variables
    cmdName = 'MasterWriteRead'
    cmdNum = Config.cmdMasterWriteRead
    netFn = Config.netFnApp

    # Define sample raw bytes for Master Write-Read
    # Below bytes will read first 8 bytes from FRU EEPROM
    rawBytesList = \
        [ '0D', 'A8', '08', '00', '00' ]

    # Send raw bytes via IpmiUtil
    cmdPassOrFail, respData = IpmiUtil.SendRawCmd(interfaceParams, \
        netFn, cmdNum, rawBytesList)

    # Verify response
    if cmdPassOrFail:
        UtilLogger.verboseLogger.info(cmdName + \
            ": Command passed: " + str(respData))
    else:
        UtilLogger.verboseLogger.error(cmdName + \
            ": Command failed. Completion Code: " + str(respData))

    return cmdPassOrFail
def Execute(interfaceParams):

    # Define Test variables
    cmdPassOrFail = False
    respData = None

    # Define GetSystemBootOptions variables
    cmdName = 'GetSystemBootOptions'
    cmdNum = Config.cmdGetSystemBootOptions
    netFn = Config.netFnChassis

    # Define sample raw bytes for Set Power Cycle Interval
    # Raw bytes defined as no delay
    rawBytesList = \
        [ '05', '00', '00' ]

    # Send raw bytes via IpmiUtil
    cmdPassOrFail, respData = IpmiUtil.SendRawCmd(interfaceParams, \
        netFn, cmdNum, rawBytesList)

    # Verify response
    if cmdPassOrFail:
        UtilLogger.verboseLogger.info(cmdName + \
            ": Command passed: " + str(respData))
    else:
        UtilLogger.verboseLogger.error(cmdName + \
            ": Command failed. Completion Code: " + str(respData))

    return cmdPassOrFail
def Setup(interfaceParams):

    # Declare global (module-scope) variables.
    global sensorList

    # Parse the XML file to get the information regarding the sensors to test.
    # Validate file containing sensors to monitor.
    sensorListFile = Config.sensorListXmlFile  # File containing list of sensors to monitor.
    if (not os.path.isfile(sensorListFile)):
        UtilLogger.verboseLogger.error(
            "SensorReadingStressTest.py: File path " + sensorListFile +
            " is invalid.")
        return False

    xmlParserObj = XmlParser.XmlParser(sensorListFile)
    if not xmlParserObj.root:
        UtilLogger.verboseLogger.error("SensorReadingStressTest.py - XmlParser: " + \
                                       "failed to parse sensor list XML file.")
        return False

    # Store info regarding all sensors to be monitored in sensorList.
    for sensorEntry in xmlParserObj.root:
        sensorName = sensorEntry.attrib["name"]
        nominalValue = sensorEntry.attrib["nominal"]
        tolerance = sensorEntry.attrib["tolerance"]
        gotSensorIdSuccess, sensorId = IpmiUtil.GetIpmiUtilSensorId(
            interfaceParams, sensorName)
        if (not gotSensorIdSuccess):
            UtilLogger.verboseLogger.error("SensorReadingStressTest.py - Setup(): " + \
                                       "Failed to get sensor ID for sensor '%s'." % sensorName)
            return False
        sensorList.append(
            (sensorName, sensorId, float(nominalValue), float(tolerance)))

    return True
Beispiel #11
0
def Setup(interfaceParams):

    # Declare module-scope variables
    global reservationId

    # Define variables
    cmdPassOrFail = False
    respData = None

    # Define ReserveSel variables
    cmdName = 'ReserveSel'
    cmdNum = Config.cmdReserveSel
    netFn = Config.netFnStorage

    # Send raw bytes via IpmiUtil
    cmdPassOrFail, respData = IpmiUtil.SendRawCmd(interfaceParams, \
        netFn, cmdNum, [])

    # Verify response
    if cmdPassOrFail:
        UtilLogger.verboseLogger.info(cmdName + \
            ": Command passed: " + str(respData))
        # Update reservationId variable with respData
        reservationId = respData

    else:
        UtilLogger.verboseLogger.error(cmdName + \
            ": Command failed. Completion Code: " + str(respData))

    return cmdPassOrFail
Beispiel #12
0
def Cleanup(interfaceParams):

    # Define Test variables
    cmdPassOrFail = False
    respData = None

    # Define SetGpio variables
    cmdName = 'SetGpio'
    cmdNum = Config.cmdSetGpio
    netFn = Config.netFnOem30

    # Define sample raw bytes for Set GPIO
    # Raw bytes defined as setting
    # output GPIOF6 (CATERR LED) to '0'
    rawBytesList = \
        [ '2E', '01', '00' ]

    # Send raw bytes via IpmiUtil
    cmdPassOrFail, respData = IpmiUtil.SendRawCmd(interfaceParams, \
        netFn, cmdNum, rawBytesList)

    # Verify response
    if cmdPassOrFail:
        UtilLogger.verboseLogger.info(cmdName + \
            ": Command passed: " + str(respData))
    else:
        UtilLogger.verboseLogger.error(cmdName + \
            ": Command failed. Completion Code: " + str(respData))

    return cmdPassOrFail
Beispiel #13
0
def RetryCommand(cmdName, interfaceParams, rawBytesList):

    # Retry max of 5 times
    retryMax = 5

    # Loop and check for either 
    # Success completion code or
    # Node Busy (0xC0)
    retryCount = 0
    sendMsgPassOrFail = False
    respData = []
    for retryCount in range(0, retryMax):

        sendMsgPassOrFail, respData = IpmiUtil.SendRawCmd2ME(interfaceParams, \
            rawBytesList)
        if sendMsgPassOrFail:
            break
        elif respData != 'c0':
            break
    
    # Verify results
    if sendMsgPassOrFail:
        UtilLogger.verboseLogger.info(\
            cmdName + \
            ": Command passed: " + str(respData) + \
            ". Retry count: " + str(retryCount))
    else:
        UtilLogger.verboseLogger.error(cmdName + \
            ": Command failed. Completion Code: " + \
            str(respData) + ". Retry count: " + \
            str(retryCount))

    return sendMsgPassOrFail
def Execute(interfaceParams):

    # Define Test variables
    cmdPassOrFail = False
    respData = None

    # Define SetMemoryInfo variables
    cmdName = 'SetMemoryInfo'
    cmdNum = Config.cmdSetMemoryInfo
    netFn = Config.netFnOem30

    # Define sample raw bytes (NOTE: only memory index 1)
    rawBytesList = \
        [ '49', '4D', '41', '00', '00', '01', '01', '46'\
        , 'DC', '05', '00', '7D', '00', '00', '02' ]

    # Send raw bytes via IpmiUtil
    cmdPassOrFail, respData = IpmiUtil.SendRawCmd(interfaceParams, \
        netFn, cmdNum, rawBytesList)

    # Verify response
    if cmdPassOrFail:
        UtilLogger.verboseLogger.info(cmdName + \
            ": Command passed: " + str(respData))
    else:
        UtilLogger.verboseLogger.error(cmdName + \
            ": Command failed. Completion Code: " + str(respData))

    return cmdPassOrFail
Beispiel #15
0
def Execute(interfaceParams):

    # Define Test variables
    cmdPassOrFail = False
    respData = None

    # Define SendMessage variables
    cmdName = 'SendMessage'

    # Define sample raw bytes for Send Message
    # Bytes are request to ME to get CPU and DIMM temperatures
    rawBytesList = \
        [ '00', '20', 'B8', '4B', '57', '01', '00',\
        '03', 'FF', 'FF', 'FF', 'FF', '00', '00', '00', '00' ]

    # Send raw bytes via IpmiUtil
    # NOTE: as this is using the -m send message feature from
    # IPMIUtil, netFn and cmdNum are not needed
    cmdPassOrFail, respData = IpmiUtil.SendRawCmd2ME(interfaceParams, \
        rawBytesList)

    # Verify response
    if cmdPassOrFail:
        UtilLogger.verboseLogger.info(cmdName + \
            ": Command passed: " + str(respData))
    else:
        UtilLogger.verboseLogger.error(cmdName + \
            ": Command failed. Completion Code: " + str(respData))

    return cmdPassOrFail
Beispiel #16
0
def Execute(interfaceParams):

    # Define Test variables
    cmdPassOrFail = False
    respData = None

    # Define GetSelEntry variables
    cmdName = 'GetSelEntry'
    cmdNum = Config.cmdGetSelEntry
    netFn = Config.netFnStorage

    # Define sample raw bytes for Get SEL Entry
    # Raw bytes defined as reading entire first entry 
    rawBytesList = \
        [ '00', '00', '00', '00', '00', 'FF' ]
        
    # Send raw bytes via IpmiUtil
    cmdPassOrFail, respData = IpmiUtil.SendRawCmd(interfaceParams, \
        netFn, cmdNum, rawBytesList)

    # Verify response
    if cmdPassOrFail:
        UtilLogger.verboseLogger.info(cmdName + \
            ": Command passed: " + str(respData))
    else:
        UtilLogger.verboseLogger.error(cmdName + \
            ": Command failed. Completion Code: " + str(respData))

    return cmdPassOrFail
def Execute(interfaceParams):

    # Define Test variables
    cmdPassOrFail = False
    respData = None

    # Define SetBiosConfig variables
    cmdName = 'SetBiosConfig'
    cmdNum = Config.cmdSetBiosConfig
    netFn = Config.netFnOem38

    # Define sample raw bytes for Set Bios Config (default BIOS config)
    rawBytesList = \
        [ '00' ]
        
    # Send raw bytes via IpmiUtil
    cmdPassOrFail, respData = IpmiUtil.SendRawCmd(interfaceParams, \
        netFn, cmdNum, rawBytesList)

    # Verify response
    if cmdPassOrFail:
        UtilLogger.verboseLogger.info(cmdName + \
            ": Command passed: " + str(respData))
    else:
        UtilLogger.verboseLogger.error(cmdName + \
            ": Command failed. Completion Code: " + str(respData))

    return cmdPassOrFail
Beispiel #18
0
def Execute(interfaceParams):

    # Define Test variables
    cmdPassOrFail = False
    respData = None

    # Define GetSensorType variables
    cmdName = 'GetSensorType'
    cmdNum = Config.cmdGetSensorType
    netFn = Config.netFnSensor

    # Define sample raw bytes for Get Sensor Type
    # Raw byte defined as Temp_Inlet sensor
    rawBytesList = \
        [ 'B0' ]

    # Send raw bytes via IpmiUtil
    cmdPassOrFail, respData = IpmiUtil.SendRawCmd(interfaceParams, \
        netFn, cmdNum, rawBytesList)

    # Verify response
    if cmdPassOrFail:
        UtilLogger.verboseLogger.info(cmdName + \
            ": Command passed: " + str(respData))
    else:
        UtilLogger.verboseLogger.error(cmdName + \
            ": Command failed. Completion Code: " + str(respData))

    return cmdPassOrFail
Beispiel #19
0
def Execute(interfaceParams):

    # Define Test variables
    cmdPassOrFail = False
    respData = None

    # Define SetNicInfo variables
    cmdName = 'SetNicInfo'
    cmdNum = Config.cmdSetNicInfo
    netFn = Config.netFnOem30

    # Define sample raw bytes for NIC indexes 0 and 1
    rawBytesList = \
        [ '49', '4D', '41', '00', '00', '02', '00', '11'\
        , '22', '33', '44', '55', '66', '01', '77', '88'\
        , '99', 'AA', 'BB', 'CC' ]

    # Send raw bytes via IpmiUtil
    cmdPassOrFail, respData = IpmiUtil.SendRawCmd(interfaceParams, \
        netFn, cmdNum, rawBytesList)

    # Verify response
    if cmdPassOrFail:
        UtilLogger.verboseLogger.info(cmdName + \
            ": Command passed: " + str(respData))
    else:
        UtilLogger.verboseLogger.error(cmdName + \
            ": Command failed. Completion Code: " + str(respData))

    return cmdPassOrFail
def Execute(interfaceParams):

    # Define Test variables
    cmdPassOrFail = False
    respData = None

    # Define ReadFruData variables
    cmdName = 'ReadFruData'
    cmdNum = Config.cmdReadFruData
    netFn = Config.netFnStorage

    # Define sample raw bytes for Read Fru Data
    # Raw bytes defined as reading first 8 bytes of FRU EEPROM
    rawBytesList = \
        [ '00', '00', '00', '08' ]

    # Send raw bytes via IpmiUtil
    cmdPassOrFail, respData = IpmiUtil.SendRawCmd(interfaceParams, \
        netFn, cmdNum, rawBytesList)

    # Verify response
    if cmdPassOrFail:
        UtilLogger.verboseLogger.info(cmdName + \
            ": Command passed: " + str(respData))
    else:
        UtilLogger.verboseLogger.error(cmdName + \
            ": Command failed. Completion Code: " + str(respData))

    return cmdPassOrFail
Beispiel #21
0
def Execute(interfaceParams):

    # Define Test variables
    cmdPassOrFail = False
    respData = None

    # Define MasterMuxedWriteRead variables
    cmdName = 'MasterMuxedWriteRead'
    cmdNum = Config.cmdMasterMuxedWriteRead
    netFn = Config.netFnOem38

    # Define sample raw bytes for Master Muxed-Write-Read
    rawBytesList = \
        [ '03', 'E0', '05', 'FF', '00', '98', '02', '02' ]
        
    # Send raw bytes via IpmiUtil
    cmdPassOrFail, respData = IpmiUtil.SendRawCmd(interfaceParams, \
        netFn, cmdNum, rawBytesList)

    # Verify response
    if cmdPassOrFail:
        UtilLogger.verboseLogger.info(cmdName + \
            ": Command passed: " + str(respData))
    else:
        UtilLogger.verboseLogger.error(cmdName + \
            ": Command failed. Completion Code: " + str(respData))

    return cmdPassOrFail
Beispiel #22
0
def Execute(interfaceParams):

    # Define Test variables
    cmdPassOrFail = False
    respData = None

    # Define GetMessage variables
    cmdName = 'GetMessage'
    cmdNum = Config.cmdGetMessage
    netFn = Config.netFnApp

    # Check if running in Ipmi Over LAN+
    # if so, exit test
    if interfaceParams:
        UtilLogger.verboseLogger.info("VerifyGetMessage" + \
            ": currently running commands via Ipmi over LAN+. Will not execute.")
        return True

    # Send raw bytes via IpmiUtil
    cmdPassOrFail, respData = IpmiUtil.SendRawCmd(interfaceParams, \
        netFn, cmdNum, [])

    # Verify response
    if cmdPassOrFail:
        UtilLogger.verboseLogger.info(cmdName + \
            ": Command passed: " + str(respData))
    else:
        UtilLogger.verboseLogger.error(cmdName + \
            ": Command failed. Completion Code: " + str(respData))

    return cmdPassOrFail
def Execute(interfaceParams):

    result = None
    try:
        result = IpmiUtil.VerifyThresholdSensors([], "./C2010TestScripts/XmlFiles/sensorlistxmlfile.xml")
    except AssertionError, ex:
        print("Exception Caught: Invalid input argument(s) for function IpmiUtil.VerifyThresholdSensors")
        print("Exception Message: {}".format(ex))
        return False
Beispiel #24
0
def CheckForChassisStatus(interfaceParams, expectedStatus, startTime = None):

    # Define constants
    currPowerStateIdx = 0

    # Initialize variables
    getStatusStartTime = None
    getStatusDuration = Config.getChassisStatusLimitInSeconds
    statusPassOrFail = False
    expectedStatusResp = [ 'off', 'on' ]

    # Define start time
    if startTime is None:
        getStatusStartTime = time.time()
    else:
        getStatusStartTime = startTime

    # Get Chassis Status
    while ((time.time() - getStatusStartTime) \
        <= Config.getChassisStatusLimitInSeconds) and \
        not statusPassOrFail:
        cmdPassOrFail, respData = IpmiUtil.SendRawCmd(interfaceParams, \
            Config.netFnChassis, Config.cmdGetChassisStatus, [])
        if cmdPassOrFail:
            UtilLogger.verboseLogger.info("GetChassisStatus: " + \
                "command passed. Response: " + str(respData))
            actualStatus = int(respData[currPowerStateIdx], 16) & 1
            if actualStatus == expectedStatus:
                UtilLogger.verboseLogger.info("Helper.CheckForChassisStatus: " + \
                    "status check passed. Received get chassis status: " + \
                    expectedStatusResp[expectedStatus])
                statusPassOrFail = True
                getStatusDuration = time.time() - getStatusStartTime
            else:
                if Config.debugEn:
                    UtilLogger.verboseLogger.error("Helper.CheckForChassisStatus: " + \
                        "status check failed. Expected: " + \
                        expectedStatusResp[expectedStatus] + \
                        ". Actual: " + \
                        expectedStatusResp[actualStatus])
        else:
            UtilLogger.verboseLogger.error("GetChassisStatus: " + \
                "command failed. Completion Code: " + str(respData))

    if statusPassOrFail:
        UtilLogger.verboseLogger.info("Helper.CheckForChassisStatus: " + \
            "test passed. Able to get expected chassis status " + \
            expectedStatusResp[expectedStatus] + " after " + \
            str(getStatusDuration) + " seconds.")
    else:
        UtilLogger.verboseLogger.error("Helper.CheckForChassisStatus: " + \
            "test failed. Unable to get expected chassis status " + \
            expectedStatusResp[expectedStatus] + " after " + \
            str(Config.getChassisStatusLimitInSeconds) + " seconds.")

    return statusPassOrFail
def Execute(interfaceParams):

    # Define Test variables
    cmdPassOrFail = True
    respData = None

    # Define GetBiosConfig variables
    cmdName = 'GetBiosConfig'
    cmdNum = Config.cmdGetBiosConfig
    netFn = Config.netFnOem38

    # Send raw bytes via IpmiUtil
    cmdPassOrFail, respData = IpmiUtil.SendRawCmd(interfaceParams, \
        netFn, cmdNum, [])

    # Verify response completion code
    if cmdPassOrFail:
        UtilLogger.verboseLogger.info(cmdName + \
            ": default Completion Code correct: Success completion code.")
    else:
        UtilLogger.verboseLogger.error(cmdName + \
            ": default Completion Code incorrect. Completion Code: " + \
            str(respData))
        return False

    # Parse variable values from response
    currentBiosConfiguration = int(respData[0], 16)
    chosenBiosConfiguration = int(respData[1], 16)

    # Verify current Bios configuration
    if currentBiosConfiguration == Config.defaultCurrentBiosConfiguration:
        UtilLogger.verboseLogger.info(cmdName + \
            ": default value correct for Current BIOS Configuration: " + \
            str(currentBiosConfiguration))
    else:
        UtilLogger.verboseLogger.error(cmdName + \
            ": default value incorrect for Current BIOS Configuration. Expected: " + \
            str(Config.defaultCurrentBiosConfiguration) + \
            " Actual: " + str(currentBiosConfiguration))
        cmdPassOrFail = False

    # Verify chosen Bios configuration
    if chosenBiosConfiguration == Config.defaultChosenBiosConfiguration:
        UtilLogger.verboseLogger.info(cmdName + \
            ": default value correct for Chosen BIOS Configuration: " + \
            str(chosenBiosConfiguration))
    else:
        UtilLogger.verboseLogger.error(cmdName + \
            ": default value incorrect for Chosen BIOS Configuration. Expected: " + \
            str(Config.defaultChosenBiosConfiguration) + \
            " Actual: " + str(chosenBiosConfiguration))
        cmdPassOrFail = False

    return cmdPassOrFail
Beispiel #26
0
def Execute(interfaceParams):

    # Define Test variables
    cmdPassOrFail = False
    respData = None

    # Define SetBiosConfigInfo variables
    cmdName = 'SetBiosConfigInfo'
    cmdNum = Config.cmdSetBiosConfigInfo
    netFn = Config.netFnOem38

    # Define sample raw bytes for Set Bios Config Info
    # (current: default BIOS config; and all available BIOS configs)
    rawBytesList = \
        [ '00', '00', 'bc', '66', '69', '00', '00', '00',\
        '00', '00', '00', '01', '00', '00', '00', '00',\
        '00', '18', 'b2', '66', '69', '00', '00', '00',\
        '00', '18', '00', '00', '03', '00', '00', '00',\
        '00', '00', '00', 'ff', 'ff', 'ff', 'ff', '00',\
        '40', '02', '06', '7f', '00', '00', '00', '00',\
        '03', '07', '7f', '00', '00', '00', '00', '03',\
        '08', '7f', '00', '00', '00', '00', '03', '09',\
        '46', '60', '09', '00', '40', '02', '0a', '7f',\
        '00', '00', '00', '00', '03', '0b', '46', '60',\
        '09', '00', '40', '02', '0c', '7f', '00', '00',\
        '00', '00', '03', '0d', '7f', '00', '00', '00',\
        '00', '03', '0e', '7f', '00', '00', '00', '00',\
        '03', '0f', '7f', '00', '00', '00', '00', '03',\
        '10', '7f', '00', '00', '00', '00', '03', '11',\
        '7f', '00', '00', '00', '00', '03', '12', '7f',\
        '00', '00', '00', '00', '03', '13', '7f', '00',\
        '00', '00', '00', '03', '14', '7f', '00', '00',\
        '00', '00', '03', '15', '7f', '00', '00', '00',\
        '00', '03', '16', '7f', '00', '00', '00', '00',\
        '03', '17', '7f', '00', '00', '00', '00', '03',\
        '18', '7f', '00', '00', '00', '00', '03', '00',\
        '00', '00', '00', '00', '00', '00', '00', '00',\
        '00', '00', '00', '00', '00', '00', '00', '00',\
        '00', '00', '00', '00', '00', '00', '00', '00' ]

    # Send raw bytes via IpmiUtil
    cmdPassOrFail, respData = IpmiUtil.SendRawCmd(interfaceParams, \
        netFn, cmdNum, rawBytesList)

    # Verify response
    if cmdPassOrFail:
        UtilLogger.verboseLogger.info(cmdName + \
            ": Command passed: " + str(respData))
    else:
        UtilLogger.verboseLogger.error(cmdName + \
            ": Command failed. Completion Code: " + str(respData))

    return cmdPassOrFail
Beispiel #27
0
def Setup(interfaceParams):

    # Declare global (module-scope) variables.
    global sensorList

    # Parse the XML file to get the information regarding the sensors to test.
    # Validate file containing sensors to monitor.
    sensorListFile = Config.thresholdSensorListXmlFile  # File containing list of threshold sensors to monitor.
    if (not os.path.isfile(sensorListFile)):
        UtilLogger.verboseLogger.error("SensorThresholdStressTest.py: File path " + sensorListFile + " is invalid.")
        return False

    xmlParserObj = XmlParser.XmlParser(sensorListFile)
    if not xmlParserObj.root:
        UtilLogger.verboseLogger.error("SensorThresholdStressTest.py - XmlParser: " + \
                                       "failed to parse sensor list XML file.")
        return False

    # Store info regarding all sensors to be monitored in sensorList.
    for sensorEntry in xmlParserObj.root:
        sensorName = sensorEntry.attrib["name"]
        gotSensorIdSuccess, sensorId = IpmiUtil.GetIpmiUtilSensorId(interfaceParams, sensorName)
        if (not gotSensorIdSuccess):
            UtilLogger.verboseLogger.error("SensorThresholdStressTest.py - Setup(): " + \
                                       "Failed to get sensor ID for sensor '%s'." % sensorName)
            return False
        sensorInfo = IpmiUtil.SdrInfo([ sensorId[2] + sensorId[3], \
            sensorId[0] + sensorId[1] ], sensorName, interfaceParams)
        updatePassOrFail = sensorInfo.UpdateSdrInfo(interfaceParams) # Update SDR Info for sensor
        if updatePassOrFail:
            UtilLogger.verboseLogger.info("SensorThresholdStressTest.py - Setup(): " + \
                "Successfully received sensor thresholds for sensor '%s'." % sensorName)
        else:
            UtilLogger.verboseLogger.error("SensorThresholdStressTest.py - Setup(): " + \
                "Failed to get sensor thresholds for sensor '%s'." % sensorName)
        sensorList.append((sensorName, sensorId, sensorInfo))

    return True
Beispiel #28
0
def Setup(interfaceParams):

    # Send raw bytes for Send Message (Activate Power Limit - Activate)
    cmdPassOrFail, respData = IpmiUtil.SendRawCmd(\
        interfaceParams, Config.netFnDcmi, Config.cmdActivatePowerLimit, \
        [ 'DC', '01', '00', '00' ])
    if cmdPassOrFail:
        UtilLogger.verboseLogger.info('Send Message (Activate Power Limit - Activate)' + \
            ": Command passed: " + str(respData))
    else:
        UtilLogger.verboseLogger.info('Send Message (Activate Power Limit - Activate)' + \
            ": Command failed. Completion Code: " + str(respData))

    return cmdPassOrFail
def Execute(interfaceParams):

    UtilLogger.verboseLogger.info(
        "VerifySelAgainstXmlList_DebugTest.py: running Execute fxn")

    try:
        selPassOrFail, unexpectedSels = IpmiUtil.VerifySelAgainstXmlList(
            [], "./../SupportFiles/ValidSelEvents.xml")
    except AssertionError, ex:
        print(
            "Exception Caught: Invalid input argument(s) for function IpmiUtil.VerifySelAgainstXmlList"
        )
        print("Exception Message: {}".format(ex))
        return False
Beispiel #30
0
def Setup(interfaceParams):

    # Declare module-scope variables
    global previousFwVersion

    # Initialize variables
    setupPassOrFail = True
    processCmd = []

    # Flash Bmc Fw with previous version
    flashPassOrFail = FwFlash.YafuFlashBmcFw(\
        Config.bmcPrevBinFilePath,\
        Config.bmcIpAddress,\
        Config.bmcUser,\
        Config.bmcPassword)

    if flashPassOrFail:
        UtilLogger.verboseLogger.info("YafuFlashBmcFwUpdateTest: " + \
            "Bmc FW at path " + Config.bmcPrevBinFilePath + \
            " successfully flashed.")
        # Sleep
        UtilLogger.verboseLogger.info("YafuFlashBmcFwUpdateTest" + \
            ": Sleeping for " + str(Config.acPowerOnSleepInSeconds) + \
            " seconds..")
        time.sleep(Config.acPowerOnSleepInSeconds)
    else:
        UtilLogger.verboseLogger.info("YafuFlashBmcFwUpdateTest: " + \
            "Bmc FW at path " + Config.bmcPrevBinFilePath + \
            " failed FW flash.")
        return False

    # Get Device Id
    cmdName = 'GetDeviceId'
    cmdNum = Config.cmdGetDeviceId
    netFn = Config.netFnApp

    cmdPassOrFail, respData = IpmiUtil.SendRawCmd(\
        interfaceParams, netFn, cmdNum, [])
    if cmdPassOrFail:
        UtilLogger.verboseLogger.info(cmdName + \
            ": success completion code.")
        major, minor, aux = FwFlash.extractBmcFwGetDeviceId(respData)
        previousFwVersion = [major, minor, aux]
    else:
        UtilLogger.verboseLogger.error(cmdName + \
            ": command failed. Completion Code: " + \
            str(respData))
        setupPassOrFail = False

    return setupPassOrFail