Migrate constants to enums
Following sushy change at Ic950a35bb9fc603e5c4b943ac19dba982bdf7212 Change-Id: Id5424ec2742b7fdd1c96185ee0164468a4c0768e
This commit is contained in:
parent
1d40392814
commit
48e17f3c40
@ -4,4 +4,4 @@
|
|||||||
|
|
||||||
pbr!=2.1.0,>=2.0.0 # Apache-2.0
|
pbr!=2.1.0,>=2.0.0 # Apache-2.0
|
||||||
python-dateutil>=2.7.0 # BSD
|
python-dateutil>=2.7.0 # BSD
|
||||||
sushy>=3.11.0 # Apache-2.0
|
sushy>=4.0.0 # Apache-2.0
|
||||||
|
@ -12,102 +12,149 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
# export system config action constants
|
import enum
|
||||||
|
|
||||||
EXPORT_TARGET_ALL = 'all'
|
|
||||||
"""Export entire system configuration"""
|
|
||||||
|
|
||||||
EXPORT_TARGET_BIOS = 'BIOS'
|
|
||||||
"""Export BIOS related configuration"""
|
|
||||||
|
|
||||||
EXPORT_TARGET_IDRAC = 'iDRAC'
|
|
||||||
"""Export IDRAC related configuration"""
|
|
||||||
|
|
||||||
EXPORT_TARGET_NIC = 'NIC'
|
|
||||||
"""Export NIC related configuration"""
|
|
||||||
|
|
||||||
EXPORT_TARGET_RAID = 'RAID'
|
|
||||||
"""Export RAID related configuration"""
|
|
||||||
|
|
||||||
# iDRAC Reset action constants
|
|
||||||
|
|
||||||
|
|
||||||
RESET_IDRAC_GRACEFUL_RESTART = 'graceful restart'
|
class ExportTarget(enum.Enum):
|
||||||
"""Perform a graceful shutdown followed by a restart of the system"""
|
"""Export system config action constants"""
|
||||||
|
|
||||||
RESET_IDRAC_FORCE_RESTART = 'force restart'
|
ALL = 'ALL'
|
||||||
"""Perform an immediate (non-graceful) shutdown, followed by a restart"""
|
"""Export entire system configuration"""
|
||||||
|
|
||||||
# ImportSystemConfiguration ShutdownType values
|
BIOS = 'BIOS'
|
||||||
IMPORT_SHUTDOWN_GRACEFUL = 'graceful shutdown'
|
"""Export BIOS related configuration"""
|
||||||
"""Graceful shutdown for Import System Configuration
|
|
||||||
|
|
||||||
Will wait for the host up to 5 minutes to shut down before timing out. The
|
IDRAC = 'IDRAC'
|
||||||
operating system can potentially deny or ignore the graceful shutdown request.
|
"""Export iDRAC related configuration"""
|
||||||
"""
|
|
||||||
|
|
||||||
IMPORT_SHUTDOWN_FORCED = 'forced shutdown'
|
NIC = 'NIC'
|
||||||
"""Forced shutdown for Import System Configuration
|
"""Export NIC related configuration"""
|
||||||
|
|
||||||
The host server will be powered off immediately. Should be used when it is safe
|
RAID = 'RAID'
|
||||||
to power down the host.
|
"""Export RAID related configuration"""
|
||||||
"""
|
|
||||||
|
|
||||||
IMPORT_SHUTDOWN_NO_REBOOT = 'no shutdown'
|
|
||||||
"""No reboot for Import System Configuration
|
|
||||||
|
|
||||||
No shutdown performed. Explicit reboot is necessary to apply changes.
|
# Backward compatibility
|
||||||
"""
|
EXPORT_TARGET_ALL = ExportTarget.ALL
|
||||||
|
EXPORT_TARGET_BIOS = ExportTarget.BIOS
|
||||||
|
EXPORT_TARGET_IDRAC = ExportTarget.IDRAC
|
||||||
|
EXPORT_TARGET_NIC = ExportTarget.NIC
|
||||||
|
EXPORT_TARGET_RAID = ExportTarget.RAID
|
||||||
|
|
||||||
# ExportUse in ExportSystemConfiguration
|
|
||||||
EXPORT_USE_DEFAULT = 'Default'
|
|
||||||
"""Default export type
|
|
||||||
|
|
||||||
Leaves some attributes commented out and requires user to enable them before
|
class ResetType(enum.Enum):
|
||||||
they can be applied during import.
|
"""iDRAC Reset reset type constants"""
|
||||||
"""
|
|
||||||
|
|
||||||
EXPORT_USE_CLONE = 'Clone'
|
GRACEFUL = 'Graceful'
|
||||||
"""Clone export type suitable for cloning a 'golden' configuration.
|
"""Perform a graceful shutdown followed by a restart of the system"""
|
||||||
|
|
||||||
Compared to Default export type, more attributes are enabled and
|
FORCE = 'Force'
|
||||||
storage settings adjusted to aid in cloning process.
|
"""Perform an immediate (non-graceful) shutdown, followed by a restart"""
|
||||||
"""
|
|
||||||
|
|
||||||
EXPORT_USE_REPLACE = 'Replace'
|
|
||||||
"""Replace export type suited for retiring or replacing complete configuration.
|
|
||||||
|
|
||||||
Compared to Clone export type, most attributes are enabled and storage settings
|
# Backward compatibility
|
||||||
adjusted to aid in the replace process.
|
RESET_IDRAC_GRACEFUL_RESTART = ResetType.GRACEFUL
|
||||||
"""
|
RESET_IDRAC_FORCE_RESTART = ResetType.FORCE
|
||||||
|
|
||||||
# IncludeInExport in ExportSystemConfiguration
|
|
||||||
INCLUDE_EXPORT_DEFAULT = 'Default'
|
|
||||||
"""Default for what to include in export.
|
|
||||||
|
|
||||||
Does not include read-only attributes, and depending on Export Use, passwords
|
class ShutdownType(enum.Enum):
|
||||||
are marked as ****** (for Default) or are set to default password values (for
|
"""ImportSystemConfiguration ShutdownType values"""
|
||||||
Clone and Replace).
|
|
||||||
"""
|
|
||||||
|
|
||||||
INCLUDE_EXPORT_READ_ONLY = 'Include read only attributes'
|
GRACEFUL = 'Graceful'
|
||||||
"""Includes read-only attributes.
|
"""Graceful shutdown for Import System Configuration
|
||||||
|
|
||||||
In addition to values included by Default option, this also includes read-only
|
Will wait for the host up to 5 minutes to shut down before timing out. The
|
||||||
attributes that cannot be changed via Import and are provided for informational
|
operating system can potentially deny or ignore the graceful shutdown
|
||||||
purposes only.
|
request.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
INCLUDE_EXPORT_PASSWORD_HASHES = 'Include password hash values'
|
FORCED = 'Forced'
|
||||||
"""Include password hashes.
|
"""Forced shutdown for Import System Configuration
|
||||||
|
|
||||||
When using Clone or Replace, include password hashes, instead of default
|
The host server will be powered off immediately. Should be used when it is
|
||||||
password. Can be used to replicate passwords across systems.
|
safe to power down the host.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
INCLUDE_EXPORT_READ_ONLY_PASSWORD_HASHES = ('Include read only attributes and '
|
NO_REBOOT = 'NoReboot'
|
||||||
'password hash values')
|
"""No reboot for Import System Configuration
|
||||||
"""Includes both read-only attributes and password hashes.
|
|
||||||
|
|
||||||
INCLUDE_EXPORT_READ_ONLY and INCLUDE_EXPORT_PASSWORD_HASHES combined
|
No shutdown performed. Explicit reboot is necessary to apply changes.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
# Backward compatibility
|
||||||
|
IMPORT_SHUTDOWN_GRACEFUL = ShutdownType.GRACEFUL
|
||||||
|
IMPORT_SHUTDOWN_FORCED = ShutdownType.FORCED
|
||||||
|
IMPORT_SHUTDOWN_NO_REBOOT = ShutdownType.NO_REBOOT
|
||||||
|
|
||||||
|
|
||||||
|
class ExportUse(enum.Enum):
|
||||||
|
"""ExportUse in ExportSystemConfiguration"""
|
||||||
|
|
||||||
|
DEFAULT = 'Default'
|
||||||
|
"""Default export type
|
||||||
|
|
||||||
|
Leaves some attributes commented out and requires user to enable them
|
||||||
|
before they can be applied during import.
|
||||||
|
"""
|
||||||
|
|
||||||
|
CLONE = 'Clone'
|
||||||
|
"""Clone export type suitable for cloning a 'golden' configuration.
|
||||||
|
|
||||||
|
Compared to Default export type, more attributes are enabled and
|
||||||
|
storage settings adjusted to aid in cloning process.
|
||||||
|
"""
|
||||||
|
|
||||||
|
REPLACE = 'Replace'
|
||||||
|
"""Replace export type suited for replacing complete configuration.
|
||||||
|
|
||||||
|
Compared to Clone export type, most attributes are enabled and storage
|
||||||
|
settings adjusted to aid in the replace process.
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
# Backward compatibility
|
||||||
|
EXPORT_USE_DEFAULT = ExportUse.DEFAULT
|
||||||
|
EXPORT_USE_CLONE = ExportUse.CLONE
|
||||||
|
EXPORT_USE_REPLACE = ExportUse.REPLACE
|
||||||
|
|
||||||
|
|
||||||
|
class IncludeInExport(enum.Enum):
|
||||||
|
"""IncludeInExport in ExportSystemConfiguration"""
|
||||||
|
|
||||||
|
DEFAULT = 'Default'
|
||||||
|
"""Default for what to include in export.
|
||||||
|
|
||||||
|
Does not include read-only attributes, and depending on Export Use,
|
||||||
|
passwords are marked as ****** (for Default) or are set to default password
|
||||||
|
values (for Clone and Replace).
|
||||||
|
"""
|
||||||
|
|
||||||
|
READ_ONLY = 'IncludeReadOnly'
|
||||||
|
"""Includes read-only attributes.
|
||||||
|
|
||||||
|
In addition to values included by Default option, this also includes
|
||||||
|
read-only attributes that cannot be changed via Import and are provided for
|
||||||
|
informational purposes only.
|
||||||
|
"""
|
||||||
|
|
||||||
|
PASSWORD_HASHES = 'IncludePasswordHashValues'
|
||||||
|
"""Include password hashes.
|
||||||
|
|
||||||
|
When using Clone or Replace, include password hashes, instead of default
|
||||||
|
password. Can be used to replicate passwords across systems.
|
||||||
|
"""
|
||||||
|
|
||||||
|
READ_ONLY_PASSWORD_HASHES = ('IncludeReadOnly,IncludePasswordHashValues')
|
||||||
|
"""Includes both read-only attributes and password hashes.
|
||||||
|
|
||||||
|
INCLUDE_EXPORT_READ_ONLY and INCLUDE_EXPORT_PASSWORD_HASHES combined
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
# Backward compatibility
|
||||||
|
INCLUDE_EXPORT_DEFAULT = IncludeInExport.DEFAULT
|
||||||
|
INCLUDE_EXPORT_READ_ONLY = IncludeInExport.READ_ONLY
|
||||||
|
INCLUDE_EXPORT_PASSWORD_HASHES = IncludeInExport.PASSWORD_HASHES
|
||||||
|
INCLUDE_EXPORT_READ_ONLY_PASSWORD_HASHES =\
|
||||||
|
IncludeInExport.READ_ONLY_PASSWORD_HASHES
|
||||||
|
@ -18,7 +18,6 @@ from sushy import exceptions
|
|||||||
from sushy.resources import base
|
from sushy.resources import base
|
||||||
|
|
||||||
from sushy_oem_idrac.resources.manager import constants as mgr_cons
|
from sushy_oem_idrac.resources.manager import constants as mgr_cons
|
||||||
from sushy_oem_idrac.resources.manager import mappings as mgr_maps
|
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -62,24 +61,22 @@ class DelliDRACCardService(base.ResourceBase):
|
|||||||
if not reset_action.allowed_values:
|
if not reset_action.allowed_values:
|
||||||
LOG.warning('Could not figure out the allowed values for the '
|
LOG.warning('Could not figure out the allowed values for the '
|
||||||
'reset idrac action for %s', self.identity)
|
'reset idrac action for %s', self.identity)
|
||||||
return set(mgr_maps.RESET_IDRAC_VALUE_MAP_REV)
|
return set(mgr_cons.ResetType)
|
||||||
|
|
||||||
return set([mgr_maps.RESET_IDRAC_VALUE_MAP[value] for value in
|
return {v for v in mgr_cons.ResetType
|
||||||
set(mgr_maps.RESET_IDRAC_VALUE_MAP).
|
if v.value in reset_action.allowed_values}
|
||||||
intersection(reset_action.allowed_values)])
|
|
||||||
|
|
||||||
def reset_idrac(self):
|
def reset_idrac(self):
|
||||||
"""Reset the iDRAC.
|
"""Reset the iDRAC.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
reset_type = mgr_cons.RESET_IDRAC_GRACEFUL_RESTART
|
reset_type = mgr_cons.ResetType.GRACEFUL
|
||||||
valid_resets = self.get_allowed_reset_idrac_values()
|
valid_resets = self.get_allowed_reset_idrac_values()
|
||||||
if reset_type not in valid_resets:
|
if reset_type not in valid_resets:
|
||||||
raise exceptions.InvalidParameterValueError(
|
raise exceptions.InvalidParameterValueError(
|
||||||
parameter='value', value=reset_type, valid_values=valid_resets)
|
parameter='value', value=reset_type, valid_values=valid_resets)
|
||||||
reset_type = mgr_maps.RESET_IDRAC_VALUE_MAP_REV[reset_type]
|
|
||||||
target_uri = self._actions.reset_idrac.target_uri
|
target_uri = self._actions.reset_idrac.target_uri
|
||||||
payload = {"Force": reset_type}
|
payload = {"Force": reset_type.value}
|
||||||
LOG.debug('Resetting the iDRAC %s ...', self.identity)
|
LOG.debug('Resetting the iDRAC %s ...', self.identity)
|
||||||
self._conn.post(target_uri, data=payload)
|
self._conn.post(target_uri, data=payload)
|
||||||
LOG.info('The iDRAC %s is being reset', self.identity)
|
LOG.info('The iDRAC %s is being reset', self.identity)
|
||||||
|
@ -32,7 +32,6 @@ from sushy_oem_idrac.resources.manager import idrac_card_service
|
|||||||
from sushy_oem_idrac.resources.manager import job_collection
|
from sushy_oem_idrac.resources.manager import job_collection
|
||||||
from sushy_oem_idrac.resources.manager import job_service
|
from sushy_oem_idrac.resources.manager import job_service
|
||||||
from sushy_oem_idrac.resources.manager import lifecycle_service
|
from sushy_oem_idrac.resources.manager import lifecycle_service
|
||||||
from sushy_oem_idrac.resources.manager import mappings as mgr_maps
|
|
||||||
from sushy_oem_idrac import utils
|
from sushy_oem_idrac import utils
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
@ -289,11 +288,9 @@ VFDD\
|
|||||||
LOG.warning('Could not figure out the allowed values for the '
|
LOG.warning('Could not figure out the allowed values for the '
|
||||||
'target of export system configuration at %s',
|
'target of export system configuration at %s',
|
||||||
self.path)
|
self.path)
|
||||||
return set(mgr_maps.EXPORT_CONFIG_VALUE_MAP_REV)
|
return set(mgr_cons.ExportTarget)
|
||||||
|
|
||||||
return set([mgr_maps.EXPORT_CONFIG_VALUE_MAP[value] for value in
|
return {v for v in mgr_cons.ExportTarget if v.value in allowed_values}
|
||||||
set(mgr_maps.EXPORT_CONFIG_VALUE_MAP).
|
|
||||||
intersection(allowed_values)])
|
|
||||||
|
|
||||||
def get_allowed_export_use_values(self):
|
def get_allowed_export_use_values(self):
|
||||||
"""Get allowed export use values of export system configuration.
|
"""Get allowed export use values of export system configuration.
|
||||||
@ -307,11 +304,9 @@ VFDD\
|
|||||||
LOG.warning('Could not figure out the allowed values for the '
|
LOG.warning('Could not figure out the allowed values for the '
|
||||||
'export use of export system configuration at %s',
|
'export use of export system configuration at %s',
|
||||||
self.path)
|
self.path)
|
||||||
return set(mgr_maps.EXPORT_USE_VALUE_MAP_REV)
|
return set(mgr_cons.ExportUse)
|
||||||
|
|
||||||
return set([mgr_maps.EXPORT_USE_VALUE_MAP[value] for value in
|
return {v for v in mgr_cons.ExportUse if v.value in allowed_values}
|
||||||
set(mgr_maps.EXPORT_USE_VALUE_MAP).
|
|
||||||
intersection(allowed_values)])
|
|
||||||
|
|
||||||
def get_allowed_include_in_export_values(self):
|
def get_allowed_include_in_export_values(self):
|
||||||
"""Get allowed include in export values of export system configuration.
|
"""Get allowed include in export values of export system configuration.
|
||||||
@ -325,15 +320,14 @@ VFDD\
|
|||||||
LOG.warning('Could not figure out the allowed values for the '
|
LOG.warning('Could not figure out the allowed values for the '
|
||||||
'include in export of export system configuration at '
|
'include in export of export system configuration at '
|
||||||
'%s', self.path)
|
'%s', self.path)
|
||||||
return set(mgr_maps.INCLUDE_EXPORT_VALUE_MAP_REV)
|
return set(mgr_cons.IncludeInExport)
|
||||||
|
|
||||||
return set([mgr_maps.INCLUDE_EXPORT_VALUE_MAP[value] for value
|
return {v for v in mgr_cons.IncludeInExport
|
||||||
in set(mgr_maps.INCLUDE_EXPORT_VALUE_MAP).
|
if v.value in allowed_values}
|
||||||
intersection(allowed_values)])
|
|
||||||
|
|
||||||
def _export_system_configuration(
|
def _export_system_configuration(
|
||||||
self, target, export_use=mgr_cons.EXPORT_USE_DEFAULT,
|
self, target, export_use=mgr_cons.ExportUse.DEFAULT,
|
||||||
include_in_export=mgr_cons.INCLUDE_EXPORT_DEFAULT):
|
include_in_export=mgr_cons.IncludeInExport.DEFAULT):
|
||||||
"""Export system configuration.
|
"""Export system configuration.
|
||||||
|
|
||||||
It exports system configuration for specified target like NIC, BIOS,
|
It exports system configuration for specified target like NIC, BIOS,
|
||||||
@ -371,26 +365,25 @@ VFDD\
|
|||||||
# Older iDRACs used to include comma separated option in
|
# Older iDRACs used to include comma separated option in
|
||||||
# AllowableValues but got removed in newer versions violating
|
# AllowableValues but got removed in newer versions violating
|
||||||
# AllowableValues validation logic.
|
# AllowableValues validation logic.
|
||||||
include_in_export_rev =\
|
|
||||||
mgr_maps.INCLUDE_EXPORT_VALUE_MAP_REV.get(include_in_export)
|
|
||||||
all_items_valid = False
|
|
||||||
if include_in_export_rev is not None:
|
|
||||||
items = include_in_export_rev.split(',')
|
|
||||||
all_items_valid = True
|
all_items_valid = True
|
||||||
|
if not isinstance(include_in_export, mgr_cons.IncludeInExport):
|
||||||
|
all_items_valid = False
|
||||||
|
else:
|
||||||
|
items = include_in_export.value.split(',')
|
||||||
for item in items:
|
for item in items:
|
||||||
if (mgr_maps.INCLUDE_EXPORT_VALUE_MAP[item]
|
if (mgr_cons.IncludeInExport(item)
|
||||||
not in allowed_include_in_export):
|
not in allowed_include_in_export):
|
||||||
all_items_valid = False
|
all_items_valid = False
|
||||||
break
|
break
|
||||||
|
|
||||||
if not all_items_valid:
|
if not all_items_valid:
|
||||||
raise sushy.exceptions.InvalidParameterValueError(
|
raise sushy.exceptions.InvalidParameterValueError(
|
||||||
parameter='include_in_export', value=include_in_export,
|
parameter='include_in_export', value=include_in_export,
|
||||||
valid_values=allowed_include_in_export)
|
valid_values=allowed_include_in_export)
|
||||||
|
|
||||||
target = mgr_maps.EXPORT_CONFIG_VALUE_MAP_REV[target]
|
target = mgr_cons.ExportTarget(target).value
|
||||||
export_use = mgr_maps.EXPORT_USE_VALUE_MAP_REV[export_use]
|
export_use = mgr_cons.ExportUse(export_use).value
|
||||||
include_in_export =\
|
include_in_export = mgr_cons.IncludeInExport(include_in_export).value
|
||||||
mgr_maps.INCLUDE_EXPORT_VALUE_MAP_REV[include_in_export]
|
|
||||||
|
|
||||||
action_data = {
|
action_data = {
|
||||||
'ShareParameters': {
|
'ShareParameters': {
|
||||||
@ -433,11 +426,11 @@ VFDD\
|
|||||||
:raises: ExtensionError on failure to perform requested
|
:raises: ExtensionError on failure to perform requested
|
||||||
operation
|
operation
|
||||||
"""
|
"""
|
||||||
include_in_export = mgr_cons.INCLUDE_EXPORT_READ_ONLY_PASSWORD_HASHES
|
|
||||||
|
|
||||||
|
include_in_export = mgr_cons.IncludeInExport.READ_ONLY_PASSWORD_HASHES
|
||||||
response = self._export_system_configuration(
|
response = self._export_system_configuration(
|
||||||
mgr_cons.EXPORT_TARGET_ALL,
|
mgr_cons.ExportTarget.ALL,
|
||||||
export_use=mgr_cons.EXPORT_USE_CLONE,
|
export_use=mgr_cons.ExportUse.CLONE,
|
||||||
include_in_export=include_in_export)
|
include_in_export=include_in_export)
|
||||||
|
|
||||||
if (response.status_code == _RESPONSE_OK_CODE
|
if (response.status_code == _RESPONSE_OK_CODE
|
||||||
@ -466,7 +459,7 @@ VFDD\
|
|||||||
pxe_port_macs = []
|
pxe_port_macs = []
|
||||||
# Get NIC configuration
|
# Get NIC configuration
|
||||||
nic_settings = self._export_system_configuration(
|
nic_settings = self._export_system_configuration(
|
||||||
target=mgr_cons.EXPORT_TARGET_NIC)
|
target=mgr_cons.ExportTarget.NIC)
|
||||||
|
|
||||||
if nic_settings.status_code != _RESPONSE_OK_CODE:
|
if nic_settings.status_code != _RESPONSE_OK_CODE:
|
||||||
error = (('An error occurred when attempting to export '
|
error = (('An error occurred when attempting to export '
|
||||||
@ -506,11 +499,10 @@ VFDD\
|
|||||||
LOG.warning('Could not figure out the allowed values for the '
|
LOG.warning('Could not figure out the allowed values for the '
|
||||||
'shutdown type of import system configuration at %s',
|
'shutdown type of import system configuration at %s',
|
||||||
self.path)
|
self.path)
|
||||||
return set(mgr_maps.IMPORT_SHUTDOWN_VALUE_MAP_REV)
|
return set(mgr_cons.ShutdownType)
|
||||||
|
|
||||||
return set([mgr_maps.IMPORT_SHUTDOWN_VALUE_MAP[value] for value in
|
return {v for v in mgr_cons.ShutdownType
|
||||||
set(mgr_maps.IMPORT_SHUTDOWN_VALUE_MAP).
|
if v.value in allowed_values}
|
||||||
intersection(allowed_values)])
|
|
||||||
|
|
||||||
def import_system_configuration(self, import_buffer):
|
def import_system_configuration(self, import_buffer):
|
||||||
"""Imports system configuration.
|
"""Imports system configuration.
|
||||||
@ -523,7 +515,7 @@ VFDD\
|
|||||||
action_data = dict(self.ACTION_DATA, ImportBuffer=import_buffer)
|
action_data = dict(self.ACTION_DATA, ImportBuffer=import_buffer)
|
||||||
# Caller needs to handle system reboot separately to preserve
|
# Caller needs to handle system reboot separately to preserve
|
||||||
# one-time boot settings.
|
# one-time boot settings.
|
||||||
shutdown_type = mgr_cons.IMPORT_SHUTDOWN_NO_REBOOT
|
shutdown_type = mgr_cons.ShutdownType.NO_REBOOT
|
||||||
|
|
||||||
allowed_shutdown_types = self.get_allowed_import_shutdown_type_values()
|
allowed_shutdown_types = self.get_allowed_import_shutdown_type_values()
|
||||||
if shutdown_type not in allowed_shutdown_types:
|
if shutdown_type not in allowed_shutdown_types:
|
||||||
@ -531,8 +523,7 @@ VFDD\
|
|||||||
parameter='shutdown_type', value=shutdown_type,
|
parameter='shutdown_type', value=shutdown_type,
|
||||||
valid_values=allowed_shutdown_types)
|
valid_values=allowed_shutdown_types)
|
||||||
|
|
||||||
action_data['ShutdownType'] =\
|
action_data['ShutdownType'] = shutdown_type.value
|
||||||
mgr_maps.IMPORT_SHUTDOWN_VALUE_MAP_REV[shutdown_type]
|
|
||||||
|
|
||||||
response = self._conn.post(self.import_system_configuration_uri,
|
response = self._conn.post(self.import_system_configuration_uri,
|
||||||
data=action_data)
|
data=action_data)
|
||||||
|
@ -1,63 +0,0 @@
|
|||||||
# Copyright (c) 2020-2021 Dell Inc. or its subsidiaries.
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
||||||
# not use this file except in compliance with the License. You may obtain
|
|
||||||
# a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
||||||
# License for the specific language governing permissions and limitations
|
|
||||||
# under the License.
|
|
||||||
|
|
||||||
from sushy import utils
|
|
||||||
|
|
||||||
from sushy_oem_idrac.resources.manager import constants as mgr_cons
|
|
||||||
|
|
||||||
EXPORT_CONFIG_VALUE_MAP = {
|
|
||||||
'ALL': mgr_cons.EXPORT_TARGET_ALL,
|
|
||||||
'BIOS': mgr_cons.EXPORT_TARGET_BIOS,
|
|
||||||
'IDRAC': mgr_cons.EXPORT_TARGET_IDRAC,
|
|
||||||
'NIC': mgr_cons.EXPORT_TARGET_NIC,
|
|
||||||
'RAID': mgr_cons.EXPORT_TARGET_RAID
|
|
||||||
}
|
|
||||||
|
|
||||||
EXPORT_CONFIG_VALUE_MAP_REV = utils.revert_dictionary(EXPORT_CONFIG_VALUE_MAP)
|
|
||||||
|
|
||||||
RESET_IDRAC_VALUE_MAP = {
|
|
||||||
'Graceful': mgr_cons.RESET_IDRAC_GRACEFUL_RESTART,
|
|
||||||
'Force': mgr_cons.RESET_IDRAC_FORCE_RESTART,
|
|
||||||
}
|
|
||||||
|
|
||||||
RESET_IDRAC_VALUE_MAP_REV = utils.revert_dictionary(RESET_IDRAC_VALUE_MAP)
|
|
||||||
|
|
||||||
IMPORT_SHUTDOWN_VALUE_MAP = {
|
|
||||||
'Graceful': mgr_cons.IMPORT_SHUTDOWN_GRACEFUL,
|
|
||||||
'Forced': mgr_cons.IMPORT_SHUTDOWN_FORCED,
|
|
||||||
'NoReboot': mgr_cons.IMPORT_SHUTDOWN_NO_REBOOT
|
|
||||||
}
|
|
||||||
|
|
||||||
IMPORT_SHUTDOWN_VALUE_MAP_REV =\
|
|
||||||
utils.revert_dictionary(IMPORT_SHUTDOWN_VALUE_MAP)
|
|
||||||
|
|
||||||
EXPORT_USE_VALUE_MAP = {
|
|
||||||
'Default': mgr_cons.EXPORT_USE_DEFAULT,
|
|
||||||
'Clone': mgr_cons.EXPORT_USE_CLONE,
|
|
||||||
'Replace': mgr_cons.EXPORT_USE_REPLACE
|
|
||||||
}
|
|
||||||
|
|
||||||
EXPORT_USE_VALUE_MAP_REV = utils.revert_dictionary(EXPORT_USE_VALUE_MAP)
|
|
||||||
|
|
||||||
INCLUDE_EXPORT_VALUE_MAP = {
|
|
||||||
'Default': mgr_cons.INCLUDE_EXPORT_DEFAULT,
|
|
||||||
'IncludeReadOnly': mgr_cons.INCLUDE_EXPORT_READ_ONLY,
|
|
||||||
'IncludePasswordHashValues':
|
|
||||||
mgr_cons.INCLUDE_EXPORT_PASSWORD_HASHES,
|
|
||||||
'IncludeReadOnly,IncludePasswordHashValues':
|
|
||||||
mgr_cons.INCLUDE_EXPORT_READ_ONLY_PASSWORD_HASHES
|
|
||||||
}
|
|
||||||
|
|
||||||
INCLUDE_EXPORT_VALUE_MAP_REV =\
|
|
||||||
utils.revert_dictionary(INCLUDE_EXPORT_VALUE_MAP)
|
|
@ -1,4 +1,4 @@
|
|||||||
# Copyright (c) 2021 Dell Inc. or its subsidiaries.
|
# Copyright (c) 2021-2022 Dell Inc. or its subsidiaries.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
# not use this file except in compliance with the License. You may obtain
|
# not use this file except in compliance with the License. You may obtain
|
||||||
@ -12,8 +12,19 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
PHYSICAL_DISK_STATE_MODE_RAID = 'RAID'
|
import enum
|
||||||
"""RAID mode"""
|
|
||||||
|
|
||||||
PHYSICAL_DISK_STATE_MODE_NONRAID = 'Non-RAID'
|
|
||||||
"""Non-RAID mode"""
|
class PhysicalDiskStateMode(enum.Enum):
|
||||||
|
"""Physical disk state mode constants"""
|
||||||
|
|
||||||
|
RAID = 'RAID'
|
||||||
|
"""RAID physical disk state mode"""
|
||||||
|
|
||||||
|
NONRAID = 'Non-RAID'
|
||||||
|
"""Non-RAID physical disk state mode"""
|
||||||
|
|
||||||
|
|
||||||
|
# For backward compatibility
|
||||||
|
PHYSICAL_DISK_STATE_MODE_RAID = PhysicalDiskStateMode.RAID
|
||||||
|
PHYSICAL_DISK_STATE_MODE_NONRAID = PhysicalDiskStateMode.NONRAID
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# Copyright (c) 2021 Dell Inc. or its subsidiaries.
|
# Copyright (c) 2021-2022 Dell Inc. or its subsidiaries.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
# not use this file except in compliance with the License. You may obtain
|
# not use this file except in compliance with the License. You may obtain
|
||||||
@ -25,8 +25,7 @@ def _filter_disks_not_in_mode(controller_to_disks, mode):
|
|||||||
"""Filters disks that are not in requested mode
|
"""Filters disks that are not in requested mode
|
||||||
|
|
||||||
:param controller_to_disks: dictionary of controllers and their drives
|
:param controller_to_disks: dictionary of controllers and their drives
|
||||||
:param mode: constants.PHYSICAL_DISK_STATE_MODE_RAID or
|
:param mode: constants.PhysicalDiskStateMode
|
||||||
constants.PHYSICAL_DISK_STATE_MODE_NONRAID
|
|
||||||
:returns: dictionary of controllers and their drives that need mode changed
|
:returns: dictionary of controllers and their drives that need mode changed
|
||||||
"""
|
"""
|
||||||
sushy_raw_device = sushy.VOLUME_TYPE_RAW_DEVICE
|
sushy_raw_device = sushy.VOLUME_TYPE_RAW_DEVICE
|
||||||
@ -45,9 +44,9 @@ def _filter_disks_not_in_mode(controller_to_disks, mode):
|
|||||||
or volumes[0].raid_type is None)):
|
or volumes[0].raid_type is None)):
|
||||||
is_raw_device = True
|
is_raw_device = True
|
||||||
|
|
||||||
if (mode == sys_cons.PHYSICAL_DISK_STATE_MODE_RAID
|
if (mode == sys_cons.PhysicalDiskStateMode.RAID
|
||||||
and is_raw_device
|
and is_raw_device
|
||||||
or mode == sys_cons.PHYSICAL_DISK_STATE_MODE_NONRAID
|
or mode == sys_cons.PhysicalDiskStateMode.NONRAID
|
||||||
and not is_raw_device):
|
and not is_raw_device):
|
||||||
toprocess_drives.append(drive)
|
toprocess_drives.append(drive)
|
||||||
controller_to_disks[controller] = toprocess_drives
|
controller_to_disks[controller] = toprocess_drives
|
||||||
@ -74,8 +73,7 @@ class DellSystemExtension(oem_base.OEMResourceBase):
|
|||||||
|
|
||||||
Converts only those disks that are not already in requested mode.
|
Converts only those disks that are not already in requested mode.
|
||||||
|
|
||||||
:param mode: constants.PHYSICAL_DISK_STATE_MODE_RAID or
|
:param mode: constants.PhysicalDiskStateMode
|
||||||
constants.PHYSICAL_DISK_STATE_MODE_NONRAID
|
|
||||||
:param controller_to_disks: dictionary of controllers and their drives.
|
:param controller_to_disks: dictionary of controllers and their drives.
|
||||||
Optional, if not provided, processes all RAID, except BOSS,
|
Optional, if not provided, processes all RAID, except BOSS,
|
||||||
controller drives.
|
controller drives.
|
||||||
@ -99,10 +97,10 @@ class DellSystemExtension(oem_base.OEMResourceBase):
|
|||||||
for controller, drives in controller_to_disks.items():
|
for controller, drives in controller_to_disks.items():
|
||||||
if drives:
|
if drives:
|
||||||
drive_fqdds = [d.identity for d in drives]
|
drive_fqdds = [d.identity for d in drives]
|
||||||
if mode == sys_cons.PHYSICAL_DISK_STATE_MODE_RAID:
|
if mode == sys_cons.PhysicalDiskStateMode.RAID:
|
||||||
task_monitors.append(
|
task_monitors.append(
|
||||||
self.raid_service.convert_to_raid(drive_fqdds))
|
self.raid_service.convert_to_raid(drive_fqdds))
|
||||||
elif mode == sys_cons.PHYSICAL_DISK_STATE_MODE_NONRAID:
|
elif mode == sys_cons.PhysicalDiskStateMode.NONRAID:
|
||||||
task_monitors.append(
|
task_monitors.append(
|
||||||
self.raid_service.convert_to_nonraid(drive_fqdds))
|
self.raid_service.convert_to_nonraid(drive_fqdds))
|
||||||
|
|
||||||
|
@ -12,166 +12,234 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
# Job state constants
|
import enum
|
||||||
JOB_STATE_COMPLETED = "Completed"
|
|
||||||
"""A job is in completed state"""
|
|
||||||
|
|
||||||
JOB_STATE_COMPLETED_ERRORS = "Completed with errors"
|
|
||||||
"""A job is in completed state with errors"""
|
|
||||||
|
|
||||||
JOB_STATE_DOWNLOADED = "Downloaded"
|
class JobState(enum.Enum):
|
||||||
"""A job is in downloaded state"""
|
"""Job state constants"""
|
||||||
|
|
||||||
JOB_STATE_DOWNLOADING = "Downloading"
|
COMPLETED = "Completed"
|
||||||
"""A job is in downloading state"""
|
"""A job is in completed state"""
|
||||||
|
|
||||||
JOB_STATE_FAILED = "Failed"
|
COMPLETED_ERRORS = "CompletedWithErrors"
|
||||||
"""A job is in failed state"""
|
"""A job is in completed state with errors"""
|
||||||
|
|
||||||
JOB_STATE_NEW = "New"
|
DOWNLOADED = "Downloaded"
|
||||||
"""A job is in newly created state"""
|
"""A job is in downloaded state"""
|
||||||
|
|
||||||
JOB_STATE_PAUSED = "Paused"
|
DOWNLOADING = "Downloading"
|
||||||
"""A job is in paused state"""
|
"""A job is in downloading state"""
|
||||||
|
|
||||||
JOB_STATE_PENDING_ACTIVATION = "Pending activation"
|
FAILED = "Failed"
|
||||||
"""A job is in pending activation state"""
|
"""A job is in failed state"""
|
||||||
|
|
||||||
JOB_STATE_READY_EXECUTION = "Ready for execution"
|
NEW = "New"
|
||||||
"""A job is in ready for execution state"""
|
"""A job is in newly created state"""
|
||||||
|
|
||||||
JOB_STATE_REBOOT_COMPLETED = "Reboot completed"
|
PAUSED = "Paused"
|
||||||
"""A job is in reboot completed state"""
|
"""A job is in paused state"""
|
||||||
|
|
||||||
JOB_STATE_REBOOT_FAILED = "Reboot failed"
|
PENDING_ACTIVATION = "PendingActivation"
|
||||||
"""A job is in reboot failed state"""
|
"""A job is in pending activation state"""
|
||||||
|
|
||||||
JOB_STATE_REBOOT_PENDING = "Reboot pending"
|
READY_EXECUTION = "ReadyForExecution"
|
||||||
"""A job is in pending state for reboot"""
|
"""A job is in ready for execution state"""
|
||||||
|
|
||||||
JOB_STATE_RUNNING = "Running"
|
REBOOT_COMPLETED = "RebootCompleted"
|
||||||
"""A job is in running state"""
|
"""A job is in reboot completed state"""
|
||||||
|
|
||||||
JOB_STATE_SCHEDULED = "Scheduled"
|
REBOOT_FAILED = "RebootFailed"
|
||||||
"""A job is in scheduled state"""
|
"""A job is in reboot failed state"""
|
||||||
|
|
||||||
JOB_STATE_SCHEDULING = "Scheduling"
|
REBOOT_PENDING = "RebootPending"
|
||||||
"""A job is in scheduling state"""
|
"""A job is in pending state for reboot"""
|
||||||
|
|
||||||
JOB_STATE_UNKNOWN = "Unknown"
|
RUNNING = "Running"
|
||||||
"""A job is in unknown state"""
|
"""A job is in running state"""
|
||||||
|
|
||||||
JOB_STATE_WAITING = "Waiting"
|
SCHEDULED = "Scheduled"
|
||||||
"""A job is in waiting state"""
|
"""A job is in scheduled state"""
|
||||||
|
|
||||||
# Job type constants
|
SCHEDULING = "Scheduling"
|
||||||
JOB_TYPE_BIOS_CONF = "BIOS configuration"
|
"""A job is in scheduling state"""
|
||||||
"""A BIOS configuration job"""
|
|
||||||
|
|
||||||
JOB_TYPE_EXPORT_CONF = "Export configuration"
|
UNKNOWN = "Unknown"
|
||||||
"""A server configuration profile export job"""
|
"""A job is in unknown state"""
|
||||||
|
|
||||||
JOB_TYPE_FC_CONF = "Fibre Channel configuration"
|
WAITING = "Waiting"
|
||||||
"""A Fibre Channel configuration job"""
|
"""A job is in waiting state"""
|
||||||
|
|
||||||
JOB_TYPE_FACTORY_CONF_EXPORT = "Factory configuration export"
|
|
||||||
"""A factory configuration export job"""
|
|
||||||
|
|
||||||
JOB_TYPE_FIRMWARE_ROLLBACK = "Firmware rollback"
|
# Backward compatibility
|
||||||
"""A firmware rollback job"""
|
JOB_STATE_COMPLETED = JobState.COMPLETED
|
||||||
|
JOB_STATE_COMPLETED_ERRORS = JobState.COMPLETED_ERRORS
|
||||||
|
JOB_STATE_DOWNLOADED = JobState.DOWNLOADED
|
||||||
|
JOB_STATE_DOWNLOADING = JobState.DOWNLOADING
|
||||||
|
JOB_STATE_FAILED = JobState.FAILED
|
||||||
|
JOB_STATE_NEW = JobState.NEW
|
||||||
|
JOB_STATE_PAUSED = JobState.PAUSED
|
||||||
|
JOB_STATE_PENDING_ACTIVATION = JobState.PENDING_ACTIVATION
|
||||||
|
JOB_STATE_READY_EXECUTION = JobState.READY_EXECUTION
|
||||||
|
JOB_STATE_REBOOT_COMPLETED = JobState.REBOOT_COMPLETED
|
||||||
|
JOB_STATE_REBOOT_FAILED = JobState.REBOOT_FAILED
|
||||||
|
JOB_STATE_REBOOT_PENDING = JobState.REBOOT_PENDING
|
||||||
|
JOB_STATE_RUNNING = JobState.RUNNING
|
||||||
|
JOB_STATE_SCHEDULED = JobState.SCHEDULED
|
||||||
|
JOB_STATE_SCHEDULING = JobState.SCHEDULING
|
||||||
|
JOB_STATE_UNKNOWN = JobState.UNKNOWN
|
||||||
|
JOB_STATE_WAITING = JobState.WAITING
|
||||||
|
|
||||||
JOB_TYPE_FIRMWARE_UPDATE = "Firmware update"
|
|
||||||
"""A firmware update job"""
|
|
||||||
|
|
||||||
JOB_TYPE_HW_INVENTORY_EXPORT = "Hardware inventory export"
|
class JobType(enum.Enum):
|
||||||
"""A hardware inventory export job"""
|
"""Job type constants"""
|
||||||
|
|
||||||
JOB_TYPE_IMPORT_CONF = "Import configuration"
|
BIOS_CONF = "BIOSConfiguration"
|
||||||
"""A server configuration profile import job"""
|
"""A BIOS configuration job"""
|
||||||
|
|
||||||
JOB_TYPE_INBAND_BIOS_CONF = "Inband BIOS configuration"
|
EXPORT_CONF = "ExportConfiguration"
|
||||||
"""An inband BIOS configuration job"""
|
"""A server configuration profile export job"""
|
||||||
|
|
||||||
JOB_TYPE_LC_CONF = "LC configuration"
|
FC_CONF = "FCConfiguration"
|
||||||
"""A lifecycle controller attribute configuration job"""
|
"""A Fibre Channel configuration job"""
|
||||||
|
|
||||||
JOB_TYPE_LC_EXPORT = "LC export"
|
FACTORY_CONF_EXPORT = "FactoryConfigurationExport"
|
||||||
"""A lifecycle controller export job"""
|
"""A factory configuration export job"""
|
||||||
|
|
||||||
JOB_TYPE_LC_LOG_EXPORT = "LC log export"
|
FIRMWARE_ROLLBACK = "FirmwareRollback"
|
||||||
"""A lifecycle controller log export job"""
|
"""A firmware rollback job"""
|
||||||
|
|
||||||
JOB_TYPE_LICENSE_EXPORT = "License export"
|
FIRMWARE_UPDATE = "FirmwareUpdate"
|
||||||
"""A license export job"""
|
"""A firmware update job"""
|
||||||
|
|
||||||
JOB_TYPE_LICENSE_IMPORT = "License import"
|
HW_INVENTORY_EXPORT = "HardwareInventoryExport"
|
||||||
"""A license import job"""
|
"""A hardware inventory export job"""
|
||||||
|
|
||||||
JOB_TYPE_MSG_REG_EXPORT = "Message registry export"
|
IMPORT_CONF = "ImportConfiguration"
|
||||||
"""Export message registry report job"""
|
"""A server configuration profile import job"""
|
||||||
|
|
||||||
JOB_TYPE_NIC_CONF = "NIC configuration"
|
INBAND_BIOS_CONF = "InbandBIOSConfiguration"
|
||||||
"""A NIC configuration job"""
|
"""An inband BIOS configuration job"""
|
||||||
|
|
||||||
JOB_TYPE_OS_DEPLOY = "OS deploy"
|
LC_CONF = "LCConfig"
|
||||||
"""Operating System deploy job"""
|
"""A lifecycle controller attribute configuration job"""
|
||||||
|
|
||||||
JOB_TYPE_RAID_CONF = "RAID configuration"
|
LC_EXPORT = "LCExport"
|
||||||
"""A RAID configuration job"""
|
"""A lifecycle controller export job"""
|
||||||
|
|
||||||
JOB_TYPE_RT_NO_REBOOT_CONF = "Real-time no reboot configuration"
|
LC_LOG_EXPORT = "LCLogExport"
|
||||||
"""A real time configuration job without reboot"""
|
"""A lifecycle controller log export job"""
|
||||||
|
|
||||||
JOB_TYPE_REBOOT_FORCE = "Reboot force"
|
LICENSE_EXPORT = "LicenseExport"
|
||||||
"""A reboot job with forced shutdown"""
|
"""A license export job"""
|
||||||
|
|
||||||
JOB_TYPE_REBOOT_NO_FORCE = "Reboot no force"
|
LICENSE_IMPORT = "LicenseImport"
|
||||||
"""A graceful reboot job without forced shutdown"""
|
"""A license import job"""
|
||||||
|
|
||||||
JOB_TYPE_REBOOT_POWER_CYCLE = "Reboot power cycle"
|
MSG_REG_EXPORT = "MessageRegistryExport"
|
||||||
"""A power cycle job"""
|
"""Export message registry report job"""
|
||||||
|
|
||||||
JOB_TYPE_REMOTE_DIAG = "Remote diagnostics"
|
NIC_CONF = "NICConfiguration"
|
||||||
"""A remote diagnostics job"""
|
"""A NIC configuration job"""
|
||||||
|
|
||||||
JOB_TYPE_REPO_UPDATE = "Repository update"
|
OS_DEPLOY = "OSDeploy"
|
||||||
"""An update job from a repository"""
|
"""Operating System deploy job"""
|
||||||
|
|
||||||
JOB_TYPE_SA_COL_EXP_HEALTH_DATA = "SA collect and export health data"
|
RAID_CONF = "RAIDConfiguration"
|
||||||
"""Support Assist collect and export health data job"""
|
"""A RAID configuration job"""
|
||||||
|
|
||||||
JOB_TYPE_SA_COL_HEALTH_DATA = "SA collect health data"
|
RT_NO_REBOOT_CONF = "RealTimeNoRebootConfiguration"
|
||||||
"""Support Assist collect health data job"""
|
"""A real time configuration job without reboot"""
|
||||||
|
|
||||||
JOB_TYPE_SA_EXP_HEALTH_DATA = "SA export health data"
|
REBOOT_FORCE = "RebootForce"
|
||||||
"""Support Assist export health data job"""
|
"""A reboot job with forced shutdown"""
|
||||||
|
|
||||||
JOB_TYPE_SA_ISM = "SA expose iSM"
|
REBOOT_NO_FORCE = "RebootNoForce"
|
||||||
"""Support Assist expose iDRAC Service Module installer package to host job"""
|
"""A graceful reboot job without forced shutdown"""
|
||||||
|
|
||||||
JOB_TYPE_SA_REG = "SA registration"
|
REBOOT_POWER_CYCLE = "RebootPowerCycle"
|
||||||
"""Support Assist register iDRAC to Dell backend server job"""
|
"""A power cycle job"""
|
||||||
|
|
||||||
JOB_TYPE_SEKM_REKEY = "SEKM rekey"
|
REMOTE_DIAG = "RemoteDiagnostics"
|
||||||
"""A Secure Enterprise Key Manager rekey job"""
|
"""A remote diagnostics job"""
|
||||||
|
|
||||||
JOB_TYPE_SEKM_STATUS_SET = "SEKM status set"
|
REPO_UPDATE = "RepositoryUpdate"
|
||||||
"""A Secure Enterprise Key Manager status set job"""
|
"""An update job from a repository"""
|
||||||
|
|
||||||
JOB_TYPE_SHUTDOWN = "Shutdown"
|
SA_COL_EXP_HEALTH_DATA = "SACollectExportHealthData"
|
||||||
"""A shutdown job"""
|
"""Support Assist collect and export health data job"""
|
||||||
|
|
||||||
JOB_TYPE_SYS_ERASE = "System erase"
|
SA_COL_HEALTH_DATA = "SACollectHealthData"
|
||||||
"""A selective system erase job"""
|
"""Support Assist collect health data job"""
|
||||||
|
|
||||||
JOB_TYPE_SYS_INFO_CONF = "System info configuration"
|
SA_EXP_HEALTH_DATA = "SAExportHealthData"
|
||||||
"""A system info configuration job"""
|
"""Support Assist export health data job"""
|
||||||
|
|
||||||
JOB_TYPE_THERMAL_HIST_EXP = "Thermal history export"
|
SA_ISM = "SAExposeISM"
|
||||||
"""A thermal history export job"""
|
"""Support Assist expose ISM installer package to host job"""
|
||||||
|
|
||||||
JOB_TYPE_UNKNOWN = "Unknown"
|
SA_REG = "SARegistration"
|
||||||
"""An unknown job"""
|
"""Support Assist register iDRAC to Dell backend server job"""
|
||||||
|
|
||||||
JOB_TYPE_IDRAC_CONF = "iDRAC configuration"
|
SEKM_REKEY = "SEKMRekey"
|
||||||
"""An iDRAC configuration job"""
|
"""A Secure Enterprise Key Manager rekey job"""
|
||||||
|
|
||||||
|
SEKM_STATUS_SET = "SEKMStatusSet"
|
||||||
|
"""A Secure Enterprise Key Manager status set job"""
|
||||||
|
|
||||||
|
SHUTDOWN = "Shutdown"
|
||||||
|
"""A shutdown job"""
|
||||||
|
|
||||||
|
SYS_ERASE = "SystemErase"
|
||||||
|
"""A selective system erase job"""
|
||||||
|
|
||||||
|
SYS_INFO_CONF = "SystemInfoConfiguration"
|
||||||
|
"""A system info configuration job"""
|
||||||
|
|
||||||
|
THERMAL_HIST_EXP = "ThermalHistoryExport"
|
||||||
|
"""A thermal history export job"""
|
||||||
|
|
||||||
|
UNKNOWN = "Unknown"
|
||||||
|
"""An unknown job"""
|
||||||
|
|
||||||
|
IDRAC_CONF = "iDRACConfiguration"
|
||||||
|
"""An iDRAC configuration job"""
|
||||||
|
|
||||||
|
|
||||||
|
# Backward compatibility
|
||||||
|
JOB_TYPE_BIOS_CONF = JobType.BIOS_CONF
|
||||||
|
JOB_TYPE_EXPORT_CONF = JobType.EXPORT_CONF
|
||||||
|
JOB_TYPE_FC_CONF = JobType.FC_CONF
|
||||||
|
JOB_TYPE_FACTORY_CONF_EXPORT = JobType.FACTORY_CONF_EXPORT
|
||||||
|
JOB_TYPE_FIRMWARE_ROLLBACK = JobType.FIRMWARE_ROLLBACK
|
||||||
|
JOB_TYPE_FIRMWARE_UPDATE = JobType.FIRMWARE_UPDATE
|
||||||
|
JOB_TYPE_HW_INVENTORY_EXPORT = JobType.HW_INVENTORY_EXPORT
|
||||||
|
JOB_TYPE_IMPORT_CONF = JobType.IMPORT_CONF
|
||||||
|
JOB_TYPE_INBAND_BIOS_CONF = JobType.INBAND_BIOS_CONF
|
||||||
|
JOB_TYPE_LC_CONF = JobType.LC_CONF
|
||||||
|
JOB_TYPE_LC_EXPORT = JobType.LC_EXPORT
|
||||||
|
JOB_TYPE_LC_LOG_EXPORT = JobType.LC_LOG_EXPORT
|
||||||
|
JOB_TYPE_LICENSE_EXPORT = JobType.LICENSE_EXPORT
|
||||||
|
JOB_TYPE_LICENSE_IMPORT = JobType.LICENSE_IMPORT
|
||||||
|
JOB_TYPE_MSG_REG_EXPORT = JobType.MSG_REG_EXPORT
|
||||||
|
JOB_TYPE_NIC_CONF = JobType.NIC_CONF
|
||||||
|
JOB_TYPE_OS_DEPLOY = JobType.OS_DEPLOY
|
||||||
|
JOB_TYPE_RAID_CONF = JobType.RAID_CONF
|
||||||
|
JOB_TYPE_RT_NO_REBOOT_CONF = JobType.RT_NO_REBOOT_CONF
|
||||||
|
JOB_TYPE_REBOOT_FORCE = JobType.REBOOT_FORCE
|
||||||
|
JOB_TYPE_REBOOT_NO_FORCE = JobType.REBOOT_NO_FORCE
|
||||||
|
JOB_TYPE_REBOOT_POWER_CYCLE = JobType.REBOOT_POWER_CYCLE
|
||||||
|
JOB_TYPE_REMOTE_DIAG = JobType.REMOTE_DIAG
|
||||||
|
JOB_TYPE_REPO_UPDATE = JobType.REPO_UPDATE
|
||||||
|
JOB_TYPE_SA_COL_EXP_HEALTH_DATA = JobType.SA_COL_EXP_HEALTH_DATA
|
||||||
|
JOB_TYPE_SA_COL_HEALTH_DATA = JobType.SA_COL_HEALTH_DATA
|
||||||
|
JOB_TYPE_SA_EXP_HEALTH_DATA = JobType.SA_EXP_HEALTH_DATA
|
||||||
|
JOB_TYPE_SA_ISM = JobType.SA_ISM
|
||||||
|
JOB_TYPE_SA_REG = JobType.SA_REG
|
||||||
|
JOB_TYPE_SEKM_REKEY = JobType.SEKM_REKEY
|
||||||
|
JOB_TYPE_SEKM_STATUS_SET = JobType.SEKM_STATUS_SET
|
||||||
|
JOB_TYPE_SHUTDOWN = JobType.SHUTDOWN
|
||||||
|
JOB_TYPE_SYS_ERASE = JobType.SYS_ERASE
|
||||||
|
JOB_TYPE_SYS_INFO_CONF = JobType.SYS_INFO_CONF
|
||||||
|
JOB_TYPE_THERMAL_HIST_EXP = JobType.THERMAL_HIST_EXP
|
||||||
|
JOB_TYPE_UNKNOWN = JobType.UNKNOWN
|
||||||
|
JOB_TYPE_IDRAC_CONF = JobType.IDRAC_CONF
|
||||||
|
@ -1,81 +0,0 @@
|
|||||||
# Copyright (c) 2021 Dell Inc. or its subsidiaries.
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
||||||
# not use this file except in compliance with the License. You may obtain
|
|
||||||
# a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
||||||
# License for the specific language governing permissions and limitations
|
|
||||||
# under the License.
|
|
||||||
|
|
||||||
from sushy import utils
|
|
||||||
|
|
||||||
from sushy_oem_idrac.resources.taskservice import constants as ts_cons
|
|
||||||
|
|
||||||
JOB_STATE_VALUE_MAP = {
|
|
||||||
"New": ts_cons.JOB_STATE_NEW,
|
|
||||||
"Scheduled": ts_cons.JOB_STATE_SCHEDULED,
|
|
||||||
"Running": ts_cons.JOB_STATE_RUNNING,
|
|
||||||
"Completed": ts_cons.JOB_STATE_COMPLETED,
|
|
||||||
"Downloading": ts_cons.JOB_STATE_DOWNLOADING,
|
|
||||||
"Downloaded": ts_cons.JOB_STATE_DOWNLOADED,
|
|
||||||
"Scheduling": ts_cons.JOB_STATE_SCHEDULING,
|
|
||||||
"ReadyForExecution": ts_cons.JOB_STATE_READY_EXECUTION,
|
|
||||||
"Waiting": ts_cons.JOB_STATE_WAITING,
|
|
||||||
"Paused": ts_cons.JOB_STATE_PAUSED,
|
|
||||||
"Failed": ts_cons.JOB_STATE_FAILED,
|
|
||||||
"CompletedWithErrors": ts_cons.JOB_STATE_COMPLETED_ERRORS,
|
|
||||||
"RebootPending": ts_cons.JOB_STATE_REBOOT_PENDING,
|
|
||||||
"RebootFailed": ts_cons.JOB_STATE_REBOOT_FAILED,
|
|
||||||
"RebootCompleted": ts_cons.JOB_STATE_REBOOT_COMPLETED,
|
|
||||||
"PendingActivation": ts_cons.JOB_STATE_PENDING_ACTIVATION,
|
|
||||||
"Unknown": ts_cons.JOB_STATE_UNKNOWN
|
|
||||||
}
|
|
||||||
|
|
||||||
JOB_STATE_VALUE_MAP_REV = utils.revert_dictionary(JOB_STATE_VALUE_MAP)
|
|
||||||
|
|
||||||
JOB_TYPE_VALUE_MAP = {
|
|
||||||
"FirmwareUpdate": ts_cons.JOB_TYPE_FIRMWARE_UPDATE,
|
|
||||||
"FirmwareRollback": ts_cons.JOB_TYPE_FIRMWARE_ROLLBACK,
|
|
||||||
"RepositoryUpdate": ts_cons.JOB_TYPE_REPO_UPDATE,
|
|
||||||
"RebootPowerCycle": ts_cons.JOB_TYPE_REBOOT_POWER_CYCLE,
|
|
||||||
"RebootForce": ts_cons.JOB_TYPE_REBOOT_FORCE,
|
|
||||||
"RebootNoForce": ts_cons.JOB_TYPE_REBOOT_NO_FORCE,
|
|
||||||
"Shutdown": ts_cons.JOB_TYPE_SHUTDOWN,
|
|
||||||
"RAIDConfiguration": ts_cons.JOB_TYPE_RAID_CONF,
|
|
||||||
"BIOSConfiguration": ts_cons.JOB_TYPE_BIOS_CONF,
|
|
||||||
"NICConfiguration": ts_cons.JOB_TYPE_NIC_CONF,
|
|
||||||
"FCConfiguration": ts_cons.JOB_TYPE_FC_CONF,
|
|
||||||
"iDRACConfiguration": ts_cons.JOB_TYPE_IDRAC_CONF,
|
|
||||||
"SystemInfoConfiguration": ts_cons.JOB_TYPE_SYS_INFO_CONF,
|
|
||||||
"InbandBIOSConfiguration": ts_cons.JOB_TYPE_INBAND_BIOS_CONF,
|
|
||||||
"ExportConfiguration": ts_cons.JOB_TYPE_EXPORT_CONF,
|
|
||||||
"ImportConfiguration": ts_cons.JOB_TYPE_IMPORT_CONF,
|
|
||||||
"RemoteDiagnostics": ts_cons.JOB_TYPE_REMOTE_DIAG,
|
|
||||||
"RealTimeNoRebootConfiguration": ts_cons.JOB_TYPE_RT_NO_REBOOT_CONF,
|
|
||||||
"LCLogExport": ts_cons.JOB_TYPE_LC_LOG_EXPORT,
|
|
||||||
"HardwareInventoryExport": ts_cons.JOB_TYPE_HW_INVENTORY_EXPORT,
|
|
||||||
"FactoryConfigurationExport": ts_cons.JOB_TYPE_FACTORY_CONF_EXPORT,
|
|
||||||
"LicenseImport": ts_cons.JOB_TYPE_LICENSE_IMPORT,
|
|
||||||
"LicenseExport": ts_cons.JOB_TYPE_LICENSE_EXPORT,
|
|
||||||
"ThermalHistoryExport": ts_cons.JOB_TYPE_THERMAL_HIST_EXP,
|
|
||||||
"LCConfig": ts_cons.JOB_TYPE_LC_CONF,
|
|
||||||
"LCExport": ts_cons.JOB_TYPE_LC_EXPORT,
|
|
||||||
"SACollectHealthData": ts_cons.JOB_TYPE_SA_COL_HEALTH_DATA,
|
|
||||||
"SAExportHealthData": ts_cons.JOB_TYPE_SA_EXP_HEALTH_DATA,
|
|
||||||
"SACollectExportHealthData": ts_cons.JOB_TYPE_SA_COL_EXP_HEALTH_DATA,
|
|
||||||
"SAExposeISM": ts_cons.JOB_TYPE_SA_ISM,
|
|
||||||
"SARegistration": ts_cons.JOB_TYPE_SA_REG,
|
|
||||||
"SystemErase": ts_cons.JOB_TYPE_SYS_ERASE,
|
|
||||||
"MessageRegistryExport": ts_cons.JOB_TYPE_MSG_REG_EXPORT,
|
|
||||||
"OSDeploy": ts_cons.JOB_TYPE_OS_DEPLOY,
|
|
||||||
"SEKMRekey": ts_cons.JOB_TYPE_SEKM_REKEY,
|
|
||||||
"SEKMStatusSet": ts_cons.JOB_TYPE_SEKM_STATUS_SET,
|
|
||||||
"Unknown": ts_cons.JOB_TYPE_UNKNOWN
|
|
||||||
}
|
|
||||||
|
|
||||||
JOB_TYPE_VALUE_MAP_REV = utils.revert_dictionary(JOB_TYPE_VALUE_MAP)
|
|
@ -17,7 +17,7 @@ import logging
|
|||||||
from sushy.resources import base
|
from sushy.resources import base
|
||||||
from sushy.resources.oem import base as oem_base
|
from sushy.resources.oem import base as oem_base
|
||||||
|
|
||||||
from sushy_oem_idrac.resources.taskservice import mappings as ts_maps
|
from sushy_oem_idrac.resources.taskservice import constants as ts_cons
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -42,10 +42,10 @@ class DellTaskExtension(oem_base.OEMResourceBase):
|
|||||||
applicable.
|
applicable.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
job_state = base.MappedField('JobState', ts_maps.JOB_STATE_VALUE_MAP)
|
job_state = base.MappedField('JobState', ts_cons.JobState)
|
||||||
"""Job state"""
|
"""Job state"""
|
||||||
|
|
||||||
job_type = base.MappedField('JobType', ts_maps.JOB_TYPE_VALUE_MAP)
|
job_type = base.MappedField('JobType', ts_cons.JobType)
|
||||||
"""Job type"""
|
"""Job type"""
|
||||||
|
|
||||||
message = base.Field('Message')
|
message = base.Field('Message')
|
||||||
|
@ -47,8 +47,8 @@ class DelliDRACCardServiceTestCase(BaseTestCase):
|
|||||||
data={'Force': 'Graceful'})
|
data={'Force': 'Graceful'})
|
||||||
|
|
||||||
def test_get_allowed_reset_idrac_values(self):
|
def test_get_allowed_reset_idrac_values(self):
|
||||||
expected_values = {mgr_cons.RESET_IDRAC_GRACEFUL_RESTART,
|
expected_values = {mgr_cons.ResetType.GRACEFUL,
|
||||||
mgr_cons.RESET_IDRAC_FORCE_RESTART}
|
mgr_cons.ResetType.FORCE}
|
||||||
allowed_values = \
|
allowed_values = \
|
||||||
self.idrac_card_service.get_allowed_reset_idrac_values()
|
self.idrac_card_service.get_allowed_reset_idrac_values()
|
||||||
self.assertEqual(expected_values, allowed_values)
|
self.assertEqual(expected_values, allowed_values)
|
||||||
@ -58,8 +58,8 @@ class DelliDRACCardServiceTestCase(BaseTestCase):
|
|||||||
base_property = '#DelliDRACCardService.iDRACReset'
|
base_property = '#DelliDRACCardService.iDRACReset'
|
||||||
remove_property = 'Force@Redfish.AllowableValues'
|
remove_property = 'Force@Redfish.AllowableValues'
|
||||||
idrac_service_json['Actions'][base_property].pop(remove_property)
|
idrac_service_json['Actions'][base_property].pop(remove_property)
|
||||||
expected_values = {mgr_cons.RESET_IDRAC_GRACEFUL_RESTART,
|
expected_values = {mgr_cons.ResetType.GRACEFUL,
|
||||||
mgr_cons.RESET_IDRAC_FORCE_RESTART}
|
mgr_cons.ResetType.FORCE}
|
||||||
allowed_values = \
|
allowed_values = \
|
||||||
self.idrac_card_service.get_allowed_reset_idrac_values()
|
self.idrac_card_service.get_allowed_reset_idrac_values()
|
||||||
self.assertEqual(expected_values, allowed_values)
|
self.assertEqual(expected_values, allowed_values)
|
||||||
|
@ -97,11 +97,11 @@ class ManagerTestCase(BaseTestCase):
|
|||||||
@mock.patch('sushy.resources.oem.common._global_extn_mgrs_by_resource', {})
|
@mock.patch('sushy.resources.oem.common._global_extn_mgrs_by_resource', {})
|
||||||
def test_get_allowed_export_target_values(self):
|
def test_get_allowed_export_target_values(self):
|
||||||
oem = self.manager.get_oem_extension('Dell')
|
oem = self.manager.get_oem_extension('Dell')
|
||||||
expected_values = {mgr_cons.EXPORT_TARGET_IDRAC,
|
expected_values = {mgr_cons.ExportTarget.IDRAC,
|
||||||
mgr_cons.EXPORT_TARGET_RAID,
|
mgr_cons.ExportTarget.RAID,
|
||||||
mgr_cons.EXPORT_TARGET_ALL,
|
mgr_cons.ExportTarget.ALL,
|
||||||
mgr_cons.EXPORT_TARGET_BIOS,
|
mgr_cons.ExportTarget.BIOS,
|
||||||
mgr_cons.EXPORT_TARGET_NIC}
|
mgr_cons.ExportTarget.NIC}
|
||||||
allowed_values = oem.get_allowed_export_target_values()
|
allowed_values = oem.get_allowed_export_target_values()
|
||||||
self.assertEqual(expected_values, allowed_values)
|
self.assertEqual(expected_values, allowed_values)
|
||||||
|
|
||||||
@ -114,11 +114,11 @@ class ManagerTestCase(BaseTestCase):
|
|||||||
'Target@Redfish.AllowableValues')
|
'Target@Redfish.AllowableValues')
|
||||||
oem.refresh()
|
oem.refresh()
|
||||||
oem = self.manager.get_oem_extension('Dell')
|
oem = self.manager.get_oem_extension('Dell')
|
||||||
expected_values = {mgr_cons.EXPORT_TARGET_IDRAC,
|
expected_values = {mgr_cons.ExportTarget.IDRAC,
|
||||||
mgr_cons.EXPORT_TARGET_RAID,
|
mgr_cons.ExportTarget.RAID,
|
||||||
mgr_cons.EXPORT_TARGET_ALL,
|
mgr_cons.ExportTarget.ALL,
|
||||||
mgr_cons.EXPORT_TARGET_BIOS,
|
mgr_cons.ExportTarget.BIOS,
|
||||||
mgr_cons.EXPORT_TARGET_NIC}
|
mgr_cons.ExportTarget.NIC}
|
||||||
allowed_values = oem.get_allowed_export_target_values()
|
allowed_values = oem.get_allowed_export_target_values()
|
||||||
self.assertEqual(expected_values, allowed_values)
|
self.assertEqual(expected_values, allowed_values)
|
||||||
|
|
||||||
@ -135,7 +135,7 @@ class ManagerTestCase(BaseTestCase):
|
|||||||
def test__export_system_configuration(self):
|
def test__export_system_configuration(self):
|
||||||
oem = self.manager.get_oem_extension('Dell')
|
oem = self.manager.get_oem_extension('Dell')
|
||||||
oem._export_system_configuration(
|
oem._export_system_configuration(
|
||||||
target=mgr_cons.EXPORT_TARGET_ALL)
|
target=mgr_cons.ExportTarget.ALL)
|
||||||
|
|
||||||
self.conn.post.assert_called_once_with(
|
self.conn.post.assert_called_once_with(
|
||||||
'/redfish/v1/Managers/iDRAC.Embedded.1/Actions/Oem/EID_674_Manager'
|
'/redfish/v1/Managers/iDRAC.Embedded.1/Actions/Oem/EID_674_Manager'
|
||||||
@ -148,10 +148,10 @@ class ManagerTestCase(BaseTestCase):
|
|||||||
@mock.patch('sushy.resources.oem.common._global_extn_mgrs_by_resource', {})
|
@mock.patch('sushy.resources.oem.common._global_extn_mgrs_by_resource', {})
|
||||||
def test__export_system_configuration_nondefault(self):
|
def test__export_system_configuration_nondefault(self):
|
||||||
oem = self.manager.get_oem_extension('Dell')
|
oem = self.manager.get_oem_extension('Dell')
|
||||||
include_in_export = mgr_cons.INCLUDE_EXPORT_READ_ONLY_PASSWORD_HASHES
|
include_in_export = mgr_cons.IncludeInExport.READ_ONLY_PASSWORD_HASHES
|
||||||
oem._export_system_configuration(
|
oem._export_system_configuration(
|
||||||
target=mgr_cons.EXPORT_TARGET_RAID,
|
target=mgr_cons.ExportTarget.RAID,
|
||||||
export_use=mgr_cons.EXPORT_USE_CLONE,
|
export_use=mgr_cons.ExportUse.CLONE,
|
||||||
include_in_export=include_in_export)
|
include_in_export=include_in_export)
|
||||||
|
|
||||||
self.conn.post.assert_called_once_with(
|
self.conn.post.assert_called_once_with(
|
||||||
@ -174,13 +174,15 @@ class ManagerTestCase(BaseTestCase):
|
|||||||
def test__export_system_configuration_invalid_export_use(self):
|
def test__export_system_configuration_invalid_export_use(self):
|
||||||
oem = self.manager.get_oem_extension('Dell')
|
oem = self.manager.get_oem_extension('Dell')
|
||||||
self.assertRaises(sushy.exceptions.InvalidParameterValueError,
|
self.assertRaises(sushy.exceptions.InvalidParameterValueError,
|
||||||
oem._export_system_configuration, "RAID",
|
oem._export_system_configuration,
|
||||||
|
mgr_cons.ExportTarget.RAID,
|
||||||
export_use="ABC")
|
export_use="ABC")
|
||||||
|
|
||||||
def test__export_system_configuration_invalid_include_in_export(self):
|
def test__export_system_configuration_invalid_include_in_export(self):
|
||||||
oem = self.manager.get_oem_extension('Dell')
|
oem = self.manager.get_oem_extension('Dell')
|
||||||
self.assertRaises(sushy.exceptions.InvalidParameterValueError,
|
self.assertRaises(sushy.exceptions.InvalidParameterValueError,
|
||||||
oem._export_system_configuration, "RAID",
|
oem._export_system_configuration,
|
||||||
|
mgr_cons.ExportTarget.RAID,
|
||||||
include_in_export="ABC")
|
include_in_export="ABC")
|
||||||
|
|
||||||
def test__export_system_configuration_invalid_include_in_export_part(self):
|
def test__export_system_configuration_invalid_include_in_export_part(self):
|
||||||
@ -193,9 +195,10 @@ class ManagerTestCase(BaseTestCase):
|
|||||||
['Default', 'IncludeReadOnly']
|
['Default', 'IncludeReadOnly']
|
||||||
oem.refresh()
|
oem.refresh()
|
||||||
oem = self.manager.get_oem_extension('Dell')
|
oem = self.manager.get_oem_extension('Dell')
|
||||||
include_in_export = mgr_cons.INCLUDE_EXPORT_READ_ONLY_PASSWORD_HASHES
|
include_in_export = mgr_cons.IncludeInExport.READ_ONLY_PASSWORD_HASHES
|
||||||
self.assertRaises(sushy.exceptions.InvalidParameterValueError,
|
self.assertRaises(sushy.exceptions.InvalidParameterValueError,
|
||||||
oem._export_system_configuration, "RAID",
|
oem._export_system_configuration,
|
||||||
|
mgr_cons.ExportTarget.RAID,
|
||||||
include_in_export=include_in_export)
|
include_in_export=include_in_export)
|
||||||
|
|
||||||
def test__export_system_configuration_include_in_export_legacy(
|
def test__export_system_configuration_include_in_export_legacy(
|
||||||
@ -210,10 +213,10 @@ class ManagerTestCase(BaseTestCase):
|
|||||||
'IncludeReadOnly,IncludePasswordHashValues']
|
'IncludeReadOnly,IncludePasswordHashValues']
|
||||||
oem.refresh()
|
oem.refresh()
|
||||||
|
|
||||||
include_in_export = mgr_cons.INCLUDE_EXPORT_READ_ONLY_PASSWORD_HASHES
|
include_in_export = mgr_cons.IncludeInExport.READ_ONLY_PASSWORD_HASHES
|
||||||
oem._export_system_configuration(
|
oem._export_system_configuration(
|
||||||
target=mgr_cons.EXPORT_TARGET_RAID,
|
target=mgr_cons.ExportTarget.RAID,
|
||||||
export_use=mgr_cons.EXPORT_USE_CLONE,
|
export_use=mgr_cons.ExportUse.CLONE,
|
||||||
include_in_export=include_in_export)
|
include_in_export=include_in_export)
|
||||||
|
|
||||||
self.conn.post.assert_called_once_with(
|
self.conn.post.assert_called_once_with(
|
||||||
@ -229,9 +232,9 @@ class ManagerTestCase(BaseTestCase):
|
|||||||
@mock.patch('sushy.resources.oem.common._global_extn_mgrs_by_resource', {})
|
@mock.patch('sushy.resources.oem.common._global_extn_mgrs_by_resource', {})
|
||||||
def test_get_allowed_export_use_values(self):
|
def test_get_allowed_export_use_values(self):
|
||||||
oem = self.manager.get_oem_extension('Dell')
|
oem = self.manager.get_oem_extension('Dell')
|
||||||
expected_values = {mgr_cons.EXPORT_USE_DEFAULT,
|
expected_values = {mgr_cons.ExportUse.DEFAULT,
|
||||||
mgr_cons.EXPORT_USE_CLONE,
|
mgr_cons.ExportUse.CLONE,
|
||||||
mgr_cons.EXPORT_USE_REPLACE}
|
mgr_cons.ExportUse.REPLACE}
|
||||||
allowed_values = oem.get_allowed_export_use_values()
|
allowed_values = oem.get_allowed_export_use_values()
|
||||||
self.assertIsInstance(allowed_values, set)
|
self.assertIsInstance(allowed_values, set)
|
||||||
self.assertEqual(expected_values, allowed_values)
|
self.assertEqual(expected_values, allowed_values)
|
||||||
@ -244,9 +247,9 @@ class ManagerTestCase(BaseTestCase):
|
|||||||
oem.json['Actions']['Oem'][export_action].pop(
|
oem.json['Actions']['Oem'][export_action].pop(
|
||||||
'ExportUse@Redfish.AllowableValues')
|
'ExportUse@Redfish.AllowableValues')
|
||||||
oem.refresh()
|
oem.refresh()
|
||||||
expected_values = {mgr_cons.EXPORT_USE_DEFAULT,
|
expected_values = {mgr_cons.ExportUse.DEFAULT,
|
||||||
mgr_cons.EXPORT_USE_CLONE,
|
mgr_cons.ExportUse.CLONE,
|
||||||
mgr_cons.EXPORT_USE_REPLACE}
|
mgr_cons.ExportUse.REPLACE}
|
||||||
allowed_values = oem.get_allowed_export_use_values()
|
allowed_values = oem.get_allowed_export_use_values()
|
||||||
self.assertIsInstance(allowed_values, set)
|
self.assertIsInstance(allowed_values, set)
|
||||||
self.assertEqual(expected_values, allowed_values)
|
self.assertEqual(expected_values, allowed_values)
|
||||||
@ -255,9 +258,9 @@ class ManagerTestCase(BaseTestCase):
|
|||||||
@mock.patch('sushy.resources.oem.common._global_extn_mgrs_by_resource', {})
|
@mock.patch('sushy.resources.oem.common._global_extn_mgrs_by_resource', {})
|
||||||
def test_get_allowed_include_in_export_values(self):
|
def test_get_allowed_include_in_export_values(self):
|
||||||
oem = self.manager.get_oem_extension('Dell')
|
oem = self.manager.get_oem_extension('Dell')
|
||||||
expected_values = {mgr_cons.INCLUDE_EXPORT_DEFAULT,
|
expected_values = {mgr_cons.IncludeInExport.DEFAULT,
|
||||||
mgr_cons.INCLUDE_EXPORT_READ_ONLY,
|
mgr_cons.IncludeInExport.READ_ONLY,
|
||||||
mgr_cons.INCLUDE_EXPORT_PASSWORD_HASHES}
|
mgr_cons.IncludeInExport.PASSWORD_HASHES}
|
||||||
allowed_values = oem.get_allowed_include_in_export_values()
|
allowed_values = oem.get_allowed_include_in_export_values()
|
||||||
self.assertIsInstance(allowed_values, set)
|
self.assertIsInstance(allowed_values, set)
|
||||||
self.assertEqual(expected_values, allowed_values)
|
self.assertEqual(expected_values, allowed_values)
|
||||||
@ -270,10 +273,10 @@ class ManagerTestCase(BaseTestCase):
|
|||||||
oem.json['Actions']['Oem'][export_action].pop(
|
oem.json['Actions']['Oem'][export_action].pop(
|
||||||
'IncludeInExport@Redfish.AllowableValues')
|
'IncludeInExport@Redfish.AllowableValues')
|
||||||
oem.refresh()
|
oem.refresh()
|
||||||
expected_values = {mgr_cons.INCLUDE_EXPORT_DEFAULT,
|
expected_values = {mgr_cons.IncludeInExport.DEFAULT,
|
||||||
mgr_cons.INCLUDE_EXPORT_READ_ONLY,
|
mgr_cons.IncludeInExport.READ_ONLY,
|
||||||
mgr_cons.INCLUDE_EXPORT_PASSWORD_HASHES,
|
mgr_cons.IncludeInExport.PASSWORD_HASHES,
|
||||||
mgr_cons.INCLUDE_EXPORT_READ_ONLY_PASSWORD_HASHES}
|
mgr_cons.IncludeInExport.READ_ONLY_PASSWORD_HASHES}
|
||||||
allowed_values = oem.get_allowed_include_in_export_values()
|
allowed_values = oem.get_allowed_include_in_export_values()
|
||||||
self.assertIsInstance(allowed_values, set)
|
self.assertIsInstance(allowed_values, set)
|
||||||
self.assertEqual(expected_values, allowed_values)
|
self.assertEqual(expected_values, allowed_values)
|
||||||
@ -289,10 +292,10 @@ class ManagerTestCase(BaseTestCase):
|
|||||||
response = oem.export_system_configuration()
|
response = oem.export_system_configuration()
|
||||||
|
|
||||||
self.assertEqual(mock_response, response)
|
self.assertEqual(mock_response, response)
|
||||||
include_in_export = mgr_cons.INCLUDE_EXPORT_READ_ONLY_PASSWORD_HASHES
|
include_in_export = mgr_cons.IncludeInExport.READ_ONLY_PASSWORD_HASHES
|
||||||
oem._export_system_configuration.assert_called_once_with(
|
oem._export_system_configuration.assert_called_once_with(
|
||||||
mgr_cons.EXPORT_TARGET_ALL,
|
mgr_cons.ExportTarget.ALL,
|
||||||
export_use=mgr_cons.EXPORT_USE_CLONE,
|
export_use=mgr_cons.ExportUse.CLONE,
|
||||||
include_in_export=include_in_export)
|
include_in_export=include_in_export)
|
||||||
|
|
||||||
@mock.patch('sushy.resources.oem.common._global_extn_mgrs_by_resource', {})
|
@mock.patch('sushy.resources.oem.common._global_extn_mgrs_by_resource', {})
|
||||||
@ -431,9 +434,9 @@ class ManagerTestCase(BaseTestCase):
|
|||||||
|
|
||||||
def test_get_allowed_import_shutdown_type_values(self):
|
def test_get_allowed_import_shutdown_type_values(self):
|
||||||
oem = self.manager.get_oem_extension('Dell')
|
oem = self.manager.get_oem_extension('Dell')
|
||||||
expected_values = {mgr_cons.IMPORT_SHUTDOWN_GRACEFUL,
|
expected_values = {mgr_cons.ShutdownType.GRACEFUL,
|
||||||
mgr_cons.IMPORT_SHUTDOWN_FORCED,
|
mgr_cons.ShutdownType.FORCED,
|
||||||
mgr_cons.IMPORT_SHUTDOWN_NO_REBOOT}
|
mgr_cons.ShutdownType.NO_REBOOT}
|
||||||
allowed_values = oem.get_allowed_import_shutdown_type_values()
|
allowed_values = oem.get_allowed_import_shutdown_type_values()
|
||||||
self.assertIsInstance(allowed_values, set)
|
self.assertIsInstance(allowed_values, set)
|
||||||
self.assertEqual(expected_values, allowed_values)
|
self.assertEqual(expected_values, allowed_values)
|
||||||
@ -446,9 +449,9 @@ class ManagerTestCase(BaseTestCase):
|
|||||||
oem.json['Actions']['Oem'][import_action].pop(
|
oem.json['Actions']['Oem'][import_action].pop(
|
||||||
'ShutdownType@Redfish.AllowableValues')
|
'ShutdownType@Redfish.AllowableValues')
|
||||||
oem.refresh()
|
oem.refresh()
|
||||||
expected_values = {mgr_cons.IMPORT_SHUTDOWN_GRACEFUL,
|
expected_values = {mgr_cons.ShutdownType.GRACEFUL,
|
||||||
mgr_cons.IMPORT_SHUTDOWN_FORCED,
|
mgr_cons.ShutdownType.FORCED,
|
||||||
mgr_cons.IMPORT_SHUTDOWN_NO_REBOOT}
|
mgr_cons.ShutdownType.NO_REBOOT}
|
||||||
allowed_values = oem.get_allowed_import_shutdown_type_values()
|
allowed_values = oem.get_allowed_import_shutdown_type_values()
|
||||||
self.assertIsInstance(allowed_values, set)
|
self.assertIsInstance(allowed_values, set)
|
||||||
self.assertEqual(expected_values, allowed_values)
|
self.assertEqual(expected_values, allowed_values)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# Copyright (c) 2021 Dell Inc. or its subsidiaries.
|
# Copyright (c) 2021-2022 Dell Inc. or its subsidiaries.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
# not use this file except in compliance with the License. You may obtain
|
# not use this file except in compliance with the License. You may obtain
|
||||||
@ -88,7 +88,7 @@ class SystemTestCase(BaseTestCase):
|
|||||||
self.oem_system.raid_service.convert_to_nonraid = mock_nonraid
|
self.oem_system.raid_service.convert_to_nonraid = mock_nonraid
|
||||||
|
|
||||||
task_mons = self.oem_system.change_physical_disk_state(
|
task_mons = self.oem_system.change_physical_disk_state(
|
||||||
sys_cons.PHYSICAL_DISK_STATE_MODE_RAID)
|
sys_cons.PhysicalDiskStateMode.RAID)
|
||||||
|
|
||||||
self.assertEqual([mock_taskmon], task_mons)
|
self.assertEqual([mock_taskmon], task_mons)
|
||||||
mock_raid.assert_called_once_with(
|
mock_raid.assert_called_once_with(
|
||||||
@ -104,7 +104,7 @@ class SystemTestCase(BaseTestCase):
|
|||||||
self.oem_system.raid_service.convert_to_nonraid = mock_nonraid
|
self.oem_system.raid_service.convert_to_nonraid = mock_nonraid
|
||||||
|
|
||||||
task_mons = self.oem_system.change_physical_disk_state(
|
task_mons = self.oem_system.change_physical_disk_state(
|
||||||
sys_cons.PHYSICAL_DISK_STATE_MODE_NONRAID)
|
sys_cons.PhysicalDiskStateMode.NONRAID)
|
||||||
|
|
||||||
self.assertEqual([mock_taskmon], task_mons)
|
self.assertEqual([mock_taskmon], task_mons)
|
||||||
mock_raid.assert_not_called()
|
mock_raid.assert_not_called()
|
||||||
|
@ -49,6 +49,11 @@ class TaskTestCase(BaseTestCase):
|
|||||||
self.assertEqual('Job Instance', self.oem_task.description)
|
self.assertEqual('Job Instance', self.oem_task.description)
|
||||||
self.assertIsNone(self.oem_task.completion_time)
|
self.assertIsNone(self.oem_task.completion_time)
|
||||||
self.assertEqual('TIME_NA', self.oem_task.end_time)
|
self.assertEqual('TIME_NA', self.oem_task.end_time)
|
||||||
|
self.assertEqual(ts_cons.JobState.SCHEDULED,
|
||||||
|
self.oem_task.job_state)
|
||||||
|
self.assertEqual(ts_cons.JobType.RAID_CONF,
|
||||||
|
self.oem_task.job_type)
|
||||||
|
# For backward compability
|
||||||
self.assertEqual(ts_cons.JOB_STATE_SCHEDULED,
|
self.assertEqual(ts_cons.JOB_STATE_SCHEDULED,
|
||||||
self.oem_task.job_state)
|
self.oem_task.job_state)
|
||||||
self.assertEqual(ts_cons.JOB_TYPE_RAID_CONF,
|
self.assertEqual(ts_cons.JOB_TYPE_RAID_CONF,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user