Make dns_domain value configurable

Test test_dns_domain_and_name uses a hardcoded dns_domain value, which
corresponds with the value configured in neutron repository.
This value could change and/or it can be different in other CI jobs.
Due to that, with this patch the dns_domain value becomes configurable.

Change-Id: Ib35b2ecd3a7350f5b744e5e063cfa25b1ecd4806
diff --git a/neutron_tempest_plugin/api/test_ports.py b/neutron_tempest_plugin/api/test_ports.py
index f1dfe5c..8d5772b 100644
--- a/neutron_tempest_plugin/api/test_ports.py
+++ b/neutron_tempest_plugin/api/test_ports.py
@@ -80,7 +80,7 @@
                        service="network")
     def test_create_update_port_with_dns_name(self):
         # NOTE(manjeets) dns_domain is set to openstackgate.local
-        # so dns_name for port can be set
+        # (or any other configured value) so dns_name for port can be set
         self.create_subnet(self.network)
         body = self.create_port(self.network, dns_name='d1')
         self.assertEqual('d1', body['dns_name'])
diff --git a/neutron_tempest_plugin/config.py b/neutron_tempest_plugin/config.py
index aea79ad..4fad1fa 100644
--- a/neutron_tempest_plugin/config.py
+++ b/neutron_tempest_plugin/config.py
@@ -73,6 +73,10 @@
                choices=['None', 'openvswitch', 'ovn',
                         'iptables_hybrid', 'iptables'],
                help='Driver for security groups firewall in the L2 agent'),
+    cfg.StrOpt('dns_domain',
+               default='openstackgate.local',
+               help='dns_domain value configured at neutron.conf, which will '
+                    'be used for the DNS configuration of the instances'),
 
     # Multicast tests settings
     cfg.StrOpt('multicast_group_range',
diff --git a/neutron_tempest_plugin/scenario/test_internal_dns.py b/neutron_tempest_plugin/scenario/test_internal_dns.py
index 692bb70..e705241 100644
--- a/neutron_tempest_plugin/scenario/test_internal_dns.py
+++ b/neutron_tempest_plugin/scenario/test_internal_dns.py
@@ -129,12 +129,13 @@
             servers=[self.server, leia])
 
         resolv_conf = ssh_client.exec_command('cat /etc/resolv.conf')
-        self.assertIn('openstackgate.local', resolv_conf)
+        dns_domain = CONF.neutron_plugin_options.dns_domain
+        self.assertIn(dns_domain, resolv_conf)
         self.assertNotIn('starwars', resolv_conf)
 
         self.check_remote_connectivity(ssh_client, 'leia',
                                        servers=[self.server, leia])
-        self.check_remote_connectivity(ssh_client, 'leia.openstackgate.local',
+        self.check_remote_connectivity(ssh_client, 'leia.' + dns_domain,
                                        servers=[self.server, leia])
 
     @utils.requires_ext(extension="dns-integration", service="network")