-
Notifications
You must be signed in to change notification settings - Fork 2
Core Framework: Power Control
This section details the powerControlClass
, a Python class within the framework that provides a standardized way to manage the power state of devices connected to your testing rack. This class abstracts the complexities of different power switch hardware, offering a simple interface for controlling power on, power off, and reboot operations.
The powerControlClass
supports a variety of power switches commonly used in testing environments:
-
orvbioS20
: A network-controlled relay board. -
kasa
: TP-Link Kasa smart plugs and power strips. -
hs100
: TP-Link HS100 smart plugs (also supported by Kasa). -
apc
: APC network-managed power distribution units (PDUs). -
olimex
: Olimex relay boards. -
SLP
: Sentry Power Manager (SPM) with Serial-over-LAN (SLP) interface. -
none
: For testing or simulating power control without actual hardware.
The power control configuration is defined within your rack configuration file (e.g., example_rack_config.yml
). Each device slot in your rack can be associated with a specific power switch and its settings.
Example Configuration (from example_rack_config.yml
):
slot1:
device: "broadcom-stb"
powerSwitch: # Specific power switch for each slot
type: "HS100"
ip: "192.168.1.7"
port: 9999
This configuration specifies that the device in slot1
is connected to an HS100 smart plug with the IP address "192.168.1.7".
Configuration Parameters:
Each power switch type requires specific parameters:
-
orvbioS20
:ip
,mac
, and optionallyport
andrelay
. -
kasa
:ip
andoptions
. Use--plug
for single plugs and--strip
with--index
for power strips. -
hs100
:ip
and optionallyport
. -
apc
:ip
,username
, andpassword
. -
olimex
:ip
,relay
, and optionallyport
. -
SLP
:ip
,username
,password
,outlet_id
, and optionallyport
.
The framework typically handles the instantiation of the powerControlClass
based on your rack configuration. You usually interact with its methods through other parts of the framework.
Available Methods:
-
powerOn()
: Powers on the device. -
powerOff()
: Powers off the device. -
reboot()
: Performs a power cycle (off then on).
These methods return True
if the operation is successful and False
otherwise.
The powerControlClass
incorporates error handling with retries to increase the reliability of power operations. It also uses the framework's logging mechanism to record events and errors, aiding in debugging and monitoring.
- Ensure your rack configuration file accurately reflects your hardware setup and power switch connections.
- Consult the documentation for individual power switch modules for detailed information and troubleshooting.
- This section assumes familiarity with the overall framework and its configuration. Refer to other sections for foundational knowledge.