From fefbea907f51cbbb490ab2efa896f8f4b1648232 Mon Sep 17 00:00:00 2001 From: Eric MacDonald Date: Tue, 17 Sep 2019 16:13:44 -0400 Subject: [PATCH] Add bmc access method as service parameter This update adds a new service parameter called bmc_access_method to system inventory. With this change the customer can configure the protocol method by which maintenance accesses the BMC. Three options are ipmi, redfish and learn. Test Plan: PASS: Verify service parameter change and handling. PASS: Verify sysinv Tox tests pass Change-Id: I79f872716eba026bc8aaed2da821b887c30c0e46 Story: 2005861 Task: 36668 Signed-off-by: Eric MacDonald --- .../sysinv/sysinv/sysinv/common/constants.py | 2 ++ .../sysinv/sysinv/common/service_parameter.py | 27 +++++++++++++++++++ .../sysinv/sysinv/sysinv/conductor/manager.py | 5 ++++ 3 files changed, 34 insertions(+) diff --git a/sysinv/sysinv/sysinv/sysinv/common/constants.py b/sysinv/sysinv/sysinv/sysinv/common/constants.py index 02432355d0..8a4735b0d5 100644 --- a/sysinv/sysinv/sysinv/sysinv/common/constants.py +++ b/sysinv/sysinv/sysinv/sysinv/common/constants.py @@ -944,6 +944,7 @@ SERVICE_PARAM_PLAT_MTCE_HBS_FAILURE_THRESHOLD = 'heartbeat_failure_threshold' SERVICE_PARAM_PLAT_MTCE_HBS_DEGRADE_THRESHOLD = 'heartbeat_degrade_threshold' SERVICE_PARAM_PLAT_MTCE_MNFA_THRESHOLD = 'mnfa_threshold' SERVICE_PARAM_PLAT_MTCE_MNFA_TIMEOUT = 'mnfa_timeout' +SERVICE_PARAM_PLAT_MTCE_BMC_ACCESS_METHOD = 'bmc_access_method' SERVICE_PARAM_PLAT_MTCE_WORKER_BOOT_TIMEOUT_DEFAULT = 720 SERVICE_PARAM_PLAT_MTCE_CONTROLLER_BOOT_TIMEOUT_DEFAULT = 1200 @@ -953,6 +954,7 @@ SERVICE_PARAM_PLAT_MTCE_HBS_FAILURE_THRESHOLD_DEFAULT = 10 SERVICE_PARAM_PLAT_MTCE_HBS_DEGRADE_THRESHOLD_DEFAULT = 6 SERVICE_PARAM_PLAT_MTCE_MNFA_THRESHOLD_DEFAULT = 2 SERVICE_PARAM_PLAT_MTCE_MNFA_TIMEOUT_DEFAULT = 0 +SERVICE_PARAM_PLAT_MTCE_BMC_ACCESS_METHOD_DEFAULT = 'learn' # default time to live seconds PM_TTL_DEFAULT = 86400 diff --git a/sysinv/sysinv/sysinv/sysinv/common/service_parameter.py b/sysinv/sysinv/sysinv/sysinv/common/service_parameter.py index 84c1e752d2..42859ea58d 100644 --- a/sysinv/sysinv/sysinv/sysinv/common/service_parameter.py +++ b/sysinv/sysinv/sysinv/sysinv/common/service_parameter.py @@ -228,6 +228,25 @@ def _validate_mnfa_timeout(name, value): SERVICE_PARAM_PLAT_MTCE_MNFA_TIMEOUT_MAX) +def _validate_bmc_access_method(name, value): + error = False + try: + if str(value) != SERVICE_PARAM_PLAT_MTCE_BMC_ACCESS_METHOD_LEARN and \ + str(value) != SERVICE_PARAM_PLAT_MTCE_BMC_ACCESS_METHOD_IPMI and \ + str(value) != SERVICE_PARAM_PLAT_MTCE_BMC_ACCESS_METHOD_REDFISH: + error = True + + except ValueError: + error = True + + if error is True: + raise wsme.exc.ClientSideError(_( + "Method must be one of '%s', '%s' or '%s'" % + (SERVICE_PARAM_PLAT_MTCE_BMC_ACCESS_METHOD_LEARN, + SERVICE_PARAM_PLAT_MTCE_BMC_ACCESS_METHOD_IPMI, + SERVICE_PARAM_PLAT_MTCE_BMC_ACCESS_METHOD_REDFISH))) + + def _validate_ipv4(name, value): """Check if router_id value is valid""" if not netaddr.valid_ipv4(value): @@ -340,6 +359,7 @@ PLATFORM_MTCE_PARAMETER_MANDATORY = [ constants.SERVICE_PARAM_PLAT_MTCE_HBS_DEGRADE_THRESHOLD, constants.SERVICE_PARAM_PLAT_MTCE_MNFA_THRESHOLD, constants.SERVICE_PARAM_PLAT_MTCE_MNFA_TIMEOUT, + constants.SERVICE_PARAM_PLAT_MTCE_BMC_ACCESS_METHOD, ] PLATFORM_SYSINV_PARAMETER_PROTECTED = ['firewall_rules_id'] @@ -362,6 +382,10 @@ SERVICE_PARAM_PLAT_MTCE_MNFA_THRESHOLD_MIN = 2 SERVICE_PARAM_PLAT_MTCE_MNFA_THRESHOLD_MAX = 100 SERVICE_PARAM_PLAT_MTCE_MNFA_TIMEOUT_MIN = 100 SERVICE_PARAM_PLAT_MTCE_MNFA_TIMEOUT_MAX = 86400 +SERVICE_PARAM_PLAT_MTCE_BMC_ACCESS_METHOD_LEARN = 'learn' +SERVICE_PARAM_PLAT_MTCE_BMC_ACCESS_METHOD_REDFISH = 'redfish' +SERVICE_PARAM_PLAT_MTCE_BMC_ACCESS_METHOD_IPMI = 'ipmi' + PLATFORM_MTCE_PARAMETER_VALIDATOR = { constants.SERVICE_PARAM_PLAT_MTCE_WORKER_BOOT_TIMEOUT: @@ -380,6 +404,8 @@ PLATFORM_MTCE_PARAMETER_VALIDATOR = { _validate_mnfa_threshold, constants.SERVICE_PARAM_PLAT_MTCE_MNFA_TIMEOUT: _validate_mnfa_timeout, + constants.SERVICE_PARAM_PLAT_MTCE_BMC_ACCESS_METHOD: + _validate_bmc_access_method, } PLATFORM_MTCE_PARAMETER_RESOURCE = { @@ -391,6 +417,7 @@ PLATFORM_MTCE_PARAMETER_RESOURCE = { constants.SERVICE_PARAM_PLAT_MTCE_HBS_DEGRADE_THRESHOLD: 'platform::mtce::params::heartbeat_degrade_threshold', constants.SERVICE_PARAM_PLAT_MTCE_MNFA_THRESHOLD: 'platform::mtce::params::mnfa_threshold', constants.SERVICE_PARAM_PLAT_MTCE_MNFA_TIMEOUT: 'platform::mtce::params::mnfa_timeout', + constants.SERVICE_PARAM_PLAT_MTCE_BMC_ACCESS_METHOD: 'platform::mtce::params::bmc_access_method', } RADOSGW_CONFIG_PARAMETER_MANDATORY = [ diff --git a/sysinv/sysinv/sysinv/sysinv/conductor/manager.py b/sysinv/sysinv/sysinv/sysinv/conductor/manager.py index f113c747df..1fd8902bc4 100644 --- a/sysinv/sysinv/sysinv/sysinv/conductor/manager.py +++ b/sysinv/sysinv/sysinv/sysinv/conductor/manager.py @@ -473,6 +473,11 @@ class ConductorManager(service.PeriodicService): 'name': constants.SERVICE_PARAM_PLAT_MTCE_MNFA_TIMEOUT, 'value': constants.SERVICE_PARAM_PLAT_MTCE_MNFA_TIMEOUT_DEFAULT, }, + {'service': constants.SERVICE_TYPE_PLATFORM, + 'section': constants.SERVICE_PARAM_SECTION_PLATFORM_MAINTENANCE, + 'name': constants.SERVICE_PARAM_PLAT_MTCE_BMC_ACCESS_METHOD, + 'value': constants.SERVICE_PARAM_PLAT_MTCE_BMC_ACCESS_METHOD_DEFAULT, + }, {'service': constants.SERVICE_TYPE_RADOSGW, 'section': constants.SERVICE_PARAM_SECTION_RADOSGW_CONFIG, 'name': constants.SERVICE_PARAM_NAME_RADOSGW_SERVICE_ENABLED,