Merge "Adding dns_domain parameter into create_network"

This commit is contained in:
Zuul 2019-05-18 12:57:08 +00:00 committed by Gerrit Code Review
commit 4f276064a8
3 changed files with 17 additions and 3 deletions

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.

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 = {

View File

@ -0,0 +1,5 @@
---
features:
- |
Added dns_domain parameter into the create_network and update_network
methods.