summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/source/cli/command-objects/port.rst16
-rw-r--r--openstackclient/network/v2/port.py8
-rw-r--r--openstackclient/tests/unit/network/v2/fakes.py1
-rw-r--r--openstackclient/tests/unit/network/v2/test_port.py5
-rw-r--r--releasenotes/notes/bug-1714878-46806jv2yv13q054.yaml8
5 files changed, 36 insertions, 2 deletions
diff --git a/doc/source/cli/command-objects/port.rst b/doc/source/cli/command-objects/port.rst
index c2da09b3..c3a9798c 100644
--- a/doc/source/cli/command-objects/port.rst
+++ b/doc/source/cli/command-objects/port.rst
@@ -28,6 +28,7 @@ Create new port
[--enable | --disable]
[--mac-address <mac-address>]
[--security-group <security-group> | --no-security-group]
+ [--dns-domain <dns-domain>]
[--dns-name <dns-name>]
[--allowed-address ip-address=<ip-address>[,mac-address=<mac-address>]]
[--qos-policy <qos-policy>]
@@ -95,9 +96,14 @@ Create new port
Associate no security groups with this port
+.. option:: --dns-domain <dns-name>
+
+ Set DNS domain for this port
+ (requires dns_domain for ports extension)
+
.. option:: --dns-name <dns-name>
- Set DNS name to this port
+ Set DNS name for this port
(requires DNS integration extension)
.. option:: --allowed-address ip-address=<ip-address>[,mac-address=<mac-address>]
@@ -256,6 +262,7 @@ Set port properties
[--security-group <security-group>]
[--no-security-group]
[--enable-port-security | --disable-port-security]
+ [--dns-domain <dns-domain>]
[--dns-name <dns-name>]
[--allowed-address ip-address=<ip-address>[,mac-address=<mac-address>]]
[--no-allowed-address]
@@ -346,9 +353,14 @@ Set port properties
Disable port security for this port
+.. option:: --dns-domain <dns-domain>
+
+ Set DNS domain for this port
+ (requires dns_domain for ports extension)
+
.. option:: --dns-name <dns-name>
- Set DNS name to this port
+ Set DNS name for this port
(requires DNS integration extension)
.. option:: --allowed-address ip-address=<ip-address>[,mac-address=<mac-address>]
diff --git a/openstackclient/network/v2/port.py b/openstackclient/network/v2/port.py
index 9536fe86..ea5a04e6 100644
--- a/openstackclient/network/v2/port.py
+++ b/openstackclient/network/v2/port.py
@@ -127,6 +127,8 @@ def _get_attrs(client_manager, parsed_args):
if parsed_args.mac_address is not None:
attrs['mac_address'] = parsed_args.mac_address
+ if parsed_args.dns_domain is not None:
+ attrs['dns_domain'] = parsed_args.dns_domain
if parsed_args.dns_name is not None:
attrs['dns_name'] = parsed_args.dns_name
# It is possible that name is not updated during 'port set'
@@ -269,6 +271,12 @@ def _add_updatable_args(parser):
help=argparse.SUPPRESS,
)
parser.add_argument(
+ '--dns-domain',
+ metavar='dns-domain',
+ help=_("Set DNS domain to this port "
+ "(requires dns_domain extension for ports)")
+ )
+ parser.add_argument(
'--dns-name',
metavar='dns-name',
help=_("Set DNS name to this port "
diff --git a/openstackclient/tests/unit/network/v2/fakes.py b/openstackclient/tests/unit/network/v2/fakes.py
index bdc1c1fb..f13b6b46 100644
--- a/openstackclient/tests/unit/network/v2/fakes.py
+++ b/openstackclient/tests/unit/network/v2/fakes.py
@@ -565,6 +565,7 @@ class FakePort(object):
'device_id': 'device-id-' + uuid.uuid4().hex,
'device_owner': 'compute:nova',
'dns_assignment': [{}],
+ 'dns_domain': 'dns-domain-' + uuid.uuid4().hex,
'dns_name': 'dns-name-' + uuid.uuid4().hex,
'extra_dhcp_opts': [{}],
'fixed_ips': [{'ip_address': '10.0.0.3',
diff --git a/openstackclient/tests/unit/network/v2/test_port.py b/openstackclient/tests/unit/network/v2/test_port.py
index 45e1045d..7cc8ac28 100644
--- a/openstackclient/tests/unit/network/v2/test_port.py
+++ b/openstackclient/tests/unit/network/v2/test_port.py
@@ -50,6 +50,7 @@ class TestPort(network_fakes.TestNetworkV2):
'device_id',
'device_owner',
'dns_assignment',
+ 'dns_domain',
'dns_name',
'extra_dhcp_opts',
'fixed_ips',
@@ -78,6 +79,7 @@ class TestPort(network_fakes.TestNetworkV2):
fake_port.device_id,
fake_port.device_owner,
utils.format_list_of_dicts(fake_port.dns_assignment),
+ fake_port.dns_domain,
fake_port.dns_name,
utils.format_list_of_dicts(fake_port.extra_dhcp_opts),
utils.format_list_of_dicts(fake_port.fixed_ips),
@@ -152,6 +154,7 @@ class TestCreatePort(TestPort):
'--binding-profile', 'foo=bar',
'--binding-profile', 'foo2=bar2',
'--network', self._port.network_id,
+ '--dns-domain', 'example.org',
'--dns-name', '8.8.8.8',
'test-port',
@@ -169,6 +172,7 @@ class TestCreatePort(TestPort):
('vnic_type', 'macvtap'),
('binding_profile', {'foo': 'bar', 'foo2': 'bar2'}),
('network', self._port.network_id),
+ ('dns_domain', 'example.org'),
('dns_name', '8.8.8.8'),
('name', 'test-port'),
]
@@ -187,6 +191,7 @@ class TestCreatePort(TestPort):
'binding:vnic_type': 'macvtap',
'binding:profile': {'foo': 'bar', 'foo2': 'bar2'},
'network_id': self._port.network_id,
+ 'dns_domain': 'example.org',
'dns_name': '8.8.8.8',
'name': 'test-port',
})
diff --git a/releasenotes/notes/bug-1714878-46806jv2yv13q054.yaml b/releasenotes/notes/bug-1714878-46806jv2yv13q054.yaml
new file mode 100644
index 00000000..a2f376b8
--- /dev/null
+++ b/releasenotes/notes/bug-1714878-46806jv2yv13q054.yaml
@@ -0,0 +1,8 @@
+---
+features:
+ - |
+ Add ``--dns-domain`` option to ``port create`` and ``port set`` commands.
+ Requires the ``dns_domain for ports`` extension to be enabled. See the
+ `Neutron DNS integration <https://docs.openstack.org/neutron/latest/admin/config-dns-int.html>`_
+ documentation for information how to use this.
+ [Bug `1714878 <https://bugs.launchpad.net/python-openstackclient/+bug/1714878>`_]