From cfc0aa8d0500614617aed76ad597377594e59543 Mon Sep 17 00:00:00 2001 From: Lin Yang Date: Fri, 8 Feb 2019 11:19:25 -0800 Subject: [PATCH] Add missing fields in 2.3&2.4 root service Change-Id: If14aa7d384b8f0e66eef45c153c2ac18a44c645f --- rsd_lib/resources/v2_3/__init__.py | 4 ---- rsd_lib/resources/v2_4/__init__.py | 6 ++++++ rsd_lib/tests/unit/json_samples/v2_3/root.json | 12 +++++++++--- rsd_lib/tests/unit/json_samples/v2_4/root.json | 16 +++++++++++----- .../unit/resources/v2_2/test_rsdlib_v2_2.py | 3 +++ .../unit/resources/v2_3/test_rsdlib_v2_3.py | 6 +++++- .../unit/resources/v2_4/test_rsdlib_v2_4.py | 8 ++++++-- 7 files changed, 40 insertions(+), 15 deletions(-) diff --git a/rsd_lib/resources/v2_3/__init__.py b/rsd_lib/resources/v2_3/__init__.py index 322169f..eb05f0c 100644 --- a/rsd_lib/resources/v2_3/__init__.py +++ b/rsd_lib/resources/v2_3/__init__.py @@ -26,10 +26,6 @@ from rsd_lib.resources.v2_3.system import system class RSDLibV2_3(v2_2.RSDLibV2_2): - # Override telemetry variable inherited from v2.2. The corresponding - # service don't exist in RSD v2.3 - _telemetry_service_path = None - _ethernet_switches_path = base.Field( ['Oem', 'Intel_RackScale', 'EthernetSwitches', '@odata.id']) """EthernetSwitchCollecton path""" diff --git a/rsd_lib/resources/v2_4/__init__.py b/rsd_lib/resources/v2_4/__init__.py index 68475db..6aede63 100644 --- a/rsd_lib/resources/v2_4/__init__.py +++ b/rsd_lib/resources/v2_4/__init__.py @@ -13,12 +13,18 @@ # License for the specific language governing permissions and limitations # under the License. +from sushy.resources import base + from rsd_lib.resources import v2_3 from rsd_lib.resources.v2_4.storage_service import storage_service class RSDLibV2_4(v2_3.RSDLibV2_3): + _telemetry_service_path = base.Field( + ['Oem', 'Intel_RackScale', 'TelemetryService', '@odata.id']) + """EthernetSwitchCollecton path""" + def get_storage_service_collection(self): """Get the StorageServiceCollection object diff --git a/rsd_lib/tests/unit/json_samples/v2_3/root.json b/rsd_lib/tests/unit/json_samples/v2_3/root.json index 3d2cb52..e8f9415 100644 --- a/rsd_lib/tests/unit/json_samples/v2_3/root.json +++ b/rsd_lib/tests/unit/json_samples/v2_3/root.json @@ -20,16 +20,19 @@ "@odata.id": "/redfish/v1/EventService" }, "Fabrics": { - "@odata.id": "/redfish/v1/Fabrics" + "@odata.id": "/redfish/v1/Fabrics" }, "Tasks": { "@odata.id": "/redfish/v1/TaskService" }, "StorageServices": { - "@odata.id": "/redfish/v1/StorageServices" + "@odata.id": "/redfish/v1/StorageServices" }, "Registries": { - "@odata.id": "/redfish/v1/Registries" + "@odata.id": "/redfish/v1/Registries" + }, + "TelemetryService": { + "@odata.id": "/redfish/v1/TelemetryService" }, "Oem": { "Intel_RackScale": { @@ -38,6 +41,9 @@ "Nodes": { "@odata.id": "/redfish/v1/Nodes" }, + "Services": { + "@odata.id": "/redfish/v1/Services" + }, "EthernetSwitches": { "@odata.id": "/redfish/v1/EthernetSwitches" } diff --git a/rsd_lib/tests/unit/json_samples/v2_4/root.json b/rsd_lib/tests/unit/json_samples/v2_4/root.json index 585ea61..0e3aa63 100644 --- a/rsd_lib/tests/unit/json_samples/v2_4/root.json +++ b/rsd_lib/tests/unit/json_samples/v2_4/root.json @@ -1,11 +1,11 @@ { "@odata.context": "/redfish/v1/$metadata#ServiceRoot.ServiceRoot", "@odata.id": "/redfish/v1/", - "@odata.type": "#ServiceRoot.v1_1_1.ServiceRoot", + "@odata.type": "#ServiceRoot.v1_3_1.ServiceRoot", "Id": "RootService", "Name": "Root Service", "Description": "description-as-string", - "RedfishVersion": "1.1.0", + "RedfishVersion": "1.5.0", "UUID": "92384634-2938-2342-8820-489239905423", "Systems": { "@odata.id": "/redfish/v1/Systems" @@ -20,16 +20,16 @@ "@odata.id": "/redfish/v1/EventService" }, "Fabrics": { - "@odata.id": "/redfish/v1/Fabrics" + "@odata.id": "/redfish/v1/Fabrics" }, "Tasks": { "@odata.id": "/redfish/v1/TaskService" }, "StorageServices": { - "@odata.id": "/redfish/v1/StorageServices" + "@odata.id": "/redfish/v1/StorageServices" }, "Registries": { - "@odata.id": "/redfish/v1/Registries" + "@odata.id": "/redfish/v1/Registries" }, "Oem": { "Intel_RackScale": { @@ -38,8 +38,14 @@ "Nodes": { "@odata.id": "/redfish/v1/Nodes" }, + "Services": { + "@odata.id": "/redfish/v1/Services" + }, "EthernetSwitches": { "@odata.id": "/redfish/v1/EthernetSwitches" + }, + "TelemetryService": { + "@odata.id": "/redfish/v1/TelemetryService" } } }, diff --git a/rsd_lib/tests/unit/resources/v2_2/test_rsdlib_v2_2.py b/rsd_lib/tests/unit/resources/v2_2/test_rsdlib_v2_2.py index 2a7cc0d..eba3ccd 100644 --- a/rsd_lib/tests/unit/resources/v2_2/test_rsdlib_v2_2.py +++ b/rsd_lib/tests/unit/resources/v2_2/test_rsdlib_v2_2.py @@ -56,8 +56,11 @@ class RSDLibV2_2TestCase(testtools.TestCase): self.assertEqual("/redfish/v1/Services", self.rsd._storage_service_path) self.assertEqual("/redfish/v1/Fabrics", self.rsd._fabrics_path) + self.assertEqual("/redfish/v1/Managers", self.rsd._managers_path) self.assertEqual("/redfish/v1/TelemetryService", self.rsd._telemetry_service_path) + self.assertEqual("/redfish/v1/EthernetSwitches", + self.rsd._ethernet_switches_path) self.assertEqual("/redfish/v1/TaskService", self.rsd._task_service_path) self.assertEqual("/redfish/v1/Registries", diff --git a/rsd_lib/tests/unit/resources/v2_3/test_rsdlib_v2_3.py b/rsd_lib/tests/unit/resources/v2_3/test_rsdlib_v2_3.py index e526139..8e41517 100644 --- a/rsd_lib/tests/unit/resources/v2_3/test_rsdlib_v2_3.py +++ b/rsd_lib/tests/unit/resources/v2_3/test_rsdlib_v2_3.py @@ -54,7 +54,11 @@ class RSDLibV2_3TestCase(testtools.TestCase): self.assertEqual("/redfish/v1/Fabrics", self.rsd._fabrics_path) self.assertEqual("/redfish/v1/StorageServices", self.rsd._storage_service_path) - self.assertEqual(None, self.rsd._telemetry_service_path) + self.assertEqual("/redfish/v1/Managers", self.rsd._managers_path) + self.assertEqual("/redfish/v1/EthernetSwitches", + self.rsd._ethernet_switches_path) + self.assertEqual("/redfish/v1/TelemetryService", + self.rsd._telemetry_service_path) self.assertEqual("/redfish/v1/TaskService", self.rsd._task_service_path) self.assertEqual("/redfish/v1/Registries", diff --git a/rsd_lib/tests/unit/resources/v2_4/test_rsdlib_v2_4.py b/rsd_lib/tests/unit/resources/v2_4/test_rsdlib_v2_4.py index 04d9ab9..e204917 100644 --- a/rsd_lib/tests/unit/resources/v2_4/test_rsdlib_v2_4.py +++ b/rsd_lib/tests/unit/resources/v2_4/test_rsdlib_v2_4.py @@ -47,14 +47,18 @@ class RSDLibV2_3TestCase(testtools.TestCase): def test__parse_attributes(self): self.rsd._parse_attributes() self.assertEqual("2.4.0", self.rsd._rsd_api_version) - self.assertEqual("1.1.0", self.rsd._redfish_version) + self.assertEqual("1.5.0", self.rsd._redfish_version) self.assertEqual("/redfish/v1/Systems", self.rsd._systems_path) self.assertEqual("/redfish/v1/Nodes", self.rsd._nodes_path) self.assertEqual("/redfish/v1/Chassis", self.rsd._chassis_path) self.assertEqual("/redfish/v1/Fabrics", self.rsd._fabrics_path) self.assertEqual("/redfish/v1/StorageServices", self.rsd._storage_service_path) - self.assertEqual(None, self.rsd._telemetry_service_path) + self.assertEqual("/redfish/v1/Managers", self.rsd._managers_path) + self.assertEqual("/redfish/v1/EthernetSwitches", + self.rsd._ethernet_switches_path) + self.assertEqual("/redfish/v1/TelemetryService", + self.rsd._telemetry_service_path) self.assertEqual("/redfish/v1/TaskService", self.rsd._task_service_path) self.assertEqual("/redfish/v1/Registries",