Fix DNS Domain Name in endpoint file.

When the DNS server receives the dns domain name
it includes a period in the end -- i.e. "example.com."
This causes the client to think that the DNS is "bad"
which is what it puts in /etc/resolv.conf file.
We need to remove the period in the end of dns_domain name
before the server sends the information to the client.

Change-Id: Id56da2b3972fb1ce045577565b2eb7597dc7e257
This commit is contained in:
Sayali Naval
2020-08-21 18:27:40 -04:00
parent ee47b3e132
commit e4087b6d27
3 changed files with 4 additions and 2 deletions

View File

@@ -900,6 +900,7 @@ class ApicRpcHandlerMixin(object):
if self.apic_optimized_dhcp_lease_time > 0:
details['dhcp_lease_time'] = self.apic_optimized_dhcp_lease_time
details['dns_domain'] = port_info.net_dns_domain or ''
details['dns_domain'] = details['dns_domain'].rstrip('.')
details['enable_dhcp_optimization'] = self.enable_dhcp_opt
details['enable_metadata_optimization'] = self.enable_metadata_opt
if port_info.svi:

View File

@@ -10706,7 +10706,8 @@ class TestOpflexRpc(ApicAimTestCase):
gbp_details['dhcp_lease_time'])
else:
self.assertNotIn('dhcp_lease_time', gbp_details)
self.assertEqual(net['dns_domain'], gbp_details['dns_domain'])
self.assertEqual(net['dns_domain'].rstrip('.'),
gbp_details['dns_domain'])
self.assertEqual(self.driver.enable_dhcp_opt,
gbp_details['enable_dhcp_optimization'])
self.assertEqual(self.driver.enable_metadata_opt,

View File

@@ -3512,7 +3512,7 @@ class TestPolicyTarget(AIMBaseTestCase,
mapping = self.mech_driver.get_gbp_details(
self._neutron_admin_context, device='tap%s' % port_id,
host='h1')
self.assertEqual('mydomain.', mapping['dns_domain'])
self.assertEqual('mydomain', mapping['dns_domain'])
req_mapping = self.mech_driver.request_endpoint_details(
nctx.get_admin_context(),
request={'device': 'tap%s' % port_id,