diff options
author | Cédric Ollivier <cedric.ollivier@orange.com> | 2019-01-19 20:59:08 +0100 |
---|---|---|
committer | Cédric Ollivier <cedric.ollivier@orange.com> | 2019-01-19 21:12:49 +0100 |
commit | ee52195f4476d3debf9c3f92c6d808256a199500 (patch) | |
tree | f71cc3644f3fb0172d3dbe88d3828eb5e8e83fb6 | |
parent | ad93c57678ccd0719e43fbbadc108b00a71f6038 (diff) |
Take control over Rally logics
Rally selects the first external network [1] which could raise side
effects if:
- another testcase is creating a dummy external network in //
- all external subnets are not reachable from jumphost
It's now overriden by EXTERNAL_NETWORK as defined in Functest
Rally creates a new shared network if one already exists [2].
As juju now allows other shared networks, it can be safely created by
Functest to allow only one logic and to handle provider networks,
different name servers, etc...
[1] https://github.com/openstack/rally-openstack/blob/master/rally_openstack/verification/tempest/config.py#L146
[2] https://github.com/openstack/rally-openstack/blob/master/rally_openstack/verification/tempest/context.py#L85
Change-Id: Icf8c08077d4b0a9eb1c2e1b7309c62957b0a3b63
Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
-rw-r--r-- | functest/opnfv_tests/openstack/tempest/tempest.py | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/functest/opnfv_tests/openstack/tempest/tempest.py b/functest/opnfv_tests/openstack/tempest/tempest.py index 9d788de8c..75a2fb5a1 100644 --- a/functest/opnfv_tests/openstack/tempest/tempest.py +++ b/functest/opnfv_tests/openstack/tempest/tempest.py @@ -33,11 +33,12 @@ LOGGER = logging.getLogger(__name__) class TempestCommon(singlevm.VmReady2): - # pylint: disable=too-many-instance-attributes + # pylint: disable=too-many-instance-attributes,too-many-public-methods """TempestCommon testcases implementation class.""" visibility = 'public' filename_alt = '/home/opnfv/functest/images/cirros-0.4.0-x86_64-disk.img' + shared_network = True def __init__(self, **kwargs): if "case_name" not in kwargs: @@ -83,9 +84,6 @@ class TempestCommon(singlevm.VmReady2): except Exception: # pylint: disable=broad-except pass - def create_network_resources(self): - pass - def check_services(self): """Check the mandatory services.""" for service in self.services: @@ -356,6 +354,27 @@ class TempestCommon(singlevm.VmReady2): with open(rally_conf, 'wb') as config_file: rconfig.write(config_file) + def update_network_section(self): + """Update network section in tempest.conf""" + rconfig = configparser.RawConfigParser() + rconfig.read(self.conf_file) + if not rconfig.has_section('network'): + rconfig.add_section('network') + rconfig.set('network', 'public_network_id', self.ext_net.id) + rconfig.set('network', 'floating_network_name', self.ext_net.name) + with open(self.conf_file, 'wb') as config_file: + rconfig.write(config_file) + + def update_compute_section(self): + """Update neutron section in tempest.conf""" + rconfig = configparser.RawConfigParser() + rconfig.read(self.conf_file) + if not rconfig.has_section('compute'): + rconfig.add_section('compute') + rconfig.set('compute', 'fixed_network_name', self.network.name) + with open(self.conf_file, 'wb') as config_file: + rconfig.write(config_file) + def update_scenario_section(self): """Update scenario section in tempest.conf""" rconfig = configparser.RawConfigParser() @@ -431,6 +450,8 @@ class TempestCommon(singlevm.VmReady2): flavor_alt_id=self.flavor_alt.id, admin_role_name=self.role_name, cidr=self.cidr, domain_id=self.project.domain.id) + self.update_network_section() + self.update_compute_section() self.update_scenario_section() self.backup_tempest_config(self.conf_file, self.res_dir) |