class OpTestSystem(): ## 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_lparIP The IP address of the LPAR # @param i_lparuser The userid to log into the LPAR # @param i_lparPasswd The password of the userid to log into the LPAR with # def __init__(self, i_bmcIP, i_bmcUser, i_bmcPasswd, i_bmcUserIpmi,i_bmcPasswdIpmi,i_ffdcDir=None, i_lparip=None, i_lparuser=None, i_lparPasswd=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) self.cv_LPAR = OpTestLpar(i_lparip, i_lparuser, i_lparPasswd) self.util = OpTestUtil() ############################################################################ # System Interfaces ############################################################################ ## # @brief Clear all System Event Log in the System # # @return BMC_CONST.FW_SUCCESS or BMC_CONST.FW_FAILED # def sys_sel_clear(self): try: rc = self.cv_IPMI.ipmi_sel_clear() except OpTestError as e: return BMC_CONST.FW_FAILED return rc ## # @brief Power on the system # # @return BMC_CONST.FW_SUCCESS or BMC_CONST.FW_FAILED # def sys_power_on(self): try: rc = self.cv_IPMI.ipmi_power_on() except OpTestError as e: return BMC_CONST.FW_FAILED return rc ## # @brief Power soft the system # # @return BMC_CONST.FW_SUCCESS or BMC_CONST.FW_FAILED # def sys_power_soft(self): try: rc = self.cv_IPMI.ipmi_power_soft() except OpTestError as e: return BMC_CONST.FW_FAILED return rc ## # @brief Power off the system # # @return BMC_CONST.FW_SUCCESS or BMC_CONST.FW_FAILED # def sys_power_off(self): try: rc = self.cv_IPMI.ipmi_power_off() except OpTestError as e: return BMC_CONST.FW_FAILED return rc ## # @brief Warm reset on the bmc system # # @return BMC_CONST.FW_SUCCESS or BMC_CONST.FW_FAILED # def sys_warm_reset(self): try: rc = self.cv_IPMI.ipmi_warm_reset() except OpTestError as e: return BMC_CONST.FW_FAILED return rc ## # @brief Wait for boot to end based on serial over lan output data # # @return BMC_CONST.FW_SUCCESS or BMC_CONST.FW_FAILED # def sys_ipl_wait_for_working_state(self,i_timeout=10): try: rc = self.cv_IPMI.ipl_wait_for_working_state(i_timeout) except OpTestError as e: return BMC_CONST.FW_FAILED return rc ## # @brief Check for error during IPL that would result in test case failure # # @return BMC_CONST.FW_SUCCESS or BMC_CONST.FW_FAILED # def sys_sel_check(self,i_string): try: rc = self.cv_IPMI.ipmi_sel_check(i_string) except OpTestError as e: return BMC_CONST.FW_FAILED return rc ## # @Get data from apss # # @return BMC_CONST.FW_SUCCESS or BMC_CONST.FW_FAILED # def sys_apss_get(self): try: rc = self.cv_IPMI.ipmi_apss_get() except OpTestError as e: return BMC_CONST.FW_FAILED return rc ## # @brief get all SDR's in the System # # @return BMC_CONST.FW_SUCCESS or BMC_CONST.FW_FAILED # def sys_sdr_get(self): try: rc = self.cv_IPMI.ipmi_sdr_get() except OpTestError as e: return BMC_CONST.FW_FAILED return rc ############################################################################ # BMC Interfaces ############################################################################ ## # @brief Reboot the BMC # # @return BMC_CONST.FW_SUCCESS or BMC_CONST.FW_FAILED # def sys_bmc_reboot(self): try: rc = self.cv_BMC.reboot() except OpTestError as e: return BMC_CONST.FW_FAILED return BMC_CONST.FW_SUCCESS ## # @brief Update the BMC fw image using hpm file # # @param i_image HPM file image including location # # @return BMC_CONST.FW_SUCCESS or BMC_CONST.FW_FAILED # def sys_bmc_outofband_fw_update_hpm(self,i_image): try: self.cv_IPMI.ipmi_power_off() self.cv_IPMI.ipmi_preserve_network_setting() self.cv_IPMI.ipmi_code_update(i_image, BMC_CONST.BMC_FW_IMAGE_UPDATE) self.cv_IPMI.ipmi_power_on() except OpTestError as e: return BMC_CONST.FW_FAILED return BMC_CONST.FW_SUCCESS ## # @brief Update the BMC pnor image using hpm file # # @param i_image HPM file image including location # # @return BMC_CONST.FW_SUCCESS or BMC_CONST.FW_FAILED # def sys_bmc_outofband_pnor_update_hpm(self,i_image): try: self.cv_IPMI.ipmi_power_off() self.cv_IPMI.ipmi_preserve_network_setting() self.cv_IPMI.ipmi_code_update(i_image, BMC_CONST.BMC_PNOR_IMAGE_UPDATE) self.cv_IPMI.ipmi_power_on() except OpTestError as e: return BMC_CONST.FW_FAILED return BMC_CONST.FW_SUCCESS ## # @brief Update the BMC fw and pnor image using hpm file # # @param i_image HPM file image including location # # @return BMC_CONST.FW_SUCCESS or BMC_CONST.FW_FAILED # def sys_bmc_outofband_fwandpnor_update_hpm(self,i_image): try: self.cv_IPMI.ipmi_power_off() self.cv_IPMI.ipmi_preserve_network_setting() self.cv_IPMI.ipmi_code_update(i_image,BMC_CONST.BMC_FWANDPNOR_IMAGE_UPDATE) self.cv_IPMI.ipmi_power_on() except OpTestError as e: return BMC_CONST.FW_FAILED return BMC_CONST.FW_SUCCESS ## # @brief Update the BMC fw using hpm file using LPAR # # @param i_image HPM file image including location # # @return BMC_CONST.FW_SUCCESS or BMC_CONST.FW_FAILED # def sys_bmc_inband_fw_update_hpm(self,i_image): try: self.sys_bmc_validate_lpar() self.cv_IPMI.ipmi_cold_reset() self.cv_IPMI.ipmi_preserve_network_setting() self.cv_LPAR.lpar_code_update(i_image, BMC_CONST.BMC_FW_IMAGE_UPDATE) except OpTestError as e: return BMC_CONST.FW_FAILED return BMC_CONST.FW_SUCCESS ## # @brief Update the BMC pnor using hpm file using LPAR # # @param i_image HPM file image including location # # @return BMC_CONST.FW_SUCCESS or BMC_CONST.FW_FAILED # def sys_bmc_inband_pnor_update_hpm(self,i_image): try: self.sys_bmc_validate_lpar() self.cv_IPMI.ipmi_cold_reset() self.cv_IPMI.ipmi_preserve_network_setting() self.cv_LPAR.lpar_code_update(i_image, BMC_CONST.BMC_PNOR_IMAGE_UPDATE) except OpTestError as e: return BMC_CONST.FW_FAILED return BMC_CONST.FW_SUCCESS ## # @brief Update the BMC fw and pnor using hpm file using LPAR # # @param i_image HPM file image including location # # @return BMC_CONST.FW_SUCCESS or BMC_CONST.FW_FAILED # def sys_bmc_inband_fwandpnor_update_hpm(self,i_image): try: self.sys_bmc_validate_lpar() self.cv_IPMI.ipmi_cold_reset() self.cv_IPMI.ipmi_preserve_network_setting() self.cv_LPAR.lpar_code_update(i_image, BMC_CONST.BMC_FWANDPNOR_IMAGE_UPDATE) except OpTestError as e: return BMC_CONST.FW_FAILED return BMC_CONST.FW_SUCCESS ## # @brief Validates the partition and waits for partition to connect # important to perform before all inband communications # # @return BMC_CONST.FW_SUCCESS raises OpTestError when failed # def sys_bmc_validate_lpar(self): # Check to see if lpar credentials are present if(self.cv_LPAR.ip == None): l_msg = "Partition credentials not provided" print l_msg raise OpTestError(l_msg) # Check if partition is active try: self.util.PingFunc(self.cv_LPAR.ip) except OpTestError as e: self.cv_IPMI.ipmi_power_off() self.cv_IPMI.ipmi_power_on() self.util.PingFunc(self.cv_LPAR.ip, BMC_CONST.PING_RETRY_POWERCYCLE) print 'Partition is pinging' return BMC_CONST.FW_SUCCESS