Add missing resource types in RSD 2.2
Change-Id: I10aeb104294d905602b2725741a4522528cac303
This commit is contained in:
parent
6e1ba65d28
commit
deee42caba
@ -70,7 +70,7 @@ from rsd_lib.resources.v2_1.task import task_service
|
||||
RESOURCE_CLASS = {
|
||||
'Chassis': chassis.Chassis,
|
||||
'ChassisCollection': chassis.ChassisCollection,
|
||||
'.ComposedNode': node.Node,
|
||||
'ComposedNode': node.Node,
|
||||
'ComposedNodeCollection': node.NodeCollection,
|
||||
'ComputerSystem': system.System,
|
||||
'ComputerSystemCollection': system.SystemCollection,
|
||||
|
@ -17,6 +17,7 @@ from sushy.resources import base
|
||||
|
||||
from rsd_lib import exceptions as rsd_lib_exceptions
|
||||
from rsd_lib.resources import v2_1
|
||||
from rsd_lib.resources.v2_2.chassis import chassis
|
||||
from rsd_lib.resources.v2_2.ethernet_switch import ethernet_switch
|
||||
from rsd_lib.resources.v2_2.fabric import fabric
|
||||
from rsd_lib.resources.v2_2.node import node
|
||||
@ -49,6 +50,29 @@ class RSDLibV2_2(v2_1.RSDLibV2_1):
|
||||
_update_service_path = base.Field(["UpdateService", "@odata.id"])
|
||||
"""Update Service path"""
|
||||
|
||||
def get_chassis_collection(self):
|
||||
"""Get the ChassisCollection object
|
||||
|
||||
:raises: MissingAttributeError, if the collection attribute is
|
||||
not found
|
||||
:returns: a ChassisCollection object
|
||||
"""
|
||||
return chassis.ChassisCollection(
|
||||
self._conn,
|
||||
self._chassis_path,
|
||||
redfish_version=self.redfish_version,
|
||||
)
|
||||
|
||||
def get_chassis(self, identity):
|
||||
"""Given the identity return a Chassis object
|
||||
|
||||
:param identity: The identity of the Chassis resource
|
||||
:returns: The Chassis object
|
||||
"""
|
||||
return chassis.Chassis(
|
||||
self._conn, identity, redfish_version=self.redfish_version
|
||||
)
|
||||
|
||||
def get_system(self, identity):
|
||||
"""Given the identity return a System object
|
||||
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
from sushy import utils
|
||||
|
||||
from rsd_lib import base as rsd_lib_base
|
||||
from rsd_lib.resources.v2_1.chassis import chassis
|
||||
from rsd_lib.resources.v2_2.chassis import power
|
||||
from rsd_lib.resources.v2_2.chassis import thermal
|
||||
@ -58,3 +59,9 @@ class Chassis(chassis.Chassis):
|
||||
utils.get_sub_resource_path_by(self, "Thermal"),
|
||||
redfish_version=self.redfish_version,
|
||||
)
|
||||
|
||||
|
||||
class ChassisCollection(rsd_lib_base.ResourceCollectionBase):
|
||||
@property
|
||||
def _resource_type(self):
|
||||
return Chassis
|
||||
|
@ -17,11 +17,24 @@ from copy import deepcopy
|
||||
|
||||
from rsd_lib.resources.v2_1.types import RESOURCE_CLASS as RESOURCE_CLASS_V21
|
||||
|
||||
from rsd_lib.resources.v2_2.chassis import chassis
|
||||
from rsd_lib.resources.v2_2.chassis import power
|
||||
from rsd_lib.resources.v2_2.chassis import thermal
|
||||
from rsd_lib.resources.v2_2.ethernet_switch import ethernet_switch
|
||||
from rsd_lib.resources.v2_2.ethernet_switch import ethernet_switch_metrics
|
||||
from rsd_lib.resources.v2_2.ethernet_switch import ethernet_switch_port
|
||||
from rsd_lib.resources.v2_2.ethernet_switch import ethernet_switch_port_metrics
|
||||
from rsd_lib.resources.v2_2.fabric import fabric
|
||||
from rsd_lib.resources.v2_2.fabric import port
|
||||
from rsd_lib.resources.v2_2.fabric import port_metrics
|
||||
from rsd_lib.resources.v2_2.fabric import switch
|
||||
from rsd_lib.resources.v2_2.node import node
|
||||
from rsd_lib.resources.v2_2.system import computer_system_metrics
|
||||
from rsd_lib.resources.v2_2.system import memory
|
||||
from rsd_lib.resources.v2_2.system import memory_metrics
|
||||
from rsd_lib.resources.v2_2.system import processor
|
||||
from rsd_lib.resources.v2_2.system import processor_metrics
|
||||
from rsd_lib.resources.v2_2.system import system
|
||||
from rsd_lib.resources.v2_2.telemetry_service import metric
|
||||
from rsd_lib.resources.v2_2.telemetry_service import metric_definition
|
||||
from rsd_lib.resources.v2_2.telemetry_service import metric_report
|
||||
@ -35,27 +48,49 @@ from rsd_lib.resources.v2_2.update_service import update_service
|
||||
RESOURCE_CLASS = deepcopy(RESOURCE_CLASS_V21)
|
||||
RESOURCE_CLASS.update(
|
||||
{
|
||||
'ActionInfo': action_info.ActionInfo,
|
||||
'ComputerSystemMetrics': computer_system_metrics.ComputerSystemMetrics,
|
||||
'EthernetSwitchMetrics': ethernet_switch_metrics.EthernetSwitchMetrics,
|
||||
'EthernetSwitchPortMetrics':
|
||||
"Chassis": chassis.Chassis,
|
||||
"ChassisCollection": chassis.ChassisCollection,
|
||||
"ComposedNodeCollection": node.NodeCollection,
|
||||
"ComputerSystem": system.System,
|
||||
"ComputerSystemCollection": system.SystemCollection,
|
||||
"ActionInfo": action_info.ActionInfo,
|
||||
"ComputerSystemMetrics": computer_system_metrics.ComputerSystemMetrics,
|
||||
"EthernetSwitch": ethernet_switch.EthernetSwitch,
|
||||
"EthernetSwitchCollection": ethernet_switch.EthernetSwitchCollection,
|
||||
"EthernetSwitchMetrics": ethernet_switch_metrics.EthernetSwitchMetrics,
|
||||
"EthernetSwitchPort": ethernet_switch_port.EthernetSwitchPort,
|
||||
"EthernetSwitchPortCollection":
|
||||
ethernet_switch_port.EthernetSwitchPortCollection,
|
||||
"EthernetSwitchPortMetrics":
|
||||
ethernet_switch_port_metrics.EthernetSwitchPortMetrics,
|
||||
'MemoryMetrics': memory_metrics.MemoryMetrics,
|
||||
'Metric': metric.Metric,
|
||||
'MetricDefinition': metric_definition.MetricDefinition,
|
||||
'MetricDefinitionCollection':
|
||||
"Fabric": fabric.Fabric,
|
||||
"FabricCollection": fabric.FabricCollection,
|
||||
"Memory": memory.Memory,
|
||||
"MemoryCollection": memory.MemoryCollection,
|
||||
"MemoryMetrics": memory_metrics.MemoryMetrics,
|
||||
"Metric": metric.Metric,
|
||||
"MetricDefinition": metric_definition.MetricDefinition,
|
||||
"MetricDefinitionCollection":
|
||||
metric_definition.MetricDefinitionCollection,
|
||||
'MetricReport': metric_report.MetricReport,
|
||||
'MetricReportCollection': metric_report.MetricReportCollection,
|
||||
'MetricReportDefinition':
|
||||
"MetricReport": metric_report.MetricReport,
|
||||
"MetricReportCollection": metric_report.MetricReportCollection,
|
||||
"MetricReportDefinition":
|
||||
metric_report_definition.MetricReportDefinition,
|
||||
'MetricReportDefinitionCollection':
|
||||
"MetricReportDefinitionCollection":
|
||||
metric_report_definition.MetricReportDefinitionCollection,
|
||||
# 'PortMetrics'
|
||||
'ProcessorMetrics': processor_metrics.ProcessorMetrics,
|
||||
'TelemetryService': telemetry_service.TelemetryService,
|
||||
'Triggers': triggers.Triggers,
|
||||
'TriggersCollection': triggers.TriggersCollection,
|
||||
'UpdateService': update_service.UpdateService
|
||||
"Port": port.Port,
|
||||
"PortCollection": port.PortCollection,
|
||||
"PortMetrics": port_metrics.PortMetrics,
|
||||
"Power": power.Power,
|
||||
"Processor": processor.Processor,
|
||||
"ProcessorCollection": processor.ProcessorCollection,
|
||||
"ProcessorMetrics": processor_metrics.ProcessorMetrics,
|
||||
"Switch": switch.Switch,
|
||||
"SwitchCollection": switch.SwitchCollection,
|
||||
"TelemetryService": telemetry_service.TelemetryService,
|
||||
"Thermal": thermal.Thermal,
|
||||
"Triggers": triggers.Triggers,
|
||||
"TriggersCollection": triggers.TriggersCollection,
|
||||
"UpdateService": update_service.UpdateService,
|
||||
}
|
||||
)
|
||||
|
@ -18,7 +18,6 @@ import mock
|
||||
import testtools
|
||||
|
||||
from rsd_lib.exceptions import NoMatchingResourceError
|
||||
from rsd_lib.resources.v2_1.chassis import chassis as v2_1_chassis
|
||||
from rsd_lib.resources.v2_1.event_service import event_service \
|
||||
as v2_1_event_service
|
||||
from rsd_lib.resources.v2_1.manager import manager as v2_1_manager
|
||||
@ -29,6 +28,7 @@ from rsd_lib.resources.v2_1.storage_service import storage_service \
|
||||
as v2_1_storage_service
|
||||
from rsd_lib.resources.v2_1.task import task_service as v2_1_task_service
|
||||
from rsd_lib.resources import v2_2
|
||||
from rsd_lib.resources.v2_2.chassis import chassis as v2_2_chassis
|
||||
from rsd_lib.resources.v2_2.ethernet_switch import ethernet_switch \
|
||||
as v2_2_ethernet_switch
|
||||
from rsd_lib.resources.v2_2.fabric import fabric as v2_2_fabric
|
||||
@ -131,7 +131,7 @@ class RSDLibV2_2TestCase(testtools.TestCase):
|
||||
redfish_version=self.rsd.redfish_version,
|
||||
)
|
||||
|
||||
@mock.patch.object(v2_1_chassis, "ChassisCollection", autospec=True)
|
||||
@mock.patch.object(v2_2_chassis, "ChassisCollection", autospec=True)
|
||||
def test_get_chassis_collection(self, mock_chassis_collection):
|
||||
self.rsd.get_chassis_collection()
|
||||
mock_chassis_collection.assert_called_once_with(
|
||||
@ -140,7 +140,7 @@ class RSDLibV2_2TestCase(testtools.TestCase):
|
||||
redfish_version=self.rsd.redfish_version,
|
||||
)
|
||||
|
||||
@mock.patch.object(v2_1_chassis, "Chassis", autospec=True)
|
||||
@mock.patch.object(v2_2_chassis, "Chassis", autospec=True)
|
||||
def test_get_chassis(self, mock_chassis):
|
||||
self.rsd.get_chassis("fake-chassis-id")
|
||||
mock_chassis.assert_called_once_with(
|
||||
|
@ -18,12 +18,12 @@ import mock
|
||||
import testtools
|
||||
|
||||
from rsd_lib.exceptions import NoMatchingResourceError
|
||||
from rsd_lib.resources.v2_1.chassis import chassis as v2_1_chassis
|
||||
from rsd_lib.resources.v2_1.event_service import event_service \
|
||||
as v2_1_event_service
|
||||
from rsd_lib.resources.v2_1.registries import message_registry_file \
|
||||
as v2_1_registries
|
||||
from rsd_lib.resources.v2_1.task import task_service as v2_1_task_service
|
||||
from rsd_lib.resources.v2_2.chassis import chassis as v2_2_chassis
|
||||
from rsd_lib.resources.v2_2.update_service import update_service \
|
||||
as v2_2_update_service
|
||||
from rsd_lib.resources import v2_3
|
||||
@ -112,14 +112,14 @@ class RSDLibV2_3TestCase(testtools.TestCase):
|
||||
self.rsd._conn, 'fake-fabric-id',
|
||||
redfish_version=self.rsd.redfish_version)
|
||||
|
||||
@mock.patch.object(v2_1_chassis, 'ChassisCollection', autospec=True)
|
||||
@mock.patch.object(v2_2_chassis, 'ChassisCollection', autospec=True)
|
||||
def test_get_chassis_collection(self, mock_chassis_collection):
|
||||
self.rsd.get_chassis_collection()
|
||||
mock_chassis_collection.assert_called_once_with(
|
||||
self.rsd._conn, '/redfish/v1/Chassis',
|
||||
redfish_version=self.rsd.redfish_version)
|
||||
|
||||
@mock.patch.object(v2_1_chassis, 'Chassis', autospec=True)
|
||||
@mock.patch.object(v2_2_chassis, 'Chassis', autospec=True)
|
||||
def test_get_chassis(self, mock_chassis):
|
||||
self.rsd.get_chassis('fake-chassis-id')
|
||||
mock_chassis.assert_called_once_with(
|
||||
|
@ -17,12 +17,12 @@ import json
|
||||
import mock
|
||||
import testtools
|
||||
|
||||
from rsd_lib.resources.v2_1.chassis import chassis as v2_1_chassis
|
||||
from rsd_lib.resources.v2_1.event_service import event_service \
|
||||
as v2_1_event_service
|
||||
from rsd_lib.resources.v2_1.registries import message_registry_file \
|
||||
as v2_1_registries
|
||||
from rsd_lib.resources.v2_1.task import task_service as v2_1_task_service
|
||||
from rsd_lib.resources.v2_2.chassis import chassis as v2_2_chassis
|
||||
from rsd_lib.resources.v2_2.update_service import update_service \
|
||||
as v2_2_update_service
|
||||
from rsd_lib.resources.v2_3.ethernet_switch import ethernet_switch \
|
||||
@ -111,14 +111,14 @@ class RSDLibV2_3TestCase(testtools.TestCase):
|
||||
self.rsd._conn, 'fake-fabric-id',
|
||||
redfish_version=self.rsd.redfish_version)
|
||||
|
||||
@mock.patch.object(v2_1_chassis, 'ChassisCollection', autospec=True)
|
||||
@mock.patch.object(v2_2_chassis, 'ChassisCollection', autospec=True)
|
||||
def test_get_chassis_collection(self, mock_chassis_collection):
|
||||
self.rsd.get_chassis_collection()
|
||||
mock_chassis_collection.assert_called_once_with(
|
||||
self.rsd._conn, '/redfish/v1/Chassis',
|
||||
redfish_version=self.rsd.redfish_version)
|
||||
|
||||
@mock.patch.object(v2_1_chassis, 'Chassis', autospec=True)
|
||||
@mock.patch.object(v2_2_chassis, 'Chassis', autospec=True)
|
||||
def test_get_chassis(self, mock_chassis):
|
||||
self.rsd.get_chassis('fake-chassis-id')
|
||||
mock_chassis.assert_called_once_with(
|
||||
|
Loading…
x
Reference in New Issue
Block a user