Remove deprecated floating_ips_bulk API
These were deprecated in Newton in change: aaebeb05a03e34281a091dc6dfc4672b01cdfbbb Change-Id: Idee91ca8fc4715cd952f97dafcdd5519c9bec919
This commit is contained in:
parent
ef74c0a7c8
commit
ab3315b46f
novaclient
tests/unit
v2
releasenotes/notes
@ -47,51 +47,6 @@ class FloatingFixture(base.Fixture):
|
||||
headers=self.json_headers)
|
||||
|
||||
|
||||
class BulkFixture(base.Fixture):
|
||||
|
||||
base_url = 'os-floating-ips-bulk'
|
||||
|
||||
def setUp(self):
|
||||
super(BulkFixture, self).setUp()
|
||||
|
||||
get_os_floating_ips_bulk = {
|
||||
'floating_ip_info': [
|
||||
{'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'},
|
||||
]
|
||||
}
|
||||
self.requests_mock.get(self.url(),
|
||||
json=get_os_floating_ips_bulk,
|
||||
headers=self.json_headers)
|
||||
self.requests_mock.get(self.url('testHost'),
|
||||
json=get_os_floating_ips_bulk,
|
||||
headers=self.json_headers)
|
||||
|
||||
def put_os_floating_ips_bulk_delete(request, context):
|
||||
ip_range = request.json().get('ip_range')
|
||||
return {'floating_ips_bulk_delete': ip_range}
|
||||
|
||||
self.requests_mock.put(self.url('delete'),
|
||||
json=put_os_floating_ips_bulk_delete,
|
||||
headers=self.json_headers)
|
||||
|
||||
def post_os_floating_ips_bulk(request, context):
|
||||
params = request.json().get('floating_ips_bulk_create')
|
||||
pool = params.get('pool', 'defaultPool')
|
||||
interface = params.get('interface', 'defaultInterface')
|
||||
return {
|
||||
'floating_ips_bulk_create': {
|
||||
'ip_range': '192.168.1.0/30',
|
||||
'pool': pool,
|
||||
'interface': interface
|
||||
}
|
||||
}
|
||||
|
||||
self.requests_mock.post(self.url(),
|
||||
json=post_os_floating_ips_bulk,
|
||||
headers=self.json_headers)
|
||||
|
||||
|
||||
class PoolsFixture(base.Fixture):
|
||||
|
||||
base_url = 'os-floating-ip-pools'
|
||||
|
@ -1030,25 +1030,6 @@ class FakeSessionClient(base_client.SessionClient):
|
||||
def delete_os_floating_ips_1(self, **kw):
|
||||
return (204, {}, None)
|
||||
|
||||
def get_os_floating_ips_bulk(self, **kw):
|
||||
return (200, {}, {'floating_ip_info': [
|
||||
{'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 post_os_floating_ips_bulk(self, **kw):
|
||||
params = kw.get('body').get('floating_ips_bulk_create')
|
||||
pool = params.get('pool', 'defaultPool')
|
||||
interface = params.get('interface', 'defaultInterface')
|
||||
return (200, {}, {'floating_ips_bulk_create':
|
||||
{'ip_range': '192.168.1.0/30',
|
||||
'pool': pool,
|
||||
'interface': interface}})
|
||||
|
||||
def put_os_floating_ips_bulk_delete(self, **kw):
|
||||
ip_range = kw.get('body').get('ip_range')
|
||||
return (200, {}, {'floating_ips_bulk_delete': ip_range})
|
||||
|
||||
#
|
||||
# Images
|
||||
#
|
||||
|
@ -1,75 +0,0 @@
|
||||
# Copyright 2012 IBM Corp.
|
||||
# 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 FloatingIPsBulkTest(utils.FixturedTestCase):
|
||||
|
||||
client_fixture_class = client.V1
|
||||
data_fixture_class = data.BulkFixture
|
||||
|
||||
def test_list_floating_ips_bulk(self):
|
||||
fl = self.cs.floating_ips_bulk.list()
|
||||
self.assert_request_id(fl, fakes.FAKE_REQUEST_ID_LIST)
|
||||
self.assert_called('GET', '/os-floating-ips-bulk')
|
||||
for f in fl:
|
||||
self.assertIsInstance(f, floating_ips.FloatingIP)
|
||||
|
||||
def test_list_floating_ips_bulk_host_filter(self):
|
||||
fl = self.cs.floating_ips_bulk.list('testHost')
|
||||
self.assert_request_id(fl, fakes.FAKE_REQUEST_ID_LIST)
|
||||
self.assert_called('GET', '/os-floating-ips-bulk/testHost')
|
||||
for f in fl:
|
||||
self.assertIsInstance(f, floating_ips.FloatingIP)
|
||||
|
||||
def test_create_floating_ips_bulk(self):
|
||||
fl = self.cs.floating_ips_bulk.create('192.168.1.0/30')
|
||||
self.assert_request_id(fl, fakes.FAKE_REQUEST_ID_LIST)
|
||||
body = {'floating_ips_bulk_create': {'ip_range': '192.168.1.0/30'}}
|
||||
self.assert_called('POST', '/os-floating-ips-bulk', body)
|
||||
self.assertEqual(fl.ip_range,
|
||||
body['floating_ips_bulk_create']['ip_range'])
|
||||
|
||||
def test_create_floating_ips_bulk_with_pool_and_host(self):
|
||||
fl = self.cs.floating_ips_bulk.create('192.168.1.0/30', 'poolTest',
|
||||
'interfaceTest')
|
||||
self.assert_request_id(fl, fakes.FAKE_REQUEST_ID_LIST)
|
||||
body = {'floating_ips_bulk_create': {
|
||||
'ip_range': '192.168.1.0/30', 'pool': 'poolTest',
|
||||
'interface': 'interfaceTest'}}
|
||||
self.assert_called('POST', '/os-floating-ips-bulk', body)
|
||||
self.assertEqual(fl.ip_range,
|
||||
body['floating_ips_bulk_create']['ip_range'])
|
||||
self.assertEqual(fl.pool,
|
||||
body['floating_ips_bulk_create']['pool'])
|
||||
self.assertEqual(fl.interface,
|
||||
body['floating_ips_bulk_create']['interface'])
|
||||
|
||||
def test_delete_floating_ips_bulk(self):
|
||||
fl = self.cs.floating_ips_bulk.delete('192.168.1.0/30')
|
||||
self.assert_request_id(fl, fakes.FAKE_REQUEST_ID_LIST)
|
||||
body = {'ip_range': '192.168.1.0/30'}
|
||||
self.assert_called('PUT', '/os-floating-ips-bulk/delete', body)
|
||||
self.assertEqual(fl.floating_ips_bulk_delete, body['ip_range'])
|
||||
|
||||
def test_repr(self):
|
||||
fl = self.cs.floating_ips_bulk.create('192.168.1.0/30', 'poolTest',
|
||||
'interfaceTest')
|
||||
self.assertEqual('<FloatingIPRange: 192.168.1.0/30>', "%s" % fl)
|
@ -33,7 +33,6 @@ from novaclient.v2 import flavor_access
|
||||
from novaclient.v2 import flavors
|
||||
from novaclient.v2 import floating_ip_pools
|
||||
from novaclient.v2 import floating_ips
|
||||
from novaclient.v2 import floating_ips_bulk
|
||||
from novaclient.v2 import fping
|
||||
from novaclient.v2 import hosts
|
||||
from novaclient.v2 import hypervisors
|
||||
@ -184,7 +183,6 @@ class Client(object):
|
||||
self.hypervisor_stats = hypervisors.HypervisorStatsManager(self)
|
||||
self.services = services.ServiceManager(self)
|
||||
self.fixed_ips = fixed_ips.FixedIPsManager(self)
|
||||
self.floating_ips_bulk = floating_ips_bulk.FloatingIPBulkManager(self)
|
||||
self.os_cache = os_cache
|
||||
self.availability_zones = \
|
||||
availability_zones.AvailabilityZoneManager(self)
|
||||
|
@ -1,64 +0,0 @@
|
||||
# Copyright 2012 IBM Corp.
|
||||
# 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.
|
||||
|
||||
"""
|
||||
Bulk Floating IPs interface
|
||||
"""
|
||||
from novaclient import api_versions
|
||||
from novaclient import base
|
||||
from novaclient.v2 import floating_ips
|
||||
|
||||
|
||||
class FloatingIPRange(base.Resource):
|
||||
"""DEPRECATED"""
|
||||
|
||||
def __repr__(self):
|
||||
return "<FloatingIPRange: %s>" % self.ip_range
|
||||
|
||||
|
||||
class FloatingIPBulkManager(base.ManagerWithFind):
|
||||
"""DEPRECATED"""
|
||||
|
||||
resource_class = FloatingIPRange
|
||||
|
||||
@api_versions.deprecated_after('2.35')
|
||||
def list(self, host=None):
|
||||
"""DEPRECATED: List all floating IPs."""
|
||||
if host is None:
|
||||
return self._list('/os-floating-ips-bulk',
|
||||
'floating_ip_info',
|
||||
obj_class=floating_ips.FloatingIP)
|
||||
else:
|
||||
return self._list('/os-floating-ips-bulk/%s' % host,
|
||||
'floating_ip_info',
|
||||
obj_class=floating_ips.FloatingIP)
|
||||
|
||||
@api_versions.deprecated_after('2.35')
|
||||
def create(self, ip_range, pool=None, interface=None):
|
||||
"""DEPRECATED: Create floating IPs by range."""
|
||||
body = {"floating_ips_bulk_create": {'ip_range': ip_range}}
|
||||
if pool is not None:
|
||||
body['floating_ips_bulk_create']['pool'] = pool
|
||||
if interface is not None:
|
||||
body['floating_ips_bulk_create']['interface'] = interface
|
||||
|
||||
return self._create('/os-floating-ips-bulk', body,
|
||||
'floating_ips_bulk_create')
|
||||
|
||||
@api_versions.deprecated_after('2.35')
|
||||
def delete(self, ip_range):
|
||||
"""DEPRECATED: Delete floating IPs by range."""
|
||||
body = {"ip_range": ip_range}
|
||||
return self._update('/os-floating-ips-bulk/delete', body)
|
@ -56,6 +56,7 @@ upgrade:
|
||||
|
||||
* novaclient.v2.contrib.tenant_networks
|
||||
* novaclient.v2.floating_ip_dns
|
||||
* novaclient.v2.floating_ips_bulk
|
||||
|
||||
deprecations:
|
||||
- |
|
||||
|
Loading…
x
Reference in New Issue
Block a user