Helper_Base_Device
A common module for different helper devices(mock devices)”
- class ska_tmc_simulators.helper_base_device.HelperBaseDevice(*args: Any, **kwargs: Any)
Bases:
SKABaseDeviceA common base device for helper devices.
- InitCommand = None
- init_device() None
- create_component_manager() EmptyComponentManager
Creates an instance of EmptyComponentManager
- Returns:
component manager instance
- Return type:
EmptyComponentManager
- push_change_archive_events(attribute_name: str, value: Any) None
Method to push change event and archive event of the given attribute.
- Args:
attribute_name (str): Attribute name value (Any): Attribute value need to be pushed
- healthInfo(value: dict) None
Writes the healthInfo attribute value.
- Args:
value (dict): healthInfo attribute value.
- SetDirectHealthInfo(argin: str) None
Sets the health info of the dish.
- read_isAdminModeEnabled() bool
This method is used to read the attribute value for isAdminModeEnabled.
- Returns:
isAdminModeEnabled
- write_isAdminModeEnabled(value: bool)
This method is used to write the attribute value for isAdminModeEnabled
- Parameters:
value – The new value to set for isAdminModeEnabled.
- read_delay() int
This method is used to read the attribute value for delay.
- Returns:
delay
- read_defective() str
Returns defective status of devices
- Returns:
attribute value for defective params
- Return type:
str
- read_isSubsystemAvailable() bool
Returns availability status for the leaf nodes devices
- Returns:
availabitlity status
- Return type:
bool
- read_adminMode() int
This method reads the adminMode value of the device.
- Returns:
admin_mode value
- Return type:
AdminMode
- write_adminMode(mode: int) None
This method writes the adminMode value of the device.
- SetDelay(delay: int) None
Set the delay value.
- Parameters:
delay (int) – Delay to be set
- SetDefective(values: str) None
Trigger defective change
- Param:
values
- Type:
str
- induce_fault(command_name: str, command_id: str, is_dish: bool = False) Tuple[List[ska_tango_base.commands.ResultCode], List[str]]
Induces a fault into the device based on the given parameters.
- Parameters:
command_name (str) – The name of the command for which a fault is being induced.
command_id (str) – The command id over which the LRCR event is to be pushed.
- Returns:
ResultCode and Unique_ID
- Return type:
Tuple[List[ResultCode], List[str]]
- Example:
defective_params = json.dumps({“enabled”: False,”fault_type”: FaultType.FAILED_RESULT,”error_message”: “Default exception.”, “result”: ResultCode.FAILED,}) proxy.SetDefective(defective_params)
Explanation: This method induces various types of faults into a device to test its robustness and error-handling capabilities.
- FAILED_RESULT:
A fault type that triggers a failed result code for the command. The device will return a result code of ‘FAILED’ along with a unique_id indicating that the command execution has failed.
- LONG_RUNNING_EXCEPTION:
A fault type where a failed result will be sent over the LongRunningCommandResult attribute in ‘delay’ amount of time.
- STUCK_IN_INTERMEDIATE_STATE:
This fault type makes it such that the device is stuck in the given Observation state.
- COMMAND_NOT_ALLOWED_AFTER_QUEUING:
This fault type sends a ResultCode.NOT_ALLOWED event through the LongRunningCommandResult attribute.
- COMMAND_NOT_ALLOWED_EXCEPTION_AFTER_QUEUING:
This fault type sends a ResultCode.REJECTED event through the LongRunningCommandResult attribute.
- COMMAND_REJECTION:
This fault type returns ResultCode.REJECTED and message.
- push_pointing_state_event(pointing_state: PointingState) None
Push Pointing State Change Event
- push_dish_mode_event(dish_mode: DishMode) None
Push Dish Change Event
- push_command_result(result_code: ska_tango_base.commands.ResultCode, command_name: str, message: str = 'Command Completed', command_id: str = '') None
Push long running command result event for given command.
- Parameters:
result_code (ResultCode) – The result code to be pushed as an event
command_name (str) – The command name for which event is being pushed
message (str) – The message associated with the command result
command_id (str) – The unique command id
- SetDirectState(argin: tango.DevState) None
Trigger a DevState change
:param tango.DevState
- SetSubsystemAvailable(value: bool) None
Sets Availability of the device
- Return type:
bool
- SetDirectHealthState(argin: <Mock id='132366630295760'>) None
Trigger a HealthState change
:param tango.DevState
- is_On_allowed() bool
This method checks if the On command is allowed in current state.
- Return type:
bool
- Returns:
Trueif the command is allowed- Raises:
CommandNotAllowed – command is not allowed
- execute_On() Tuple[List[ska_tango_base.commands.ResultCode], List[str]]
This method invokes On command
- Returns:
ResultCode and message
- Return type:
Tuple
- is_Off_allowed() bool
This method checks if the Off command is allowed in current state.
- Returns:
Trueif the command is allowed- Return type:
bool
- Raises:
CommandNotAllowed – command is not allowed
- execute_Off() Tuple[List[ska_tango_base.commands.ResultCode], List[str]]
This method invokes Off command
- Returns:
ResultCode and message
- Return type:
Tuple
- is_Standby_allowed() bool
This method checks if the Standby command is allowed in current state.
- Returns:
Trueif the command is allowed- Return type:
bool
- Raises:
CommandNotAllowed – command is not allowed
- execute_Standby() Tuple[List[ska_tango_base.commands.ResultCode], List[str]]
This method invokes Standby command
- Returns:
ResultCode and message
- Return type:
Tuple
- is_SetAdminMode_allowed() bool
This method checks if SetAdminMode command is allowed in the current device state.
- Returns:
Trueif the command is allowed- Return type:
bool
- Raises:
CommandNotAllowed – command is not allowed
- SetAdminMode(argin) Tuple[List[ska_tango_base.commands.ResultCode], List[str]]
This is the method to invoke SetAdminMode command.
- Returns:
ResultCode, message
- Return type:
tuple
- is_Disable_allowed() bool
This method checks if the Disable command is allowed in current state.
- Returns:
Trueif the command is allowed- Return type:
bool
- Raises:
CommandNotAllowed – command is not allowed
- Disable() Tuple[List[ska_tango_base.commands.ResultCode], List[str]]
This method invokes Disable command
- Returns:
ResultCode and message
- Return type:
Tuple