From 20780a2e0b6d06170a2b41d280e80f7bd103a095 Mon Sep 17 00:00:00 2001 From: Lin Yang Date: Tue, 10 Sep 2019 14:27:40 -0700 Subject: [PATCH] Add delete method to base resource class Change-Id: I0a60af9e1751e623e9e266141ab3d8db9d3d4691 --- rsd_lib/base.py | 8 ++++++++ .../resources/v2_1/ethernet_switch/ethernet_switch_acl.py | 4 ---- .../v2_1/ethernet_switch/ethernet_switch_acl_rule.py | 4 ---- .../v2_1/ethernet_switch/ethernet_switch_port.py | 4 ---- .../v2_1/ethernet_switch/ethernet_switch_static_mac.py | 4 ---- .../v2_1/ethernet_switch/vlan_network_interface.py | 4 ---- rsd_lib/resources/v2_1/event_service/event_destination.py | 4 ---- rsd_lib/resources/v2_1/task/task.py | 4 ---- .../v2_2/telemetry_service/metric_report_definition.py | 4 ---- rsd_lib/resources/v2_2/telemetry_service/triggers.py | 4 ---- rsd_lib/resources/v2_3/fabric/endpoint.py | 4 ---- rsd_lib/resources/v2_3/fabric/zone.py | 4 ---- rsd_lib/resources/v2_3/storage_service/volume.py | 4 ---- rsd_lib/resources/v2_4/fabric/endpoint.py | 4 ---- 14 files changed, 8 insertions(+), 52 deletions(-) diff --git a/rsd_lib/base.py b/rsd_lib/base.py index a0787d0..dd82230 100644 --- a/rsd_lib/base.py +++ b/rsd_lib/base.py @@ -120,6 +120,10 @@ class ResourceBase(base.ResourceBase): description = base.Field("Description") """The resource description""" + def delete(self): + """Delete this resource""" + self._conn.delete(self._path) + class ResourceCollectionBase(base.ResourceCollectionBase): @@ -128,3 +132,7 @@ class ResourceCollectionBase(base.ResourceCollectionBase): description = base.Field("Description") """The resource collection description""" + + def delete(self): + """Delete this resource collection""" + self._conn.delete(self._path) diff --git a/rsd_lib/resources/v2_1/ethernet_switch/ethernet_switch_acl.py b/rsd_lib/resources/v2_1/ethernet_switch/ethernet_switch_acl.py index 971479b..c0b7b69 100644 --- a/rsd_lib/resources/v2_1/ethernet_switch/ethernet_switch_acl.py +++ b/rsd_lib/resources/v2_1/ethernet_switch/ethernet_switch_acl.py @@ -133,10 +133,6 @@ class EthernetSwitchACL(rsd_lib_base.ResourceBase): self._conn.post(target_uri, data=data) - def delete(self): - """Delete this ACL""" - self._conn.delete(self._path) - @property @utils.cache_it def rules(self): diff --git a/rsd_lib/resources/v2_1/ethernet_switch/ethernet_switch_acl_rule.py b/rsd_lib/resources/v2_1/ethernet_switch/ethernet_switch_acl_rule.py index cec9582..d5708ce 100644 --- a/rsd_lib/resources/v2_1/ethernet_switch/ethernet_switch_acl_rule.py +++ b/rsd_lib/resources/v2_1/ethernet_switch/ethernet_switch_acl_rule.py @@ -95,10 +95,6 @@ class EthernetSwitchACLRule(rsd_lib_base.ResourceBase): action. """ - def delete(self): - """Delete this ACL rule""" - self._conn.delete(self._path) - @property @utils.cache_it def forward_mirror_interface(self): 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 80d7686..4ef1127 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 @@ -142,10 +142,6 @@ 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): diff --git a/rsd_lib/resources/v2_1/ethernet_switch/ethernet_switch_static_mac.py b/rsd_lib/resources/v2_1/ethernet_switch/ethernet_switch_static_mac.py index ec6f312..59f5f95 100644 --- a/rsd_lib/resources/v2_1/ethernet_switch/ethernet_switch_static_mac.py +++ b/rsd_lib/resources/v2_1/ethernet_switch/ethernet_switch_static_mac.py @@ -61,10 +61,6 @@ class EthernetSwitchStaticMAC(rsd_lib_base.ResourceBase): self._conn.patch(self.path, data=data) - def delete(self): - """Delete this static mac address""" - self._conn.delete(self._path) - class EthernetSwitchStaticMACCollection(rsd_lib_base.ResourceCollectionBase): @property diff --git a/rsd_lib/resources/v2_1/ethernet_switch/vlan_network_interface.py b/rsd_lib/resources/v2_1/ethernet_switch/vlan_network_interface.py index d579b57..b574a1a 100644 --- a/rsd_lib/resources/v2_1/ethernet_switch/vlan_network_interface.py +++ b/rsd_lib/resources/v2_1/ethernet_switch/vlan_network_interface.py @@ -68,10 +68,6 @@ class VLanNetworkInterface(rsd_lib_base.ResourceBase): oem = OemField("Oem") """Oem specific properties.""" - def delete(self): - """Delete this vlan network interface""" - self._conn.delete(self.path) - class VLanNetworkInterfaceCollection(rsd_lib_base.ResourceCollectionBase): @property diff --git a/rsd_lib/resources/v2_1/event_service/event_destination.py b/rsd_lib/resources/v2_1/event_service/event_destination.py index 562b18f..03b51a4 100644 --- a/rsd_lib/resources/v2_1/event_service/event_destination.py +++ b/rsd_lib/resources/v2_1/event_service/event_destination.py @@ -70,10 +70,6 @@ class EventDestination(rsd_lib_base.ResourceBase): message_ids = base.Field("MessageIds") """A list of MessageIds that the service will only send.""" - def delete(self): - """Delete this event subscription""" - self._conn.delete(self._path) - class EventDestinationCollection(rsd_lib_base.ResourceCollectionBase): @property diff --git a/rsd_lib/resources/v2_1/task/task.py b/rsd_lib/resources/v2_1/task/task.py index fc637b5..5183b69 100644 --- a/rsd_lib/resources/v2_1/task/task.py +++ b/rsd_lib/resources/v2_1/task/task.py @@ -41,10 +41,6 @@ class Task(rsd_lib_base.ResourceBase): messages = message.MessageCollectionField("Messages") """This is an array of messages associated with the task.""" - def delete(self): - """Delete this task""" - self._conn.delete(self.path) - class TaskCollection(rsd_lib_base.ResourceCollectionBase): @property diff --git a/rsd_lib/resources/v2_2/telemetry_service/metric_report_definition.py b/rsd_lib/resources/v2_2/telemetry_service/metric_report_definition.py index eed209a..fc3f27a 100644 --- a/rsd_lib/resources/v2_2/telemetry_service/metric_report_definition.py +++ b/rsd_lib/resources/v2_2/telemetry_service/metric_report_definition.py @@ -146,10 +146,6 @@ class MetricReportDefinition(rsd_lib_base.ResourceBase): redfish_version=self.redfish_version, ) - def delete(self): - """Delete report definition""" - self._conn.delete(self.path) - class MetricReportDefinitionCollection(rsd_lib_base.ResourceCollectionBase): @property diff --git a/rsd_lib/resources/v2_2/telemetry_service/triggers.py b/rsd_lib/resources/v2_2/telemetry_service/triggers.py index 02e4b7b..f3b96b2 100644 --- a/rsd_lib/resources/v2_2/telemetry_service/triggers.py +++ b/rsd_lib/resources/v2_2/telemetry_service/triggers.py @@ -124,10 +124,6 @@ class Triggers(rsd_lib_base.ResourceBase): is defined. """ - def delete(self): - """Delete trigger""" - self._conn.delete(self.path) - class TriggersCollection(rsd_lib_base.ResourceCollectionBase): @property diff --git a/rsd_lib/resources/v2_3/fabric/endpoint.py b/rsd_lib/resources/v2_3/fabric/endpoint.py index 7555f89..24095b5 100644 --- a/rsd_lib/resources/v2_3/fabric/endpoint.py +++ b/rsd_lib/resources/v2_3/fabric/endpoint.py @@ -126,10 +126,6 @@ class Endpoint(rsd_lib_base.ResourceBase): self._conn.patch(self.path, data=data) - def delete(self): - """Delete this endpoint""" - self._conn.delete(self.path) - class EndpointCollection(rsd_lib_base.ResourceCollectionBase): diff --git a/rsd_lib/resources/v2_3/fabric/zone.py b/rsd_lib/resources/v2_3/fabric/zone.py index dcf0fc8..91c6d7a 100644 --- a/rsd_lib/resources/v2_3/fabric/zone.py +++ b/rsd_lib/resources/v2_3/fabric/zone.py @@ -35,10 +35,6 @@ class Zone(v2_1_zone.Zone): self._conn.patch(self.path, data=data) - def delete(self): - """Delete this zone""" - self._conn.delete(self.path) - class ZoneCollection(v2_1_zone.ZoneCollection): diff --git a/rsd_lib/resources/v2_3/storage_service/volume.py b/rsd_lib/resources/v2_3/storage_service/volume.py index 9052bc3..1df9c48 100644 --- a/rsd_lib/resources/v2_3/storage_service/volume.py +++ b/rsd_lib/resources/v2_3/storage_service/volume.py @@ -177,10 +177,6 @@ class Volume(rsd_lib_base.ResourceBase): target_uri = self._get_initialize_action_element().target_uri self._conn.post(target_uri, data=data) - def delete(self): - """Delete this volume""" - self._conn.delete(self.path) - def _get_metrics_path(self): """Helper function to find the Metrics path""" return utils.get_sub_resource_path_by(self, diff --git a/rsd_lib/resources/v2_4/fabric/endpoint.py b/rsd_lib/resources/v2_4/fabric/endpoint.py index a8b3e0d..da0eec1 100644 --- a/rsd_lib/resources/v2_4/fabric/endpoint.py +++ b/rsd_lib/resources/v2_4/fabric/endpoint.py @@ -136,10 +136,6 @@ class Endpoint(rsd_lib_base.ResourceBase): oem = OemField('Oem') """The OEM additional info of this endpoint""" - def delete(self): - """Delete this endpoint""" - self._conn.delete(self.path) - class EndpointCollection(rsd_lib_base.ResourceCollectionBase):