diff --git a/rsd_lib/resources/v2_1/ethernet_switch/ethernet_switch_port.py b/rsd_lib/resources/v2_1/ethernet_switch/ethernet_switch_port.py index 7169ae8..441def2 100644 --- a/rsd_lib/resources/v2_1/ethernet_switch/ethernet_switch_port.py +++ b/rsd_lib/resources/v2_1/ethernet_switch/ethernet_switch_port.py @@ -140,6 +140,10 @@ class EthernetSwitchPort(rsd_lib_base.ResourceBase): links = LinksField("Links") + def delete(self): + """Delete this ethernet switch port""" + self._conn.delete(self._path) + @property @utils.cache_it def vlans(self): @@ -170,6 +174,7 @@ class EthernetSwitchPort(rsd_lib_base.ResourceBase): class EthernetSwitchPortCollection(rsd_lib_base.ResourceCollectionBase): + @property def _resource_type(self): return EthernetSwitchPort diff --git a/rsd_lib/tests/unit/resources/v2_1/ethernet_switch/test_ethernet_switch_port.py b/rsd_lib/tests/unit/resources/v2_1/ethernet_switch/test_ethernet_switch_port.py index b6c3d3b..80f5bf3 100644 --- a/rsd_lib/tests/unit/resources/v2_1/ethernet_switch/test_ethernet_switch_port.py +++ b/rsd_lib/tests/unit/resources/v2_1/ethernet_switch/test_ethernet_switch_port.py @@ -110,6 +110,12 @@ class EthernetSwitchPortTestCase(testtools.TestCase): self.port_inst.links.oem.intel_rackscale.neighbor_interface, ) + def test_delete(self): + self.port_inst.delete() + self.port_inst._conn.delete.assert_called_once_with( + self.port_inst.path + ) + def test_static_mac(self): # | GIVEN | self.conn.get.return_value.json.reset_mock()