Merge "Remove deprecated floating_ips APIs"
This commit is contained in:
commit
c3b0572c5a
novaclient
releasenotes/notes
@ -996,40 +996,6 @@ class FakeSessionClient(base_client.SessionClient):
|
||||
return (202, FAKE_RESPONSE_HEADERS,
|
||||
self.get_flavors_2_os_flavor_access()[2])
|
||||
|
||||
#
|
||||
# Floating IPs
|
||||
#
|
||||
|
||||
def get_os_floating_ips(self, **kw):
|
||||
return (
|
||||
200,
|
||||
{},
|
||||
{'floating_ips': [
|
||||
{'id': 1, 'fixed_ip': '10.0.0.1', 'ip': '11.0.0.1'},
|
||||
{'id': 2, 'fixed_ip': '10.0.0.2', 'ip': '11.0.0.2'},
|
||||
]},
|
||||
)
|
||||
|
||||
def get_os_floating_ips_1(self, **kw):
|
||||
return (
|
||||
200, {}, {'floating_ip': {'id': 1, 'fixed_ip': '10.0.0.1',
|
||||
'ip': '11.0.0.1'}})
|
||||
|
||||
def post_os_floating_ips(self, body):
|
||||
if body.get('pool'):
|
||||
return (
|
||||
200, {}, {'floating_ip': {'id': 1, 'fixed_ip': '10.0.0.1',
|
||||
'ip': '11.0.0.1',
|
||||
'pool': 'nova'}})
|
||||
else:
|
||||
return (
|
||||
200, {}, {'floating_ip': {'id': 1, 'fixed_ip': '10.0.0.1',
|
||||
'ip': '11.0.0.1',
|
||||
'pool': None}})
|
||||
|
||||
def delete_os_floating_ips_1(self, **kw):
|
||||
return (204, {}, None)
|
||||
|
||||
#
|
||||
# Images
|
||||
#
|
||||
|
@ -1,66 +0,0 @@
|
||||
# Copyright (c) 2011 X.commerce, a business unit of eBay Inc.
|
||||
#
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from novaclient.tests.unit.fixture_data import client
|
||||
from novaclient.tests.unit.fixture_data import floatingips as data
|
||||
from novaclient.tests.unit import utils
|
||||
from novaclient.tests.unit.v2 import fakes
|
||||
from novaclient.v2 import floating_ips
|
||||
|
||||
|
||||
class FloatingIPsTest(utils.FixturedTestCase):
|
||||
|
||||
client_fixture_class = client.V1
|
||||
data_fixture_class = data.FloatingFixture
|
||||
|
||||
def test_list_floating_ips(self):
|
||||
fips = self.cs.floating_ips.list()
|
||||
self.assert_request_id(fips, fakes.FAKE_REQUEST_ID_LIST)
|
||||
self.assert_called('GET', '/os-floating-ips')
|
||||
for fip in fips:
|
||||
self.assertIsInstance(fip, floating_ips.FloatingIP)
|
||||
|
||||
def test_delete_floating_ip(self):
|
||||
fl = self.cs.floating_ips.list()[0]
|
||||
ret = fl.delete()
|
||||
self.assert_request_id(ret, fakes.FAKE_REQUEST_ID_LIST)
|
||||
self.assert_called('DELETE', '/os-floating-ips/1')
|
||||
ret = self.cs.floating_ips.delete(1)
|
||||
self.assert_request_id(ret, fakes.FAKE_REQUEST_ID_LIST)
|
||||
self.assert_called('DELETE', '/os-floating-ips/1')
|
||||
ret = self.cs.floating_ips.delete(fl)
|
||||
self.assert_request_id(ret, fakes.FAKE_REQUEST_ID_LIST)
|
||||
self.assert_called('DELETE', '/os-floating-ips/1')
|
||||
|
||||
def test_create_floating_ip(self):
|
||||
fl = self.cs.floating_ips.create()
|
||||
self.assert_request_id(fl, fakes.FAKE_REQUEST_ID_LIST)
|
||||
self.assert_called('POST', '/os-floating-ips')
|
||||
self.assertIsNone(fl.pool)
|
||||
self.assertIsInstance(fl, floating_ips.FloatingIP)
|
||||
|
||||
def test_create_floating_ip_with_pool(self):
|
||||
fl = self.cs.floating_ips.create('nova')
|
||||
self.assert_request_id(fl, fakes.FAKE_REQUEST_ID_LIST)
|
||||
self.assert_called('POST', '/os-floating-ips')
|
||||
self.assertEqual('nova', fl.pool)
|
||||
self.assertIsInstance(fl, floating_ips.FloatingIP)
|
||||
|
||||
def test_repr(self):
|
||||
fl = self.cs.floating_ips.list()[0]
|
||||
string = "%s" % fl
|
||||
self.assertEqual("<FloatingIP fixed_ip=10.0.0.1, id=1, ip=11.0.0.1>",
|
||||
string)
|
@ -20,6 +20,7 @@ import mock
|
||||
import six
|
||||
|
||||
from novaclient import api_versions
|
||||
from novaclient import base
|
||||
from novaclient import exceptions
|
||||
from novaclient.tests.unit.fixture_data import client
|
||||
from novaclient.tests.unit.fixture_data import floatingips
|
||||
@ -29,6 +30,21 @@ from novaclient.tests.unit.v2 import fakes
|
||||
from novaclient.v2 import servers
|
||||
|
||||
|
||||
class _FloatingIPManager(base.Manager):
|
||||
resource_class = base.Resource
|
||||
|
||||
@api_versions.deprecated_after('2.35')
|
||||
def list(self):
|
||||
"""DEPRECATED: List floating IPs"""
|
||||
return self._list("/os-floating-ips", "floating_ips")
|
||||
|
||||
@api_versions.deprecated_after('2.35')
|
||||
def get(self, floating_ip):
|
||||
"""DEPRECATED: Retrieve a floating IP"""
|
||||
return self._get("/os-floating-ips/%s" % base.getid(floating_ip),
|
||||
"floating_ip")
|
||||
|
||||
|
||||
class ServersTest(utils.FixturedTestCase):
|
||||
|
||||
client_fixture_class = client.V1
|
||||
@ -40,6 +56,7 @@ class ServersTest(utils.FixturedTestCase):
|
||||
self.useFixture(floatingips.FloatingFixture(self.requests_mock))
|
||||
if self.api_version:
|
||||
self.cs.api_version = api_versions.APIVersion(self.api_version)
|
||||
self.floating_ips = _FloatingIPManager(self.cs)
|
||||
|
||||
def _get_server_create_default_nics(self):
|
||||
"""Callback for default nics kwarg when creating a server.
|
||||
@ -565,7 +582,7 @@ class ServersTest(utils.FixturedTestCase):
|
||||
fip = self.cs.servers.add_floating_ip(s, '11.0.0.1')
|
||||
self.assert_request_id(fip, fakes.FAKE_REQUEST_ID_LIST)
|
||||
self.assert_called('POST', '/servers/1234/action')
|
||||
f = self.cs.floating_ips.list()[0]
|
||||
f = self.floating_ips.list()[0]
|
||||
fip = self.cs.servers.add_floating_ip(s, f)
|
||||
self.assert_request_id(fip, fakes.FAKE_REQUEST_ID_LIST)
|
||||
self.assert_called('POST', '/servers/1234/action')
|
||||
@ -582,7 +599,7 @@ class ServersTest(utils.FixturedTestCase):
|
||||
fixed_address='12.0.0.1')
|
||||
self.assert_request_id(fip, fakes.FAKE_REQUEST_ID_LIST)
|
||||
self.assert_called('POST', '/servers/1234/action')
|
||||
f = self.cs.floating_ips.list()[0]
|
||||
f = self.floating_ips.list()[0]
|
||||
fip = self.cs.servers.add_floating_ip(s, f)
|
||||
self.assert_request_id(fip, fakes.FAKE_REQUEST_ID_LIST)
|
||||
self.assert_called('POST', '/servers/1234/action')
|
||||
@ -598,7 +615,7 @@ class ServersTest(utils.FixturedTestCase):
|
||||
ret = self.cs.servers.remove_floating_ip(s, '11.0.0.1')
|
||||
self.assert_request_id(ret, fakes.FAKE_REQUEST_ID_LIST)
|
||||
self.assert_called('POST', '/servers/1234/action')
|
||||
f = self.cs.floating_ips.list()[0]
|
||||
f = self.floating_ips.list()[0]
|
||||
ret = self.cs.servers.remove_floating_ip(s, f)
|
||||
self.assert_request_id(ret, fakes.FAKE_REQUEST_ID_LIST)
|
||||
self.assert_called('POST', '/servers/1234/action')
|
||||
@ -1374,13 +1391,13 @@ class ServersV2_37Test(ServersV226Test):
|
||||
self.assertIsInstance(s, servers.Server)
|
||||
|
||||
def test_add_floating_ip(self):
|
||||
# self.cs.floating_ips.list() is not available after 2.35
|
||||
# self.floating_ips.list() is not available after 2.35
|
||||
pass
|
||||
|
||||
def test_add_floating_ip_to_fixed(self):
|
||||
# self.cs.floating_ips.list() is not available after 2.35
|
||||
# self.floating_ips.list() is not available after 2.35
|
||||
pass
|
||||
|
||||
def test_remove_floating_ip(self):
|
||||
# self.cs.floating_ips.list() is not available after 2.35
|
||||
# self.floating_ips.list() is not available after 2.35
|
||||
pass
|
||||
|
@ -30,7 +30,6 @@ from novaclient.v2 import cloudpipe
|
||||
from novaclient.v2 import contrib
|
||||
from novaclient.v2 import flavor_access
|
||||
from novaclient.v2 import flavors
|
||||
from novaclient.v2 import floating_ips
|
||||
from novaclient.v2 import hosts
|
||||
from novaclient.v2 import hypervisors
|
||||
from novaclient.v2 import images
|
||||
@ -154,7 +153,6 @@ class Client(object):
|
||||
self.agents = agents.AgentsManager(self)
|
||||
self.cloudpipe = cloudpipe.CloudpipeManager(self)
|
||||
self.certs = certs.CertificateManager(self)
|
||||
self.floating_ips = floating_ips.FloatingIPManager(self)
|
||||
self.volumes = volumes.VolumeManager(self)
|
||||
self.keypairs = keypairs.KeypairManager(self)
|
||||
self.networks = networks.NetworkManager(self)
|
||||
|
@ -1,60 +0,0 @@
|
||||
# Copyright (c) 2011 X.commerce, a business unit of eBay Inc.
|
||||
# Copyright 2011 OpenStack Foundation
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from novaclient import api_versions
|
||||
from novaclient import base
|
||||
|
||||
|
||||
class FloatingIP(base.Resource):
|
||||
"""DEPRECATED"""
|
||||
|
||||
def delete(self):
|
||||
"""
|
||||
DEPRECATED: Delete this floating IP
|
||||
|
||||
:returns: An instance of novaclient.base.TupleWithMeta
|
||||
"""
|
||||
return self.manager.delete(self)
|
||||
|
||||
|
||||
class FloatingIPManager(base.ManagerWithFind):
|
||||
"""DEPRECATED"""
|
||||
resource_class = FloatingIP
|
||||
|
||||
@api_versions.deprecated_after('2.35')
|
||||
def list(self):
|
||||
"""DEPRECATED: List floating IPs"""
|
||||
return self._list("/os-floating-ips", "floating_ips")
|
||||
|
||||
@api_versions.deprecated_after('2.35')
|
||||
def create(self, pool=None):
|
||||
"""DEPRECATED: Create (allocate) a floating IP for a tenant"""
|
||||
return self._create("/os-floating-ips", {'pool': pool}, "floating_ip")
|
||||
|
||||
@api_versions.deprecated_after('2.35')
|
||||
def delete(self, floating_ip):
|
||||
"""DEPRECATED: Delete (deallocate) a floating IP for a tenant
|
||||
|
||||
:param floating_ip: The floating IP address to delete.
|
||||
:returns: An instance of novaclient.base.TupleWithMeta
|
||||
"""
|
||||
return self._delete("/os-floating-ips/%s" % base.getid(floating_ip))
|
||||
|
||||
@api_versions.deprecated_after('2.35')
|
||||
def get(self, floating_ip):
|
||||
"""DEPRECATED: Retrieve a floating IP"""
|
||||
return self._get("/os-floating-ips/%s" % base.getid(floating_ip),
|
||||
"floating_ip")
|
@ -58,6 +58,7 @@ upgrade:
|
||||
* novaclient.v2.fixed_ips
|
||||
* novaclient.v2.floating_ip_dns
|
||||
* novaclient.v2.floating_ip_pools
|
||||
* novaclient.v2.floating_ips
|
||||
* novaclient.v2.floating_ips_bulk
|
||||
* novaclient.v2.fping
|
||||
* novaclient.v2.security_group_default_rules
|
||||
|
Loading…
x
Reference in New Issue
Block a user