Add additional config option "default_image_is_advanced"

In patch [1] we added new config option to configure "advanced" image
which we are using in some tests which require it and can't run using
default Cirros image.
Unfortunatelly this made life of some downstream users harder as they
have CI systems which don't use devstack and don't have easy way to
load another "advanced" image and use it for those tests.

So now this patch adds one ore config option "default_image_is_advanced"
which has boolean value and defaults to False.
If this is set to True, tests which require advanced image will not be
skipped and default image will be used for those tests.

[1] https://review.openstack.org/#/c/609762/16/neutron_tempest_plugin/config.py

Co-Authored-By: Slawek Kaplonski <skaplons@redhat.com>

Change-Id: Ic78ee64a9350863ff5bd4b4baa4b20770e1b9d47
This commit is contained in:
Yariv Rachmani 2018-11-21 12:46:57 +02:00 committed by Slawek Kaplonski
parent a57f80d180
commit fa1081ad9f
3 changed files with 55 additions and 28 deletions

View File

@ -86,6 +86,13 @@ NeutronPluginOptions = [
# Options for special, "advanced" image like e.g. Ubuntu. Such image can be
# used in tests which require some more advanced tool than available in
# Cirros
cfg.BoolOpt('default_image_is_advanced',
default=False,
help='Default image is an image which supports features '
'that Cirros does not, like Ubuntu or CentOS supporting '
'advanced features. '
'If this is set to True, "advanced_image_ref" option '
'is not required to be set.'),
cfg.StrOpt('advanced_image_ref',
default=None,
help='Valid advanced image uuid to be used in tests. '

View File

@ -46,11 +46,24 @@ class NetworkMtuBaseTest(base.BaseTempestTestCase):
secgroup_id=cls.secgroup['security_group']['id'])
cls.create_pingable_secgroup_rule(
secgroup_id=cls.secgroup['security_group']['id'])
if CONF.neutron_plugin_options.default_image_is_advanced:
cls.use_advanced_image = False
cls.username = CONF.validation.image_ssh_user
else:
cls.use_advanced_image = True
cls.username = CONF.neutron_plugin_options.advanced_image_ssh_user
def create_pingable_vm(self, net, keypair, secgroup):
if self.use_advanced_image:
flavor_ref = CONF.neutron_plugin_options.advanced_image_flavor_ref
image_ref = CONF.neutron_plugin_options.advanced_image_ref
else:
flavor_ref = CONF.compute.flavor_ref
image_ref = CONF.compute.image_ref
server = self.create_server(
flavor_ref=CONF.neutron_plugin_options.advanced_image_flavor_ref,
image_ref=CONF.neutron_plugin_options.advanced_image_ref,
flavor_ref=flavor_ref,
image_ref=image_ref,
key_name=keypair['name'],
networks=[{'uuid': net['id']}],
security_groups=[{'name': secgroup[
@ -107,23 +120,21 @@ class NetworkMtuTest(NetworkMtuBaseTest):
self.keypair, self.secgroup)
server_ssh_client1 = ssh.Client(
self.floating_ips[0]['floating_ip_address'],
CONF.neutron_plugin_options.advanced_image_ssh_user,
pkey=self.keypair['private_key'])
self.username, pkey=self.keypair['private_key'])
server2, fip2 = self.create_pingable_vm(self.networks[1],
self.keypair, self.secgroup)
server_ssh_client2 = ssh.Client(
self.floating_ips[0]['floating_ip_address'],
CONF.neutron_plugin_options.advanced_image_ssh_user,
pkey=self.keypair['private_key'])
self.username, pkey=self.keypair['private_key'])
for fip in (fip1, fip2):
self.check_connectivity(
fip['floating_ip_address'],
CONF.neutron_plugin_options.advanced_image_ssh_user,
self.keypair['private_key'])
self.username, self.keypair['private_key'])
return server_ssh_client1, fip1, server_ssh_client2, fip2
@testtools.skipUnless(
CONF.neutron_plugin_options.advanced_image_ref,
(CONF.neutron_plugin_options.advanced_image_ref or
CONF.neutron_plugin_options.default_image_is_advanced),
"Advanced image is required to run this test.")
@decorators.idempotent_id('3d73ec1a-2ec6-45a9-b0f8-04a273d9d344')
def test_connectivity_min_max_mtu(self):
@ -202,23 +213,21 @@ class NetworkWritableMtuTest(NetworkMtuBaseTest):
self.keypair, self.secgroup)
server_ssh_client1 = ssh.Client(
self.floating_ips[0]['floating_ip_address'],
CONF.neutron_plugin_options.advanced_image_ssh_user,
pkey=self.keypair['private_key'])
self.username, pkey=self.keypair['private_key'])
server2, fip2 = self.create_pingable_vm(self.networks[1],
self.keypair, self.secgroup)
server_ssh_client2 = ssh.Client(
self.floating_ips[0]['floating_ip_address'],
CONF.neutron_plugin_options.advanced_image_ssh_user,
pkey=self.keypair['private_key'])
self.username, pkey=self.keypair['private_key'])
for fip in (fip1, fip2):
self.check_connectivity(
fip['floating_ip_address'],
CONF.neutron_plugin_options.advanced_image_ssh_user,
self.keypair['private_key'])
self.username, self.keypair['private_key'])
return server_ssh_client1, fip1, server_ssh_client2, fip2
@testtools.skipUnless(
CONF.neutron_plugin_options.advanced_image_ref,
(CONF.neutron_plugin_options.advanced_image_ref or
CONF.neutron_plugin_options.default_image_is_advanced),
"Advanced image is required to run this test.")
@decorators.idempotent_id('bc470200-d8f4-4f07-b294-1b4cbaaa35b9')
def test_connectivity_min_max_mtu(self):

View File

@ -244,7 +244,9 @@ class TrunkTest(base.BaseTempestTestCase):
self._wait_for_trunk(vm.trunk)
self._assert_has_ssh_connectivity(vm1.ssh_client)
@testtools.skipUnless(CONF.neutron_plugin_options.advanced_image_ref,
@testtools.skipUnless(
(CONF.neutron_plugin_options.advanced_image_ref or
CONF.neutron_plugin_options.default_image_is_advanced),
"Advanced image is required to run this test.")
@decorators.idempotent_id('a8a02c9b-b453-49b5-89a2-cce7da66aafb')
def test_subport_connectivity(self):
@ -252,12 +254,17 @@ class TrunkTest(base.BaseTempestTestCase):
vlan_network = self.create_network()
vlan_subnet = self.create_subnet(network=vlan_network, gateway=None)
vm1 = self._create_server_with_trunk_port(subport_network=vlan_network,
use_advanced_image = (
not CONF.neutron_plugin_options.default_image_is_advanced)
vm1 = self._create_server_with_trunk_port(
subport_network=vlan_network,
segmentation_id=vlan_tag,
use_advanced_image=True)
vm2 = self._create_server_with_trunk_port(subport_network=vlan_network,
use_advanced_image=use_advanced_image)
vm2 = self._create_server_with_trunk_port(
subport_network=vlan_network,
segmentation_id=vlan_tag,
use_advanced_image=True)
use_advanced_image=use_advanced_image)
for vm in [vm1, vm2]:
self._configure_vlan_subport(vm=vm,
@ -278,7 +285,8 @@ class TrunkTest(base.BaseTempestTestCase):
vm2.subport['fixed_ips'][0]['ip_address'])
@testtools.skipUnless(
CONF.neutron_plugin_options.advanced_image_ref,
(CONF.neutron_plugin_options.advanced_image_ref or
CONF.neutron_plugin_options.default_image_is_advanced),
"Advanced image is required to run this test.")
@testtools.skipUnless(
CONF.neutron_plugin_options.q_agent == "linuxbridge",
@ -290,11 +298,14 @@ class TrunkTest(base.BaseTempestTestCase):
vlan_subnet = self.create_subnet(vlan_network)
self.create_router_interface(self.router['id'], vlan_subnet['id'])
use_advanced_image = (
not CONF.neutron_plugin_options.default_image_is_advanced)
# Create servers
trunk_network_server = self._create_server_with_trunk_port(
subport_network=vlan_network,
segmentation_id=vlan_tag,
use_advanced_image=True)
use_advanced_image=use_advanced_image)
normal_network_server = self._create_server_with_network(self.network)
vlan_network_server = self._create_server_with_network(vlan_network)