def _doOperation(self, *args, **kargs): self._notifyOpStatus(NOTIF_STATUS_PR, "Verifying...") self._setActionString( ACTION_SKIP, "Skip the telemetry verification and return success (True)") self._setActionString( ACTION_CANCEL, "Skip the telemetry verification and return failure (False)") self._setActionString(ACTION_REPEAT, "Repeat the telemetry verification") self._setActionString(ACTION_RECHECK, "Repeat the telemetry verification") # Wait some time before verifying if requested if self.__useConfig.has_key(Delay): delay = self.__useConfig.get(Delay) if delay: from spell.lang.functions import WaitFor self._write( "Waiting " + str(delay) + " seconds before TM verification", {Severity: INFORMATION}) WaitFor(delay) result = REGISTRY['TM'].verify(self.__vrfDefinition, self.__useConfig) # If we reach here, result can be true or false, but no exception was raised # this means that a false verification is considered ok. return [False, result, NOTIF_STATUS_OK, ""]
def _doOperation(self, *args, **kargs): # Wait some time before verifying if requested if self.__useConfig.has_key(Delay): delay = self.__useConfig.get(Delay) if delay: from spell.lang.functions import WaitFor self._write( "Waiting " + str(delay) + " seconds before TM verification", {Severity: INFORMATION}) WaitFor(delay) result = REGISTRY['TM'].verify(self.__vrfDefinition, self.__useConfig) return [False, result]
def _doOperation(self, *args, **kargs): self._notifyOpStatus(NOTIF_STATUS_PR, "Verifying...") # Wait some time before verifying if requested if self.__useConfig.has_key(Delay): delay = self.__useConfig.get(Delay) if delay: from spell.lang.functions import WaitFor self._write( "Waiting " + str(delay) + " seconds before TM verification", {Severity: INFORMATION}) WaitFor(delay) result = REGISTRY['TM'].verify(self.__vrfDefinition, self.__useConfig) # If we reach here, result can be true or false, but no exception was raised # this means that a false verification is considered ok. return [False, result, NOTIF_STATUS_OK, ""]
def _doOperation(self, *args, **kargs): repeat = False self.__originalOnFailure = self._config[OnFailure] #----------------------------------------------------------------------- # LIMIT ADJUSTMENT SECTION #----------------------------------------------------------------------- if self.__canAdjustLimits and self.__doAdjustLimitsP: self.__section = 'LIM1' # We don't allow resend nor recheck, only repeat self._config[OnFailure] = self._config[OnFailure] & (~RESEND) self._config[OnFailure] = self._config[OnFailure] & (~RECHECK) # We need to enlarge the limit range to the maximum to # avoid alarms (analog parameters) or to allow any # status value (status parameters) REGISTRY['CIF'].write( "Avoiding alarms by adjusting limits before TC execution") for condition in self.__verifyCondition: paramName = condition[0] paramValue = condition[2] operator = condition[1] # Do not adjust limits if the condition config dict says the contrary if type(condition[-1]) == dict: itemCfg = condition[-1] if itemCfg.has_key( AdjLimits) and itemCfg[AdjLimits] == False: continue # Do not adjust limits if eq operator is not used if operator != eq: continue # Proceed with limit adjustment if type(paramValue) == str: #Status parameters # First get the currentValue currentValue = REGISTRY['TM'][paramName].eng(Wait=False) # Build the expected value list if (currentValue != paramValue): expectedValues = currentValue + ", " + paramValue else: continue limits = {} limits[Expected] = expectedValues # Adjust the limits accordingly REGISTRY['CIF'].write(" - " + repr(paramName) + " adjusting to expected values: " + expectedValues) else: #Analog parameters # Set the limit to the maximum value limits = {} limits[LoRed] = -1.7e+308 limits[LoYel] = -1.7e+308 limits[HiRed] = 1.7e+308 limits[HiYel] = 1.7e+308 REGISTRY['CIF'].write( " - " + repr(paramName) + " enlarged analog limits to the maximum") REGISTRY['TM'].setLimits(paramName, limits, config=self._config) # Reset the OnFailure config self._config[OnFailure] = self.__originalOnFailure #----------------------------------------------------------------------- # COMMAND SECTION #----------------------------------------------------------------------- # If we are repeating the operation due to an user action, check # the flag to see if we have to resend the command if self.__doSendCommand: self.__section = 'TC' # We do not allow recheck or repeat yet, only resend self._config[OnFailure] = self._config[OnFailure] & (~REPEAT) self._config[OnFailure] = self._config[OnFailure] & (~RECHECK) try: # Actually send the command tcIsSuccess = REGISTRY['TC'].send(self._cmdDef, config=self._config) # Handle cancel exception only except CancelException: LOG("Cancelled command execution") self._write("Execution cancelled", {Severity: WARNING}) return [False, False] if tcIsSuccess: self._write("Execution success") else: self._write("Execution failed", {Severity: ERROR}) raise DriverException("Command execution failed") else: tcIsSuccess = True # Reset the OnFailure config self._config[OnFailure] = self.__originalOnFailure #----------------------------------------------------------------------- # TELEMETRY SECTION #----------------------------------------------------------------------- # If there are verification sets, verify them if self.__doCheckTelemetry and self.__verifyCondition and tcIsSuccess: self.__section = 'TM' # Wait some time before verifying if requested if self._config.has_key(Delay): delay = self._config.get(Delay) if delay: from spell.lang.functions import WaitFor self._write( "Waiting " + str(delay) + " seconds before TM verification", {Severity: INFORMATION}) WaitFor(delay, Notify=False, Verbosity=999) # We dont allow repeat here but allow recheck at least self._config[OnFailure] = self._config[OnFailure] & (~REPEAT) #self._config[OnFailure] = self._config[OnFailure] | RECHECK #self._config[OnFailure] = self._config[OnFailure] | RESEND # Perform verification tmIsSuccess = REGISTRY['TM'].verify(self.__verifyCondition, config=self._config) #repeat, tmIsSuccess = self._processActionOnResult(tmIsSuccess) else: tmIsSuccess = True # Reset the OnFailure config self._config[OnFailure] = self.__originalOnFailure #----------------------------------------------------------------------- # ADJUST LIMITS SECTION #----------------------------------------------------------------------- if tmIsSuccess and self.__canAdjustLimits and self.__doAdjustLimits: self.__section = "LIM2" # We dont allow recheck/resend for this, only repeat if the user wants self._config[OnFailure] = self._config[OnFailure] & (~RESEND) self._config[OnFailure] = self._config[OnFailure] & (~RECHECK) REGISTRY['CIF'].write( "Adjusting limit definitions after TC execution") for condition in self.__verifyCondition: paramName = condition[0] paramValue = condition[2] operator = condition[1] # Do not adjust limits if not eq operator used if operator != eq: continue # Do not adjust limits if the condition config dict says the contrary if type(condition[-1]) == dict: itemCfg = condition[-1] if itemCfg.has_key( AdjLimits) and itemCfg[AdjLimits] == False: continue if type(paramValue) == str: #Status parameters # Build the expected value list limits = {} limits[Expected] = paramValue # Adjust the limits accordingly REGISTRY['CIF'].write(" - " + repr(paramName) + " adjusting to expected value: " + paramValue) else: #Analog parameters # Set the limit to the maximum value tolerance = self.getConfig(Tolerance) if tolerance is None: tolerance = 0.1 limits = {} limits[LoRed] = paramValue - tolerance limits[LoYel] = paramValue - tolerance limits[HiRed] = paramValue + tolerance limits[HiYel] = paramValue + tolerance REGISTRY['CIF'].write(" - " + repr(paramName) + " limits set to " + repr(limits)) REGISTRY['TM'].setLimits(paramName, limits, config=self._config) # Reset the OnFailure config self._config[OnFailure] = self.__originalOnFailure # Depending on the result of both operations we decide to repeat the whole # or part of the operation. if self.__verifyCondition is None: result = tcIsSuccess else: result = tcIsSuccess and tmIsSuccess return [repeat, result]
# Store information for possible failures self.setFailureInfo("TM", self.__verifyCondition) # Adapt the action messages self._setActionString( ACTION_RECHECK, "Repeat the telemetry verification") self._setActionString( ACTION_SKIP , "Skip the telemetry verification and return success (True)") self._setActionString( ACTION_CANCEL , "Skip the telemetry verification and return failure (False)") # Wait some time before verifying if requested if self.hasConfig(Delay): delay = self.getConfig(Delay) if delay: from spell.lang.functions import WaitFor self._write("Waiting "+ str(delay) + " seconds before TM verification", {Severity:INFORMATION}) WaitFor(delay, Notify=False, Verbosity=999) # We dont allow repeat here but allow recheck at least self.addConfig(OnFailure,self.getConfig(OnFailure) & (~REPEAT)) # Adapt the action messages self._setActionString( ACTION_RECHECK, "Repeat the telemetry verification") self._setActionString( ACTION_SKIP , "Skip the telemetry verification and return success (True)") self._setActionString( ACTION_CANCEL , "Skip the telemetry verification and return failure (False)") # Perform verification tmIsSuccess = REGISTRY['TM'].verify(self.__verifyCondition, config=self.getConfig()) #repeat, tmIsSuccess = self._processActionOnResult(tmIsSuccess) else: