本文整理汇总了Python中common.OpTestIPMI.OpTestIPMI.ipmi_set_power_limit方法的典型用法代码示例。如果您正苦于以下问题:Python OpTestIPMI.ipmi_set_power_limit方法的具体用法?Python OpTestIPMI.ipmi_set_power_limit怎么用?Python OpTestIPMI.ipmi_set_power_limit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common.OpTestIPMI.OpTestIPMI
的用法示例。
在下文中一共展示了OpTestIPMI.ipmi_set_power_limit方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: OpTestEnergyScale
# 需要导入模块: from common.OpTestIPMI import OpTestIPMI [as 别名]
# 或者: from common.OpTestIPMI.OpTestIPMI import ipmi_set_power_limit [as 别名]
class OpTestEnergyScale():
## Initialize this object
# @param i_bmcIP The IP address of the BMC
# @param i_bmcUser The userid to log into the BMC with
# @param i_bmcPasswd The password of the userid to log into the BMC with
# @param i_bmcUserIpmi The userid to issue the BMC IPMI commands with
# @param i_bmcPasswdIpmi The password of BMC IPMI userid
# @param i_ffdcDir Optional param to indicate where to write FFDC
#
# "Only required for inband tests" else Default = None
# @param i_hostIP The IP address of the HOST
# @param i_hostuser The userid to log into the HOST
# @param i_hostPasswd The password of the userid to log into the HOST with
#
def __init__(self, i_bmcIP, i_bmcUser, i_bmcPasswd,
i_bmcUserIpmi, i_bmcPasswdIpmi, i_ffdcDir=None, i_platName=None, i_hostip=None,
i_hostuser=None, i_hostPasswd=None):
self.cv_BMC = OpTestBMC(i_bmcIP, i_bmcUser, i_bmcPasswd, i_ffdcDir)
self.cv_IPMI = OpTestIPMI(i_bmcIP, i_bmcUserIpmi, i_bmcPasswdIpmi,
i_ffdcDir, i_hostip, i_hostuser, i_hostPasswd)
self.cv_HOST = OpTestHost(i_hostip, i_hostuser, i_hostPasswd, i_bmcIP)
self.cv_SYSTEM = OpTestSystem(i_bmcIP, i_bmcUser, i_bmcPasswd,
i_bmcUserIpmi, i_bmcPasswdIpmi, i_ffdcDir, i_hostip,
i_hostuser, i_hostPasswd)
self.cv_PLATFORM = i_platName
self.util = OpTestUtil()
##
# @brief This function will get and return platform power limits for supported machine
#
# @param i_platform type: str platform name to get the power limits
#
# @return l_power_limit_low lower platform power limit
# l_power_limit_high higher platform power limit
# or raise OpTestError if it is a new platform
#
def get_platform_power_limits(self, i_platform):
l_platform = i_platform
if BMC_CONST.HABANERO in l_platform:
l_power_limit_high = BMC_CONST.HABANERO_POWER_LIMIT_HIGH
l_power_limit_low = BMC_CONST.HABANERO_POWER_LIMIT_LOW
elif BMC_CONST.FIRESTONE in l_platform:
l_power_limit_high = BMC_CONST.FIRESTONE_POWER_LIMIT_HIGH
l_power_limit_low = BMC_CONST.FIRESTONE_POWER_LIMIT_LOW
elif BMC_CONST.GARRISON in l_platform:
l_power_limit_high = BMC_CONST.GARRISON_POWER_LIMIT_HIGH
l_power_limit_low = BMC_CONST.GARRISON_POWER_LIMIT_LOW
else:
l_msg = "New platform, add power limit support to this platform and retry"
raise OpTestError(l_msg)
return l_power_limit_low, l_power_limit_high
##
# @brief This function will test Energy scale features at standby state
# 1. Power OFF the system.
# 2. Validate below Energy scale features at standby state
# ipmitool dcmi power get_limit :Get the configured power limits.
# ipmitool dcmi power set_limit limit <value> :Power Limit Requested in Watts.
# ipmitool dcmi power activate :Activate the set power limit.
# ipmitool dcmi power deactivate :Deactivate the set power limit.
# 3. Once platform power limit activated execute below dcmi commands at standby state.
# ipmitool dcmi discover :This command is used to discover
# supported capabilities in DCMI.
# ipmitool dcmi power reading :Get power related readings from the system.
# ipmitool dcmi power get_limit :Get the configured power limits.
# ipmitool dcmi power sensors :Prints the available DCMI sensors.
# ipmitool dcmi get_temp_reading :Get Temperature Sensor Readings.
# 4. Power ON the system.
# 5. Check after system booted to runtime, whether occ's are active or not.
# 6. Again in runtime execute all dcmi commands to check the functionality.
#
# @return BMC_CONST.FW_SUCCESS or BMC_CONST.FW_FAILED
#
def test_energy_scale_at_standby_state(self):
self.cv_SYSTEM.sys_bmc_power_on_validate_host()
print "Energy Scale Test 1: Get, Set, activate and deactivate platform power limit at power off"
l_power_limit_low, l_power_limit_high = self.get_platform_power_limits(self.cv_PLATFORM)
print "Performing a IPMI Power OFF Operation"
# Perform a IPMI Power OFF Operation(Immediate Shutdown)
self.cv_IPMI.ipmi_power_off()
if int(self.cv_SYSTEM.sys_wait_for_standby_state(BMC_CONST.SYSTEM_STANDBY_STATE_DELAY)) == 0:
print "System is in standby/Soft-off state"
else:
l_msg = "System failed to reach standby/Soft-off state"
raise OpTestError(l_msg)
self.cv_IPMI.ipmi_sdr_clear()
print self.cv_IPMI.ipmi_get_power_limit()
self.cv_IPMI.ipmi_set_power_limit(l_power_limit_high)
self.cv_IPMI.ipmi_activate_power_limit()
self.cv_IPMI.ipmi_deactivate_power_limit()
print self.cv_IPMI.ipmi_get_power_limit()
self.cv_IPMI.ipmi_activate_power_limit()
print self.cv_IPMI.ipmi_get_power_limit()
self.cv_IPMI.ipmi_deactivate_power_limit()
self.cv_IPMI.ipmi_set_power_limit(l_power_limit_low)
self.cv_IPMI.ipmi_activate_power_limit()
print self.cv_IPMI.ipmi_get_power_limit()
self.cv_IPMI.ipmi_set_power_limit(l_power_limit_high)
self.cv_IPMI.ipmi_get_power_limit()
#.........这里部分代码省略.........