def __init__(self, tc_conf, global_config): """ Constructor """ UseCaseBase.__init__(self, tc_conf, global_config) # Get TC Parameters self._step = self._tc_parameters.get_param_value("STEP", "RUNTEST") self._return_code = self._tc_parameters.get_param_value( "RETURN_CODE", Verdict.PASS) # Update return code for retro-compatibility self._return_code = self._return_code.replace("SUCCESS", Verdict.PASS) self._return_code = self._return_code.replace("FAILURE", Verdict.FAIL) self._comment = self._tc_parameters.get_param_value( "COMMENT", "No Comment") self._duration = int(self._tc_parameters.get_param_value( "DURATION", 0)) self._init_exception = self._tc_parameters.get_param_value( "INIT_EXCEPTION", False, "str_to_bool") if self._init_exception is True: raise AcsConfigException( AcsConfigException.PROHIBITIVE_BEHAVIOR, "Exception raised according to TC param 'INIT_EXCEPTION'") # Clear existing queue to avoid unexpected behavior if not Dummy.returns_code.empty(): with Dummy.returns_code.mutex: Dummy.returns_code.queue.clear() if not Dummy.steps.empty(): with Dummy.steps.mutex: Dummy.steps.queue.clear() # Fill the FIFO queue taking into account the b2b iteration number for _i in range(self.get_b2b_iteration()): for code in self._return_code.split(";"): if code.strip() == "RANDOM": code = random.choice(Verdict2Global.map.keys()) Dummy.returns_code.put(code.strip()) for step in self._step.split(";"): if step.strip() == "RANDOM": step = random.choice(["SETUP", "RUNTEST", "TEARDOWN"]) Dummy.steps.put(step.strip()) # Get return code and step only if queue is not empty. # By default verdict = PASS, step = RUNTEST self._current_verdict = Verdict.PASS self._current_step = "RUNTEST" if not Dummy.returns_code.empty(): self._current_verdict = Dummy.returns_code.get() if not Dummy.steps.empty(): self._current_step = Dummy.steps.get()
def __init__(self, tc_name, global_config): """ Constructor """ UseCaseBase.__init__(self, tc_name, global_config) self._global_config = global_config self._run_from_tc_directory = self._tc_parameters.get_param_value("RUN_FROM_TCDIRECTORY", default_value="False", default_cast_type="str_to_bool")
def __init__(self, tc_name, global_config): """ Constructor """ UseCaseBase.__init__(self, tc_name, global_config) self.__setup_script = self._tc_parameters.get_param_value("SETUP_SCRIPT_PATH") self.__run_script = self._tc_parameters.get_param_value("SCRIPT_PATH") self.__teardown_script = self._tc_parameters.get_param_value("TEAR_DOWN_SCRIPT_PATH") self.__finalize_script = self._tc_parameters.get_param_value("FINALIZE_SCRIPT_PATH") self.__verdict = None self.__message = None self.__tc_report = SecondaryTestReport(self._device.get_report_tree().get_report_path())
def __init__(self, tc_conf, global_config): """ Constructor """ UCBase.__init__(self, tc_conf, global_config)