def __init__(self, tc_name, global_config): """ Initializes this instance. """ # Call UseCase base Init function LabModemFlashingBase.__init__(self, tc_name, global_config) # Initialize attributes with default values self._flash_tty = None self._flash_app = None # Get the TTY to use for the flash operation flash_tty = self._tc_parameters.get_param_value("FLASH_TTY") if flash_tty is not None and flash_tty != "": self._flash_tty = flash_tty # Get the application to use for the flash operation flash_app = self._tc_parameters.get_param_value("FLASH_APPLICATION") if flash_app is not None and flash_app != "": self._flash_app = flash_app # Initialize the possible values to look for self._possible_values = { "NVM_CONFIGURATION_APPLIED": "Configuration Applied", "NVM_CONF_NOT_APPLIED": "Error while applying configuration", "NVM_CONF_COMMAND_FAILED": "Configuration Command Failed" }
def __init__(self, tc_name, global_config): """ Initializes this instance. """ # Call UseCase base Init function LabModemFlashingBase.__init__(self, tc_name, global_config)
def __init__(self, tc_name, global_config): """ Initializes this instance. """ # Call UseCase base Init function LabModemFlashingBase.__init__(self, tc_name, global_config) # Instantiate generic UECmd for modem self._modem_api = self._device.get_uecmd("Modem")
def run_test(self): """ Execute the test. """ # Run UC base run_test LabModemFlashingBase.run_test(self) # Check the TTY attribute value if self._flash_tty is None: message = "Invalid parameter value for parameter '%s'." % "FLASH_TTY" self._logger.error(message) raise AcsConfigException(AcsConfigException.INVALID_PARAMETER, message) # Call the flash sequence with the provided flashing application (return_code, return_msg, stdout, stderr) = \ self._modem_flashing_api.flash_nvm_mos( self._flash_file_path, self._flash_tty, self._flash_app, self._target_directory_path) # Check the error code on the stdout. # Note that the error code is only written # when an error occurred. if return_code == NvmFastbootResult.NVM_ERR_SUCESS: stdout = stdout.translate(None, '\r\n') expected_result = self._possible_values[self._expected_result] matcher = re.search("%s" % expected_result, stdout) if matcher is not None: return_code = Global.SUCCESS return_msg = "Flash test success. Found expected result: %s (%s)." % \ (str(self._expected_result), expected_result) else: return_code = Global.FAILURE return_msg = "Flash test failed. Expected flash result was %s (%s)." % ( str(self._expected_result), str(expected_result)) self._logger.error(return_msg) else: return_msg = stderr # Wait until the modem is up before # going any further in the campaign self._logger.debug("Waiting for the modem to be up") time.sleep(15) # Return the verdict of the flash return return_code, return_msg
def set_up(self): """ Initialize the test. """ # Run UC base run_test LabModemFlashingBase.set_up(self) # Check the parameters if self._expected_result not in self._possible_values.keys(): message = "Invalid parameter value: %s for parameter '%s'." % \ (str(self._expected_result), "EXPECTED_RESULT") self._logger.error(message) return Global.FAILURE, message return Global.SUCCESS, "No error."
def run_test(self): """ Execute the test """ # Run UC base run_test LabModemFlashingBase.run_test(self) # Check that device camps on the network self._logger.debug( "Check network registration status is registered on DUT") self._modem_api.check_cdk_state_bfor_timeout("registered", 300) # Return the verdict of the flash return Global.SUCCESS, "Modem FW flashing OK and registration reached"
def run_test(self): """ Execute the test """ # Run UC base run_test LabModemFlashingBase.run_test(self) # Create a flash result for the expected return value cmfwdl_expected_result = self._modem_flashing_api._get_cmfwdl_result() # pylint: disable=W0212 cmfwdl_expected_result_code = cmfwdl_expected_result.from_string(self._expected_result) # Initialize return message return_msg = None # Check the expected result code before going any further if cmfwdl_expected_result_code is None: message = "Invalid parameter value: %s for parameter '%s'." % \ (str(self._expected_result), "EXPECTED_RESULT") self._logger.error(message) raise AcsConfigException(AcsConfigException.INVALID_PARAMETER, message) # Create a flash result for the expected return value cmfwdl_actual_result = self._modem_flashing_api._get_cmfwdl_result() # pylint: disable=W0212 # Call flash sequence (return_code, stdout_string) = \ self._modem_flashing_api.flash_nvm_pos( self._flash_file_path, self._target_directory_path) cmfwdl_actual_result_code = return_code # Check the error code on the stdout. # Note that the error code is only written # when an error occurred. if return_code != NvmFastbootResult.NVM_ERR_SUCESS: stdout_string = stdout_string.translate(None, '\r\n') matcher = re.search("Error (\d)", stdout_string) if matcher is not None: error_value = matcher.group(1) cmfwdl_actual_result_code = int(error_value) else: raise DeviceException(DeviceException.PROHIBITIVE_BEHAVIOR, "The application cmfwdl-app did not print any error " "or exit status on the stdout. (%s)" % stdout_string) # Check if flash failed if cmfwdl_actual_result_code != cmfwdl_expected_result_code: return_code = Global.FAILURE cmfwdl_actual_result_text = cmfwdl_actual_result.to_string(cmfwdl_actual_result_code) message = "Flash test failed. Expected flash result was %s (%s) got %s (%s)." % ( str(self._expected_result), str(cmfwdl_expected_result_code), str(cmfwdl_actual_result_text), str(cmfwdl_actual_result_code)) self._logger.error(message) return_msg = stdout_string else: return_code = Global.SUCCESS return_msg = "Flash test success. Got expected result: %s (%d)." % \ (str(self._expected_result), cmfwdl_actual_result_code) # Return the verdict of the flash return return_code, return_msg