Merge "Add patch method in EthernetSwitchACLRule in RSD 2.1"
This commit is contained in:
commit
9b7c8a0e04
@ -130,6 +130,17 @@ class EthernetSwitchACLRule(rsd_lib_base.ResourceBase):
|
||||
)
|
||||
]
|
||||
|
||||
def update(self, data=None):
|
||||
"""Update a new ACL rule
|
||||
|
||||
:param data: JSON for acl_rule
|
||||
"""
|
||||
update_schema = acl_rule_schema.acl_rule_req_schema
|
||||
del update_schema["required"]
|
||||
if data is not None or len(data) > 0:
|
||||
validate(data, update_schema)
|
||||
self._conn.patch(self.path, data=data)
|
||||
|
||||
|
||||
class EthernetSwitchACLRuleCollection(rsd_lib_base.ResourceCollectionBase):
|
||||
@property
|
||||
|
@ -197,6 +197,23 @@ class EthernetSwitchACLRuleTestCase(testtools.TestCase):
|
||||
# | WHEN & THEN |
|
||||
self.assertIsInstance(self.acl_rule_inst.mirror_port_region, list)
|
||||
|
||||
def test_update(self):
|
||||
data = {
|
||||
"RuleId": 1,
|
||||
"Action": "Permit",
|
||||
"Condition": {
|
||||
"IPSource": {
|
||||
"IPv4Address": "192.168.6.0",
|
||||
"Mask": "0.0.0.255",
|
||||
},
|
||||
},
|
||||
}
|
||||
self.acl_rule_inst.update(data)
|
||||
self.acl_rule_inst._conn.patch.assert_called_once_with(
|
||||
"/redfish/v1/EthernetSwitches/Switch1/ACLs/ACL1/Rules/Rule1",
|
||||
data=data,
|
||||
)
|
||||
|
||||
|
||||
class EthernetSwitchACLRuleCollectionTestCase(testtools.TestCase):
|
||||
def setUp(self):
|
||||
|
Loading…
x
Reference in New Issue
Block a user