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: - 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: - 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: - 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: - 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: - 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: - 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: - 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: - 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.SNMPDriverRaritanPDU2(*args, **kwargs)[source]¶
- Bases: - SNMPDriverBase- SNMP driver class for Raritan PDU2 PDUs. - http://support.raritan.com/px2/version-2.4.1/mibs/pdu2-mib-020400-39592.txt http://cdn.raritan.com/download/PX/v1.5.20/PDU-MIB.txt - Command:
- snmpset -v2c -c private -m+PDU2-MIB <pdu IP address> PDU2-MIB::switchingOperation.1.4 = cycle snmpset -v2c -c private <pdu IP address> .1.3.6.1.4.1.13742.6.4.1.2.1.2.1.4 i 2 
- Output:
- PDU2-MIB::switchingOperation.1.4 = INTEGER: cycle(2) 
 - aboveUpperCritical = 6¶
 - aboveUpperWarning = 5¶
 - alarmed = 11¶
 - belowLowerCritical = 2¶
 - belowLowerWarning = 3¶
 - detected = 9¶
 - fail = 14¶
 - inSync = 20¶
 - marginal = 13¶
 - no = 16¶
 - notDetected = 10¶
 - oid_device = (13742, 6, 4, 1, 2, 1)¶
 - oid_power_action = (2,)¶
 - oid_power_status = (3,)¶
 - oid_tower_infeed_idx = (1,)¶
 - ok = 12¶
 - one = 18¶
 - outOfSync = 21¶
 - standby = 17¶
 - status_closed = 1¶
 - status_normal = 4¶
 - status_off = 8¶
 - status_on = 7¶
 - status_open = 0¶
 - two = 19¶
 - value_power_off = 0¶
 - value_power_on = 1¶
 - yes = 15¶
 
- class ironic.drivers.modules.snmp.SNMPDriverServerTechSentry3(*args, **kwargs)[source]¶
- Bases: - SNMPDriverBase- SNMP driver class for Server Technology Sentry 3 PDUs. - ftp://ftp.servertech.com/Pub/SNMP/sentry3/Sentry3.mib - SNMP objects for Server Technology Power PDU. 1.3.6.1.4.1.1718.3.2.3.1.5.1.1.<outlet ID> outletStatus Read 0=off, 1=on, 2=off wait, 3=on wait, […more options follow] 1.3.6.1.4.1.1718.3.2.3.1.11.1.1.<outlet ID> outletControlAction Write 0=no action, 1=on, 2=off, 3=reboot - oid_device = (1718, 3, 2, 3, 1)¶
 - oid_power_action = (11,)¶
 - oid_power_status = (5,)¶
 - oid_tower_infeed_idx = (1, 1)¶
 - status_off = 0¶
 - status_off_wait = 2¶
 - status_on = 1¶
 - status_on_wait = 3¶
 - value_power_off = 2¶
 - value_power_on = 1¶
 
- class ironic.drivers.modules.snmp.SNMPDriverServerTechSentry4(*args, **kwargs)[source]¶
- Bases: - SNMPDriverBase- SNMP driver class for Server Technology Sentry 4 PDUs. - https://www.servertech.com/support/sentry-mib-oid-tree-downloads - SNMP objects for Server Technology Power PDU. 1.3.6.1.4.1.1718.4.1.8.5.1.1<outlet ID> outletStatus notSet (0) fixedOn (1) idleOff (2) idleOn (3) […more options follow] pendOn (8) pendOff (9) off (10) on (11) […more options follow] eventOff (16) eventOn (17) eventReboot (18) eventShutdown (19) 1.3.6.1.4.1.1718.4.1.8.5.1.2.<outlet ID> outletControlAction Write 0=no action, 1=on, 2=off, 3=reboot - fixedOn = 1¶
 - idleOff = 2¶
 - idleOn = 3¶
 - lockedOff = 14¶
 - lockedOn = 15¶
 - notSet = 0¶
 - ocpOff = 6¶
 - ocpOn = 7¶
 - oid_device = (1718, 4, 1, 8, 5, 1)¶
 - oid_power_action = (2,)¶
 - oid_power_status = (1,)¶
 - oid_tower_infeed_idx = (1, 1)¶
 - reboot = 12¶
 - shutdown = 13¶
 - status_off = 10¶
 - status_on = 11¶
 - status_pendOff = 9¶
 - status_pendOn = 8¶
 - value_power_off = 2¶
 - value_power_on = 1¶
 - wakeOff = 4¶
 - wakeOn = 5¶
 
- class ironic.drivers.modules.snmp.SNMPDriverSimple(*args, **kwargs)[source]¶
- Bases: - 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. 
 
- class ironic.drivers.modules.snmp.SNMPDriverTeltronix(*args, **kwargs)[source]¶
- Bases: - 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.SNMPDriverVertivGeistPDU(*args, **kwargs)[source]¶
- Bases: - SNMPDriverBase- SNMP driver class for VertivGeist NU30017L/NU30019L PDU. - https://mibs.observium.org/mib/GEIST-V5-MIB/ - off = 2¶
 - off2on = 4¶
 - oid_device = (21239, 5, 2, 3, 5, 1)¶
 - oid_power_action = (6,)¶
 - oid_power_status = (4,)¶
 - oid_tower_infeed_idx = (1,)¶
 - on = 1¶
 - on2off = 3¶
 - rebootOff = 5¶
 - rebootOn = 5¶
 - value_power_off = 4¶
 - value_power_on = 2¶
 
- class ironic.drivers.modules.snmp.SNMPPower(*args, **kwargs)[source]¶
- Bases: - 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. 
 
 
