Subrack subpackage

This subpackage implements subrack functionality for the MCCS.

class FanMode(value)

Python enumerated type for FanMode attribute.

MANUAL = 0

Tango Device accepts commands from all clients.

class MccsSubrack(*args, **kwargs)

A Tango device for monitor and control of an SPS subrack.

PowerDownTpms()

Power down all TPMs.

Return type:

TaskFunctionType

Returns:

A tuple containing a return code and a string message indicating status. The message is for information purposes only.

PowerOffTpm(tpm_number)

Power down a TPM.

Parameters:

tpm_number (int) – the logical id of the TPM to power down

Return type:

TaskFunctionType

Returns:

A tuple containing a return code and a string message indicating status. The message is for information purposes only.

PowerOnTpm(tpm_number)

Power up a TPM.

Parameters:

tpm_number (int) – the logical id of the TPM to power up

Return type:

TaskFunctionType

Returns:

A tuple containing a return code and a string message indicating status. The message is for information purposes only.

PowerPduPortOff(port_number)

Turn the selected pdu port off.

Parameters:

port_number (int) – pdu port number

Return type:

TaskFunctionType

Returns:

A tuple containing a return code and a string message indicating status. The message is for information purpose only.

PowerPduPortOn(port_number)

Turn the selected pdu port on.

Parameters:

port_number (int) – pdu port number

Return type:

TaskFunctionType

Returns:

A tuple containing a return code and a string message indicating status. The message is for information purpose only.

PowerUpTpms()

Power up all TPMs.

Return type:

TaskFunctionType

Returns:

A tuple containing a return code and a string message indicating status. The message is for information purposes only.

ScheduleOff()

Turn self off.

Return type:

TaskFunctionType

Returns:

A tuple containing a return code and a string message indicating status. The message is for information purpose only.

ScheduleOn()

Turn self on.

Return type:

TaskFunctionType

Returns:

A tuple containing a return code and a string message indicating status. The message is for information purpose only.

SetPowerSupplyFanSpeed(power_supply_fan_id, speed_percent)

Set the selected power supply fan speed.

A json dictionary with mandatory keywords

Parameters:
  • power_supply_fan_id (int) – (int) power supply fan id from 1 to 2

  • speed_percent (int) – (int) fan speed in percent

Return type:

TaskFunctionType

Returns:

A tuple containing a return code and a string message indicating status. The message is for information purpose only.

SetSubrackFanMode(fan_id, mode)

Set the selected subrack backplane fan mode.

A json dictionary with mandatory keywords

Parameters:
  • fan_id (int) – (int) fan id from 1 to 4

  • mode (FanMode) – (int) mode: 0=MANUAL, 1=AUTO

Return type:

TaskFunctionType

Returns:

A tuple containing a return code and a string message indicating status. The message is for information purpose only.

SetSubrackFanSpeed(subrack_fan_id, speed_percent)

Set the selected subrack backplane fan speed.

A json dictionary with mandatory keywords

Parameters:
  • subrack_fan_id (int) – (int) fan id from 1 to 4

  • speed_percent (int) – (int) fan speed in percent

Return type:

TaskFunctionType

Returns:

A tuple containing a return code and a string message indicating status. The message is for information purpose only.

UpdateHealthAttributes()

Request the subrack driver to poll the health status attributes.

Return type:

TaskFunctionType

Returns:

A tuple containing a return code and a string message indicating status. The message is for information purposes only.

property UseAttributesForHealth

Use the attribute quality factor in health. ADR-115.

__init__(*args, **kwargs)

Initialise this device object.

Parameters:
  • args (Any) – positional args to the init

  • kwargs (Any) – keyword args to the init

backplaneTemperatures()

Handle a Tango attribute read of the subrack backplane temperature.

Two values are returned, respectively for the first (bays 1-4) and second (bays 5-8) halves of the backplane.

Return type:

Optional[list[float]]

Returns:

the backplane temperatures. When communication with the subrack is not established, this returns none.

boardCurrent()

Handle a Tango attribute read of subrack management board current.

Total current provided by the two power supplies.

Return type:

Optional[list[float]]

Returns:

total board current, in a list of length 1. When communication with the subrack is not established, this returns none.

boardTemperatures()

Handle a Tango attribute read of the subrack board temperature.

Two values are returned.

Return type:

Optional[list[float]]

Returns:

the board temperatures. When communication with the subrack is not established, this returns none.

cpldPllLocked()

Handle a Tango attribute read of the subrack CPLD PLL locked attribute.

Return type:

Optional[bool]

Returns:

whether the CPLD PLL is locked.

create_component_manager()

Create and return a component manager for this device.

Return type:

SubrackComponentManager

Returns:

a component manager for this device.

delete_device()

Delete the device.

Return type:

None

healthModelParams(argin)

Set the params for health transition rules.

Parameters:

argin (str) – JSON-string of dictionary of health states

Return type:

None

healthReport()

Get the health report.

Return type:

str

Returns:

the health report.

healthStatus()

Handle a dictionary of all available monitoring points.

Return type:

Optional[str]

Returns:

A dictionary containing all the monitoring points

init_device()

Initialise the device.

This is overridden here to change the Tango serialisation model.

Return type:

None

property internalVoltages1V1: float

Subrack internal 1V1 supply voltage in Volts.

Unit:

Volt

property internalVoltages1V5: float

Subrack internal 1V5 supply voltage in Volts.

Unit:

Volt

property internalVoltages2V5: float

Subrack internal 2V5 supply voltage in Volts.

Unit:

Volt

property internalVoltages2V8: float

Subrack internal 2V8 supply voltage in Volts.

Unit:

Volt

property internalVoltages3V: float

Subrack internal 3V supply voltage in Volts.

Unit:

Volt

property internalVoltages3V3: float

Subrack internal 3V3 supply voltage in Volts.

Unit:

Volt

property internalVoltages5V: float

Subrack internal 5V supply voltage in Volts.

Unit:

Volt

property internalVoltagesARM: float

Subrack internal ARM supply voltage in Volts.

Unit:

Volt

property internalVoltagesCORE: float

Subrack internal CORE supply voltage in Volts.

Unit:

Volt

property internalVoltagesDDR: float

Subrack internal DDR supply voltage in Volts.

Unit:

Volt

property internalVoltagesPOWERIN: float

Subrack power input voltage in Volts.

Unit:

Volt

property internalVoltagesSOC: float

Subrack internal SOC supply voltage in Volts.

Unit:

Volt

pduHealth()

Handle a Tango attribute read of the pdu health.

Return type:

Optional[str]

Returns:

the pdu health

pduModel()

Handle a Tango attribute read of the pdu model type.

Return type:

Optional[str]

Returns:

the pdu model type

pduNumberPorts()

Handle a Tango attribute read of thenumber of pdu ports.

Return type:

Optional[int]

Returns:

the number of pdu ports

pduPortCurrents()

Handle a Tango attribute read of the current of pdu port.

Return type:

Optional[list[float]]

Returns:

the state of the port.

pduPortStates()

Handle a Tango attribute read of the state of pdu port.

Return type:

Optional[list[int]]

Returns:

the state of the port.

pduPortVoltages()

Handle a Tango attribute read of the current of pdu port.

Return type:

Optional[list[float]]

Returns:

the state of the port.

powerSupplyCurrents()

Handle a Tango attribute read of the power supply currents.

Return type:

Optional[list[float]]

Returns:

the power supply currents. When communication with the subrack is not established, this returns none.

powerSupplyFanSpeeds()

Handle a Tango attribute read of the power supply fan speeds.

Values expressed in percent of maximum.

Return type:

Optional[list[float]]

Returns:

the power supply fan speeds. When communication with the subrack is not established, this returns none.

powerSupplyPowers()

Handle a Tango attribute read of the power supply powers.

Return type:

Optional[list[float]]

Returns:

the power supply powers. When communication with the subrack is not established, this returns none.

powerSupplyVoltages()

Handle a Tango attribute read of the power supply voltages.

Return type:

Optional[list[float]]

Returns:

the power supply voltages. When communication with the subrack is not established, this returns none.

subrackBoardInfo()

Handle a Tango attribute read of the Subrack board info.

Return type:

Optional[str]

Returns:

the subrack board info as a dict

subrackFanModes()

Handle a Tango attribute read of the subrack fan modes.

Return type:

Optional[list[int]]

Returns:

the subrack fan modes. When communication with the subrack is not established, this returns none.

subrackFanSpeeds()

Handle a Tango attribute read of the subrack fan speeds, in RPM.

Return type:

Optional[list[float]]

Returns:

the subrack fan speeds. When communication with the subrack is not established, this returns none.

subrackFanSpeedsPercent()

Handle a Tango attribute read of the subrack fan speeds, in percent.

This is the commanded setpoint; the relation between this level and the actual RPMs is not linear. Subrack speed is managed automatically by the controller, by default (see subrack_fan_mode).

Commanded speed is the same for fans 1-2 and 3-4.

Return type:

Optional[list[float]]

Returns:

the subrack fan speed setpoints in percent. When communication with the subrack is not established, this returns none.

subrackPllLocked()

Handle a Tango attribute read of the subrack PLL locked attribute.

Return type:

Optional[bool]

Returns:

whether the subrack PLL is locked.

subrackTimestamp()

Handle a Tango attribute read of the subrack timestamp attribute.

Return type:

Optional[int]

Returns:

the subrack timestamp

tpm1PowerState()

Handle a Tango attribute read of the power state of TPM 1.

Return type:

PowerState

Returns:

the power state of TPM 1.

tpm2PowerState()

Handle a Tango attribute read of the power state of TPM 2.

Return type:

PowerState

Returns:

the power state of TPM 2.

tpm3PowerState()

Handle a Tango attribute read of the power state of TPM 3.

Return type:

PowerState

Returns:

the power state of TPM 3.

tpm4PowerState()

Handle a Tango attribute read of the power state of TPM 4.

Return type:

PowerState

Returns:

the power state of TPM 4.

tpm5PowerState()

Handle a Tango attribute read of the power state of TPM 5.

Return type:

PowerState

Returns:

the power state of TPM 5.

tpm6PowerState()

Handle a Tango attribute read of the power state of TPM 6.

Return type:

PowerState

Returns:

the power state of TPM 6.

tpm7PowerState()

Handle a Tango attribute read of the power state of TPM 7.

Return type:

PowerState

Returns:

the power state of TPM 7.

tpm8PowerState()

Handle a Tango attribute read of the power state of TPM 8.

Return type:

PowerState

Returns:

the power state of TPM 8.

tpmCount()

Handle a Tango attribute read of TPM count.

Return type:

int

Returns:

the number of TPMs present in the subrack. When communication with the subrack is not established, this returns 0.

tpmCurrents()

Handle a Tango attribute read of the TPM currents.

Return type:

Optional[list[float]]

Returns:

the TPM currents. When communication with the subrack is not established, this returns none.

tpmPowers()

Handle a Tango attribute read of the TPM powers.

Return type:

Optional[list[float]]

Returns:

the TPM powers. When communication with the subrack is not established, this returns none.

tpmPresent()

Handle a Tango attribute read of which TPMs are present in the subrack.

Return type:

list[bool]

Returns:

whether a TPM is present in each bay. When communication with the subrack is not established, this returns an empty list.

tpmVoltages()

Handle a Tango attribute read of the TPM voltages.

Return type:

Optional[list[float]]

Returns:

the TPM voltages

useAttributesForHealth()

Return if adr115 is in use.

Return type:

bool

Returns:

True if attributes quality is being evaluated in health.

class SubrackComponentManager(subrack_ip, subrack_port, logger, pdu_trl, pdu_ports, power_marshaller_trl, simulated_pdu, communication_state_changed_callback, component_state_changed_callback, update_rate=5.0, command_update_rate=20.0, _driver=None, _initial_power_state=ska_control_model.PowerState.ON, _initial_fail=False)

A component manager for an subrack (simulator or driver) and its power supply.

__init__(subrack_ip, subrack_port, logger, pdu_trl, pdu_ports, power_marshaller_trl, simulated_pdu, communication_state_changed_callback, component_state_changed_callback, update_rate=5.0, command_update_rate=20.0, _driver=None, _initial_power_state=ska_control_model.PowerState.ON, _initial_fail=False)

Initialise a new instance.

Parameters:
  • subrack_ip (str) – the IP address of the subrack

  • subrack_port (int) – the subrack port

  • logger (Logger) – a logger for this object to use

  • pdu_trl (str) – trl for the pdu device

  • pdu_ports (list[int]) – the ports of the pdu that this subrack is plugged into

  • power_marshaller_trl (str) – trl for the power marshaller device

  • simulated_pdu (bool) – if we are using a simulated pdu or not

  • communication_state_changed_callback (Callable[[CommunicationStatus], None]) – callback to be called when the status of the communications channel between the component manager and its component changes

  • component_state_changed_callback (Callable[..., None]) – callback to be called when the component state changes

  • update_rate (float) – how often updates to attribute values should be provided. This is not necessarily the same as the rate at which the instrument is polled. For example, the instrument may be polled every 0.1 seconds, thus ensuring that any invoked commands or writes will be executed promptly. However, if the update_rate is 5.0, then routine reads of instrument values will only occur every 50th poll (i.e. every 5 seconds).

  • command_update_rate (float) – similar to update_rate but for polled commands such as get_health_status.

  • _driver (Optional[SubrackDriver]) – for testing only, we can inject a driver rather then letting the component manager create its own. If provided, this overrides driver-specific arguments such as the IP and port.

  • _initial_power_state (PowerState) – for testing only, we can set the initial power state of the simulated subrack power supply. If not provided, the default is ON, since all our current facilities with a real hardware subrack do not yet allow it to be powered on and off.

  • _initial_fail (bool) – for testing only, we can set the simulated subrack power supply to fail.

get_health_status(task_callback=None)

Read all the monitoring points available in health status.

Parameters:

task_callback (Optional[Callable]) – callback to be called when the status of the command changes

Return type:

tuple[TaskStatus, str]

Returns:

the task status and a human-readable status message

pdu_health_state()

Get PDU health.

Return type:

Optional[str]

Returns:

pdu health.

pdu_model()

Get PDU model type.

Return type:

Optional[str]

Returns:

pdu model type.

pdu_number_of_ports()

Get number of pdu ports .

Return type:

Optional[int]

Returns:

number of pdu ports

pdu_port_currents()

Get the currents for a pdu port.

Return type:

Optional[list[float]]

Returns:

pdu port currents.

pdu_port_states()

Get the states for a pdu port.

Return type:

Optional[list[int]]

Returns:

pdu port statuses.

pdu_port_voltages()

Get the voltages for a pdu port.

Return type:

Optional[list[float]]

Returns:

pdu port voltages.

power_pdu_port_off(port_number, task_callback=None, task_abort_event=None)

Turn a pdu port off.

Parameters:
  • port_number (int) – (one-based) number of the port to turn off.

  • task_callback (Optional[Callable]) – Update task state, defaults to None

  • task_abort_event (Optional[Event]) – Check for abort, defaults to None

Return type:

None

power_pdu_port_on(port_number, task_callback=None, task_abort_event=None)

Turn a pdu port on.

Parameters:
  • port_number (int) – (one-based) number of the port to turn on.

  • task_callback (Optional[Callable]) – Update task state, defaults to None

  • task_abort_event (Optional[Event]) – Check for abort, defaults to None

Return type:

None

read_health_status()

Read all the monitoring points available in health status.

Return type:

dict

Returns:

monitoring points available in health status.

schedule_off(task_callback=None, task_abort_event=None)

Turn self off.

Parameters:
  • task_callback (Optional[Callable]) – callback to be called when the status of the command changes

  • task_abort_event (Optional[Event]) – Check for abort, defaults to None

Return type:

None

schedule_on(task_callback=None, task_abort_event=None)

Schedule self on.

Parameters:
  • task_callback (Optional[Callable]) – callback to be called when the status of the command changes

  • task_abort_event (Optional[Event]) – Check for abort, defaults to None

Return type:

None

set_power_supply_fan_speed(fan_number, speed, task_callback=None)

Set the target speed of a power supply fan.

Parameters:
  • fan_number (int) – one-based number of the fan to be set.

  • speed (float) – speed setting for the fan.

  • task_callback (Optional[Callable]) – callback to be called when the status of the command changes

Return type:

tuple[TaskStatus, str]

Returns:

the task status and a human-readable status message

set_subrack_fan_mode(fan_number, mode, task_callback=None)

Set the target speed mode of a subrack fan.

Parameters:
  • fan_number (int) – one-based number of the fan to be set.

  • mode (FanMode) – speed mode setting for the fan.

  • task_callback (Optional[Callable]) – callback to be called when the status of the command changes

Return type:

tuple[TaskStatus, str]

Returns:

the task status and a human-readable status message

set_subrack_fan_speed(fan_number, speed, task_callback=None)

Set the target speed of a subrack fan.

Parameters:
  • fan_number (int) – one-based number of the fan to be set.

  • speed (float) – speed setting for the fan.

  • task_callback (Optional[Callable]) – callback to be called when the status of the command changes

Return type:

tuple[TaskStatus, str]

Returns:

the task status and a human-readable status message

start_communicating()

Establish communication with the subrack components.

Return type:

None

stop_communicating()

Break off communication with the subrack components.

Return type:

None

turn_off_tpm(tpm_number, task_callback=None)

Turn a TPM off.

Parameters:
  • tpm_number (int) – (one-based) number of the TPM to turn off.

  • task_callback (Optional[Callable]) – callback to be called when the status of the command changes

Return type:

tuple[TaskStatus, str]

Returns:

the task status and a human-readable status message

turn_off_tpms(task_callback=None)

Turn all TPMs off.

Parameters:

task_callback (Optional[Callable]) – callback to be called when the status of the command changes

Return type:

tuple[TaskStatus, str]

Returns:

the task status and a human-readable status message

turn_on_tpm(tpm_number, task_callback=None)

Turn a TPM on.

Parameters:
  • tpm_number (int) – (one-based) number of the TPM to turn on.

  • task_callback (Optional[Callable]) – callback to be called when the status of the command changes

Return type:

tuple[TaskStatus, str]

Returns:

the task status and a human-readable status message

turn_on_tpms(task_callback=None)

Turn all TPMs on.

Parameters:

task_callback (Optional[Callable]) – callback to be called when the status of the command changes

Return type:

tuple[TaskStatus, str]

Returns:

the task status and a human-readable status message

class SubrackData

This class contain data/facts about a subrack that are needed by multiple classes.

For example, the fact that a subrack contains 8 TPM bays is something that a subrack driver may need to know, a subrack Tango device may need to know, and a subrack simulator certainly needs to know. So rather than store this fact in three separate places, we store it here.

MAX_SUBRACK_FAN_SPEED = 8000.0

The maximum fan speed for the subrack.

TPM_BAY_COUNT = 8

The number of TPM bays (some bays may be empty)

class SubrackDriver(host, port, logger, communication_state_callback, component_state_callback, update_rate=5.0, command_update_rate=20.0, _subrack_client=None)

A component manager for an SPS subrack.

__init__(host, port, logger, communication_state_callback, component_state_callback, update_rate=5.0, command_update_rate=20.0, _subrack_client=None)

Initialise a new instance.

Parameters:
  • host (str) – the host name or IP address of the subrack management board.

  • port (int) – the port of the subrack management board.

  • logger (Logger) – a logger for this component manager to use for logging

  • communication_state_callback (Callable) – callback to be called when the status of communications between the component manager and its component changes.

  • component_state_callback (Callable) – callback to be called when the state of the component changes.

  • update_rate (float) – how often updates to attribute values should be provided. This is not necessarily the same as the rate at which the instrument is polled. For example, the instrument may be polled every 0.1 seconds, thus ensuring that any invoked commands or writes will be executed promptly. However, if the update_rate is 5.0, then routine reads of instrument values will only occur every 50th poll (i.e. every 5 seconds).

  • command_update_rate (float) – similar to update_rate but for polled commands.

  • _subrack_client (Optional[Any]) – an optional subrack client to use.

get_health_status(task_callback=None)

Read all the monitoring points available in health status.

Parameters:

task_callback (Optional[Callable]) – callback to be called when the status of the command changes

Return type:

tuple[TaskStatus, str]

Returns:

the task status and a human-readable status message

get_request()

Return the reads, writes and commands to be executed in the next poll.

Return type:

HttpPollRequest

Returns:

reads, writes and commands to be executed in the next poll.

off(task_callback=None)

Turn the component off.

Parameters:

task_callback (Optional[Callable]) – callback to be called when the status of the command changes

Raises:

NotImplementedError – because this command is not yet implemented

Return type:

tuple[TaskStatus, str]

on(task_callback=None)

Turn the component on.

Parameters:

task_callback (Optional[Callable]) – callback to be called when the status of the command changes

Raises:

NotImplementedError – because this command is not yet implemented

Return type:

tuple[TaskStatus, str]

poll(poll_request)

Poll the hardware.

Connect to the hardware, write any values that are to be written, and then read all values.

Parameters:

poll_request (HttpPollRequest) – specification of the reads and writes to be performed in this poll.

Raises:
  • RequestError – When the client returns HardwareClientResponseStatusCodes.REQUEST_EXCEPTION

  • HttpError – When the client returns HardwareClientResponseStatusCodes.HTTP_ERROR

  • ValueError – When the client returns an unknown HardwareClientResponseStatusCodes.

Return type:

HttpPollResponse

Returns:

responses to queries in this poll

poll_failed(exception)

Override parent to set PowerState.UNKNOWN when polling fails.

This is a bug fix that should be upstreamed to ska-tango-base - see MR https://gitlab.com/ska-telescope/ska-tango-base/-/merge_requests/133

Parameters:

exception (Exception) – the exception that was raised by a recent poll attempt.

Return type:

None

poll_succeeded(poll_response)

Handle the receipt of new polling values.

This is a hook called by the poller when values have been read during a poll.

Parameters:

poll_response (HttpPollResponse) – response to the pool, including any values read.

Return type:

None

polling_stopped()

Respond to polling having stopped.

This is a hook called by the poller when it stops polling.

Return type:

None

power_pdu_port_off(port_number, task_callback=None)

Turn a pdu port off.

Parameters:
  • port_number (int) – (one-based) number of the pdu port to turn off.

  • task_callback (Optional[Callable]) – callback to be called when the status of the command changes

Return type:

tuple[TaskStatus, str]

Returns:

the task status and a human-readable status message

power_pdu_port_on(port_number, task_callback=None)

Turn a pdu port on.

Parameters:
  • port_number (int) – (one-based) number of the pdu port to turn on.

  • task_callback (Optional[Callable]) – callback to be called when the status of the command changes

Return type:

tuple[TaskStatus, str]

Returns:

the task status and a human-readable status message

read_health_status()

Read all the monitoring points available in health status.

Return type:

dict

Returns:

the task status and a human-readable status message

reset(task_callback=None)

Reset the component (from fault state).

Parameters:

task_callback (Optional[Callable]) – callback to be called when the status of the command changes

Raises:

NotImplementedError – because this command is not yet implemented

Return type:

tuple[TaskStatus, str]

set_power_supply_fan_speed(fan_number, speed, task_callback=None)

Set the target speed of a power supply fan.

Parameters:
  • fan_number (int) – one-based number of the fan to be set.

  • speed (float) – speed setting for the fan.

  • task_callback (Optional[Callable]) – callback to be called when the status of the command changes

Return type:

tuple[TaskStatus, str]

Returns:

the task status and a human-readable status message

set_subrack_fan_mode(fan_number, mode, task_callback=None)

Set the target speed mode of a subrack fan.

Parameters:
  • fan_number (int) – one-based number of the fan to be set.

  • mode (FanMode) – speed mode setting for the fan.

  • task_callback (Optional[Callable]) – callback to be called when the status of the command changes

Return type:

tuple[TaskStatus, str]

Returns:

the task status and a human-readable status message

set_subrack_fan_speed(fan_number, speed, task_callback=None)

Set the target speed of a subrack fan.

Parameters:
  • fan_number (int) – one-based number of the fan to be set.

  • speed (float) – speed setting for the fan.

  • task_callback (Optional[Callable]) – callback to be called when the status of the command changes

Return type:

tuple[TaskStatus, str]

Returns:

the task status and a human-readable status message

standby(task_callback=None)

Put the component into low-power standby mode.

Parameters:

task_callback (Optional[Callable]) – callback to be called when the status of the command changes

Raises:

NotImplementedError – because this command is not yet implemented

Return type:

tuple[TaskStatus, str]

turn_off_tpm(tpm_number, task_callback=None)

Turn a TPM off.

Parameters:
  • tpm_number (int) – (one-based) number of the TPM to turn off.

  • task_callback (Optional[Callable]) – callback to be called when the status of the command changes

Return type:

tuple[TaskStatus, str]

Returns:

the task status and a human-readable status message

turn_off_tpms(task_callback=None)

Turn all TPMs off.

Parameters:

task_callback (Optional[Callable]) – callback to be called when the status of the command changes

Return type:

tuple[TaskStatus, str]

Returns:

the task status and a human-readable status message

turn_on_tpm(tpm_number, task_callback=None)

Turn a TPM on.

Parameters:
  • tpm_number (int) – (one-based) number of the TPM to turn on.

  • task_callback (Optional[Callable]) – callback to be called when the status of the command changes

Return type:

tuple[TaskStatus, str]

Returns:

the task status and a human-readable status message

turn_on_tpms(task_callback=None)

Turn all TPMs on.

Parameters:

task_callback (Optional[Callable]) – callback to be called when the status of the command changes

Return type:

tuple[TaskStatus, str]

Returns:

the task status and a human-readable status message

write_attribute(**kwargs)

Update subrack attribute value(s).

This doesn’t actually immediately write to the subrack. It only stores the details of the requested write where it will be picked up by the next iteration of the polling loop.

Parameters:

kwargs (Any) – keyword arguments specifying attributes to be written along with their corresponding value.

Return type:

None

class SubrackHealthModel(component_state_changed_callback, thresholds=None)

A health model for a subrack.

__init__(component_state_changed_callback, thresholds=None)

Initialise a new instance.

Parameters:
  • component_state_changed_callback (HealthChangedCallbackProtocol) – callback to be called whenever there is a change to this this health model’s evaluated health state.

  • thresholds (Optional[dict[str, Any]]) – Thresholds for the subrack device.

evaluate_health()

Compute overall health of the subrack.

The overall health is based on the fault and communication status of the subrack overall, together with the health of the tpms that it manages.

This implementation simply sets the health of the subrack to the health of its least healthy component.

Return type:

tuple[HealthState, str]

Returns:

an overall health of the subrack

update_data(new_states)

Update this health model with state relevant to evaluating health.

Parameters:

new_states (dict) – New states of the data points.

Return type:

None

class SubrackSimulator(**kwargs)

A simple simulator of a subrack management board web server.

class AttributeMetadataType

Type for attribute metadata dictionary.

__init__(**kwargs)

Initialise a new instance.

Parameters:

kwargs (Any) – initial values, different from the defaults, that the simulator should take.

Raises:

AttributeError – if kwargs refer to an non-existent attribute.

execute_command(name, argument)

Execute a command on the subrack hardware/simulator.

It works by checking for a method named f”_{name}”; that is, if the command name is “turn_on_tpms”, then it checks for a method named “_turn_on_tpms”. If it finds such a method, it calls it with the provided argument, and returns the return value.

Otherwise, it checks for a method named f”_async_{name}; for example, “_async_turn_on_tpms”. If it finds such a method, it simulates a long running command by returning “STARTED”, then letting a little time pass, then invoking the method.

Parameters:
  • name (str) – name of the command to execute.

  • argument (Optional[Any]) – argument to the command.

Return type:

Any

Returns:

the return value. For synchronous commands, this is the returned value of the fully executed command. For asynchronous commands, this is the string “STARTED” or “FAILED”.

Raises:

AttributeError – if the command method does not exist in the simulator.

get_attribute(name)

Return the value of a simulator attribute.

Parameters:

name (str) – name of the simulator attribute to be returned.

Return type:

Any

Returns:

the value of the attribute

property network_jitter_limits: tuple[int, int]

Return the max network jitter in miliseconds.

Returns:

the maximum network jitter in milliseconds.

set_attribute(name, value)

Set the value of a simulator attribute.

Parameters:
  • name (str) – name of the simulator attribute to be set.

  • value (Any) – new values for the simulator attribute

Return type:

Any

Returns:

the new values for the attribute

simulate_attribute(name, values)

Simulate a change in attribute value.

Parameters:
  • name (str) – name of the simulator attribute to be set.

  • values (Any) – new values for the simulator attribute

Return type:

Any

Returns:

the new values for the attribute