Merge "Migrate Manager constants to enums"
This commit is contained in:
@@ -25,78 +25,157 @@ RESET_MANAGER_GRACEFUL_RESTART = res_cons.ResetType.GRACEFUL_RESTART
|
||||
RESET_MANAGER_FORCE_RESTART = res_cons.ResetType.FORCE_RESTART
|
||||
"""Perform an immediate (non-graceful) shutdown, followed by a restart"""
|
||||
|
||||
# Manager Type constants
|
||||
|
||||
MANAGER_TYPE_MANAGEMENT_CONTROLLER = 'management controller'
|
||||
"""A controller used primarily to monitor or manage the operation of
|
||||
a device or system"""
|
||||
class ManagerType(enum.Enum):
|
||||
"""Manager Type constants"""
|
||||
|
||||
MANAGER_TYPE_ENCLOSURE_MANAGER = 'enclosure manager'
|
||||
"""A controller which provides management functions for a chassis
|
||||
or group of devices or systems"""
|
||||
MANAGEMENT_CONTROLLER = 'ManagementController'
|
||||
"""A controller that primarily monitors or manages the operation of a
|
||||
device or system."""
|
||||
|
||||
MANAGER_TYPE_BMC = 'bmc'
|
||||
"""A controller which provides management functions for a single
|
||||
computer system"""
|
||||
ENCLOSURE_MANAGER = 'EnclosureManager'
|
||||
"""A controller that provides management functions for a chassis or
|
||||
group of devices or systems."""
|
||||
|
||||
MANAGER_TYPE_RACK_MANAGER = 'rack manager'
|
||||
"""A controller which provides management functions for a whole or part
|
||||
of a rack"""
|
||||
BMC = 'BMC'
|
||||
"""A controller that provides management functions for a single computer
|
||||
system."""
|
||||
|
||||
MANAGER_TYPE_AUXILIARY_CONTROLLER = 'auxiliary controller'
|
||||
"""A controller which provides management functions for a particular
|
||||
subsystem or group of devices"""
|
||||
RACK_MANAGER = 'RackManager'
|
||||
"""A controller that provides management functions for a whole or part
|
||||
of a rack."""
|
||||
|
||||
# Graphical Console constants
|
||||
AUXILIARY_CONTROLLER = 'AuxiliaryController'
|
||||
"""A controller that provides management functions for a particular
|
||||
subsystem or group of devices."""
|
||||
|
||||
GRAPHICAL_CONSOLE_KVMIP = 'graphical console kvmip'
|
||||
"""Graphical Console connection using a KVM-IP (redirection of Keyboard,
|
||||
Video, Mouse over IP) protocol"""
|
||||
SERVICE = 'Service'
|
||||
"""A software-based service that provides management functions."""
|
||||
|
||||
GRAPHICAL_CONSOLE_OEM = 'graphical console oem'
|
||||
"""Graphical Console connection using an OEM-specific protocol"""
|
||||
|
||||
# Serial Console constants
|
||||
# Backward compatibility
|
||||
MANAGER_TYPE_MANAGEMENT_CONTROLLER = ManagerType.MANAGEMENT_CONTROLLER
|
||||
MANAGER_TYPE_ENCLOSURE_MANAGER = ManagerType.ENCLOSURE_MANAGER
|
||||
MANAGER_TYPE_BMC = ManagerType.BMC
|
||||
MANAGER_TYPE_RACK_MANAGER = ManagerType.RACK_MANAGER
|
||||
MANAGER_TYPE_AUXILIARY_CONTROLLER = ManagerType.AUXILIARY_CONTROLLER
|
||||
|
||||
SERIAL_CONSOLE_SSH = 'serial console ssh'
|
||||
"""Serial Console connection using the SSH protocol"""
|
||||
|
||||
SERIAL_CONSOLE_TELNET = 'serial console telnet'
|
||||
"""Serial Console connection using the Telnet protocol"""
|
||||
class GraphicalConnectType(enum.Enum):
|
||||
"""Graphical Console constants"""
|
||||
|
||||
SERIAL_CONSOLE_IPMI = 'serial console ipmi'
|
||||
"""Serial Console connection using the IPMI Serial-over-LAN (SOL) protocol"""
|
||||
KVMIP = 'KVMIP'
|
||||
"""The controller supports a graphical console connection through a KVM-
|
||||
IP (redirection of Keyboard, Video, Mouse over IP) protocol."""
|
||||
|
||||
SERIAL_CONSOLE_OEM = 'serial console oem'
|
||||
"""Serial Console connection using an OEM-specific protocol"""
|
||||
OEM = 'Oem'
|
||||
"""The controller supports a graphical console connection through an
|
||||
OEM-specific protocol."""
|
||||
|
||||
# Command Shell constants
|
||||
|
||||
COMMAND_SHELL_SSH = 'command shell ssh'
|
||||
"""Command Shell connection using the SSH protocol"""
|
||||
# Backward compatibility
|
||||
GRAPHICAL_CONSOLE_KVMIP = GraphicalConnectType.KVMIP
|
||||
GRAPHICAL_CONSOLE_OEM = GraphicalConnectType.OEM
|
||||
|
||||
COMMAND_SHELL_TELNET = 'command shell telnet'
|
||||
"""Command Shell connection using the Telnet protocol"""
|
||||
|
||||
COMMAND_SHELL_IPMI = 'command shell ipmi'
|
||||
"""Command Shell connection using the IPMI Serial-over-LAN (SOL) protocol"""
|
||||
class SerialConnectType(enum.Enum):
|
||||
"""Serial Console constants"""
|
||||
|
||||
COMMAND_SHELL_OEM = 'command shell oem'
|
||||
"""Command Shell connection using an OEM-specific protocol"""
|
||||
SSH = 'SSH'
|
||||
"""The controller supports a serial console connection through the SSH
|
||||
protocol."""
|
||||
|
||||
# Supported Virtual Media Type constants
|
||||
TELNET = 'Telnet'
|
||||
"""The controller supports a serial console connection through the
|
||||
Telnet protocol."""
|
||||
|
||||
VIRTUAL_MEDIA_CD = 'cd'
|
||||
VIRTUAL_MEDIA_DVD = 'dvd'
|
||||
VIRTUAL_MEDIA_FLOPPY = 'floppy'
|
||||
VIRTUAL_MEDIA_USBSTICK = 'usb'
|
||||
IPMI = 'IPMI'
|
||||
"""The controller supports a serial console connection through the IPMI
|
||||
Serial Over LAN (SOL) protocol."""
|
||||
|
||||
# Connected Via constants
|
||||
OEM = 'Oem'
|
||||
"""The controller supports a serial console connection through an OEM-
|
||||
specific protocol."""
|
||||
|
||||
CONNECTED_VIA_APPLET = 'applet'
|
||||
CONNECTED_VIA_NOT_CONNECTED = 'not_connected'
|
||||
CONNECTED_VIA_OEM = 'oem'
|
||||
CONNECTED_VIA_URI = 'uri'
|
||||
|
||||
# Backward compatibility
|
||||
SERIAL_CONSOLE_SSH = SerialConnectType.SSH
|
||||
SERIAL_CONSOLE_TELNET = SerialConnectType.TELNET
|
||||
SERIAL_CONSOLE_IPMI = SerialConnectType.IPMI
|
||||
SERIAL_CONSOLE_OEM = SerialConnectType.OEM
|
||||
|
||||
|
||||
class CommandConnectType(enum.Enum):
|
||||
"""Command Shell constants"""
|
||||
|
||||
SSH = 'SSH'
|
||||
"""The controller supports a command shell connection through the SSH
|
||||
protocol."""
|
||||
|
||||
TELNET = 'Telnet'
|
||||
"""The controller supports a command shell connection through the Telnet
|
||||
protocol."""
|
||||
|
||||
IPMI = 'IPMI'
|
||||
"""The controller supports a command shell connection through the IPMI
|
||||
Serial Over LAN (SOL) protocol."""
|
||||
|
||||
OEM = 'Oem'
|
||||
"""The controller supports a command shell connection through an OEM-
|
||||
specific protocol."""
|
||||
|
||||
|
||||
# Backward compatibility
|
||||
COMMAND_SHELL_SSH = CommandConnectType.SSH
|
||||
COMMAND_SHELL_TELNET = CommandConnectType.TELNET
|
||||
COMMAND_SHELL_IPMI = CommandConnectType.IPMI
|
||||
COMMAND_SHELL_OEM = CommandConnectType.OEM
|
||||
|
||||
|
||||
class VirtualMediaType(enum.Enum):
|
||||
"""Supported Virtual Media Type constants"""
|
||||
|
||||
CD = 'CD'
|
||||
"""A CD-ROM format (ISO) image."""
|
||||
|
||||
FLOPPY = 'Floppy'
|
||||
"""A floppy disk image."""
|
||||
|
||||
USB_STICK = 'USBStick'
|
||||
"""An emulation of a USB storage device."""
|
||||
|
||||
DVD = 'DVD'
|
||||
"""A DVD-ROM format image."""
|
||||
|
||||
|
||||
# Backward compatibility
|
||||
VIRTUAL_MEDIA_CD = VirtualMediaType.CD
|
||||
VIRTUAL_MEDIA_DVD = VirtualMediaType.DVD
|
||||
VIRTUAL_MEDIA_FLOPPY = VirtualMediaType.FLOPPY
|
||||
VIRTUAL_MEDIA_USBSTICK = VirtualMediaType.USB_STICK
|
||||
|
||||
|
||||
class ConnectedVia(enum.Enum):
|
||||
"""Connected Via constants"""
|
||||
|
||||
NOT_CONNECTED = 'NotConnected'
|
||||
"""No current connection."""
|
||||
|
||||
URI = 'URI'
|
||||
"""Connected to a URI location."""
|
||||
|
||||
APPLET = 'Applet'
|
||||
"""Connected to a client application."""
|
||||
|
||||
OEM = 'Oem'
|
||||
"""Connected through an OEM-defined method."""
|
||||
|
||||
|
||||
# Backward compatibility
|
||||
CONNECTED_VIA_NOT_CONNECTED = ConnectedVia.NOT_CONNECTED
|
||||
CONNECTED_VIA_URI = ConnectedVia.URI
|
||||
CONNECTED_VIA_APPLET = ConnectedVia.APPLET
|
||||
CONNECTED_VIA_OEM = ConnectedVia.OEM
|
||||
|
||||
|
||||
class TransferMethod(enum.Enum):
|
||||
|
||||
@@ -18,7 +18,8 @@ import logging
|
||||
from sushy import exceptions
|
||||
from sushy.resources import base
|
||||
from sushy.resources import common
|
||||
from sushy.resources.manager import mappings as mgr_maps
|
||||
from sushy.resources import constants as res_cons
|
||||
from sushy.resources.manager import constants as mgr_cons
|
||||
from sushy.resources.manager import virtual_media
|
||||
from sushy import utils
|
||||
|
||||
@@ -75,8 +76,7 @@ class Manager(base.ResourceBase):
|
||||
model = base.Field('Model')
|
||||
"""The manager model"""
|
||||
|
||||
manager_type = base.MappedField('ManagerType',
|
||||
mgr_maps.MANAGER_TYPE_VALUE_MAP)
|
||||
manager_type = base.MappedField('ManagerType', mgr_cons.ManagerType)
|
||||
"""The manager type"""
|
||||
|
||||
uuid = base.Field('UUID')
|
||||
@@ -110,12 +110,10 @@ class Manager(base.ResourceBase):
|
||||
LOG.warning('Could not figure out the supported values for '
|
||||
'remote access via graphical console for Manager %s',
|
||||
self.identity)
|
||||
return set(mgr_maps.GRAPHICAL_CONSOLE_VALUE_MAP_REV)
|
||||
return set(mgr_cons.GraphicalConnectType)
|
||||
|
||||
return set([mgr_maps.GRAPHICAL_CONSOLE_VALUE_MAP[v] for v in
|
||||
set(mgr_maps.GRAPHICAL_CONSOLE_VALUE_MAP).
|
||||
intersection(self.graphical_console.
|
||||
connect_types_supported)])
|
||||
return {v for v in mgr_cons.GraphicalConnectType
|
||||
if v.value in self.graphical_console.connect_types_supported}
|
||||
|
||||
def get_supported_serial_console_types(self):
|
||||
"""Get the supported values for Serial Console connection types.
|
||||
@@ -127,11 +125,10 @@ class Manager(base.ResourceBase):
|
||||
LOG.warning('Could not figure out the supported values for '
|
||||
'remote access via serial console for Manager %s',
|
||||
self.identity)
|
||||
return set(mgr_maps.SERIAL_CONSOLE_VALUE_MAP_REV)
|
||||
return set(mgr_cons.SerialConnectType)
|
||||
|
||||
return set([mgr_maps.SERIAL_CONSOLE_VALUE_MAP[v] for v in
|
||||
set(mgr_maps.SERIAL_CONSOLE_VALUE_MAP).
|
||||
intersection(self.serial_console.connect_types_supported)])
|
||||
return {v for v in mgr_cons.SerialConnectType
|
||||
if v.value in self.serial_console.connect_types_supported}
|
||||
|
||||
def get_supported_command_shell_types(self):
|
||||
"""Get the supported values for Command Shell connection types.
|
||||
@@ -143,11 +140,10 @@ class Manager(base.ResourceBase):
|
||||
LOG.warning('Could not figure out the supported values for '
|
||||
'remote access via command shell for Manager %s',
|
||||
self.identity)
|
||||
return set(mgr_maps.COMMAND_SHELL_VALUE_MAP_REV)
|
||||
return set(mgr_cons.CommandConnectType)
|
||||
|
||||
return set([mgr_maps.COMMAND_SHELL_VALUE_MAP[v] for v in
|
||||
set(mgr_maps.COMMAND_SHELL_VALUE_MAP).
|
||||
intersection(self.command_shell.connect_types_supported)])
|
||||
return {v for v in mgr_cons.CommandConnectType
|
||||
if v.value in self.command_shell.connect_types_supported}
|
||||
|
||||
def _get_reset_action_element(self):
|
||||
reset_action = self._actions.reset
|
||||
@@ -169,11 +165,10 @@ class Manager(base.ResourceBase):
|
||||
if not reset_action.allowed_values:
|
||||
LOG.warning('Could not figure out the allowed values for the '
|
||||
'reset manager action for Manager %s', self.identity)
|
||||
return set(mgr_maps.RESET_MANAGER_VALUE_MAP_REV)
|
||||
return set(res_cons.ResetType)
|
||||
|
||||
return set([mgr_maps.RESET_MANAGER_VALUE_MAP[v] for v in
|
||||
set(mgr_maps.RESET_MANAGER_VALUE_MAP).
|
||||
intersection(reset_action.allowed_values)])
|
||||
return {v for v in res_cons.ResetType
|
||||
if v.value in reset_action.allowed_values}
|
||||
|
||||
def reset_manager(self, value):
|
||||
"""Reset the manager.
|
||||
@@ -187,7 +182,7 @@ class Manager(base.ResourceBase):
|
||||
raise exceptions.InvalidParameterValueError(
|
||||
parameter='value', value=value, valid_values=valid_resets)
|
||||
|
||||
value = mgr_maps.RESET_MANAGER_VALUE_MAP_REV[value]
|
||||
value = res_cons.ResetType(value).value
|
||||
target_uri = self._get_reset_action_element().target_uri
|
||||
|
||||
LOG.debug('Resetting the Manager %s ...', self.identity)
|
||||
|
||||
@@ -1,75 +0,0 @@
|
||||
# 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.resources.manager import constants as mgr_cons
|
||||
from sushy import utils
|
||||
|
||||
|
||||
RESET_MANAGER_VALUE_MAP = {
|
||||
'GracefulRestart': mgr_cons.RESET_MANAGER_GRACEFUL_RESTART,
|
||||
'ForceRestart': mgr_cons.RESET_MANAGER_FORCE_RESTART,
|
||||
}
|
||||
|
||||
RESET_MANAGER_VALUE_MAP_REV = utils.revert_dictionary(RESET_MANAGER_VALUE_MAP)
|
||||
|
||||
MANAGER_TYPE_VALUE_MAP = {
|
||||
'ManagementController': mgr_cons.MANAGER_TYPE_MANAGEMENT_CONTROLLER,
|
||||
'EnclosureManager': mgr_cons.MANAGER_TYPE_ENCLOSURE_MANAGER,
|
||||
'BMC': mgr_cons.MANAGER_TYPE_BMC,
|
||||
'RackManager': mgr_cons.MANAGER_TYPE_RACK_MANAGER,
|
||||
'AuxiliaryController': mgr_cons.MANAGER_TYPE_AUXILIARY_CONTROLLER
|
||||
}
|
||||
|
||||
MANAGER_TYPE_VALUE_MAP_REV = (
|
||||
utils.revert_dictionary(MANAGER_TYPE_VALUE_MAP))
|
||||
|
||||
GRAPHICAL_CONSOLE_VALUE_MAP = {
|
||||
'KVMIP': mgr_cons.GRAPHICAL_CONSOLE_KVMIP,
|
||||
'Oem': mgr_cons.GRAPHICAL_CONSOLE_OEM,
|
||||
}
|
||||
|
||||
GRAPHICAL_CONSOLE_VALUE_MAP_REV = (
|
||||
utils.revert_dictionary(GRAPHICAL_CONSOLE_VALUE_MAP))
|
||||
|
||||
SERIAL_CONSOLE_VALUE_MAP = {
|
||||
'SSH': mgr_cons.SERIAL_CONSOLE_SSH,
|
||||
'Telnet': mgr_cons.SERIAL_CONSOLE_TELNET,
|
||||
'IPMI': mgr_cons.SERIAL_CONSOLE_IPMI,
|
||||
'Oem': mgr_cons.SERIAL_CONSOLE_OEM,
|
||||
}
|
||||
|
||||
SERIAL_CONSOLE_VALUE_MAP_REV = (
|
||||
utils.revert_dictionary(SERIAL_CONSOLE_VALUE_MAP))
|
||||
|
||||
COMMAND_SHELL_VALUE_MAP = {
|
||||
'SSH': mgr_cons.COMMAND_SHELL_SSH,
|
||||
'Telnet': mgr_cons.COMMAND_SHELL_TELNET,
|
||||
'IPMI': mgr_cons.COMMAND_SHELL_IPMI,
|
||||
'Oem': mgr_cons.COMMAND_SHELL_OEM,
|
||||
}
|
||||
|
||||
COMMAND_SHELL_VALUE_MAP_REV = (
|
||||
utils.revert_dictionary(COMMAND_SHELL_VALUE_MAP))
|
||||
|
||||
MEDIA_TYPE_VALUE_MAP = {
|
||||
'CD': mgr_cons.VIRTUAL_MEDIA_CD,
|
||||
'DVD': mgr_cons.VIRTUAL_MEDIA_DVD,
|
||||
'Floppy': mgr_cons.VIRTUAL_MEDIA_FLOPPY,
|
||||
'USBStick': mgr_cons.VIRTUAL_MEDIA_USBSTICK
|
||||
}
|
||||
|
||||
CONNECTED_VIA_VALUE_MAP = {
|
||||
"Applet": mgr_cons.CONNECTED_VIA_APPLET,
|
||||
"NotConnected": mgr_cons.CONNECTED_VIA_NOT_CONNECTED,
|
||||
"Oem": mgr_cons.CONNECTED_VIA_OEM,
|
||||
"URI": mgr_cons.CONNECTED_VIA_URI
|
||||
}
|
||||
@@ -19,7 +19,6 @@ from sushy import exceptions
|
||||
from sushy.resources import base
|
||||
from sushy.resources import common
|
||||
from sushy.resources.manager import constants as mgr_cons
|
||||
from sushy.resources.manager import mappings as mgr_maps
|
||||
|
||||
|
||||
class ActionsField(base.CompositeField):
|
||||
@@ -36,8 +35,7 @@ class VirtualMedia(base.ResourceBase):
|
||||
name = base.Field('Name', required=True)
|
||||
"""The name of resource"""
|
||||
|
||||
connected_via = base.MappedField('ConnectedVia',
|
||||
mgr_maps.CONNECTED_VIA_VALUE_MAP)
|
||||
connected_via = base.MappedField('ConnectedVia', mgr_cons.ConnectedVia)
|
||||
"""Current virtual media connection methods
|
||||
|
||||
Applet: Connected to a client application
|
||||
@@ -55,11 +53,8 @@ class VirtualMedia(base.ResourceBase):
|
||||
inserted = base.Field('Inserted')
|
||||
"""Indicates if virtual media is inserted in the virtual device"""
|
||||
|
||||
media_types = base.Field(
|
||||
'MediaTypes', adapter=(
|
||||
lambda x: [mgr_maps.MEDIA_TYPE_VALUE_MAP[v] for v in x
|
||||
if v in mgr_maps.MEDIA_TYPE_VALUE_MAP]),
|
||||
default=[])
|
||||
media_types = base.MappedListField(
|
||||
'MediaTypes', mgr_cons.VirtualMediaType, default=[])
|
||||
"""List of supported media types as virtual media"""
|
||||
|
||||
status = common.StatusField('Status')
|
||||
|
||||
@@ -56,13 +56,13 @@ class ManagerTestCase(base.TestCase):
|
||||
self.assertEqual('BMC', self.manager.identity)
|
||||
self.assertEqual('Manager', self.manager.name)
|
||||
self.assertEqual('Joo Janta 200', self.manager.model)
|
||||
self.assertEqual(sushy.MANAGER_TYPE_BMC, self.manager.manager_type)
|
||||
self.assertEqual(sushy.ManagerType.BMC, self.manager.manager_type)
|
||||
self.assertEqual('58893887-8974-2487-2389-841168418919',
|
||||
self.manager.uuid)
|
||||
|
||||
def test_get_supported_graphical_console_types(self):
|
||||
# | GIVEN |
|
||||
expected = set([sushy.GRAPHICAL_CONSOLE_KVMIP])
|
||||
expected = set([sushy.GraphicalConnectType.KVMIP])
|
||||
# | WHEN |
|
||||
values = self.manager.get_supported_graphical_console_types()
|
||||
# | THEN |
|
||||
@@ -72,8 +72,8 @@ class ManagerTestCase(base.TestCase):
|
||||
def test_get_supported_graphical_console_types_for_no_connect_types(self):
|
||||
# | GIVEN |
|
||||
graphical_console = self.manager.graphical_console
|
||||
expected = set([sushy.GRAPHICAL_CONSOLE_KVMIP,
|
||||
sushy.GRAPHICAL_CONSOLE_OEM])
|
||||
expected = set([sushy.GraphicalConnectType.KVMIP,
|
||||
sushy.GraphicalConnectType.OEM])
|
||||
|
||||
for val in [None, []]:
|
||||
graphical_console.connect_types_supported = val
|
||||
@@ -86,8 +86,8 @@ class ManagerTestCase(base.TestCase):
|
||||
def test_get_supported_graphical_console_types_missing_graphcon_attr(self):
|
||||
# | GIVEN |
|
||||
self.manager.graphical_console = None
|
||||
expected = set([sushy.GRAPHICAL_CONSOLE_KVMIP,
|
||||
sushy.GRAPHICAL_CONSOLE_OEM])
|
||||
expected = set([sushy.GraphicalConnectType.KVMIP,
|
||||
sushy.GraphicalConnectType.OEM])
|
||||
# | WHEN |
|
||||
values = self.manager.get_supported_graphical_console_types()
|
||||
# | THEN |
|
||||
@@ -96,9 +96,9 @@ class ManagerTestCase(base.TestCase):
|
||||
|
||||
def test_get_supported_serial_console_types(self):
|
||||
# | GIVEN |
|
||||
expected = set([sushy.SERIAL_CONSOLE_SSH,
|
||||
sushy.SERIAL_CONSOLE_TELNET,
|
||||
sushy.SERIAL_CONSOLE_IPMI])
|
||||
expected = set([sushy.SerialConnectType.SSH,
|
||||
sushy.SerialConnectType.TELNET,
|
||||
sushy.SerialConnectType.IPMI])
|
||||
# | WHEN |
|
||||
values = self.manager.get_supported_serial_console_types()
|
||||
# | THEN |
|
||||
@@ -108,10 +108,10 @@ class ManagerTestCase(base.TestCase):
|
||||
def test_get_supported_serial_console_types_for_no_connect_types(self):
|
||||
# | GIVEN |
|
||||
serial_console = self.manager.serial_console
|
||||
expected = set([sushy.SERIAL_CONSOLE_SSH,
|
||||
sushy.SERIAL_CONSOLE_TELNET,
|
||||
sushy.SERIAL_CONSOLE_IPMI,
|
||||
sushy.SERIAL_CONSOLE_OEM])
|
||||
expected = set([sushy.SerialConnectType.SSH,
|
||||
sushy.SerialConnectType.TELNET,
|
||||
sushy.SerialConnectType.IPMI,
|
||||
sushy.SerialConnectType.OEM])
|
||||
|
||||
for val in [None, []]:
|
||||
serial_console.connect_types_supported = val
|
||||
@@ -124,10 +124,10 @@ class ManagerTestCase(base.TestCase):
|
||||
def test_get_supported_serial_console_types_missing_serialcon_attr(self):
|
||||
# | GIVEN |
|
||||
self.manager.serial_console = None
|
||||
expected = set([sushy.SERIAL_CONSOLE_SSH,
|
||||
sushy.SERIAL_CONSOLE_TELNET,
|
||||
sushy.SERIAL_CONSOLE_IPMI,
|
||||
sushy.SERIAL_CONSOLE_OEM])
|
||||
expected = set([sushy.SerialConnectType.SSH,
|
||||
sushy.SerialConnectType.TELNET,
|
||||
sushy.SerialConnectType.IPMI,
|
||||
sushy.SerialConnectType.OEM])
|
||||
# | WHEN |
|
||||
values = self.manager.get_supported_serial_console_types()
|
||||
# | THEN |
|
||||
@@ -136,8 +136,8 @@ class ManagerTestCase(base.TestCase):
|
||||
|
||||
def test_get_supported_command_shell_types(self):
|
||||
# | GIVEN |
|
||||
expected = set([sushy.COMMAND_SHELL_SSH,
|
||||
sushy.COMMAND_SHELL_TELNET])
|
||||
expected = set([sushy.CommandConnectType.SSH,
|
||||
sushy.CommandConnectType.TELNET])
|
||||
# | WHEN |
|
||||
values = self.manager.get_supported_command_shell_types()
|
||||
# | THEN |
|
||||
@@ -147,10 +147,10 @@ class ManagerTestCase(base.TestCase):
|
||||
def test_get_supported_command_shell_types_for_no_connect_types(self):
|
||||
# | GIVEN |
|
||||
command_shell = self.manager.command_shell
|
||||
expected = set([sushy.COMMAND_SHELL_SSH,
|
||||
sushy.COMMAND_SHELL_TELNET,
|
||||
sushy.COMMAND_SHELL_IPMI,
|
||||
sushy.COMMAND_SHELL_OEM])
|
||||
expected = set([sushy.CommandConnectType.SSH,
|
||||
sushy.CommandConnectType.TELNET,
|
||||
sushy.CommandConnectType.IPMI,
|
||||
sushy.CommandConnectType.OEM])
|
||||
|
||||
for val in [None, []]:
|
||||
command_shell.connect_types_supported = val
|
||||
@@ -163,10 +163,10 @@ class ManagerTestCase(base.TestCase):
|
||||
def test_get_supported_command_shell_types_missing_cmdshell_attr(self):
|
||||
# | GIVEN |
|
||||
self.manager.command_shell = None
|
||||
expected = set([sushy.COMMAND_SHELL_SSH,
|
||||
sushy.COMMAND_SHELL_TELNET,
|
||||
sushy.COMMAND_SHELL_IPMI,
|
||||
sushy.COMMAND_SHELL_OEM])
|
||||
expected = set([sushy.CommandConnectType.SSH,
|
||||
sushy.CommandConnectType.TELNET,
|
||||
sushy.CommandConnectType.IPMI,
|
||||
sushy.CommandConnectType.OEM])
|
||||
# | WHEN |
|
||||
values = self.manager.get_supported_command_shell_types()
|
||||
# | THEN |
|
||||
@@ -175,8 +175,8 @@ class ManagerTestCase(base.TestCase):
|
||||
|
||||
def test_get_allowed_reset_manager_values(self):
|
||||
# | GIVEN |
|
||||
expected = set([sushy.RESET_MANAGER_GRACEFUL_RESTART,
|
||||
sushy.RESET_MANAGER_FORCE_RESTART])
|
||||
expected = set([sushy.ResetType.GRACEFUL_RESTART,
|
||||
sushy.ResetType.FORCE_RESTART])
|
||||
# | WHEN |
|
||||
values = self.manager.get_allowed_reset_manager_values()
|
||||
# | THEN |
|
||||
@@ -186,8 +186,18 @@ class ManagerTestCase(base.TestCase):
|
||||
def test_get_allowed_reset_manager_values_for_no_values_set(self):
|
||||
# | GIVEN |
|
||||
self.manager._actions.reset.allowed_values = []
|
||||
expected = set([sushy.RESET_MANAGER_GRACEFUL_RESTART,
|
||||
sushy.RESET_MANAGER_FORCE_RESTART])
|
||||
expected = set([sushy.ResetType.GRACEFUL_SHUTDOWN,
|
||||
sushy.ResetType.GRACEFUL_RESTART,
|
||||
sushy.ResetType.FORCE_RESTART,
|
||||
sushy.ResetType.FORCE_OFF,
|
||||
sushy.ResetType.FORCE_ON,
|
||||
sushy.ResetType.ON,
|
||||
sushy.ResetType.NMI,
|
||||
sushy.ResetType.PUSH_POWER_BUTTON,
|
||||
sushy.ResetType.POWER_CYCLE,
|
||||
sushy.ResetType.SUSPEND,
|
||||
sushy.ResetType.RESUME,
|
||||
sushy.ResetType.PAUSE])
|
||||
# | WHEN |
|
||||
values = self.manager.get_allowed_reset_manager_values()
|
||||
# | THEN |
|
||||
@@ -203,7 +213,7 @@ class ManagerTestCase(base.TestCase):
|
||||
self.manager.get_allowed_reset_manager_values)
|
||||
|
||||
def test_reset_manager(self):
|
||||
self.manager.reset_manager(sushy.RESET_MANAGER_GRACEFUL_RESTART)
|
||||
self.manager.reset_manager(sushy.ResetType.GRACEFUL_RESTART)
|
||||
self.manager._conn.post.assert_called_once_with(
|
||||
'/redfish/v1/Managers/BMC/Actions/Manager.Reset',
|
||||
data={'ResetType': 'GracefulRestart'})
|
||||
|
||||
@@ -48,10 +48,10 @@ class VirtualMediaTestCase(base.TestCase):
|
||||
self.sys_virtual_media.image)
|
||||
self.assertEqual('Sardine2.1.43.35.6a',
|
||||
self.sys_virtual_media.image_name)
|
||||
self.assertEqual(sushy.CONNECTED_VIA_URI,
|
||||
self.assertEqual(sushy.ConnectedVia.URI,
|
||||
self.sys_virtual_media.connected_via)
|
||||
self.assertEqual([sushy.VIRTUAL_MEDIA_FLOPPY,
|
||||
sushy.VIRTUAL_MEDIA_USBSTICK],
|
||||
self.assertEqual([sushy.VirtualMediaType.FLOPPY,
|
||||
sushy.VirtualMediaType.USB_STICK],
|
||||
self.sys_virtual_media.media_types)
|
||||
self.assertEqual(True, self.sys_virtual_media.inserted)
|
||||
self.assertEqual(False, self.sys_virtual_media.write_protected)
|
||||
@@ -62,10 +62,10 @@ class VirtualMediaTestCase(base.TestCase):
|
||||
# Test that various types are returned correctly
|
||||
self.assertEqual('https://www.dmtf.org/freeImages/Sardine.img',
|
||||
attributes.get('image'))
|
||||
self.assertEqual(sushy.CONNECTED_VIA_URI,
|
||||
self.assertEqual(sushy.ConnectedVia.URI,
|
||||
attributes.get('connected_via'))
|
||||
self.assertEqual([sushy.VIRTUAL_MEDIA_FLOPPY,
|
||||
sushy.VIRTUAL_MEDIA_USBSTICK],
|
||||
self.assertEqual([sushy.VirtualMediaType.FLOPPY,
|
||||
sushy.VirtualMediaType.USB_STICK],
|
||||
attributes.get('media_types'))
|
||||
|
||||
def test_insert_media_none(self):
|
||||
|
||||
Reference in New Issue
Block a user