summaryrefslogtreecommitdiff
path: root/ironic/drivers/modules/irmc/common.py
diff options
context:
space:
mode:
authorNaohiro Tamura <naohirot@jp.fujitsu.com>2015-06-26 00:00:42 +0900
committerNaohiro Tamura <naohirot@jp.fujitsu.com>2016-02-12 11:28:38 +0900
commit37590a86338e94845c74e1b1f7d8d6f61003d447 (patch)
tree694653ec31ef5087f78704b33a68ebd6a8b5f473 /ironic/drivers/modules/irmc/common.py
parente668b5e85b0d03b91338638ccef484f4de2f636f (diff)
downloadironic-37590a86338e94845c74e1b1f7d8d6f61003d447.tar.gz
Add hardware inspection module for iRMC driver
This module enables iRMC out-of-band hardware inspection for FUJITSU PRIMERGY bare metal nodes having iRMC S4 and beyond. Change-Id: I8f406a9beb3fd3c01b15f764211ffd18494464f6 Closes-Bug: #1525108
Diffstat (limited to 'ironic/drivers/modules/irmc/common.py')
-rw-r--r--ironic/drivers/modules/irmc/common.py44
1 files changed, 42 insertions, 2 deletions
diff --git a/ironic/drivers/modules/irmc/common.py b/ironic/drivers/modules/irmc/common.py
index 4b95315b2..689c4ce31 100644
--- a/ironic/drivers/modules/irmc/common.py
+++ b/ironic/drivers/modules/irmc/common.py
@@ -15,6 +15,7 @@
"""
Common functionalities shared between different iRMC modules.
"""
+import six
from oslo_config import cfg
from oslo_log import log as logging
@@ -41,6 +42,18 @@ opts = [
default='ipmitool',
help=_('Sensor data retrieval method, either '
'"ipmitool" or "scci"')),
+ cfg.StrOpt('snmp_version',
+ default='v2c',
+ choices=['v1', 'v2c', 'v3'],
+ help=_('SNMP protocol version, either "v1", "v2c" or "v3"')),
+ cfg.PortOpt('snmp_port',
+ default=161,
+ help=_('SNMP port')),
+ cfg.StrOpt('snmp_community',
+ default='public',
+ help=_('SNMP community. Required for versions "v1" and "v2c"')),
+ cfg.StrOpt('snmp_security',
+ help=_('SNMP security name. Required for version "v3"')),
]
CONF = cfg.CONF
@@ -65,6 +78,14 @@ OPTIONAL_PROPERTIES = {
'irmc_sensor_method': _("Sensor data retrieval method; either "
"'ipmitool' or 'scci'. The default value is "
"'ipmitool'. Optional."),
+ 'irmc_snmp_version': _("SNMP protocol version; either 'v1', 'v2c', or "
+ "'v3'. The default value is 'v2c'. Optional."),
+ 'irmc_snmp_port': _("SNMP port. The default is 161. Optional."),
+ 'irmc_snmp_community': _("SNMP community required for versions 'v1' and "
+ "'v2c'. The default value is 'public'. "
+ "Optional."),
+ 'irmc_snmp_security': _("SNMP security name required for version 'v3'. "
+ "Optional."),
}
COMMON_PROPERTIES = REQUIRED_PROPERTIES.copy()
@@ -97,7 +118,7 @@ def parse_driver_info(node):
# corresponding config names don't have 'irmc_' prefix
opt = {param: info.get(param, CONF.irmc.get(param[len('irmc_'):]))
for param in OPTIONAL_PROPERTIES}
- d_info = dict(list(req.items()) + list(opt.items()))
+ d_info = dict(req, **opt)
error_msgs = []
if (d_info['irmc_auth_method'].lower() not in ('basic', 'digest')):
@@ -112,6 +133,25 @@ def parse_driver_info(node):
if d_info['irmc_sensor_method'].lower() not in ('ipmitool', 'scci'):
error_msgs.append(
_("'irmc_sensor_method' has unsupported value."))
+ if d_info['irmc_snmp_version'].lower() not in ('v1', 'v2c', 'v3'):
+ error_msgs.append(
+ _("'irmc_snmp_version' has unsupported value."))
+ if not isinstance(d_info['irmc_snmp_port'], int):
+ error_msgs.append(
+ _("'irmc_snmp_port' is not integer type."))
+ if (d_info['irmc_snmp_version'].lower() in ('v1', 'v2c') and
+ d_info['irmc_snmp_community'] and
+ not isinstance(d_info['irmc_snmp_community'], six.string_types)):
+ error_msgs.append(
+ _("'irmc_snmp_community' is not string type."))
+ if d_info['irmc_snmp_version'].lower() == 'v3':
+ if d_info['irmc_snmp_security']:
+ if not isinstance(d_info['irmc_snmp_security'], six.string_types):
+ error_msgs.append(
+ _("'irmc_snmp_security' is not string type."))
+ else:
+ error_msgs.append(
+ _("'irmc_snmp_security' has to be set for SNMP version 3."))
if error_msgs:
msg = (_("The following type errors were encountered while parsing "
"driver_info:\n%s") % "\n".join(error_msgs))
@@ -145,7 +185,7 @@ def get_irmc_client(node):
def update_ipmi_properties(task):
- """Update ipmi properties to node driver_info
+ """Update ipmi properties to node driver_info.
:param task: A task from TaskManager.
"""