PowerSwitchDriver

class ska_mid_cbf_tdc_mcs.power_switch.apc_pdu_driver.ApcPduDriver(ip: str, login: str, password: str, logger: Logger)[source]

Bases: object

A driver for the APC AP8681 PDU. The PDU is controlled by a command line interface through SSH. Valid outlet IDs are 1 to 24.

Parameters:
  • 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

initialize() None[source]

Initializes any variables needed for further communication with the power switch. Should be called once before any of the other methods.

stop() None[source]

Stops communicating with the PDU and cleans up.

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

get_outlet_list() list[ska_mid_cbf_tdc_mcs.power_switch.pdu_common.Outlet][source]

Query the power switch for a list of outlets and get their name and current state.

Returns:

list of all the outlets available in this power switch, or an empty list if there was an error.

get_outlet_power_state(outlet: str) PowerState[source]

Get the power state of a specific outlet.

Parameters:

outlet – outlet ID (“all” is not supported)

Returns:

power state of the outlet

Raises:
turn_on_outlet(outlet: str) tuple[ska_control_model.result_code.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[ska_control_model.result_code.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

class ska_mid_cbf_tdc_mcs.power_switch.apc_snmp_driver.ApcSnmpDriver(ip: str, login: str, password: str, logger: Logger)[source]

Bases: object

A driver for the APC power switch. The PDU provides an interface through SNMP. Valid outlet IDs are 1 to 24.

Parameters:
  • 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

power_switch_outlets = 24
query_timeout_s = 6

Timeout in seconds used when waiting for a reply from the power switch

initialize() None[source]

Initializes any variables needed for further communication with the power switch. Should be called once before any of the other methods.

stop() None[source]

Stops communicating with the PDU and cleans up.

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

get_outlet_power_state(outlet: str) PowerState[source]

Get the power state of a specific outlet.

Parameters:

outlet – outlet ID

Returns:

power state of the outlet

Raises:
turn_on_outlet(outlet: str) tuple[ska_control_model.result_code.ResultCode, str][source]

Tell the APC power switch to turn on a specific outlet via SNMP.

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[ska_control_model.result_code.ResultCode, str][source]

Tell the APC power switch to turn off a specific outlet via SNMP.

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_outlet_list() list[ska_mid_cbf_tdc_mcs.power_switch.pdu_common.Outlet][source]

Query the power switch for a list of outlets and get their name and current state.

Returns:

list of all the outlets available in this power switch, or an empty list if there was an error.

class ska_mid_cbf_tdc_mcs.power_switch.dli_pro_switch_driver.DLIProSwitchDriver(ip: str, login: str, password: str, logger: Logger)[source]

Bases: object

A driver for the DLI web power switch. The PDU provides a restapi through http. Valid outlet IDs are 0 to 7.

Parameters:
  • 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

power_switch_outlets = 8
query_timeout_s = 6

Timeout in seconds used when waiting for a reply from the power switch

initialize() None[source]

Initializes any variables needed for further communication with the power switch. Should be called once before any of the other methods.

stop() None[source]

Stops communicating with the PDU and cleans up.

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

get_outlet_power_state(outlet: str) PowerState[source]

Get the power state of a specific outlet.

Parameters:

outlet – outlet ID

Returns:

power state of the outlet

Raises:

AssertionError – if outlet ID is out of bounds

turn_on_outlet(outlet: str) tuple[ska_control_model.result_code.ResultCode, str][source]

Tell the DLI 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[ska_control_model.result_code.ResultCode, str][source]

Tell the DLI 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_outlet_list() list[ska_mid_cbf_tdc_mcs.power_switch.pdu_common.Outlet][source]

Query the power switch for a list of outlets and get their name and current state.

Returns:

list of all the outlets available in this power switch, or an empty list if there was an error

class ska_mid_cbf_tdc_mcs.power_switch.st_switched_pro2_driver.STSwitchedPRO2Driver(ip: str, login: str, password: str, logger: Logger)[source]

Bases: object

A driver for the Server Technology Switched PRO2 PDU. The PDU provides a restapi through https. Valid outlet IDs are AA1 to AA48

Parameters:
  • 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

query_timeout_s = 6

Timeout in seconds used when waiting for a reply from the power switch

initialize() None[source]

Initializes any variables needed for further communication with the power switch. Should be called once before any of the other methods.

stop() None[source]

Stops communicating with the PDU and cleans up.

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

get_outlet_power_state(outlet: str) PowerState[source]

Get the power state of a specific outlet.

Parameters:

outlet – outlet ID

Returns:

power state of the outlet

Raises:
turn_on_outlet(outlet: str) tuple[ska_control_model.result_code.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[ska_control_model.result_code.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_outlet_list() list[ska_mid_cbf_tdc_mcs.power_switch.pdu_common.Outlet][source]

Query the power switch for a list of outlets and get their name and current state.

Returns:

list of all the outlets available in this power switch, or an empty list if there was an error