ironic.drivers.modules.snmp module¶
Ironic SNMP power manager.
Provides basic power control using an SNMP-enabled smart power controller. Uses a pluggable driver model to support devices with different SNMP object models.
-
class
ironic.drivers.modules.snmp.
SNMPClient
(address, port, version, read_community=None, write_community=None, user=None, auth_proto=None, auth_key=None, priv_proto=None, priv_key=None, context_engine_id=None, context_name=None)[source]¶ Bases:
object
SNMP client object.
Performs low level SNMP get and set operations. Encapsulates all interaction with PySNMP to simplify dynamic importing and unit testing.
-
get
(oid)[source]¶ Use PySNMP to perform an SNMP GET operation on a single object.
- Parameters
oid – The OID of the object to get.
- Raises
SNMPFailure if an SNMP request fails.
- Returns
The value of the requested object.
-
-
class
ironic.drivers.modules.snmp.
SNMPDriverAPCMasterSwitch
(*args, **kwargs)[source]¶ Bases:
ironic.drivers.modules.snmp.SNMPDriverSimple
SNMP driver class for APC MasterSwitch PDU devices.
SNMP objects for APC SNMPDriverAPCMasterSwitch PDU: 1.3.6.1.4.1.318.1.1.4.4.2.1.3 sPDUOutletCtl Values: 1=On, 2=Off, 3=PowerCycle, […more options follow]
-
oid_device
= (318, 1, 1, 4, 4, 2, 1, 3)¶
-
system_id
= (318, 1, 1, 4)¶
-
value_power_off
= 2¶
-
value_power_on
= 1¶
-
-
class
ironic.drivers.modules.snmp.
SNMPDriverAPCMasterSwitchPlus
(*args, **kwargs)[source]¶ Bases:
ironic.drivers.modules.snmp.SNMPDriverSimple
SNMP driver class for APC MasterSwitchPlus PDU devices.
SNMP objects for APC SNMPDriverAPCMasterSwitchPlus PDU: 1.3.6.1.4.1.318.1.1.6.5.1.1.5 sPDUOutletControlMSPOutletCommand Values: 1=On, 3=Off, […more options follow]
-
oid_device
= (318, 1, 1, 6, 5, 1, 1, 5)¶
-
system_id
= (318, 1, 1, 6)¶
-
value_power_off
= 3¶
-
value_power_on
= 1¶
-
-
class
ironic.drivers.modules.snmp.
SNMPDriverAPCRackPDU
(*args, **kwargs)[source]¶ Bases:
ironic.drivers.modules.snmp.SNMPDriverSimple
SNMP driver class for APC RackPDU devices.
SNMP objects for APC SNMPDriverAPCRackPDU PDU: # 1.3.6.1.4.1.318.1.1.12.3.3.1.1.4 rPDUOutletControlOutletCommand Values: 1=On, 2=Off, 3=PowerCycle, […more options follow]
-
oid_device
= (318, 1, 1, 12, 3, 3, 1, 1, 4)¶
-
system_id
= (318, 1, 1, 12)¶
-
value_power_off
= 2¶
-
value_power_on
= 1¶
-
-
class
ironic.drivers.modules.snmp.
SNMPDriverAten
(*args, **kwargs)[source]¶ Bases:
ironic.drivers.modules.snmp.SNMPDriverSimple
SNMP driver class for Aten PDU devices.
SNMP objects for Aten PDU: 1.3.6.1.4.1.21317.1.3.2.2.2.2 Outlet Power Values: 1=Off, 2=On, 3=Pending, 4=Reset
-
oid_device
= (21317, 1, 3, 2, 2, 2, 2)¶
-
system_id
= (21317,)¶
-
value_power_off
= 1¶
-
value_power_on
= 2¶
-
-
class
ironic.drivers.modules.snmp.
SNMPDriverAuto
(*args, **kwargs)[source]¶ Bases:
ironic.drivers.modules.snmp.SNMPDriverBase
-
SYS_OBJ_OID
= (1, 3, 6, 1, 2, 1, 1, 2)¶
-
-
class
ironic.drivers.modules.snmp.
SNMPDriverBase
(snmp_info)[source]¶ Bases:
object
SNMP power driver base class.
The SNMPDriver class hierarchy implements manufacturer-specific MIB actions over SNMP to interface with different smart power controller products.
-
oid_enterprise
= (1, 3, 6, 1, 4, 1)¶
-
power_off
()[source]¶ Set the power state to this node to OFF.
- Raises
SNMPFailure if an SNMP request fails.
- Returns
power state. One of
ironic.common.states
.
-
power_on
()[source]¶ Set the power state to this node to ON.
- Raises
SNMPFailure if an SNMP request fails.
- Returns
power state. One of
ironic.common.states
.
-
power_reset
()[source]¶ Reset the power to this node.
- Raises
SNMPFailure if an SNMP request fails.
- Returns
power state. One of
ironic.common.states
.
-
power_state
()[source]¶ Returns a node’s current power state.
- Raises
SNMPFailure if an SNMP request fails.
- Returns
power state. One of
ironic.common.states
.
-
retry_interval
= 1¶
-
-
class
ironic.drivers.modules.snmp.
SNMPDriverBaytechMRP27
(*args, **kwargs)[source]¶ Bases:
ironic.drivers.modules.snmp.SNMPDriverSimple
SNMP driver class for Baytech MRP27 PDU devices.
SNMP objects for Baytech MRP27 PDU: 4779, 1, 3, 5, 3, 1, 3, {unit_id} Outlet Power Values: 0=Off, 1=On, 2=Reboot
-
oid_device
= (4779, 1, 3, 5, 3, 1, 3, 1)¶
-
unit_id
= 1¶
-
value_power_off
= 0¶
-
value_power_on
= 1¶
-
-
class
ironic.drivers.modules.snmp.
SNMPDriverCyberPower
(*args, **kwargs)[source]¶ Bases:
ironic.drivers.modules.snmp.SNMPDriverSimple
SNMP driver class for CyberPower PDU devices.
SNMP objects for CyberPower PDU: 1.3.6.1.4.1.3808.1.1.3.3.3.1.1.4 ePDUOutletControlOutletCommand Values: 1=On, 2=Off, 3=PowerCycle, […more options follow]
-
oid_device
= (3808, 1, 1, 3, 3, 3, 1, 1, 4)¶
-
system_id
= (3808,)¶
-
value_power_off
= 2¶
-
value_power_on
= 1¶
-
-
class
ironic.drivers.modules.snmp.
SNMPDriverEatonPower
(*args, **kwargs)[source]¶ Bases:
ironic.drivers.modules.snmp.SNMPDriverBase
SNMP driver class for Eaton Power PDU.
The Eaton power PDU does not follow the model of SNMPDriverSimple as it uses multiple SNMP objects.
SNMP objects for Eaton Power PDU 1.3.6.1.4.1.534.6.6.7.6.6.1.2.<outlet ID> outletControlStatus Read 0=off, 1=on, 2=pending off, 3=pending on 1.3.6.1.4.1.534.6.6.7.6.6.1.3.<outlet ID> outletControlOffCmd Write 0 for immediate power off 1.3.6.1.4.1.534.6.6.7.6.6.1.4.<outlet ID> outletControlOnCmd Write 0 for immediate power on
-
oid_device
= (534, 6, 6, 7, 6, 6, 1)¶
-
oid_poweroff
= (4,)¶
-
oid_poweron
= (3,)¶
-
oid_status
= (2,)¶
-
status_off
= 0¶
-
status_on
= 1¶
-
status_pending_off
= 2¶
-
status_pending_on
= 3¶
-
system_id
= (534,)¶
-
value_power_off
= 0¶
-
value_power_on
= 0¶
-
-
class
ironic.drivers.modules.snmp.
SNMPDriverSimple
(*args, **kwargs)[source]¶ Bases:
ironic.drivers.modules.snmp.SNMPDriverBase
SNMP driver base class for simple PDU devices.
Here, simple refers to devices which provide a single SNMP object for controlling the power state of an outlet.
The default OID of the power state object is of the form <enterprise OID>.<device OID>.<outlet ID>. A different OID may be specified by overriding the _snmp_oid method in a subclass.
-
abstract property
oid_device
¶ Device dependent portion of the power state object OID.
-
abstract property
value_power_off
¶ Value representing power off state.
-
abstract property
value_power_on
¶ Value representing power on state.
-
abstract property
-
class
ironic.drivers.modules.snmp.
SNMPDriverTeltronix
(*args, **kwargs)[source]¶ Bases:
ironic.drivers.modules.snmp.SNMPDriverSimple
SNMP driver class for Teltronix PDU devices.
SNMP objects for Teltronix PDU: 1.3.6.1.4.1.23620.1.2.2.1.4 Outlet Power Values: 1=Off, 2=On
-
oid_device
= (23620, 1, 2, 2, 1, 4)¶
-
system_id
= (23620,)¶
-
value_power_off
= 1¶
-
value_power_on
= 2¶
-
-
class
ironic.drivers.modules.snmp.
SNMPPower
[source]¶ Bases:
ironic.drivers.base.PowerInterface
SNMP Power Interface.
This PowerInterface class provides a mechanism for controlling the power state of a physical device using an SNMP-enabled smart power controller.
-
get_power_state
(task)[source]¶ Get the current power state.
Poll the SNMP device for the current power state of the node.
- Parameters
task – An instance of ironic.manager.task_manager.TaskManager.
- Raises
MissingParameterValue if required SNMP parameters are missing.
- Raises
InvalidParameterValue if SNMP parameters are invalid.
- Raises
SNMPFailure if an SNMP request fails.
- Returns
power state. One of
ironic.common.states
.
-
get_properties
()[source]¶ Return the properties of the interface.
- Returns
dictionary of <property name>:<property description> entries.
-
reboot
(task, timeout=None)[source]¶ Cycles the power to a node.
- Parameters
task – An instance of ironic.manager.task_manager.TaskManager.
timeout – timeout (in seconds). Unsupported by this interface.
- Raises
MissingParameterValue if required SNMP parameters are missing.
- Raises
InvalidParameterValue if SNMP parameters are invalid.
- Raises
PowerStateFailure if the final power state of the node is not POWER_ON after the timeout.
- Raises
SNMPFailure if an SNMP request fails.
-
set_power_state
(task, pstate, timeout=None)[source]¶ Turn the power on or off.
Set the power state of a node.
- Parameters
task – An instance of ironic.manager.task_manager.TaskManager.
pstate – Either POWER_ON or POWER_OFF from :class: ironic.common.states.
timeout – timeout (in seconds). Unsupported by this interface.
- Raises
MissingParameterValue if required SNMP parameters are missing.
- Raises
InvalidParameterValue if SNMP parameters are invalid or pstate is invalid.
- Raises
PowerStateFailure if the final power state of the node is not as requested after the timeout.
- Raises
SNMPFailure if an SNMP request fails.
-