Remove deprecated floating IP DNS domain/entry APIs

These were deprecated in Newton in change:

aaebeb05a0

Change-Id: I8888f241b04f075d92d2298c623144809546581f
This commit is contained in:
Matt Riedemann 2017-03-20 16:58:22 -04:00
parent ac7c96690f
commit ef74c0a7c8
7 changed files with 1 additions and 437 deletions

View File

@ -41,11 +41,6 @@ class SimpleReadOnlyNovaClientTest(base.ClientTestBase):
def test_admin_cloudpipe_list(self):
self.nova('cloudpipe-list')
@decorators.skip_because(bug="1157349")
def test_admin_dns_list(self):
self.skip_if_neutron()
self.nova('dns-list')
def test_admin_flavor_acces_list(self):
self.assertRaises(exceptions.CommandFailed,
self.nova,

View File

@ -10,7 +10,6 @@
# License for the specific language governing permissions and limitations
# under the License.
from novaclient.tests.unit import fakes
from novaclient.tests.unit.fixture_data import base
@ -48,101 +47,6 @@ class FloatingFixture(base.Fixture):
headers=self.json_headers)
class DNSFixture(base.Fixture):
base_url = 'os-floating-ip-dns'
def setUp(self):
super(DNSFixture, self).setUp()
get_os_floating_ip_dns = {
'domain_entries': [
{'domain': 'example.org'},
{'domain': 'example.com'}
]
}
self.requests_mock.get(self.url(),
json=get_os_floating_ip_dns,
headers=self.json_headers,
status_code=205)
get_dns_testdomain_entries_testname = {
'dns_entry': {
'ip': "10.10.10.10",
'name': 'testname',
'type': "A",
'domain': 'testdomain'
}
}
self.requests_mock.get(self.url('testdomain', 'entries', 'testname'),
json=get_dns_testdomain_entries_testname,
headers=self.json_headers,
status_code=205)
self.requests_mock.delete(self.url('testdomain'),
headers=self.json_headers)
url = self.url('testdomain', 'entries', 'testname')
self.requests_mock.delete(url, headers=self.json_headers)
def put_dns_testdomain_entries_testname(request, context):
fakes.assert_has_keys(request.json()['dns_entry'],
required=['ip', 'dns_type'])
context.status_code = 205
return request.body
self.requests_mock.put(url,
text=put_dns_testdomain_entries_testname,
headers=self.json_headers)
url = self.url('testdomain', 'entries')
self.requests_mock.get(url, status_code=404)
get_os_floating_ip_dns_testdomain = {
'dns_entries': [
{
'dns_entry': {
'ip': '1.2.3.4',
'name': "host1",
'type': "A",
'domain': 'testdomain'
}
},
{
'dns_entry': {
'ip': '1.2.3.4',
'name': "host2",
'type': "A",
'domain': 'testdomain'
}
},
]
}
self.requests_mock.get(url + '?ip=1.2.3.4',
json=get_os_floating_ip_dns_testdomain,
status_code=205,
headers=self.json_headers)
def put_os_floating_ip_dns_testdomain(request, context):
body = request.json()
if body['domain_entry']['scope'] == 'private':
fakes.assert_has_keys(body['domain_entry'],
required=['availability_zone', 'scope'])
elif body['domain_entry']['scope'] == 'public':
fakes.assert_has_keys(body['domain_entry'],
required=['project', 'scope'])
else:
fakes.assert_has_keys(body['domain_entry'],
required=['project', 'scope'])
return request.body
self.requests_mock.put(self.url('testdomain'),
text=put_os_floating_ip_dns_testdomain,
status_code=205,
headers=self.json_headers)
class BulkFixture(base.Fixture):
base_url = 'os-floating-ips-bulk'

View File

@ -1030,57 +1030,6 @@ class FakeSessionClient(base_client.SessionClient):
def delete_os_floating_ips_1(self, **kw):
return (204, {}, None)
def get_os_floating_ip_dns(self, **kw):
return (205, {}, {'domain_entries':
[{'domain': 'example.org'},
{'domain': 'example.com'}]})
def get_os_floating_ip_dns_testdomain_entries(self, **kw):
if kw.get('ip'):
return (205, {}, {
'dns_entries': [
{'dns_entry': {'ip': kw.get('ip'),
'name': "host1",
'type': "A",
'domain': 'testdomain'}},
{'dns_entry': {'ip': kw.get('ip'),
'name': "host2",
'type': "A",
'domain': 'testdomain'}}]})
else:
return (404, {}, None)
def get_os_floating_ip_dns_testdomain_entries_testname(self, **kw):
return (205, {}, {
'dns_entry': {'ip': "10.10.10.10",
'name': 'testname',
'type': "A",
'domain': 'testdomain'}})
def put_os_floating_ip_dns_testdomain(self, body, **kw):
if body['domain_entry']['scope'] == 'private':
fakes.assert_has_keys(body['domain_entry'],
required=['availability_zone', 'scope'])
elif body['domain_entry']['scope'] == 'public':
fakes.assert_has_keys(body['domain_entry'],
required=['project', 'scope'])
else:
fakes.assert_has_keys(body['domain_entry'],
required=['project', 'scope'])
return (205, {}, body)
def put_os_floating_ip_dns_testdomain_entries_testname(self, body, **kw):
fakes.assert_has_keys(body['dns_entry'],
required=['ip', 'dns_type'])
return (205, {}, body)
def delete_os_floating_ip_dns_testdomain(self, **kw):
return (200, {}, None)
def delete_os_floating_ip_dns_testdomain_entries_testname(self, **kw):
return (200, {}, 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'},

View File

@ -1,100 +0,0 @@
#
# 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_ip_dns
class FloatingIPDNSDomainTest(utils.FixturedTestCase):
testdomain = "testdomain"
client_fixture_class = client.V1
data_fixture_class = data.DNSFixture
def test_dns_domains(self):
domainlist = self.cs.dns_domains.domains()
self.assert_request_id(domainlist, fakes.FAKE_REQUEST_ID_LIST)
self.assertEqual(2, len(domainlist))
for entry in domainlist:
self.assertIsInstance(entry,
floating_ip_dns.FloatingIPDNSDomain)
self.assertEqual('example.com', domainlist[1].domain)
def test_create_private_domain(self):
pd = self.cs.dns_domains.create_private(self.testdomain, 'test_avzone')
self.assert_request_id(pd, fakes.FAKE_REQUEST_ID_LIST)
self.assert_called('PUT', '/os-floating-ip-dns/%s' %
self.testdomain)
def test_create_public_domain(self):
pd = self.cs.dns_domains.create_public(self.testdomain, 'test_project')
self.assert_request_id(pd, fakes.FAKE_REQUEST_ID_LIST)
self.assert_called('PUT', '/os-floating-ip-dns/%s' %
self.testdomain)
def test_delete_domain(self):
ret = self.cs.dns_domains.delete(self.testdomain)
self.assert_request_id(ret, fakes.FAKE_REQUEST_ID_LIST)
self.assert_called('DELETE', '/os-floating-ip-dns/%s' %
self.testdomain)
class FloatingIPDNSEntryTest(utils.FixturedTestCase):
testname = "testname"
testip = "1.2.3.4"
testdomain = "testdomain"
testtype = "A"
client_fixture_class = client.V1
data_fixture_class = data.DNSFixture
def test_get_dns_entries_by_ip(self):
entries = self.cs.dns_entries.get_for_ip(self.testdomain,
ip=self.testip)
self.assert_request_id(entries, fakes.FAKE_REQUEST_ID_LIST)
self.assertEqual(2, len(entries))
for entry in entries:
self.assertIsInstance(entry,
floating_ip_dns.FloatingIPDNSEntry)
self.assertEqual('host2', entries[1].dns_entry['name'])
self.assertEqual(entries[1].dns_entry['ip'], self.testip)
def test_get_dns_entry_by_name(self):
entry = self.cs.dns_entries.get(self.testdomain,
self.testname)
self.assert_request_id(entry, fakes.FAKE_REQUEST_ID_LIST)
self.assertIsInstance(entry, floating_ip_dns.FloatingIPDNSEntry)
self.assertEqual(entry.name, self.testname)
def test_create_entry(self):
entry = self.cs.dns_entries.create(self.testdomain,
self.testname,
self.testip,
self.testtype)
self.assert_request_id(entry, fakes.FAKE_REQUEST_ID_LIST)
self.assert_called('PUT', '/os-floating-ip-dns/%s/entries/%s' %
(self.testdomain, self.testname))
def test_delete_entry(self):
ret = self.cs.dns_entries.delete(self.testdomain, self.testname)
self.assert_request_id(ret, fakes.FAKE_REQUEST_ID_LIST)
self.assert_called('DELETE', '/os-floating-ip-dns/%s/entries/%s' %
(self.testdomain, self.testname))

View File

@ -31,7 +31,6 @@ from novaclient.v2 import contrib
from novaclient.v2 import fixed_ips
from novaclient.v2 import flavor_access
from novaclient.v2 import flavors
from novaclient.v2 import floating_ip_dns
from novaclient.v2 import floating_ip_pools
from novaclient.v2 import floating_ips
from novaclient.v2 import floating_ips_bulk
@ -160,8 +159,6 @@ class Client(object):
# extensions
self.agents = agents.AgentsManager(self)
self.dns_domains = floating_ip_dns.FloatingIPDNSDomainManager(self)
self.dns_entries = floating_ip_dns.FloatingIPDNSEntryManager(self)
self.cloudpipe = cloudpipe.CloudpipeManager(self)
self.certs = certs.CertificateManager(self)
self.floating_ips = floating_ips.FloatingIPManager(self)

View File

@ -1,182 +0,0 @@
# Copyright 2011 Andrew Bogott for The Wikimedia 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 six.moves.urllib import parse
from novaclient import api_versions
from novaclient import base
def _quote_domain(domain):
"""Special quoting rule for placing domain names on a url line.
Domain names tend to have .'s in them. Urllib doesn't quote dots,
but Routes tends to choke on them, so we need an extra level of
by-hand quoting here.
"""
return parse.quote(domain.replace('.', '%2E'))
class FloatingIPDNSDomain(base.Resource):
"""DEPRECATED"""
def delete(self):
"""
DEPRECATED: Delete the own Floating IP DNS domain.
:returns: An instance of novaclient.base.TupleWithMeta
"""
return self.manager.delete(self.domain)
def create(self):
"""
DEPRECATED: Create a Floating IP DNS domain.
:returns: An instance of novaclient.base.DictWithMeta
"""
if self.scope == 'public':
return self.manager.create_public(self.domain, self.project)
else:
return self.manager.create_private(self.domain,
self.availability_zone)
def get(self):
"""
DEPRECATED: Get the own Floating IP DNS domain.
:returns: An instance of novaclient.base.TupleWithMeta or
novaclient.base.ListWithMeta
"""
entries = self.manager.domains()
for entry in entries:
if entry.get('domain') == self.domain:
return entry
return base.TupleWithMeta((), entries.request_ids)
class FloatingIPDNSDomainManager(base.Manager):
"""DEPRECATED"""
resource_class = FloatingIPDNSDomain
@api_versions.deprecated_after('2.35')
def domains(self):
"""DEPRECATED: Return the list of available dns domains."""
return self._list("/os-floating-ip-dns", "domain_entries")
@api_versions.deprecated_after('2.35')
def create_private(self, fqdomain, availability_zone):
"""DEPRECATED: Add or modify a private DNS domain."""
body = {'domain_entry': {'scope': 'private',
'availability_zone': availability_zone}}
return self._update('/os-floating-ip-dns/%s' % _quote_domain(fqdomain),
body,
'domain_entry')
@api_versions.deprecated_after('2.35')
def create_public(self, fqdomain, project):
"""DEPRECATED: Add or modify a public DNS domain."""
body = {'domain_entry': {'scope': 'public', 'project': project}}
return self._update('/os-floating-ip-dns/%s' % _quote_domain(fqdomain),
body, 'domain_entry')
@api_versions.deprecated_after('2.35')
def delete(self, fqdomain):
"""
DEPRECATED: Delete the specified domain.
:param fqdomain: The domain to delete
:returns: An instance of novaclient.base.TupleWithMeta
"""
return self._delete("/os-floating-ip-dns/%s" % _quote_domain(fqdomain))
class FloatingIPDNSEntry(base.Resource):
"""DEPRECATED"""
def delete(self):
"""
DEPRECATED: Delete the own Floating IP DNS entry.
:returns: An instance of novaclient.base.TupleWithMeta
"""
return self.manager.delete(self.name, self.domain)
def create(self):
"""
DEPRECATED: Create a Floating IP DNS entry.
:returns: :class:`FloatingIPDNSEntry`
"""
return self.manager.create(self.domain, self.name, self.ip,
self.dns_type)
def get(self):
"""DEPRECATED"""
return self.manager.get(self.domain, self.name)
class FloatingIPDNSEntryManager(base.Manager):
"""DEPRECATED"""
resource_class = FloatingIPDNSEntry
@api_versions.deprecated_after('2.35')
def get(self, domain, name):
"""
DEPRECATED: Return a list of entries for the given domain and IP or
name.
"""
return self._get("/os-floating-ip-dns/%s/entries/%s" %
(_quote_domain(domain), name), "dns_entry")
@api_versions.deprecated_after('2.35')
def get_for_ip(self, domain, ip):
"""
DEPRECATED: Return a list of entries for the given domain and IP or
name.
"""
qparams = {'ip': ip}
params = "?%s" % parse.urlencode(qparams)
return self._list("/os-floating-ip-dns/%s/entries%s" %
(_quote_domain(domain), params), "dns_entries")
@api_versions.deprecated_after('2.35')
def create(self, domain, name, ip, dns_type):
"""DEPRECATED: Add a new DNS entry."""
body = {'dns_entry': {'ip': ip, 'dns_type': dns_type}}
return self._update("/os-floating-ip-dns/%s/entries/%s" %
(_quote_domain(domain), name), body, "dns_entry")
@api_versions.deprecated_after('2.35')
def modify_ip(self, domain, name, ip):
"""DEPRECATED: Add a new DNS entry."""
body = {'dns_entry': {'ip': ip, 'dns_type': 'A'}}
return self._update("/os-floating-ip-dns/%s/entries/%s" %
(_quote_domain(domain), name), body, "dns_entry")
@api_versions.deprecated_after('2.35')
def delete(self, domain, name):
"""
DEPRECATED: Delete entry specified by name and domain.
:returns: An instance of novaclient.base.TupleWithMeta
"""
return self._delete("/os-floating-ip-dns/%s/entries/%s" %
(_quote_domain(domain), name))

View File

@ -55,6 +55,7 @@ upgrade:
Along with the following python API bindings::
* novaclient.v2.contrib.tenant_networks
* novaclient.v2.floating_ip_dns
deprecations:
- |