Skip to content

Commit 1b5cab4

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "Add support for "--dns-domain" argument"
2 parents 7505831 + 4a9e84b commit 1b5cab4

5 files changed

Lines changed: 36 additions & 2 deletions

File tree

doc/source/cli/command-objects/port.rst

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ Create new port
2828
[--enable | --disable]
2929
[--mac-address <mac-address>]
3030
[--security-group <security-group> | --no-security-group]
31+
[--dns-domain <dns-domain>]
3132
[--dns-name <dns-name>]
3233
[--allowed-address ip-address=<ip-address>[,mac-address=<mac-address>]]
3334
[--qos-policy <qos-policy>]
@@ -99,9 +100,14 @@ Create new port
99100
100101
Associate no security groups with this port
101102
103+
.. option:: --dns-domain <dns-name>
104+
105+
Set DNS domain for this port
106+
(requires dns_domain for ports extension)
107+
102108
.. option:: --dns-name <dns-name>
103109
104-
Set DNS name to this port
110+
Set DNS name for this port
105111
(requires DNS integration extension)
106112
107113
.. option:: --allowed-address ip-address=<ip-address>[,mac-address=<mac-address>]
@@ -264,6 +270,7 @@ Set port properties
264270
[--security-group <security-group>]
265271
[--no-security-group]
266272
[--enable-port-security | --disable-port-security]
273+
[--dns-domain <dns-domain>]
267274
[--dns-name <dns-name>]
268275
[--allowed-address ip-address=<ip-address>[,mac-address=<mac-address>]]
269276
[--no-allowed-address]
@@ -354,9 +361,14 @@ Set port properties
354361
355362
Disable port security for this port
356363
364+
.. option:: --dns-domain <dns-domain>
365+
366+
Set DNS domain for this port
367+
(requires dns_domain for ports extension)
368+
357369
.. option:: --dns-name <dns-name>
358370
359-
Set DNS name to this port
371+
Set DNS name for this port
360372
(requires DNS integration extension)
361373
362374
.. option:: --allowed-address ip-address=<ip-address>[,mac-address=<mac-address>]

openstackclient/network/v2/port.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@ def _get_attrs(client_manager, parsed_args):
127127
if parsed_args.mac_address is not None:
128128
attrs['mac_address'] = parsed_args.mac_address
129129

130+
if parsed_args.dns_domain is not None:
131+
attrs['dns_domain'] = parsed_args.dns_domain
130132
if parsed_args.dns_name is not None:
131133
attrs['dns_name'] = parsed_args.dns_name
132134
# It is possible that name is not updated during 'port set'
@@ -268,6 +270,12 @@ def _add_updatable_args(parser):
268270
metavar='<host-id>',
269271
help=argparse.SUPPRESS,
270272
)
273+
parser.add_argument(
274+
'--dns-domain',
275+
metavar='dns-domain',
276+
help=_("Set DNS domain to this port "
277+
"(requires dns_domain extension for ports)")
278+
)
271279
parser.add_argument(
272280
'--dns-name',
273281
metavar='dns-name',

openstackclient/tests/unit/network/v2/fakes.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,7 @@ def create_one_port(attrs=None):
565565
'device_id': 'device-id-' + uuid.uuid4().hex,
566566
'device_owner': 'compute:nova',
567567
'dns_assignment': [{}],
568+
'dns_domain': 'dns-domain-' + uuid.uuid4().hex,
568569
'dns_name': 'dns-name-' + uuid.uuid4().hex,
569570
'extra_dhcp_opts': [{}],
570571
'fixed_ips': [{'ip_address': '10.0.0.3',

openstackclient/tests/unit/network/v2/test_port.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ def _get_common_cols_data(fake_port):
5050
'device_id',
5151
'device_owner',
5252
'dns_assignment',
53+
'dns_domain',
5354
'dns_name',
5455
'extra_dhcp_opts',
5556
'fixed_ips',
@@ -78,6 +79,7 @@ def _get_common_cols_data(fake_port):
7879
fake_port.device_id,
7980
fake_port.device_owner,
8081
utils.format_list_of_dicts(fake_port.dns_assignment),
82+
fake_port.dns_domain,
8183
fake_port.dns_name,
8284
utils.format_list_of_dicts(fake_port.extra_dhcp_opts),
8385
utils.format_list_of_dicts(fake_port.fixed_ips),
@@ -152,6 +154,7 @@ def test_create_full_options(self):
152154
'--binding-profile', 'foo=bar',
153155
'--binding-profile', 'foo2=bar2',
154156
'--network', self._port.network_id,
157+
'--dns-domain', 'example.org',
155158
'--dns-name', '8.8.8.8',
156159
'test-port',
157160

@@ -169,6 +172,7 @@ def test_create_full_options(self):
169172
('vnic_type', 'macvtap'),
170173
('binding_profile', {'foo': 'bar', 'foo2': 'bar2'}),
171174
('network', self._port.network_id),
175+
('dns_domain', 'example.org'),
172176
('dns_name', '8.8.8.8'),
173177
('name', 'test-port'),
174178
]
@@ -187,6 +191,7 @@ def test_create_full_options(self):
187191
'binding:vnic_type': 'macvtap',
188192
'binding:profile': {'foo': 'bar', 'foo2': 'bar2'},
189193
'network_id': self._port.network_id,
194+
'dns_domain': 'example.org',
190195
'dns_name': '8.8.8.8',
191196
'name': 'test-port',
192197
})
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
features:
3+
- |
4+
Add ``--dns-domain`` option to ``port create`` and ``port set`` commands.
5+
Requires the ``dns_domain for ports`` extension to be enabled. See the
6+
`Neutron DNS integration <https://docs.openstack.org/neutron/latest/admin/config-dns-int.html>`_
7+
documentation for information how to use this.
8+
[Bug `1714878 <https://bugs.launchpad.net/python-openstackclient/+bug/1714878>`_]

0 commit comments

Comments
 (0)