The 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, community=None, security=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.
get_next(oid)[source]

Use PySNMP to perform an SNMP GET NEXT operation on a table object.

Parameters:oid – The OID of the object to get.
Raises:SNMPFailure if an SNMP request fails.
Returns:A list of values of the requested table object.
set(oid, value)[source]

Use PySNMP to perform an SNMP SET operation on a single object.

Parameters:
  • oid – The OID of the object to set.
  • value – The value of the object to set.
Raises:

SNMPFailure if an SNMP request fails.

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]

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]

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 SNMPDriverAPCMasterSwitch 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]

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

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.

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.
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]

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

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.

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

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 – A 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(*args, **kwargs)[source]

Cycles the power to a node.

Parameters:task – A instance of ironic.manager.task_manager.TaskManager.
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(*args, **kwargs)[source]

Turn the power on or off.

Set the power state of a node.

Parameters:
  • task – A instance of ironic.manager.task_manager.TaskManager.
  • pstate – Either POWER_ON or POWER_OFF from :class: ironic.common.states.
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.

validate(task)[source]

Check that node.driver_info contains the requisite fields.

Raises:MissingParameterValue if required SNMP parameters are missing.
Raises:InvalidParameterValue if SNMP parameters are invalid.