diff --git a/rsd_lib/resources/v2_1/ethernet_switch/acl.py b/rsd_lib/resources/v2_1/ethernet_switch/acl.py index 52b1d47..2f47dc0 100644 --- a/rsd_lib/resources/v2_1/ethernet_switch/acl.py +++ b/rsd_lib/resources/v2_1/ethernet_switch/acl.py @@ -19,8 +19,13 @@ from sushy import utils from rsd_lib.resources.v2_1.ethernet_switch import acl_rule -class ACL(base.ResourceBase): +class LinksField(base.CompositeField): + bound_ports = base.Field('BoundPorts', + adapter=utils.get_members_identities) + """return a EthernetSwitchPort collection""" + +class ACL(base.ResourceBase): identity = base.Field('Id', required=True) """The acl identity string""" @@ -33,7 +38,7 @@ class ACL(base.ResourceBase): oem = base.Field('Oem') """The acl oem info""" - links = base.Field('Links') + links = LinksField('Links') """The acl links""" def __init__(self, connector, identity, redfish_version=None): diff --git a/rsd_lib/tests/unit/resources/v2_1/ethernet_switch/test_acl.py b/rsd_lib/tests/unit/resources/v2_1/ethernet_switch/test_acl.py index a0073cc..c33b183 100644 --- a/rsd_lib/tests/unit/resources/v2_1/ethernet_switch/test_acl.py +++ b/rsd_lib/tests/unit/resources/v2_1/ethernet_switch/test_acl.py @@ -30,8 +30,8 @@ class ACLTestCase(testtools.TestCase): super(ACLTestCase, self).setUp() self.conn = mock.Mock() with open( - 'rsd_lib/tests/unit/json_samples/v2_1/ethernet_switch_acl.json', - 'r') as f: + 'rsd_lib/tests/unit/json_samples/v2_1/ethernet_switch_acl.' + 'json', 'r') as f: self.conn.get.return_value.json.return_value = json.loads(f.read()) self.acl_inst = acl.ACL( @@ -47,6 +47,8 @@ class ACLTestCase(testtools.TestCase): self.acl_inst.name) self.assertEqual('Switch ACL', self.acl_inst.description) self.assertEqual({}, self.acl_inst.oem) + self.assertEqual(('/redfish/v1/EthernetSwitches/Switch1/Ports/sw0p1',), + self.acl_inst.links.bound_ports) def test__get_acl_rule_collection_path(self): self.assertEqual(