From bf877c84b3bfca8669992e3004b9ee42f5a6b87d Mon Sep 17 00:00:00 2001 From: Federico Ressi Date: Wed, 22 Aug 2018 08:36:37 +0200 Subject: [PATCH] Deprecate BaseTempestTestCase.create_and_associate_floatingip method Add new 'debtcollector' dependency with the purpose of deprecating methods that are going to be removed. Mark BaseTempestTestCase.create_and_associate_floatingip for removal. Replace create_and_associate_floatingip with create_floatingip in BaseTempestTestCase class. Change-Id: I5c5fd143a5cb4e138c46d13445f8225444bd2f58 --- neutron_tempest_plugin/scenario/base.py | 13 ++++++------- .../mark-methods-removals-f8b230171c045a3e.yaml | 11 +++++++++++ requirements.txt | 1 + 3 files changed, 18 insertions(+), 7 deletions(-) create mode 100644 releasenotes/notes/mark-methods-removals-f8b230171c045a3e.yaml diff --git a/neutron_tempest_plugin/scenario/base.py b/neutron_tempest_plugin/scenario/base.py index 3adaa1e4..1aaf8ce8 100644 --- a/neutron_tempest_plugin/scenario/base.py +++ b/neutron_tempest_plugin/scenario/base.py @@ -14,6 +14,7 @@ # under the License. import subprocess +from debtcollector import removals import netaddr from neutron_lib.api import validators from neutron_lib import constants as neutron_lib_constants @@ -158,14 +159,12 @@ class BaseTempestTestCase(base_api.BaseNetworkTest): cls.routers.append(router) return router + @removals.remove(version='Stein', + message="Please use create_floatingip method instead of " + "create_and_associate_floatingip.") def create_and_associate_floatingip(self, port_id, client=None): client = client or self.os_primary.network_client - fip = client.create_floatingip( - CONF.network.public_network_id, - port_id=port_id)['floatingip'] - if client is self.os_primary.network_client: - self.floating_ips.append(fip) - return fip + return self.create_floatingip(port_id=port_id, client=client) def create_interface(cls, server_id, port_id, client=None): client = client or cls.os_primary.interfaces_client @@ -215,7 +214,7 @@ class BaseTempestTestCase(base_api.BaseNetworkTest): self.port = self.client.list_ports(network_id=self.network['id'], device_id=self.server[ 'server']['id'])['ports'][0] - self.fip = self.create_and_associate_floatingip(self.port['id']) + self.fip = self.create_floatingip(port=self.port) def check_connectivity(self, host, ssh_user, ssh_key, servers=None): ssh_client = ssh.Client(host, ssh_user, pkey=ssh_key) diff --git a/releasenotes/notes/mark-methods-removals-f8b230171c045a3e.yaml b/releasenotes/notes/mark-methods-removals-f8b230171c045a3e.yaml new file mode 100644 index 00000000..ab9f37a5 --- /dev/null +++ b/releasenotes/notes/mark-methods-removals-f8b230171c045a3e.yaml @@ -0,0 +1,11 @@ +--- + +features: + - | + Add new 'debtcollector' dependency with the purpose of deprecating methods + that are going to be removed. + +deprecations: + - | + Deprecate method BaseTempestTestCase.create_and_associate_floatingip after + replacing it with method BaseNetworkTest.create_floatingip. diff --git a/requirements.txt b/requirements.txt index 5660c685..e48daf7a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -16,3 +16,4 @@ ddt>=1.0.1 # MIT testtools>=2.2.0 # MIT testscenarios>=0.4 # Apache-2.0/BSD eventlet!=0.18.3,!=0.20.1,>=0.18.2 # MIT +debtcollector>=1.2.0 # Apache-2.0