Update system schema to 1.10

Updates corresponding unit tests.

Change-Id: I9dc958b0159eff189456b1ba192ebda3471f2f18
This commit is contained in:
Riccardo Pittau 2020-07-21 18:20:58 +02:00
parent 619445ce54
commit 8df68d8f63
4 changed files with 33 additions and 23 deletions

View File

@ -14,7 +14,7 @@
# under the License.
# This is referred from Redfish standard schema.
# https://redfish.dmtf.org/schemas/ComputerSystem.v1_5_0.json
# https://redfish.dmtf.org/schemas/v1/ComputerSystem.v1_10_0.json
import collections
import logging

View File

@ -1,11 +1,12 @@
{
"@odata.type": "#ComputerSystem.v1_5_0.ComputerSystem",
"@odata.type": "#ComputerSystem.v1_10_0.ComputerSystem",
"Id": "437XR1138R2",
"Name": "WebFrontEnd483",
"SystemType": "Physical",
"AssetTag": "Chicago-45Z-2381",
"Manufacturer": "Contoso",
"Model": "3500RX",
"Model": "3500",
"SubModel": "RX",
"SKU": "8675309",
"SerialNumber": "437XR1138R2",
"PartNumber": "224071-J23",
@ -17,6 +18,9 @@
"Health": "OK",
"HealthRollup": "OK"
},
"HostingRoles": [
"ApplicationServer"
],
"IndicatorLED": "Off",
"PowerState": "On",
"Boot": {
@ -49,18 +53,18 @@
],
"Oem": {
"Contoso": {
"@odata.type": "http://Contoso.com/Schema#Contoso.ComputerSystem",
"@odata.type": "#Contoso.ComputerSystem",
"ProductionLocation": {
"FacilityName": "PacWest Production Facility",
"Country": "USA"
}
},
"Chipwise": {
"@odata.type": "http://Chipwise.com/Schema#Chipwise.ComputerSystem",
"@odata.type": "#Chipwise.ComputerSystem",
"Style": "Executive"
}
},
"BiosVersion": "P79 v1.33 (02/28/2015)",
"BiosVersion": "P79 v1.45 (12/06/2017)",
"ProcessorSummary": {
"Count": 2,
"ProcessorFamily": "Multi-Core Intel(R) Xeon(R) processor 7xxx Series",
@ -72,6 +76,8 @@
},
"MemorySummary": {
"TotalSystemMemoryGiB": 96,
"TotalSystemPersistentMemoryGiB": 0,
"MemoryMirroring": "None",
"Status": {
"State": "Enabled",
"Health": "OK",
@ -79,7 +85,10 @@
}
},
"Bios": {
"@odata.id": "/redfish/v1/Systems/437XR1138R2/BIOS"
"@odata.id": "/redfish/v1/Systems/437XR1138R2/Bios"
},
"SecureBoot": {
"@odata.id": "/redfish/v1/Systems/437XR1138R2/SecureBoot"
},
"Processors": {
"@odata.id": "/redfish/v1/Systems/437XR1138R2/Processors"
@ -93,9 +102,6 @@
"SimpleStorage": {
"@odata.id": "/redfish/v1/Systems/437XR1138R2/SimpleStorage"
},
"Storage": {
"@odata.id": "/redfish/v1/Systems/437XR1138R2/Storage"
},
"LogServices": {
"@odata.id": "/redfish/v1/Systems/437XR1138R2/LogServices"
},
@ -121,7 +127,8 @@
"GracefulRestart",
"ForceRestart",
"Nmi",
"ForceOn"
"ForceOn",
"PushPowerButton"
],
"@Redfish.OperationApplyTimeSupport": {
"@odata.type": "#Settings.v1_2_0.OperationApplyTimeSupport",

View File

@ -37,7 +37,7 @@ class FakeOEMSystemExtensionTestCase(base.TestCase):
self.sys_instance, 'Contoso')
def test__parse_oem_attributes(self):
self.assertEqual('http://Contoso.com/Schema#Contoso.ComputerSystem',
self.assertEqual('#Contoso.ComputerSystem',
self.fake_sys_oem_extn.data_type)
self.assertEqual('PacWest Production Facility', (
self.fake_sys_oem_extn.production_location.facility_name))

View File

@ -28,7 +28,6 @@ from sushy.resources.system import bios
from sushy.resources.system import mappings as sys_map
from sushy.resources.system import processor
from sushy.resources.system import simple_storage
from sushy.resources.system.storage import storage
from sushy.resources.system import system
from sushy.tests.unit import base
@ -51,7 +50,7 @@ class SystemTestCase(base.TestCase):
self.sys_inst._parse_attributes(self.json_doc)
self.assertEqual('1.0.2', self.sys_inst.redfish_version)
self.assertEqual('Chicago-45Z-2381', self.sys_inst.asset_tag)
self.assertEqual('P79 v1.33 (02/28/2015)', self.sys_inst.bios_version)
self.assertEqual('P79 v1.45 (12/06/2017)', self.sys_inst.bios_version)
self.assertEqual('Web Front End node', self.sys_inst.description)
self.assertEqual('web483', self.sys_inst.hostname)
self.assertEqual('437XR1138R2', self.sys_inst.identity)
@ -127,7 +126,8 @@ class SystemTestCase(base.TestCase):
"GracefulRestart",
"ForceRestart",
"Nmi",
"ForceOn"
"ForceOn",
"PushPowerButton"
],
value.allowed_values)
@ -145,7 +145,8 @@ class SystemTestCase(base.TestCase):
sushy.RESET_FORCE_OFF,
sushy.RESET_FORCE_ON,
sushy.RESET_ON,
sushy.RESET_NMI])
sushy.RESET_NMI,
sushy.RESET_PUSH_POWER_BUTTON])
self.assertEqual(expected, values)
self.assertIsInstance(values, set)
@ -538,7 +539,7 @@ class SystemTestCase(base.TestCase):
simple_storage.SimpleStorageCollection)
def test_storage_for_missing_attr(self):
self.sys_inst.json.pop('Storage')
self.sys_inst.json.pop('SimpleStorage')
with self.assertRaisesRegex(
exceptions.MissingAttributeError, 'attribute Storage'):
self.sys_inst.storage
@ -550,16 +551,17 @@ class SystemTestCase(base.TestCase):
'storage_collection.json') as f:
self.conn.get.return_value.json.return_value = json.load(f)
# | WHEN |
actual_storage = self.sys_inst.storage
actual_storage = self.sys_inst.simple_storage
# | THEN |
self.assertIsInstance(actual_storage, storage.StorageCollection)
self.assertIsInstance(actual_storage,
simple_storage.SimpleStorageCollection)
self.conn.get.return_value.json.assert_called_once_with()
# reset mock
self.conn.get.return_value.json.reset_mock()
# | WHEN & THEN |
# tests for same object on invoking subsequently
self.assertIs(actual_storage, self.sys_inst.storage)
self.assertIs(actual_storage, self.sys_inst.simple_storage)
self.conn.get.return_value.json.assert_not_called()
def test_storage_on_refresh(self):
@ -568,8 +570,8 @@ class SystemTestCase(base.TestCase):
'storage_collection.json') as f:
self.conn.get.return_value.json.return_value = json.load(f)
# | WHEN & THEN |
self.assertIsInstance(self.sys_inst.storage,
storage.StorageCollection)
self.assertIsInstance(self.sys_inst.simple_storage,
simple_storage.SimpleStorageCollection)
# On refreshing the system instance...
with open('sushy/tests/unit/json_samples/system.json') as f:
@ -583,7 +585,8 @@ class SystemTestCase(base.TestCase):
'storage_collection.json') as f:
self.conn.get.return_value.json.return_value = json.load(f)
# | WHEN & THEN |
self.assertIsInstance(self.sys_inst.storage, storage.StorageCollection)
self.assertIsInstance(self.sys_inst.simple_storage,
simple_storage.SimpleStorageCollection)
def test_managers(self):
# | GIVEN |