Browse Source

Add Google DNS to subnet

Change-Id: I0443c1a0b32e14e50ec6459c8d139ceeee7b0aa2
Georgy Dyuldin 2 years ago
parent
commit
2560d59c11
1 changed files with 14 additions and 2 deletions
  1. 14
    2
      plugin_test/vapor/vapor/fixtures/subnets.py

+ 14
- 2
plugin_test/vapor/vapor/fixtures/subnets.py View File

@@ -13,6 +13,7 @@
13 13
 from pycontrail import exceptions
14 14
 import pycontrail.types as types
15 15
 import pytest
16
+from stepler import config as stepler_config
16 17
 
17 18
 
18 19
 def _get_ipam_refs(network):
@@ -35,7 +36,10 @@ def contrail_create_subnet(contrail_api_client, contrail_default_ipam):
35 36
     def _contrail_create_subnet(network,
36 37
                                 ipam=None,
37 38
                                 ip_prefix='10.0.0.0',
38
-                                ip_prefix_len=24):
39
+                                ip_prefix_len=24,
40
+                                dns_server_address=None):
41
+        dns_server_address = dns_server_address or stepler_config.GOOGLE_DNS_IP
42
+
39 43
         # Refresh network data
40 44
         network = contrail_api_client.virtual_network_read(id=network.uuid)
41 45
         ipam = ipam or contrail_default_ipam
@@ -57,7 +61,15 @@ def contrail_create_subnet(contrail_api_client, contrail_default_ipam):
57 61
 
58 62
         subnet_type = types.SubnetType(
59 63
             ip_prefix=ip_prefix, ip_prefix_len=ip_prefix_len)
60
-        ipam_subnets.append(types.IpamSubnetType(subnet=subnet_type))
64
+        ipam_subnets.append(
65
+            types.IpamSubnetType(
66
+                subnet=subnet_type,
67
+                dhcp_option_list={
68
+                    'dhcp_option': [{
69
+                        'dhcp_option_value': dns_server_address,
70
+                        'dhcp_option_name': '6'
71
+                    }]
72
+                }))
61 73
         vn_sub = types.VnSubnetsType(ipam_subnets=ipam_subnets)
62 74
         if update_exists:
63 75
             network.set_network_ipam(ipam, vn_sub)

Loading…
Cancel
Save