Merge "Unify sushy models by Redfish schema bundle"

This commit is contained in:
Zuul 2018-12-12 10:54:45 +00:00 committed by Gerrit Code Review
commit 3ac4cbd42d
34 changed files with 216 additions and 38 deletions

View File

@ -0,0 +1,7 @@
features:
- |
Unifies sushy models by Redfish schema bundle.
These changes introduce and update currently implemented
sushy models to comply with the most recent schema bundle[1].
[1]https://www.dmtf.org/documents/redfish-spmf/redfish-schema-bundle-20181

View File

@ -10,6 +10,9 @@
# License for the specific language governing permissions and limitations
# under the License.
# This is referred from Redfish standard schema.
# https://redfish.dmtf.org/schemas/Manager.v1_4_0.json
import logging
from sushy import exceptions
@ -38,6 +41,10 @@ class RemoteAccessField(base.CompositeField):
class Manager(base.ResourceBase):
auto_dst_enabled = base.Field('AutoDSTEnabled')
"""Indicates whether the manager is configured for automatic DST
adjustment"""
firmware_version = base.Field('FirmwareVersion')
"""The manager firmware version"""

View File

@ -10,6 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
# This is referred from Redfish standard schema.
# https://redfish.dmtf.org/schemas/v1/MessageRegistryFileCollection.json
# https://redfish.dmtf.org/schemas/v1/MessageRegistryFile.v1_1_0.json

View File

@ -13,6 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
# This is referred from Redfish standard schema.
# https://redfish.dmtf.org/schemas/Session.v1_1_0.json
import logging
from sushy.resources import base

View File

@ -13,6 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
# This is referred from Redfish standard schema.
# https://redfish.dmtf.org/schemas/SessionService.v1_1_3.json
import logging
from sushy import exceptions

View File

@ -11,7 +11,7 @@
# under the License.
# This is referred from Redfish standard schema.
# http://redfish.dmtf.org/schemas/v1/Settings.v1_0_0.json
# https://redfish.dmtf.org/schemas/Settings.v1_2_0.json
from sushy.resources import base
@ -48,6 +48,38 @@ class MessageListField(base.ListField):
"""
class MaintenanceWindowField(base.CompositeField):
maintenance_window_duration_in_seconds = base.Field(
'MaintenanceWindowDurationInSeconds',
required=True)
"""The expiry time of maintenance window in seconds"""
maintenance_window_start_time = base.Field(
'MaintenanceWindowStartTime',
required=True)
"""The start time of a maintenance window"""
class OperationApplyTimeSupportField(base.CompositeField):
maintenance_window_duration_in_seconds = base.Field(
'MaintenanceWindowDurationInSeconds')
"""The expiry time of maintenance window in seconds"""
maintenance_window_resource = base.Field(
'MaintenanceWindowResource')
"""The location of the maintenance window settings"""
maintenance_window_start_time = base.Field(
'MaintenanceWindowStartTime')
"""The start time of a maintenance window"""
supported_values = base.Field('SupportedValues', required=True)
"""The client is allowed request when performing a create, delete, or
action operation"""
class SettingsField(base.CompositeField):
"""The settings of a resource
@ -76,10 +108,19 @@ class SettingsField(base.CompositeField):
to change this resource
"""
_maintenance_window = MaintenanceWindowField('MaintenanceWindow')
"""Indicates if a given resource has a maintenance window assignment
for applying settings or operations"""
messages = MessageListField("Messages")
"""Represents the results of the last time the values of the Settings
resource were applied to the server"""
_operation_apply_time_support = OperationApplyTimeSupportField(
'OperationApplyTimeSupport')
"""Indicates if a client is allowed to request for a specific apply
time of a create, delete, or action operation of a given resource"""
def commit(self, connector, value):
"""Commits new settings values

View File

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
# Values comes from the Redfish System json-schema 1.0.0:
# Values come from the Redfish System json-schema 1.0.0:
# http://redfish.dmtf.org/schemas/v1/ComputerSystem.v1_0_0.json#/definitions/ComputerSystem # noqa
from sushy.resources import constants as res_cons
@ -114,8 +114,8 @@ BOOT_SOURCE_ENABLED_CONTINUOUS = 'continuous'
BOOT_SOURCE_ENABLED_DISABLED = 'disabled'
# Processor related constants
# Values comes from the Redfish Processor json-schema 1.0.0:
# http://redfish.dmtf.org/schemas/v1/Processor.v1_0_0.json
# Values comes from the Redfish Processor json-schema 1.3.0:
# http://redfish.dmtf.org/schemas/v1/Processor.v1_3_0.json
# Processor Architecture constants
@ -124,3 +124,25 @@ PROCESSOR_ARCH_IA_64 = 'Intel Itanium'
PROCESSOR_ARCH_ARM = 'ARM'
PROCESSOR_ARCH_MIPS = 'MIPS'
PROCESSOR_ARCH_OEM = 'OEM-defined'
# Processor type constants
PROCESSOR_TYPE_ACCELERATOR = 'An Accelerator'
PROCESSOR_TYPE_CPU = 'A Central Processing Unit'
PROCESSOR_TYPE_CORE = 'A Core in a Processor'
PROCESSOR_TYPE_DSP = 'A Digital Signal Processor'
PROCESSOR_TYPE_FPGA = 'A Field Programmable Gate Array'
PROCESSOR_TYPE_GPU = 'A Graphics Processing Unit'
PROCESSOR_TYPE_OEM = 'An OEM-defined Processing Unit'
PROCESSOR_TYPE_THREAD = 'A Thread in a Processor'
# Processor InstructionSet constants
PROCESSOR_INSTRUCTIONSET_ARM_A32 = 'ARM 32-bit'
PROCESSOR_INSTRUCTIONSET_ARM_A64 = 'ARM 64-bit'
PROCESSOR_INSTRUCTIONSET_IA_64 = 'Intel IA-64'
PROCESSOR_INSTRUCTIONSET_MIPS32 = 'MIPS 32-bit'
PROCESSOR_INSTRUCTIONSET_MIPS64 = 'MIPS 64-bit'
PROCESSOR_INSTRUCTIONSET_OEM = 'OEM-defined'
PROCESSOR_INSTRUCTIONSET_x86 = 'x86 32-bit'
PROCESSOR_INSTRUCTIONSET_x86_64 = 'x86 64-bit'

View File

@ -11,7 +11,7 @@
# under the License.
# This is referred from Redfish standard schema.
# http://redfish.dmtf.org/schemas/EthernetInterface.v1_3_0.json
# https://redfish.dmtf.org/schemas/EthernetInterface.v1_4_0.json
import logging

View File

@ -73,3 +73,31 @@ PROCESSOR_ARCH_VALUE_MAP = {
PROCESSOR_ARCH_VALUE_MAP_REV = (
utils.revert_dictionary(PROCESSOR_ARCH_VALUE_MAP))
PROCESSOR_TYPE_VALUE_MAP = {
'Accelerator': sys_cons.PROCESSOR_TYPE_ACCELERATOR,
'CPU': sys_cons.PROCESSOR_TYPE_CPU,
'Core': sys_cons.PROCESSOR_TYPE_CORE,
'DSP': sys_cons.PROCESSOR_TYPE_DSP,
'FPGA': sys_cons.PROCESSOR_TYPE_FPGA,
'GPU': sys_cons.PROCESSOR_TYPE_GPU,
'OEM': sys_cons.PROCESSOR_TYPE_OEM,
'Thread': sys_cons.PROCESSOR_TYPE_THREAD
}
PROCESSOR_TYPE_VALUE_MAP_REV = (
utils.revert_dictionary(PROCESSOR_TYPE_VALUE_MAP))
PROCESSOR_INSTRUCTIONSET_VALUE_MAP = {
'ARM-A32': sys_cons.PROCESSOR_INSTRUCTIONSET_ARM_A32,
'ARM-A64': sys_cons.PROCESSOR_INSTRUCTIONSET_ARM_A64,
'IA-64': sys_cons.PROCESSOR_INSTRUCTIONSET_IA_64,
'MIPS32': sys_cons.PROCESSOR_INSTRUCTIONSET_MIPS32,
'MIPS64': sys_cons.PROCESSOR_INSTRUCTIONSET_MIPS64,
'OEM': sys_cons.PROCESSOR_INSTRUCTIONSET_OEM,
'x86': sys_cons.PROCESSOR_INSTRUCTIONSET_x86,
'x86-64': sys_cons.PROCESSOR_INSTRUCTIONSET_x86_64
}
PROCESSOR_INSTRUCTIONSET_VALUE_MAP_REV = (
utils.revert_dictionary(PROCESSOR_INSTRUCTIONSET_VALUE_MAP))

View File

@ -12,9 +12,13 @@
# License for the specific language governing permissions and limitations
# under the License.
# This is referred from Redfish standard schema.
# https://redfish.dmtf.org/schemas/Processor.v1_3_0.json
import collections
import logging
from sushy import exceptions
from sushy.resources import base
from sushy.resources import common
from sushy.resources.system import mappings as sys_maps
@ -55,16 +59,16 @@ class Processor(base.ResourceBase):
socket = base.Field('Socket')
"""The socket or location of the processor"""
# TODO(deray): Create mappings for the processor_type
processor_type = base.Field('ProcessorType')
processor_type = base.MappedField(
'ProcessorType', sys_maps.PROCESSOR_TYPE_VALUE_MAP)
"""The type of processor"""
processor_architecture = base.MappedField(
'ProcessorArchitecture', sys_maps.PROCESSOR_ARCH_VALUE_MAP)
"""The architecture of the processor"""
# TODO(deray): Create mappings for the instruction_set
instruction_set = base.Field('InstructionSet')
instruction_set = base.MappedField(
'InstructionSet', sys_maps.PROCESSOR_INSTRUCTIONSET_VALUE_MAP)
"""The instruction set of the processor"""
manufacturer = base.Field('Manufacturer')
@ -98,6 +102,26 @@ class Processor(base.ResourceBase):
"""
super(Processor, self).__init__(connector, identity, redfish_version)
def _get_processor_collection_path(self):
"""Helper function to find the ProcessorCollection path"""
pro_col = self.json.get('ProcessorCollection')
if not pro_col:
raise exceptions.MissingAttributeError(
attribute='ProcessorCollection', resource=self._path)
return pro_col.get('@odata.id')
@property
@utils.cache_it
def sub_processors(self):
"""A reference to
the collection of Sub-Processors associated with
this system, such as cores or threads that are part of a processor.
"""
return ProcessorCollection(
self.conn, self._get_processor_collection_path,
redfish_version=self.redfish_version)
class ProcessorCollection(base.ResourceCollectionBase):

View File

@ -11,7 +11,7 @@
# under the License.
# This is referred from Redfish standard schema.
# http://redfish.dmtf.org/schemas/v1/Drive.v1_3_0.json
# http://redfish.dmtf.org/schemas/v1/Drive.v1_4_0.json
import logging

View File

@ -13,6 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
# This is referred from Redfish standard schema.
# https://redfish.dmtf.org/schemas/ComputerSystem.v1_5_0.json
import logging
from sushy import exceptions

View File

@ -1,5 +1,5 @@
{
"@odata.type": "#Bios.v1_0_0.Bios",
"@odata.type": "#Bios.v1_0_3.Bios",
"Id": "BIOS",
"Name": "BIOS Configuration Current Settings",
"AttributeRegistry": "BiosAttributeRegistryP89.v1_0_0",

View File

@ -1,5 +1,5 @@
{
"@odata.type": "#Bios.v1_0_0.Bios",
"@odata.type": "#Bios.v1_0_3.Bios",
"Id": "Settings",
"Name": "BIOS Configuration Pending Settings",
"AttributeRegistry": "BiosAttributeRegistryP89.v1_0_0",

View File

@ -1,5 +1,5 @@
{
"@odata.type": "#Drive.v1_2_0.Drive",
"@odata.type": "#Drive.v1_4_0.Drive",
"Id": "32ADF365C6C1B7BD",
"Name": "Drive Sample",
"IndicatorLED": "Lit",
@ -43,4 +43,4 @@
"@odata.context": "/redfish/v1/$metadata#Drive.Drive",
"@odata.id": "/redfish/v1/Systems/437XR1138R2/Storage/1/Drives/32ADF365C6C1B7BD",
"@Redfish.Copyright": "Copyright 2014-2017 Distributed Management Task Force, Inc. (DMTF). For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright."
}
}

View File

@ -1,5 +1,5 @@
{
"@odata.type": "#Drive.v1_2_0.Drive",
"@odata.type": "#Drive.v1_4_0.Drive",
"Id": "35D38F11ACEF7BD3",
"Name": "Drive Sample",
"IndicatorLED": "Lit",
@ -48,4 +48,4 @@
"@odata.context": "/redfish/v1/$metadata#Drive.Drive",
"@odata.id": "/redfish/v1/Systems/437XR1138R2/Storage/1/Drives/35D38F11ACEF7BD3",
"@Redfish.Copyright": "Copyright 2014-2017 Distributed Management Task Force, Inc. (DMTF). For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright."
}
}

View File

@ -1,5 +1,5 @@
{
"@odata.type": "#Drive.v1_2_0.Drive",
"@odata.type": "#Drive.v1_4_0.Drive",
"Id": "3D58ECBC375FD9F2",
"Name": "Drive Sample",
"IndicatorLED": "Lit",
@ -51,4 +51,4 @@
"@odata.context": "/redfish/v1/$metadata#Drive.Drive",
"@odata.id": "/redfish/v1/Systems/437XR1138R2/Storage/1/Drives/3D58ECBC375FD9F2",
"@Redfish.Copyright": "Copyright 2014-2017 Distributed Management Task Force, Inc. (DMTF). For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright."
}
}

View File

@ -1,5 +1,5 @@
{
"@odata.type": "#EthernetInterface.v1_0_2.EthernetInterface",
"@odata.type": "#EthernetInterface.v1_4_0.EthernetInterface",
"Id": "1",
"Name": "Ethernet Interface",
"Description": "System NIC 1",

View File

@ -1,5 +1,5 @@
{
"@odata.type": "#Manager.v1_1_0.Manager",
"@odata.type": "#Manager.v1_4_0.Manager",
"Id": "BMC",
"Name": "Manager",
"ManagerType": "BMC",
@ -9,6 +9,7 @@
"Model": "Joo Janta 200",
"DateTime": "2015-03-13T04:14:33+06:00",
"DateTimeLocalOffset": "+06:00",
"AutoDSTEnabled": false,
"Status": {
"State": "Enabled",
"Health": "OK"

View File

@ -1,11 +1,11 @@
{
"@odata.type": "#MessageRegistry.v1_0_0.MessageRegistry",
"Id": "Test.1.0.0",
"@odata.type": "#MessageRegistry.v1_1_1.MessageRegistry",
"Id": "Test.1.1.1",
"Name": "Test Message Registry",
"Language": "en",
"Description": "This registry defines messages for sushy testing",
"RegistryPrefix": "Test",
"RegistryVersion": "1.0.0",
"RegistryVersion": "1.1.1",
"OwningEntity": "sushy",
"Messages": {
"Success": {

View File

@ -1,5 +1,5 @@
{
"@odata.type": "#MessageRegistryFile.v1_1_0.MessageRegistryFile",
"@odata.type": "#MessageRegistryFile.v1_1_1.MessageRegistryFile",
"Id": "Test",
"Name": "Test Message Registry File",
"Description": "Message Registry file for testing",

View File

@ -1,5 +1,5 @@
{
"@odata.type": "#Processor.v1_0_2.Processor",
"@odata.type": "#Processor.v1_3_0.Processor",
"Id": "CPU1",
"Socket": "CPU 1",
"ProcessorType": "CPU",

View File

@ -1,5 +1,5 @@
{
"@odata.type": "#Processor.v1_0_2.Processor",
"@odata.type": "#Processor.v1_3_0.Processor",
"Id": "CPU2",
"Socket": "CPU 2",
"ProcessorType": "CPU",

View File

@ -1,5 +1,5 @@
{
"@odata.type": "#ServiceRoot.v1_0_2.ServiceRoot",
"@odata.type": "#ServiceRoot.v1_3_1.ServiceRoot",
"Id": "RootService",
"Name": "Root Service",
"RedfishVersion": "1.0.2",

View File

@ -1,5 +1,5 @@
{
"@odata.type": "#Session.v1_0_2.Session",
"@odata.type": "#Session.v1_1_0.Session",
"Id": "1234567890ABCDEF",
"Name": "User Session",
"Description": "Manager User Session",

View File

@ -1,5 +1,5 @@
{
"@odata.type": "#SessionService.v1_0_2.SessionService",
"@odata.type": "#SessionService.v1_1_3.SessionService",
"Id": "SessionService",
"Name": "Session Service",
"Description": "Session Service",

View File

@ -1,7 +1,22 @@
{
"@Redfish.Settings": {
"@odata.type": "#Settings.v1_0_0.Settings",
"@odata.type": "#Settings.v1_2_0.Settings",
"ETag": "9234ac83b9700123cc32",
"MaintenanceWindow": {
"MaintenanceWindowDurationInSeconds": 1,
"MaintenanceWindowStartTime": "2016-03-07T14:44.30-05:05"
},
"OperationApplyTimeSupport": {
"MaintenanceWindowDurationInSeconds": 1,
"MaintenanceWindowResource": "",
"MaintenanceWindowStartTime": "2016-03-07T14:44.30-05:10",
"SupportedValues": [
"Immediate",
"OnReset",
"AtMaintenanceWindowStart",
"InMaintenanceWindowOnReset"
]
},
"Messages": [{
"MessageId": "Base.1.0.SettingsFailed",
"Message": "Settings update failed due to invalid value",

View File

@ -1,5 +1,5 @@
{
"@odata.type": "#Storage.v1_3_0.Storage",
"@odata.type": "#Storage.v1_4_0.Storage",
"Id": "1",
"Name": "Local Storage Controller",
"Description": "Integrated RAID Controller",
@ -71,4 +71,4 @@
"@odata.context": "/redfish/v1/$metadata#Storage.Storage",
"@odata.id": "/redfish/v1/Systems/437XR1138R2/Storage/1",
"@Redfish.Copyright": "Copyright 2014-2017 Distributed Management Task Force, Inc. (DMTF). For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright."
}
}

View File

@ -1,5 +1,5 @@
{
"@odata.type": "#ComputerSystem.v1_1_0.ComputerSystem",
"@odata.type": "#ComputerSystem.v1_5_0.ComputerSystem",
"Id": "437XR1138R2",
"Name": "WebFrontEnd483",
"SystemType": "Physical",

View File

@ -1,5 +1,5 @@
{
"@odata.type": "#VirtualMedia.v1_1_0.VirtualMedia",
"@odata.type": "#VirtualMedia.v1_2_0.VirtualMedia",
"Id": "Floppy1",
"Name": "Virtual Removable Media",
"MediaTypes": [

View File

@ -38,6 +38,7 @@ class ManagerTestCase(base.TestCase):
# | THEN |
self.assertEqual('1.0.2', self.manager.redfish_version)
self.assertEqual('1.00', self.manager.firmware_version)
self.assertFalse(self.manager.auto_dst_enabled)
self.assertEqual(True, self.manager.graphical_console.service_enabled)
self.assertEqual(
2, self.manager.graphical_console.max_concurrent_sessions)

View File

@ -36,13 +36,13 @@ class MessageRegistryTestCase(base.TestCase):
def test__parse_attributes(self):
self.registry._parse_attributes()
self.assertEqual('Test.1.0.0', self.registry.identity)
self.assertEqual('Test.1.1.1', self.registry.identity)
self.assertEqual('Test Message Registry', self.registry.name)
self.assertEqual('en', self.registry.language)
self.assertEqual('This registry defines messages for sushy testing',
self.registry.description)
self.assertEqual('Test', self.registry.registry_prefix)
self.assertEqual('1.0.0', self.registry.registry_version)
self.assertEqual('1.1.1', self.registry.registry_version)
self.assertEqual('sushy', self.registry.owning_entity)
self.assertEqual(3, len(self.registry.messages))
self.assertEqual('Everything OK',

View File

@ -39,10 +39,14 @@ class ProcessorTestCase(base.TestCase):
self.assertEqual('1.0.2', self.sys_processor.redfish_version)
self.assertEqual('CPU1', self.sys_processor.identity)
self.assertEqual('CPU 1', self.sys_processor.socket)
self.assertEqual('CPU', self.sys_processor.processor_type)
self.assertEqual(
sushy.PROCESSOR_TYPE_CPU,
self.sys_processor.processor_type)
self.assertEqual(sushy.PROCESSOR_ARCH_x86,
self.sys_processor.processor_architecture)
self.assertEqual('x86-64', self.sys_processor.instruction_set)
self.assertEqual(
sushy.PROCESSOR_INSTRUCTIONSET_x86_64,
self.sys_processor.instruction_set)
self.assertEqual('Intel(R) Corporation',
self.sys_processor.manufacturer)
self.assertEqual('Multi-Core Intel(R) Xeon(R) processor 7xxx Series',

View File

@ -53,6 +53,24 @@ class SettingsFieldTestCase(base.TestCase):
instance.messages[0]._related_properties[0])
self.assertEqual('/redfish/v1/Systems/437XR1138R2/BIOS/Settings',
instance._settings_object_idref.resource_uri)
self.assertEqual(
1,
instance.
_maintenance_window.maintenance_window_duration_in_seconds)
self.assertEqual(
'2016-03-07T14:44.30-05:05',
instance._maintenance_window.maintenance_window_start_time)
self.assertEqual(
1,
instance._operation_apply_time_support.
maintenance_window_duration_in_seconds)
self.assertEqual(
'2016-03-07T14:44.30-05:10',
instance._operation_apply_time_support.
maintenance_window_start_time)
self.assertIn(
'Immediate',
instance._operation_apply_time_support.supported_values)
def test_commit(self):
conn = mock.Mock()