Add DNS support to floating IP commands
Add the DNS domain and name options to the ``floating ip create`` command. Also add these two columns to the output of the ``floating ip list --long`` command. Change-Id: Id4cb18b51b252f19b87b24ec5d77183771189d17 Story: 1547736 Task: 13114
This commit is contained in:
parent
b8754e15e7
commit
ed09f28a9d
@ -21,6 +21,8 @@ Create floating IP
|
|||||||
[--qos-policy <qos-policy>]
|
[--qos-policy <qos-policy>]
|
||||||
[--project <project> [--project-domain <project-domain>]]
|
[--project <project> [--project-domain <project-domain>]]
|
||||||
[--tag <tag> | --no-tag]
|
[--tag <tag> | --no-tag]
|
||||||
|
[--dns-domain <dns-domain>]
|
||||||
|
[--dns-name <dns-name>]
|
||||||
<network>
|
<network>
|
||||||
|
|
||||||
.. option:: --subnet <subnet>
|
.. option:: --subnet <subnet>
|
||||||
@ -79,6 +81,14 @@ Create floating IP
|
|||||||
|
|
||||||
*Network version 2 only*
|
*Network version 2 only*
|
||||||
|
|
||||||
|
.. option:: --dns-domain <dns-domain>
|
||||||
|
|
||||||
|
Set DNS domain for this floating IP (requires DNS integration extension).
|
||||||
|
|
||||||
|
.. option:: --dns-name <dns-name>
|
||||||
|
|
||||||
|
Set DNS name for this floating IP (requires DNS integration extension).
|
||||||
|
|
||||||
.. describe:: <network>
|
.. describe:: <network>
|
||||||
|
|
||||||
Network to allocate floating IP from (name or ID)
|
Network to allocate floating IP from (name or ID)
|
||||||
|
@ -82,6 +82,12 @@ def _get_attrs(client_manager, parsed_args):
|
|||||||
).id
|
).id
|
||||||
attrs['tenant_id'] = project_id
|
attrs['tenant_id'] = project_id
|
||||||
|
|
||||||
|
if parsed_args.dns_domain:
|
||||||
|
attrs['dns_domain'] = parsed_args.dns_domain
|
||||||
|
|
||||||
|
if parsed_args.dns_name:
|
||||||
|
attrs['dns_name'] = parsed_args.dns_name
|
||||||
|
|
||||||
return attrs
|
return attrs
|
||||||
|
|
||||||
|
|
||||||
@ -139,15 +145,32 @@ class CreateFloatingIP(common.NetworkAndComputeShowOne):
|
|||||||
metavar='<project>',
|
metavar='<project>',
|
||||||
help=_("Owner's project (name or ID)")
|
help=_("Owner's project (name or ID)")
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
'--dns-domain',
|
||||||
|
metavar='<dns-domain>',
|
||||||
|
dest='dns_domain',
|
||||||
|
help=_("Set DNS domain for this floating IP")
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
'--dns-name',
|
||||||
|
metavar='<dns-name>',
|
||||||
|
dest='dns_name',
|
||||||
|
help=_("Set DNS name for this floating IP")
|
||||||
|
)
|
||||||
|
|
||||||
identity_common.add_project_domain_option_to_parser(parser)
|
identity_common.add_project_domain_option_to_parser(parser)
|
||||||
_tag.add_tag_option_to_parser_for_create(parser, _('floating IP'))
|
_tag.add_tag_option_to_parser_for_create(parser, _('floating IP'))
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
def take_action_network(self, client, parsed_args):
|
def take_action_network(self, client, parsed_args):
|
||||||
attrs = _get_attrs(self.app.client_manager, parsed_args)
|
attrs = _get_attrs(self.app.client_manager, parsed_args)
|
||||||
obj = client.create_ip(**attrs)
|
with common.check_missing_extension_if_error(
|
||||||
|
self.app.client_manager.network, attrs):
|
||||||
|
obj = client.create_ip(**attrs)
|
||||||
|
|
||||||
# tags cannot be set when created, so tags need to be set later.
|
# tags cannot be set when created, so tags need to be set later.
|
||||||
_tag.update_tags_for_set(client, obj, parsed_args)
|
_tag.update_tags_for_set(client, obj, parsed_args)
|
||||||
|
|
||||||
display_columns, columns = _get_network_columns(obj)
|
display_columns, columns = _get_network_columns(obj)
|
||||||
data = utils.get_item_properties(obj, columns)
|
data = utils.get_item_properties(obj, columns)
|
||||||
return (display_columns, data)
|
return (display_columns, data)
|
||||||
@ -314,12 +337,16 @@ class ListFloatingIP(common.NetworkAndComputeLister):
|
|||||||
'status',
|
'status',
|
||||||
'description',
|
'description',
|
||||||
'tags',
|
'tags',
|
||||||
|
'dns_name',
|
||||||
|
'dns_domain',
|
||||||
)
|
)
|
||||||
headers = headers + (
|
headers = headers + (
|
||||||
'Router',
|
'Router',
|
||||||
'Status',
|
'Status',
|
||||||
'Description',
|
'Description',
|
||||||
'Tags',
|
'Tags',
|
||||||
|
'DNS Name',
|
||||||
|
'DNS Domain',
|
||||||
)
|
)
|
||||||
|
|
||||||
query = {}
|
query = {}
|
||||||
|
@ -49,6 +49,8 @@ class TestCreateFloatingIPNetwork(TestFloatingIPNetwork):
|
|||||||
attrs={
|
attrs={
|
||||||
'floating_network_id': floating_network.id,
|
'floating_network_id': floating_network.id,
|
||||||
'port_id': port.id,
|
'port_id': port.id,
|
||||||
|
'dns_domain': 'example.org.',
|
||||||
|
'dns_name': 'fip1',
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -129,6 +131,8 @@ class TestCreateFloatingIPNetwork(TestFloatingIPNetwork):
|
|||||||
'--floating-ip-address', self.floating_ip.floating_ip_address,
|
'--floating-ip-address', self.floating_ip.floating_ip_address,
|
||||||
'--fixed-ip-address', self.floating_ip.fixed_ip_address,
|
'--fixed-ip-address', self.floating_ip.fixed_ip_address,
|
||||||
'--description', self.floating_ip.description,
|
'--description', self.floating_ip.description,
|
||||||
|
'--dns-domain', self.floating_ip.dns_domain,
|
||||||
|
'--dns-name', self.floating_ip.dns_name,
|
||||||
self.floating_ip.floating_network_id,
|
self.floating_ip.floating_network_id,
|
||||||
]
|
]
|
||||||
verifylist = [
|
verifylist = [
|
||||||
@ -137,6 +141,8 @@ class TestCreateFloatingIPNetwork(TestFloatingIPNetwork):
|
|||||||
('fixed_ip_address', self.floating_ip.fixed_ip_address),
|
('fixed_ip_address', self.floating_ip.fixed_ip_address),
|
||||||
('network', self.floating_ip.floating_network_id),
|
('network', self.floating_ip.floating_network_id),
|
||||||
('description', self.floating_ip.description),
|
('description', self.floating_ip.description),
|
||||||
|
('dns_domain', self.floating_ip.dns_domain),
|
||||||
|
('dns_name', self.floating_ip.dns_name),
|
||||||
('floating_ip_address', self.floating_ip.floating_ip_address),
|
('floating_ip_address', self.floating_ip.floating_ip_address),
|
||||||
]
|
]
|
||||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||||
@ -150,6 +156,8 @@ class TestCreateFloatingIPNetwork(TestFloatingIPNetwork):
|
|||||||
'fixed_ip_address': self.floating_ip.fixed_ip_address,
|
'fixed_ip_address': self.floating_ip.fixed_ip_address,
|
||||||
'floating_network_id': self.floating_ip.floating_network_id,
|
'floating_network_id': self.floating_ip.floating_network_id,
|
||||||
'description': self.floating_ip.description,
|
'description': self.floating_ip.description,
|
||||||
|
'dns_domain': self.floating_ip.dns_domain,
|
||||||
|
'dns_name': self.floating_ip.dns_name,
|
||||||
})
|
})
|
||||||
self.assertEqual(self.columns, columns)
|
self.assertEqual(self.columns, columns)
|
||||||
self.assertEqual(self.data, data)
|
self.assertEqual(self.data, data)
|
||||||
@ -393,6 +401,8 @@ class TestListFloatingIPNetwork(TestFloatingIPNetwork):
|
|||||||
'Status',
|
'Status',
|
||||||
'Description',
|
'Description',
|
||||||
'Tags',
|
'Tags',
|
||||||
|
'DNS Name',
|
||||||
|
'DNS Domain',
|
||||||
)
|
)
|
||||||
|
|
||||||
data = []
|
data = []
|
||||||
@ -417,6 +427,8 @@ class TestListFloatingIPNetwork(TestFloatingIPNetwork):
|
|||||||
ip.status,
|
ip.status,
|
||||||
ip.description,
|
ip.description,
|
||||||
ip.tags,
|
ip.tags,
|
||||||
|
ip.dns_domain,
|
||||||
|
ip.dns_name,
|
||||||
))
|
))
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
@ -0,0 +1,14 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
Add ``--dns-domain`` and ``--dns-name`` options to the
|
||||||
|
``floating ip create`` commands. These options
|
||||||
|
set the DNS domain and name for the floating IP.
|
||||||
|
|
||||||
|
Check backend available extension and return an error
|
||||||
|
message if it is missing (instead of a Bad Request HTTP 400).
|
||||||
|
[Bug `1547736 <https://storyboard.openstack.org/#!/story/1547736>`_]
|
||||||
|
- |
|
||||||
|
Add ``--long`` option to the ``floating ip list`` command. This adds
|
||||||
|
``DNS Name`` and ``DNS Domain`` columns to the floating IP list.
|
||||||
|
[Bug `1547736 <https://storyboard.openstack.org/#!/story/1547736>`_]
|
Loading…
Reference in New Issue
Block a user