Add patch method in EthernetSwitchACLRule in RSD 2.1
Change-Id: I5e98ada0bd68c6fa1545ff0d5e8f117a955c7119
This commit is contained in:
		@@ -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):
 | 
					class EthernetSwitchACLRuleCollection(rsd_lib_base.ResourceCollectionBase):
 | 
				
			||||||
    @property
 | 
					    @property
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -197,6 +197,23 @@ class EthernetSwitchACLRuleTestCase(testtools.TestCase):
 | 
				
			|||||||
        # | WHEN & THEN |
 | 
					        # | WHEN & THEN |
 | 
				
			||||||
        self.assertIsInstance(self.acl_rule_inst.mirror_port_region, list)
 | 
					        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):
 | 
					class EthernetSwitchACLRuleCollectionTestCase(testtools.TestCase):
 | 
				
			||||||
    def setUp(self):
 | 
					    def setUp(self):
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user