Add delete method in EthernetSwitchStaticMAC in RSD 2.1

Change-Id: I32ee4b01b43bbde83216c7a8116e592fa89a6910
This commit is contained in:
Lin Yang 2019-03-26 20:00:32 -07:00
parent 17da19a34d
commit 9720ce2e89
2 changed files with 11 additions and 0 deletions

View File

@ -36,8 +36,13 @@ class EthernetSwitchStaticMAC(rsd_lib_base.ResourceBase):
mac_address = base.Field("MACAddress")
"""The static mac address"""
def delete(self):
"""Delete this static mac address"""
self._conn.delete(self._path)
class EthernetSwitchStaticMACCollection(rsd_lib_base.ResourceCollectionBase):
@property
def _resource_type(self):
return EthernetSwitchStaticMAC

View File

@ -52,6 +52,12 @@ class EthernetSwitchStaticMACTestCase(testtools.TestCase):
self.assertEqual("00:11:22:33:44:55", self.static_mac_inst.mac_address)
self.assertEqual(112, self.static_mac_inst.vlan_id)
def test_delete(self):
self.static_mac_inst.delete()
self.static_mac_inst._conn.delete.assert_called_once_with(
self.static_mac_inst.path
)
class EthernetSwitchStaticMACCollectionTestCase(testtools.TestCase):
def setUp(self):