Add acl missing property and unitest
Change-Id: I2a02251049897fd301f2e9600351a755a6b599bb
This commit is contained in:
parent
5836a2f06d
commit
158f4ec6bd
@ -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):
|
||||
|
@ -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(
|
||||
|
Loading…
x
Reference in New Issue
Block a user