diff options
author | Linda Wang <wangwulin@huawei.com> | 2018-03-05 03:14:23 +0000 |
---|---|---|
committer | Cédric Ollivier <cedric.ollivier@orange.com> | 2018-03-07 03:36:40 +0100 |
commit | 530c678677cc314c159936fdf5e121e83fc1d0cc (patch) | |
tree | dc206cc94f933c696721b064ba00c48ce20e7872 | |
parent | 8ea8434a1d02d57f61c34113b676d9f8f2530dde (diff) |
Add a new env var for nameserver
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>
-rw-r--r-- | functest/opnfv_tests/openstack/rally/rally.py | 3 | ||||
-rw-r--r-- | functest/opnfv_tests/openstack/tempest/tempest.py | 3 | ||||
-rw-r--r-- | functest/opnfv_tests/openstack/vping/vping_base.py | 3 | ||||
-rw-r--r-- | functest/opnfv_tests/vnf/ims/cloudify_ims.py | 4 | ||||
-rw-r--r-- | functest/opnfv_tests/vnf/ims/cloudify_ims_perf.py | 4 | ||||
-rw-r--r-- | functest/opnfv_tests/vnf/ims/orchestra_clearwaterims.py | 4 | ||||
-rw-r--r-- | functest/opnfv_tests/vnf/ims/orchestra_openims.py | 4 | ||||
-rw-r--r-- | functest/opnfv_tests/vnf/router/cloudify_vrouter.py | 4 | ||||
-rw-r--r-- | functest/tests/unit/openstack/vping/test_vping.py | 11 | ||||
-rw-r--r-- | functest/utils/env.py | 3 |
10 files changed, 30 insertions, 13 deletions
diff --git a/functest/opnfv_tests/openstack/rally/rally.py b/functest/opnfv_tests/openstack/rally/rally.py index 5c7acfded..f9fb7b8a4 100644 --- a/functest/opnfv_tests/openstack/rally/rally.py +++ b/functest/opnfv_tests/openstack/rally/rally.py @@ -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 diff --git a/functest/opnfv_tests/openstack/tempest/tempest.py b/functest/opnfv_tests/openstack/tempest/tempest.py index b1384dd1e..f2b82d886 100644 --- a/functest/opnfv_tests/openstack/tempest/tempest.py +++ b/functest/opnfv_tests/openstack/tempest/tempest.py @@ -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) diff --git a/functest/opnfv_tests/openstack/vping/vping_base.py b/functest/opnfv_tests/openstack/vping/vping_base.py index 620acf3ff..edc78482b 100644 --- a/functest/opnfv_tests/openstack/vping/vping_base.py +++ b/functest/opnfv_tests/openstack/vping/vping_base.py @@ -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 diff --git a/functest/opnfv_tests/vnf/ims/cloudify_ims.py b/functest/opnfv_tests/vnf/ims/cloudify_ims.py index b7a750e6d..73a9bfe9e 100644 --- a/functest/opnfv_tests/vnf/ims/cloudify_ims.py +++ b/functest/opnfv_tests/vnf/ims/cloudify_ims.py @@ -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]) diff --git a/functest/opnfv_tests/vnf/ims/cloudify_ims_perf.py b/functest/opnfv_tests/vnf/ims/cloudify_ims_perf.py index 7af609a71..37148c918 100644 --- a/functest/opnfv_tests/vnf/ims/cloudify_ims_perf.py +++ b/functest/opnfv_tests/vnf/ims/cloudify_ims_perf.py @@ -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) diff --git a/functest/opnfv_tests/vnf/ims/orchestra_clearwaterims.py b/functest/opnfv_tests/vnf/ims/orchestra_clearwaterims.py index 2d248b2e6..2b458e8c1 100644 --- a/functest/opnfv_tests/vnf/ims/orchestra_clearwaterims.py +++ b/functest/opnfv_tests/vnf/ims/orchestra_clearwaterims.py @@ -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]) diff --git a/functest/opnfv_tests/vnf/ims/orchestra_openims.py b/functest/opnfv_tests/vnf/ims/orchestra_openims.py index 8f209d5cf..5615b6ac7 100644 --- a/functest/opnfv_tests/vnf/ims/orchestra_openims.py +++ b/functest/opnfv_tests/vnf/ims/orchestra_openims.py @@ -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]) diff --git a/functest/opnfv_tests/vnf/router/cloudify_vrouter.py b/functest/opnfv_tests/vnf/router/cloudify_vrouter.py index 11b9000bc..14269ad36 100644 --- a/functest/opnfv_tests/vnf/router/cloudify_vrouter.py +++ b/functest/opnfv_tests/vnf/router/cloudify_vrouter.py @@ -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]) diff --git a/functest/tests/unit/openstack/vping/test_vping.py b/functest/tests/unit/openstack/vping/test_vping.py index 85e5ab9e8..3aaa4594a 100644 --- a/functest/tests/unit/openstack/vping/test_vping.py +++ b/functest/tests/unit/openstack/vping/test_vping.py @@ -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( diff --git a/functest/utils/env.py b/functest/utils/env.py index 44bd9e0de..b0b8501f1 100644 --- a/functest/utils/env.py +++ b/functest/utils/env.py @@ -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' } |