From 262dee6d22d2ea16a87865038e4ba98e8ebd9c59 Mon Sep 17 00:00:00 2001 From: Federico Ressi Date: Tue, 30 Jul 2019 13:07:07 +0200 Subject: [PATCH] Add VM to VM L3HA connectivity test cases Change-Id: I110b0f25411b51e515e96313855633e5573c0411 --- tobiko/openstack/stacks/__init__.py | 8 +++- tobiko/openstack/stacks/_l3ha.py | 47 +++++++++++++++++++ tobiko/openstack/stacks/_neutron.py | 5 -- tobiko/openstack/stacks/_nova.py | 4 ++ .../scenario/neutron/test_floating_ip.py | 17 ++----- tobiko/tests/scenario/neutron/test_network.py | 32 +++++++++++-- zuul.d/tobiko-devstack.yaml | 3 ++ 7 files changed, 92 insertions(+), 24 deletions(-) create mode 100644 tobiko/openstack/stacks/_l3ha.py diff --git a/tobiko/openstack/stacks/__init__.py b/tobiko/openstack/stacks/__init__.py index f9c90b9ac..47d4ad1ef 100644 --- a/tobiko/openstack/stacks/__init__.py +++ b/tobiko/openstack/stacks/__init__.py @@ -16,6 +16,7 @@ from __future__ import absolute_import from tobiko.openstack.stacks import _cirros +from tobiko.openstack.stacks import _l3ha from tobiko.openstack.stacks import _neutron from tobiko.openstack.stacks import _nova from tobiko.openstack.stacks import _ubuntu @@ -28,10 +29,15 @@ CirrosDifferentHostServerStackFixture = ( _cirros.CirrosDifferentHostServerStackFixture) CirrosSameHostServerStackFixture = _cirros.CirrosSameHostServerStackFixture +L3haNetworkStackFixture = _l3ha.L3haNetworkStackFixture +L3haServerStackFixture = _l3ha.L3haServerStackFixture +L3haPeerServerStackFixture = _l3ha.L3haPeerServerStackFixture +L3haDifferentHostServerStackFixture = _l3ha.L3haDifferentHostServerStackFixture +L3haSameHostServerStackFixture = _l3ha.L3haSameHostServerStackFixture + NetworkStackFixture = _neutron.NetworkStackFixture NetworkWithNetMtuWriteStackFixture = ( _neutron.NetworkWithNetMtuWriteStackFixture) -NetworkWithL3HAStackFixture = _neutron.NetworkWithL3HAStackFixture SecurityGroupsFixture = _neutron.SecurityGroupsFixture ServerStackFixture = _nova.ServerStackFixture diff --git a/tobiko/openstack/stacks/_l3ha.py b/tobiko/openstack/stacks/_l3ha.py new file mode 100644 index 000000000..d7f36aabc --- /dev/null +++ b/tobiko/openstack/stacks/_l3ha.py @@ -0,0 +1,47 @@ +# Copyright 2019 Red Hat +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +from __future__ import absolute_import + +import tobiko +from tobiko.openstack import neutron +from tobiko.openstack.stacks import _cirros +from tobiko.openstack.stacks import _neutron +from tobiko.openstack.stacks import _nova + + +@neutron.skip_if_missing_networking_extensions('l3-ha') +class L3haNetworkStackFixture(_neutron.NetworkStackFixture): + ha = True + + +@neutron.skip_if_missing_networking_extensions('l3-ha') +class L3haServerStackFixture(_cirros.CirrosServerStackFixture): + #: Heat stack for creating internal network with custom MTU value + network_stack = tobiko.required_setup_fixture( + L3haNetworkStackFixture) + + +class L3haPeerServerStackFixture( + L3haServerStackFixture, _nova.PeerServerStackFixture): + peer_stack = tobiko.required_setup_fixture(L3haServerStackFixture) + + +class L3haSameHostServerStackFixture( + L3haPeerServerStackFixture, _nova.SameHostServerStackFixture): + pass + + +class L3haDifferentHostServerStackFixture( + L3haPeerServerStackFixture, _nova.DifferentHostServerStackFixture): + pass diff --git a/tobiko/openstack/stacks/_neutron.py b/tobiko/openstack/stacks/_neutron.py index 577f7acb0..5f61b0729 100644 --- a/tobiko/openstack/stacks/_neutron.py +++ b/tobiko/openstack/stacks/_neutron.py @@ -153,11 +153,6 @@ class NetworkWithNetMtuWriteStackFixture(NetworkStackFixture): return dict(value_specs, mtu=self.custom_mtu_size) -@neutron.skip_if_missing_networking_extensions('l3-ha') -class NetworkWithL3HAStackFixture(NetworkStackFixture): - ha = True - - @neutron.skip_if_missing_networking_extensions('security-group') class SecurityGroupsFixture(heat.HeatStackFixture): """Heat stack with some security groups diff --git a/tobiko/openstack/stacks/_nova.py b/tobiko/openstack/stacks/_nova.py index f924f1300..0fa99df28 100644 --- a/tobiko/openstack/stacks/_nova.py +++ b/tobiko/openstack/stacks/_nova.py @@ -219,6 +219,10 @@ class PeerServerStackFixture(ServerStackFixture): username=self.username, proxy_command=proxy_command) + @property + def network(self): + return self.peer_stack.network + @nova.skip_if_missing_hypervisors(count=2, state='up', status='enabled') class DifferentHostServerStackFixture(PeerServerStackFixture): diff --git a/tobiko/tests/scenario/neutron/test_floating_ip.py b/tobiko/tests/scenario/neutron/test_floating_ip.py index af474b4ac..00d4642ba 100644 --- a/tobiko/tests/scenario/neutron/test_floating_ip.py +++ b/tobiko/tests/scenario/neutron/test_floating_ip.py @@ -234,22 +234,11 @@ class FloatingIpWithMtuWritableTest(FloatingIPTest): return self.stack.network_stack.custom_mtu_size -# --- Test la-h3 extension -------------------------------------------- - -@neutron.skip_if_missing_networking_extensions('l3-ha') -class FloatingIPWithL3HAFixture(stacks.CirrosServerStackFixture): - """Heat stack for testing floating IP with a custom MTU network value""" - - #: Heat stack for creating internal network with custom MTU value - network_stack = tobiko.required_setup_fixture( - stacks.NetworkWithL3HAStackFixture) - +# --- Test la-h3 extension ---------------------------------------------------- @neutron.skip_if_missing_networking_extensions('l3-ha') @neutron.skip_if_missing_networking_agents(binary='neutron-l3-agent', count=2) -class NetworkWithL3HATest(FloatingIPTest): - """Tests connectivity via floating IP with a custom MTU value""" - +class FloatingIpWithL3HATest(FloatingIPTest): #: Resources stack with floating IP and Nova server - stack = tobiko.required_setup_fixture(FloatingIPWithL3HAFixture) + stack = tobiko.required_setup_fixture(stacks.L3haServerStackFixture) diff --git a/tobiko/tests/scenario/neutron/test_network.py b/tobiko/tests/scenario/neutron/test_network.py index a1435eb42..15b99a4f6 100644 --- a/tobiko/tests/scenario/neutron/test_network.py +++ b/tobiko/tests/scenario/neutron/test_network.py @@ -64,8 +64,6 @@ class NetworkTest(testtools.TestCase): gateway['ha']) -# --- Same compute host VM to VM scenario ------------------------------------- - class SameHostNetworkTest(NetworkTest): #: Resources stack with Nova server to send messages to @@ -81,8 +79,6 @@ class SameHostNetworkTest(NetworkTest): getattr(receiver, 'OS-EXT-SRV-ATTR:host')) -# --- Different compute host VM to VM scenario -------------------------------- - @nova.skip_if_missing_hypervisors(count=2, state='up', status='enabled') class DifferentHostNetworkTest(NetworkTest): @@ -97,3 +93,31 @@ class DifferentHostNetworkTest(NetworkTest): self.stack.scheduler_hints) self.assertNotEqual(getattr(sender, 'OS-EXT-SRV-ATTR:host'), getattr(receiver, 'OS-EXT-SRV-ATTR:host')) + + +# --- l3-ha extension VM to VM scenario --------------------------------------- + +@neutron.skip_if_missing_networking_extensions('l3-ha') +@neutron.skip_if_missing_networking_agents(binary='neutron-l3-agent', + count=2) +class L3haNetworkTest(NetworkTest): + #: Resources stack with floating IP and Nova server + stack = tobiko.required_setup_fixture(stacks.L3haPeerServerStackFixture) + + +@neutron.skip_if_missing_networking_extensions('l3-ha') +@neutron.skip_if_missing_networking_agents(binary='neutron-l3-agent', + count=2) +class L3haSameHostNetworkTest(SameHostNetworkTest): + #: Resources stack with Nova server to send messages to + stack = tobiko.required_setup_fixture( + stacks.L3haSameHostServerStackFixture) + + +@neutron.skip_if_missing_networking_extensions('l3-ha') +@neutron.skip_if_missing_networking_agents(binary='neutron-l3-agent', + count=2) +class L3haDifferentHostNetworkTest(SameHostNetworkTest): + #: Resources stack with Nova server to send messages to + stack = tobiko.required_setup_fixture( + stacks.L3haDifferentHostServerStackFixture) diff --git a/zuul.d/tobiko-devstack.yaml b/zuul.d/tobiko-devstack.yaml index 8da72a774..40b57c0c4 100644 --- a/zuul.d/tobiko-devstack.yaml +++ b/zuul.d/tobiko-devstack.yaml @@ -59,6 +59,9 @@ quota_floatingip: 500 quota_security_group: 100 quota_security_group_rule: 1000 + $NOVA_CONF: + QUOTAS: + quota_instances: 20 test-config: $TEMPEST_CONFIG: compute: