Add a new env var for nameserver 73/53073/3
authorLinda Wang <wangwulin@huawei.com>
Mon, 5 Mar 2018 03:14:23 +0000 (03:14 +0000)
committerCédric Ollivier <cedric.ollivier@orange.com>
Wed, 7 Mar 2018 02:36:40 +0000 (03:36 +0100)
We should still consider that the nameserver must be handled by all
installers instead [1]:
  - by configuring one or more DNS resolvers in dhcp_agent.ini
  - by asking a local resolv

It eases setting the nameserver in testcases and then allows gating
them. 8.8.8.8 is still defined by default.

[1] https://docs.openstack.org/neutron/pike/admin/config-dns-res.html

Co-Authored-By: Cédric Ollivier <cedric.ollivier@orange.com>
Change-Id: Id58dd5ebee612a0fce2ebc40f089769e60899416
Signed-off-by: Linda Wang <wangwulin@huawei.com>
Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
functest/opnfv_tests/openstack/rally/rally.py
functest/opnfv_tests/openstack/tempest/tempest.py
functest/opnfv_tests/openstack/vping/vping_base.py
functest/opnfv_tests/vnf/ims/cloudify_ims.py
functest/opnfv_tests/vnf/ims/cloudify_ims_perf.py
functest/opnfv_tests/vnf/ims/orchestra_clearwaterims.py
functest/opnfv_tests/vnf/ims/orchestra_openims.py
functest/opnfv_tests/vnf/router/cloudify_vrouter.py
functest/tests/unit/openstack/vping/test_vping.py
functest/utils/env.py

index 5c7acfd..f9fb7b8 100644 (file)
@@ -464,7 +464,8 @@ class RallyBase(testcase.TestCase):
                 segmentation_id=rally_segmentation_id,
                 subnet_settings=[SubnetConfig(
                     name=subnet_name,
-                    cidr=self.RALLY_PRIVATE_SUBNET_CIDR)]))
+                    cidr=self.RALLY_PRIVATE_SUBNET_CIDR,
+                    dns_nameservers=[env.get('NAMESERVER')])]))
         if network_creator is None:
             raise Exception("Failed to create private network")
         self.priv_net_id = network_creator.get_network().id
index b1384dd..f2b82d8 100644 (file)
@@ -385,7 +385,8 @@ class TempestResourcesManager(object):
                         'tempest_private_subnet_name') + self.guid,
                     project_name=project_name,
                     cidr=getattr(
-                        config.CONF, 'tempest_private_subnet_cidr'))]))
+                        config.CONF, 'tempest_private_subnet_cidr'),
+                    dns_nameservers=[env.get('NAMESERVER')])]))
         if network_creator is None or network_creator.get_network() is None:
             raise Exception("Failed to create private network")
         self.creators.append(network_creator)
index 620acf3..edc7848 100644 (file)
@@ -126,7 +126,8 @@ class VPingBase(testcase.TestCase):
                 segmentation_id=vping_segmentation_id,
                 subnet_settings=[SubnetConfig(
                     name=private_subnet_name,
-                    cidr=private_subnet_cidr)]))
+                    cidr=private_subnet_cidr,
+                    dns_nameservers=[env.get('NAMESERVER')])]))
         self.creators.append(self.network_creator)
 
         # Creating router to external network
index b7a750e..73a9bfe 100644 (file)
@@ -39,6 +39,7 @@ from xtesting.energy import energy
 from functest.opnfv_tests.openstack.snaps import snaps_utils
 import functest.opnfv_tests.vnf.ims.clearwater_ims_base as clearwater_ims_base
 from functest.utils import config
+from functest.utils import env
 
 __author__ = "Valentin Boucher <valentin.boucher@orange.com>"
 
@@ -145,7 +146,8 @@ class CloudifyIms(clearwater_ims_base.ClearwaterOnBoardingBase):
         self.__logger.info("Creating full network ...")
         subnet_settings = SubnetConfig(
             name='cloudify_ims_subnet-{}'.format(self.uuid),
-            cidr='10.67.79.0/24')
+            cidr='10.67.79.0/24',
+            dns_nameservers=[env.get('NAMESERVER')])
         network_settings = NetworkConfig(
             name='cloudify_ims_network-{}'.format(self.uuid),
             subnet_settings=[subnet_settings])
index 7af609a..37148c9 100644 (file)
@@ -38,6 +38,7 @@ from functest.opnfv_tests.vnf.ims.ixia.utils import IxChassisUtils
 from functest.opnfv_tests.vnf.ims.ixia.utils import IxLoadUtils
 from functest.opnfv_tests.vnf.ims.ixia.utils import IxRestUtils
 from functest.utils import config
+from functest.utils import env
 
 __author__ = "Valentin Boucher <valentin.boucher@orange.com>"
 
@@ -113,7 +114,8 @@ class CloudifyImsPerf(cloudify_ims.CloudifyIms):
 
         self.__logger.info("Creating full IXIA network ...")
         subnet_settings = SubnetConfig(name='ixia_management_subnet',
-                                       cidr='10.10.10.0/24')
+                                       cidr='10.10.10.0/24',
+                                       dns_nameservers=[env.get('NAMESERVER')])
         network_settings = NetworkConfig(name='ixia_management_network',
                                          subnet_settings=[subnet_settings])
         network_creator = OpenStackNetwork(self.snaps_creds, network_settings)
index 2d248b2..2b458e8 100644 (file)
@@ -21,6 +21,7 @@ import yaml
 from functest.core import vnf
 from functest.opnfv_tests.openstack.snaps import snaps_utils
 from functest.utils import config
+from functest.utils import env
 
 from org.openbaton.cli.errors.errors import NfvoException
 from org.openbaton.cli.agents.agents import MainAgent
@@ -315,7 +316,8 @@ class ClearwaterImsVnf(vnf.VnfOnBoarding):
             "Creating network/subnet/router if they doen't exist yet...")
         subnet_settings = SubnetConfig(
             name='{}_subnet-{}'.format(self.case_name, self.uuid),
-            cidr="192.168.100.0/24")
+            cidr="192.168.100.0/24",
+            dns_nameservers=[env.get('NAMESERVER')])
         network_settings = NetworkConfig(
             name='{}_net-{}'.format(self.case_name, self.uuid),
             subnet_settings=[subnet_settings])
index 8f209d5..5615b6a 100644 (file)
@@ -19,6 +19,7 @@ import yaml
 
 from functest.core import vnf
 from functest.utils import config
+from functest.utils import env
 
 from org.openbaton.cli.errors.errors import NfvoException
 from org.openbaton.cli.agents.agents import MainAgent
@@ -300,7 +301,8 @@ class OpenImsVnf(vnf.VnfOnBoarding):
             "Creating network/subnet/router if they doen't exist yet...")
         subnet_settings = SubnetConfig(
             name='{}_subnet-{}'.format(self.case_name, self.uuid),
-            cidr="192.168.100.0/24")
+            cidr="192.168.100.0/24",
+            dns_nameservers=[env.get('NAMESERVER')])
         network_settings = NetworkConfig(
             name='{}_net-{}'.format(self.case_name, self.uuid),
             subnet_settings=[subnet_settings])
index 11b9000..14269ad 100644 (file)
@@ -24,6 +24,7 @@ from functest.opnfv_tests.openstack.snaps import snaps_utils
 import functest.opnfv_tests.vnf.router.vrouter_base as vrouter_base
 from functest.opnfv_tests.vnf.router.utilvnf import Utilvnf
 from functest.utils import config
+from functest.utils import env
 from functest.utils import functest_utils
 
 from git import Repo
@@ -168,7 +169,8 @@ class CloudifyVrouter(vrouter_base.VrouterOnBoardingBase):
         self.__logger.info("Creating full network ...")
         subnet_settings = SubnetConfig(
             name='cloudify_vrouter_subnet-{}'.format(self.uuid),
-            cidr='10.67.79.0/24')
+            cidr='10.67.79.0/24',
+            dns_nameservers=[env.get('NAMESERVER')])
         network_settings = NetworkConfig(
             name='cloudify_vrouter_network-{}'.format(self.uuid),
             subnet_settings=[subnet_settings])
index 85e5ab9..3aaa459 100644 (file)
@@ -29,6 +29,7 @@ from snaps.openstack.os_credentials import OSCreds
 from xtesting.core import testcase
 
 from functest.opnfv_tests.openstack.vping import vping_userdata, vping_ssh
+from functest.utils import env
 
 
 class VPingUserdataTesting(unittest.TestCase):
@@ -127,6 +128,11 @@ class VPingSSHTesting(unittest.TestCase):
         scp_client = mock.MagicMock(name='put')
         scp_client.put.return_value = None
 
+        subnet_config = SubnetConfig(
+            name='bar',
+            cidr='10.0.0.1/24',
+            dns_nameservers=[env.get('NAMESERVER')])
+
         with mock.patch('snaps.openstack.utils.deploy_utils.create_image',
                         return_value=OpenStackImage(self.os_creds, None)), \
                 mock.patch('snaps.openstack.utils.deploy_utils.create_network',
@@ -134,10 +140,7 @@ class VPingSSHTesting(unittest.TestCase):
                                self.os_creds,
                                NetworkConfig(
                                    name='foo',
-                                   subnet_settings=[
-                                       SubnetConfig(
-                                           name='bar',
-                                           cidr='10.0.0.1/24')]))), \
+                                   subnet_settings=[subnet_config]))), \
                 mock.patch('snaps.openstack.utils.deploy_utils.'
                            'create_vm_instance',
                            return_value=OpenStackVmInstance(
index 44bd9e0..b0b8501 100644 (file)
@@ -27,7 +27,8 @@ INPUTS = {
     'ENERGY_RECORDER_API_URL': env.INPUTS['ENERGY_RECORDER_API_URL'],
     'ENERGY_RECORDER_API_USER': env.INPUTS['ENERGY_RECORDER_API_USER'],
     'ENERGY_RECORDER_API_PASSWORD': env.INPUTS['ENERGY_RECORDER_API_PASSWORD'],
-    'VOLUME_DEVICE_NAME': 'vdb'
+    'VOLUME_DEVICE_NAME': 'vdb',
+    'NAMESERVER': '8.8.8.8'
 }