PowerSwitchComponentManager Class

class ska_mid_cbf_mcs.power_switch.power_switch_component_manager.PowerSwitchComponentManager(*args: Any, **kwargs: Any)[source]

Bases: CbfComponentManager

A component manager for the power switch. Calls either the power switch driver or the power switch simulator based on the value of simulation mode.

Parameters:
  • simulation_mode – simulation mode identifies if the real power switch driver or the simulator should be used

  • protocol – Connection protocol (HTTP or HTTPS) for the power switch

  • ip – IP address of the power switch

  • login – Login username of the power switch

  • password – Login password for the power switch

  • logger – a logger for this object to use

property num_outlets: int

Get number of outlets present in this power switch.

Returns:

number of outlets

property is_communicating: bool

Returns whether or not the power switch can be communicated with.

Returns:

whether the power switch is communicating

property simulation_mode: SimulationMode

Get the simulation mode of the component manager.

Returns:

simulation mode of the component manager

start_communicating() None[source]

Perform any setup needed for communicating with the power switch.

stop_communicating() None[source]

Stop communication with the component.

get_outlet_power_mode(outlet: str) PowerMode[source]

Get the power mode of a specific outlet.

Parameters:

outlet – outlet ID

Returns:

power mode of the outlet

Raises:

AssertionError – if outlet ID is out of bounds

turn_on_outlet(outlet: str) Tuple[ResultCode, str][source]

Tell the power switch to turn on a specific outlet.

Parameters:

outlet – outlet ID to turn on

Returns:

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

Raises:

AssertionError – if outlet ID is out of bounds

turn_off_outlet(outlet: str) Tuple[ResultCode, str][source]

Tell the power switch to turn off a specific outlet.

Parameters:

outlet – outlet ID to turn off

Returns:

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

Raises:

AssertionError – if outlet ID is out of bounds

get_power_switch_driver(model: str, ip: str, login: str, password: str, logger: Logger)[source]