SMART Box device

This module implements the MCCS SmartBox device.

class MccsSmartBox(*args, **kwargs)

An implementation of the SmartBox device for MCCS.

ClearThresholdCache()

Clear the threshold caches.

Return type:

tuple[list[ResultCode], list[Optional[str]]]

Returns:

A tuple containing a return code and a string message indicating status.

PowerOffAntenna(antenna_name)

Power off an antenna.

Parameters:

antenna_name (str) – the antenna 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.

PowerOffPort(port_number)

Power down a port.

This may or may not have a Antenna attached.

Parameters:

port_number (int) – the smartbox port 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.

PowerOnAntenna(antenna_name)

Power up an antenna.

Parameters:

antenna_name (str) – the antenna 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.

PowerOnPort(port_number)

Power up a port.

This may or may not have a Antenna attached.

Parameters:

port_number (int) – the smartbox port 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.

ReadableName()

Return the name of the smartbox in a readable format.

Return type:

str

Returns:

the name of the smartbox

SetAntennaMasking(argin)

Set the masking status for antennas on this smartbox.

Antennas absent from the dict are left unchanged. The local port mask cache is updated immediately so no Init() is required.

Returns REJECTED if none of the supplied antenna names are known to this smartbox (e.g. all names are unrecognised or the dict is empty).

Parameters:

argin (str) – JSON string mapping antenna names to masked status, e.g. {"sb01-01": true, "sb01-03": false}. true means masked (port will not be powered on); false means unmasked.

Return type:

tuple[list[ResultCode], list[Optional[str]]]

Returns:

A tuple containing a return code and a string message indicating status. The message is for information purposes only. Returns REJECTED if no antennas would be masked.

SetPortPowers(json_argument)

Set port powers.

These ports may not have an antenna attached.

Parameters:

json_argument (str) – desired port powers of unmasked ports with smartboxes attached in json form.

Return type:

TaskFunctionType

Returns:

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

UpdateThresholdCache()

Update the threshold caches.

Return type:

tuple[list[ResultCode], list[Optional[str]]]

Returns:

A tuple containing a return code and a string message indicating status.

__init__(*args, **kwargs)

Initialise this device object.

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

  • kwargs (Any) – keyword args to the init

antennaNames()

Get the names of antennas on this smartbox.

Return type:

str

Returns:

the names of antennas on this smartbox.

antennaPowers()

Get the antenna powers.

Return type:

str

Returns:

the antenna powers.

create_component_manager()

Create and return a component manager for this device.

Return type:

SmartBoxComponentManager

Returns:

a component manager for this device.

delete_device()

Delete the device.

Return type:

None

execute_Off()

Execute the Off command.

Return type:

TaskFunctionType

Returns:

the callable function.

execute_On()

Execute the On command.

Return type:

TaskFunctionType

Returns:

the callable function.

execute_Standby()

Execute the Standby command.

Return type:

TaskFunctionType

Returns:

the callable function.

fndhPort()

Return the fndh port the smartbox is attached to.

Return type:

str

Returns:

the fndh port that the smartbox is attached to.

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.

init_device()

Initialise the device.

This is overridden here to change the Tango serialisation model.

Return type:

None

is_engineering()

Return a flag representing whether we are in Engineering mode.

Return type:

bool

Returns:

True if Smartbox is in Engineering Mode.

is_firmware_threshold_allowed(req_type)

Return a flag representing whether we are allowed to access the attribute.

Parameters:

req_type (AttReqType) – the request type

Return type:

bool

Returns:

True if access is allowed.

numberOfPortBreakersTripped()

Return the total number of breakers which have tripped.

This is used for alarm configuration.

Return type:

Optional[int]

Returns:

the total number of breakers which have been tripped.

portMask(port_mask)

Set the port mask for this smartbox’s ports.

Parameters:

port_mask (list[bool]) – the port mask, it must be the correct length (12).

Raises:

ValueError – if the length of supplied port mask is incorrect.

Return type:

None

thresholdDifferences()

Return the differences between threshold values.

Return type:

str

Returns:

Return the differences between threshold values.

update_threshold_cache()

Update smartbox thresholds cache from database.

Return type:

None

useNewHealthRules(use_new_rules)

Set whether to use new health rules.

Parameters:

use_new_rules (bool) – whether to use new rules

Return type:

None