Tile Health Rules

A file to store health transition rules for tile.

class TileHealthRules(hw_version, bios_version, preadu_presence, *args, **kwargs)

A class to handle transition rules for tile.

__init__(hw_version, bios_version, preadu_presence, *args, **kwargs)

Initialise this device object.

Parameters:
  • hw_version (str) – the TPM version.

  • bios_version (str) – the TPM bios version.

  • preadu_presence (list[bool]) – Represent is a PreAdu is present on a per channel basis.

  • args (Any) – positional args to the init

  • kwargs (Any) – keyword args to the init

compute_intermediate_state(monitoring_points, min_max, path='', health_key=None)

Compute the intermediate health state for the Tile.

This is computed for a particular category of monitoring points e.g. voltage, io etc.

Parameters:
  • monitoring_points (dict[str, Any]) – dictionary of all the TPM monitoring points for the given category of monitoring point

  • min_max (dict[str, Any]) – minimum/maximum/expected values for the monitoring points. For monitoring points where a minimum/maximum doesn’t make sense, the value provided will be that which the monitoring point is required to have for the device to be healthy

  • path (str) – the location in the health structure dictionary that is currently being computed.

  • health_key (Optional[str]) – the root health key.

Return type:

tuple[HealthState, str]

Returns:

the computed health state and health report

property default_thresholds: dict[str, Any]

Get the default thresholds for tile.

Returns:

the default thresholds

degraded_rule(intermediate_healths, tile_state)

Test whether DEGRADED is valid for the tile.

Parameters:
Return type:

tuple[bool, str]

Returns:

True if DEGRADED is a valid state, along with a text report.

failed_rule(intermediate_healths, tile_state)

Test whether FAILED is valid for the tile.

Parameters:
Return type:

tuple[bool, str]

Returns:

True if FAILED is a valid state, along with a text report.

healthy_rule(intermediate_healths, tile_state)

Test whether OK is valid for the tile.

Parameters:
Return type:

tuple[bool, str]

Returns:

True if OK is a valid state, along with a text report.

set_logger(logger)

Set logger for debugging.

Parameters:

logger (Any) – a logger.

Return type:

None

unknown_rule(intermediate_healths, tile_state)

Test whether UNKNOWN is valid for the tile.

Parameters:
Return type:

tuple[bool, str]

Returns:

True if UNKNOWN is a valid state, along with a text report.

deep_merge_dicts(dest, src)

Recursively merges the src dictionary into the dest dictionary.

For each key in src:
  • If the key exists in dest and both values are dictionaries, merge them recursively.

  • Otherwise, overwrite or add the key-value pair in dest with a deep copy from src.

This function modifies the dest dictionary in place and also returns it.

Example:
>>> dest = {'a': {'b': 1}, 'c': 2}
>>> src = {'a': {'d': 3}, 'c': 4}
>>> deep_merge_dicts(dest, src)
>>> # dest becomes {'a': {'b': 1, 'd': 3}, 'c': 4}
Parameters:
  • dest (dict[str, Any]) – The destination dictionary to merge into.

  • src (dict[str, Any]) – The source dictionary to merge from.

Return type:

dict[str, Any]

Returns:

The destination dictionary.