Expose fabric related interfaces
Added two fabric interfaces get_fabric() and get_fabric_collection() to allow user to invoke fabric related functionality. Change-Id: I4a9344ee878b2957ba267a2f83e714878759cd4e
This commit is contained in:
parent
b6360378d1
commit
8a60e21875
@ -17,6 +17,7 @@ import sushy
|
|||||||
from sushy.resources import base
|
from sushy.resources import base
|
||||||
|
|
||||||
from rsd_lib.resources import chassis
|
from rsd_lib.resources import chassis
|
||||||
|
from rsd_lib.resources.fabric import fabric
|
||||||
from rsd_lib.resources.node import node
|
from rsd_lib.resources.node import node
|
||||||
from rsd_lib.resources.storage_service import storage_service
|
from rsd_lib.resources.storage_service import storage_service
|
||||||
|
|
||||||
@ -33,6 +34,9 @@ class RSDLib(sushy.Sushy):
|
|||||||
'@odata.id'], required=True)
|
'@odata.id'], required=True)
|
||||||
"""StorageServiceCollection path"""
|
"""StorageServiceCollection path"""
|
||||||
|
|
||||||
|
_fabrics_path = base.Field(['Fabrics', '@odata.id'], required=True)
|
||||||
|
"""FabricCollection path"""
|
||||||
|
|
||||||
def get_node_collection(self):
|
def get_node_collection(self):
|
||||||
"""Get the NodeCollection object
|
"""Get the NodeCollection object
|
||||||
|
|
||||||
@ -93,3 +97,24 @@ class RSDLib(sushy.Sushy):
|
|||||||
return chassis.Chassis(self._conn,
|
return chassis.Chassis(self._conn,
|
||||||
identity,
|
identity,
|
||||||
redfish_version=self.redfish_version)
|
redfish_version=self.redfish_version)
|
||||||
|
|
||||||
|
def get_fabric_collection(self):
|
||||||
|
"""Get the FabricCollection object
|
||||||
|
|
||||||
|
:raises: MissingAttributeError, if the collection attribute is
|
||||||
|
not found
|
||||||
|
:returns: a FabricCollection object
|
||||||
|
"""
|
||||||
|
return fabric.FabricCollection(self._conn,
|
||||||
|
self._fabrics_path,
|
||||||
|
redfish_version=self.redfish_version)
|
||||||
|
|
||||||
|
def get_fabric(self, identity):
|
||||||
|
"""Given the identity return a Fabric object
|
||||||
|
|
||||||
|
:param identity: The identity of the Fabric resource
|
||||||
|
:returns: The Fabric object
|
||||||
|
"""
|
||||||
|
return fabric.Fabric(self._conn,
|
||||||
|
identity,
|
||||||
|
redfish_version=self.redfish_version)
|
||||||
|
@ -31,6 +31,9 @@
|
|||||||
"Nodes": {
|
"Nodes": {
|
||||||
"@odata.id": "/redfish/v1/Nodes"
|
"@odata.id": "/redfish/v1/Nodes"
|
||||||
},
|
},
|
||||||
|
"Fabrics" : {
|
||||||
|
"@odata.id" : "/redfish/v1/Fabrics"
|
||||||
|
},
|
||||||
"Links": {
|
"Links": {
|
||||||
"Sessions": {
|
"Sessions": {
|
||||||
"@odata.id": "/redfish/v1/SessionService/Sessions"
|
"@odata.id": "/redfish/v1/SessionService/Sessions"
|
||||||
|
@ -20,6 +20,7 @@ from sushy import connector
|
|||||||
import testtools
|
import testtools
|
||||||
|
|
||||||
from rsd_lib import main
|
from rsd_lib import main
|
||||||
|
from rsd_lib.resources.fabric import fabric
|
||||||
from rsd_lib.resources.node import node
|
from rsd_lib.resources.node import node
|
||||||
|
|
||||||
|
|
||||||
@ -48,3 +49,17 @@ class RSDLibTestCase(testtools.TestCase):
|
|||||||
mock_node.assert_called_once_with(
|
mock_node.assert_called_once_with(
|
||||||
self.rsd._conn, 'fake-node-id',
|
self.rsd._conn, 'fake-node-id',
|
||||||
redfish_version=self.rsd.redfish_version)
|
redfish_version=self.rsd.redfish_version)
|
||||||
|
|
||||||
|
@mock.patch.object(fabric, 'FabricCollection', autospec=True)
|
||||||
|
def test_get_fabric_collection(self, mock_fabric_collection):
|
||||||
|
self.rsd.get_fabric_collection()
|
||||||
|
mock_fabric_collection.assert_called_once_with(
|
||||||
|
self.rsd._conn, '/redfish/v1/Fabrics',
|
||||||
|
redfish_version=self.rsd.redfish_version)
|
||||||
|
|
||||||
|
@mock.patch.object(fabric, 'Fabric', autospec=True)
|
||||||
|
def test_get_fabric(self, mock_fabric):
|
||||||
|
self.rsd.get_fabric('fake-fabric-id')
|
||||||
|
mock_fabric.assert_called_once_with(
|
||||||
|
self.rsd._conn, 'fake-fabric-id',
|
||||||
|
redfish_version=self.rsd.redfish_version)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user