Adding dns_domain parameter into create_network

The Network class supports the dns_domain field. This change
adds in the ability to create & update networks with the
dns_domain set.

Change-Id: Ifa072138b616d2a12696b27e10556f92542c05cb
This commit is contained in:
Raimund Hook committed 2019-05-17 14:30:50 +01:00
1 parent e47d2561e4
commit a3e846e2b9
3 files changed
+17 -3

No files matched your search

+10 -2
View File
@@ -448,7 +448,7 @@ class NetworkCloudMixin(_normalize.Normalizer):
external=False, provider=None, project_id=None,
availability_zone_hints=None,
port_security_enabled=None,
mtu_size=None):
mtu_size=None, dns_domain=None):
"""Create a network.
:param string name: Name of the network being created.
@@ -465,6 +465,8 @@ class NetworkCloudMixin(_normalize.Normalizer):
:param bool port_security_enabled: Enable / Disable port security
:param int mtu_size: maximum transmission unit value to address
fragmentation. Minimum value is 68 for IPv4, and 1280 for IPv6.
:param string dns_domain: Specify the DNS domain associated with
this network.
:returns: The network object.
:raises: OpenStackCloudException on operation error.
@@ -523,6 +525,9 @@ class NetworkCloudMixin(_normalize.Normalizer):
network['mtu'] = mtu_size
if dns_domain:
network['dns_domain'] = dns_domain
data = self.network.post("/networks.json", json={'network': network})
# Reset cache so the new network is picked up
@@ -530,7 +535,8 @@ class NetworkCloudMixin(_normalize.Normalizer):
return self._get_and_munchify('network', data)
@_utils.valid_kwargs("name", "shared", "admin_state_up", "external",
"provider", "mtu_size", "port_security_enabled")
"provider", "mtu_size", "port_security_enabled",
"dns_domain")
def update_network(self, name_or_id, **kwargs):
"""Update a network.
@@ -545,6 +551,8 @@ class NetworkCloudMixin(_normalize.Normalizer):
:param int mtu_size: New maximum transmission unit value to address
fragmentation. Minimum value is 68 for IPv4, and 1280 for IPv6.
:param bool port_security_enabled: Enable or disable port security.
:param string dns_domain: Specify the DNS domain associated with
this network.
:returns: The updated network object.
:raises: OpenStackCloudException on operation error.
+2 -1
View File
@@ -45,7 +45,8 @@ class TestNetwork(base.TestCase):
'admin_state_up': True,
'tenant_id': '861808a93da0484ea1767967c4df8a23',
'created_at': '2017-04-22T19:22:53Z',
'mtu': 0
'mtu': 0,
'dns_domain': 'sample.openstack.org.'
}
network_availability_zone_extension = {
@@ -0,0 +1,5 @@
---
features:
- |
Added dns_domain parameter into the create_network and update_network
methods.