IP Block Base Classes

BaseIPBlockManager Class

class ska_mid_cbf_fhs_common.base_classes.ip_block.managers.base_ip_block_manager.BaseIPBlockManager(ip_block_id: str, controlling_device_name: str, bitstream_path: str, bitstream_id: str, bitstream_version: str, firmware_ip_block_id: str, simulation_mode: SimulationMode = SimulationMode.TRUE, emulation_mode: bool = False, emulator_ip_block_id: str | None = None, emulator_id: str | None = None, emulator_base_url: str | None = None, logging_level: str = 'INFO', create_log_file: bool = True, **additional_properties: Any)[source]

Bases: ABC, Generic[IPBlockConfigT, IPBlockStatusT, FhsBaseApiInterfaceT]

Base class for IP Block Manager classes. Provides basic API method wrappers and sets up IP block-level logging.

Parameters:
  • ip_block_id (str) – The ID of the IP block being managed.

  • controlling_device_name (str) – The name of the Tango device controlling this IP block manager.

  • bitstream_path (str) – The path to the bitstream being used for this IP block.

  • bitstream_id (str) – The ID of the bitstream being used for this IP block.

  • bitstream_version (str) – The version of the bitstream being used for this IP block.

  • firmware_ip_block_id (str) – The firmware ID of the IP block being managed.

  • simulation_mode (SimulationMode, optional) – Whether the controller is deployed in simulation mode (SimulationMode.TRUE) or not (SimulationMode.FALSE). Default is SimulationMode.FALSE.

  • emulation_mode (bool, optional) – Whether the controller is deployed in emulation mode or not. Default is False.

  • emulator_ip_block_id (str) – The emulator ID of the IP block being managed.

  • emulator_id (str) – The ID of the bitstream emulator this manager will communicate with in emulation mode.

  • emulator_base_url (str) – The base URL of the bitstream emulator this manager will communicate with in emulation mode.

  • logging_level (str) – The logging level to initialize this IP block manager with.

  • create_log_file (bool, optional) – Whether or not to create a log file for this IP block manager. Default is True.

  • **additional_properties (Any) – Any additional properties for a particular IP block subclass.

abstract property config_dataclass: type[IPBlockConfigT]

The configuration dataclass for this IP block.

abstract property status_dataclass: type[IPBlockStatusT]

The status dataclass for this IP block.

property emulator_api_class: type[EmulatorApi]

The emulator API base class for this IP block. Should only be overridden if additional API methods are required on top of the base API.

Type:

type[EmulatorApi]

property firmware_api_class: type[FirmwareApi]

The firmware API base class for this IP block. Should only be overridden if additional API methods are required on top of the base API.

Type:

type[FirmwareApi]

abstract property simulator_api_class: type[BaseSimulatorApi]

The simulator API class for this IP block.

Type:

type[BaseSimulatorApi]

ip_block_id

The ID of the IP block being managed.

Type:

str

emulator_ip_block_id

The emulator ID of the IP block being managed.

Type:

str

firmware_ip_block_id

The firmware ID of the IP block being managed.

Type:

str

logger: Logger

The logger used by this IP block manager.

Type:

Logger

log_critical(msg: str, transaction_id: str | None = None) None[source]
log_error(msg: str, transaction_id: str | None = None) None[source]
log_warning(msg: str, transaction_id: str | None = None) None[source]
log_info(msg: str, transaction_id: str | None = None) None[source]
log_debug(msg: str, transaction_id: str | None = None) None[source]
update_logging_level(logging_level: str) None[source]

Update the logging level of this IP block manager.

Parameters:

logging_level (str) – The new logging level to apply.

get_health_state() HealthState[source]

Get the current health state of this IP block manager.

configure(config: IPBlockConfigT | None = None) int[source]

Configure the IP block.

Parameters:

config (IPBlockConfigT | None, optional) – A configuration to apply, or None (no configuration). Default is None.

deconfigure(config: IPBlockConfigT | None = None) int[source]

Deconfigure the IP block.

Parameters:

config (IPBlockConfigT | None, optional) – A config object to reference during deconfiguration, or None. Default is None.

start() int[source]

Start the IP block.

stop() int[source]

Stop the IP block.

recover() int[source]

Recover the IP block.

status(clear: bool = False) IPBlockStatusT | None[source]

Get the current status from the IP block.

Parameters:

clear (bool, optional) – Whether or not to clear counters in firmware (or the emulator). Default is False.

Returns:

The status retrieved from the IP block if successful, or None if retrieval was unsuccessful.

Return type:

IPBlockStatusT | None

BaseMonitoringIPBlockManager Class

class ska_mid_cbf_fhs_common.base_classes.ip_block.managers.base_monitoring_ip_block_manager.BaseMonitoringIPBlockManager(ip_block_id: str, controlling_device_name: str, bitstream_path: str, bitstream_id: str, bitstream_version: str, firmware_ip_block_id: str, simulation_mode: ~ska_control_model.simulation_mode.SimulationMode = SimulationMode.TRUE, emulation_mode: bool = False, emulator_ip_block_id: str | None = None, emulator_id: str | None = None, emulator_base_url: str | None = None, logging_level: str = 'INFO', health_monitor_poll_interval: float = 30.0, update_health_state_callback: ~typing.Callable = <function BaseMonitoringIPBlockManager.<lambda>>, create_log_file: bool = True, **additional_properties: ~typing.Any)[source]

Bases: BaseIPBlockManager[IPBlockConfigT, IPBlockStatusT, FhsBaseApiInterfaceT], Generic[IPBlockConfigT, IPBlockStatusT, FhsBaseApiInterfaceT]

Base class for health monitoring IP Block Manager classes.

Parameters:
  • ip_block_id (str) – The ID of the IP block being managed.

  • controlling_device_name (str) – The name of the Tango device controlling this IP block manager.

  • bitstream_path (str) – The path to the bitstream being used for this IP block.

  • bitstream_id (str) – The ID of the bitstream being used for this IP block.

  • bitstream_version (str) – The version of the bitstream being used for this IP block.

  • firmware_ip_block_id (str) – The firmware ID of the IP block being managed.

  • simulation_mode (SimulationMode, optional) – Whether the controller is deployed in simulation mode (SimulationMode.TRUE) or not (SimulationMode.FALSE). Default is SimulationMode.FALSE.

  • emulation_mode (bool, optional) – Whether the controller is deployed in emulation mode or not. Default is False.

  • emulator_ip_block_id (str) – The emulator ID of the IP block being managed.

  • emulator_id (str) – The ID of the bitstream emulator this manager will communicate with in emulation mode.

  • emulator_base_url (str) – The base URL of the bitstream emulator this manager will communicate with in emulation mode.

  • logging_level (str) – The logging level to initialize this IP block manager with.

  • health_monitor_poll_interval (float) – The interval, in seconds, at which to run health state polling.

  • update_health_state_callback (Callable) – Callback to run whenever the IP block’s health state changes.

  • create_log_file (bool, optional) – Whether or not to create a log file for this IP block manager. Default is True.

  • **additional_properties (Any) – Any additional properties for a particular IP block subclass.

health_monitor

The health state monitor for this IP block.

Type:

FhsHealthMonitor

start() int[source]

Start the IP block and start health state polling.

stop() int[source]

Stop the IP block and stop health state polling.

abstractmethod get_status_healthstates(status: IPBlockStatusT) dict[str, HealthState][source]

Determine the health states of various parts of the status retrieved from the IP block. This runs once per polling cycle.

Parameters:

status (IPBlockStatusT) – The status returned by the IP block’s API.

Returns:

A dictionary mapping status items to their determined HealthStates, which will be used to determine the overall health state of the IP block.

Return type:

dict[str, HealthState]

BaseSimulatorApi Class

class ska_mid_cbf_fhs_common.base_classes.api.base_simulator_api.BaseSimulatorApi(ip_block_name: str, logger: Logger)[source]

Bases: FhsBaseApiInterface

recover() int[source]
configure(config: dict) int[source]
start() int[source]
stop() int[source]
deconfigure(config: dict) int[source]
status(clear: bool = False) dict | None[source]

FhsBaseApiInterface Class

class ska_mid_cbf_fhs_common.base_classes.api.fhs_base_api_interface.FhsBaseApiInterface[source]

Bases: ABC

abstractmethod recover() int[source]
abstractmethod configure(config: dict = None) int[source]
abstractmethod start() int[source]
abstractmethod stop(force: bool = False) int[source]
abstractmethod deconfigure(config: dict) int[source]
abstractmethod status(clear: bool = False) dict | None[source]