From 1398583e07aab24ceebaa084a6f2878e4b3b278d Mon Sep 17 00:00:00 2001 From: Frode Nordahl Date: Wed, 5 Feb 2020 13:20:55 +0100 Subject: [PATCH 1/3] ovn: Update bridge configuration code After power user feedback we want to change how interfaces are attached to bridges on the OVN charms. Ref: openstack-charmers/charm-layer-ovn#6 --- zaza/openstack/utilities/openstack.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/zaza/openstack/utilities/openstack.py b/zaza/openstack/utilities/openstack.py index 7e48a98..2c27b7d 100644 --- a/zaza/openstack/utilities/openstack.py +++ b/zaza/openstack/utilities/openstack.py @@ -672,7 +672,7 @@ def configure_gateway_ext_port(novaclient, neutronclient, net_id=None, except KeyError: # ovn-dedicated-chassis not in deployment pass - port_config_key = 'interface-bridge-mappings' + port_config_key = 'bridge-interface-mappings' config.update({'ovn-bridge-mappings': 'physnet1:br-ex'}) add_dataport_to_netplan = True else: @@ -713,8 +713,6 @@ def configure_gateway_ext_port(novaclient, neutronclient, net_id=None, if 'ext-port' in port['name']: if deprecated_extnet_mode: ext_br_macs.append(port['mac_address']) - elif ovn_present(): - ext_br_macs.append('{}:br-ex'.format(port['mac_address'])) else: ext_br_macs.append('br-ex:{}'.format(port['mac_address'])) ext_br_macs.sort() From 6672fe934d6559dab9a0e1a724a152df150855eb Mon Sep 17 00:00:00 2001 From: David Ames Date: Fri, 24 Jan 2020 16:21:36 -0800 Subject: [PATCH 2/3] Test ovs-use-veth setting Validate settings for existing and configured ovs-use-veth settings. Verify the charm goes into a blocked state if they conflict. Partial-Bug: #1831935 --- zaza/openstack/charm_tests/neutron/tests.py | 89 ++++++++++++++++----- 1 file changed, 69 insertions(+), 20 deletions(-) diff --git a/zaza/openstack/charm_tests/neutron/tests.py b/zaza/openstack/charm_tests/neutron/tests.py index 02450e5..694b1fb 100644 --- a/zaza/openstack/charm_tests/neutron/tests.py +++ b/zaza/openstack/charm_tests/neutron/tests.py @@ -17,6 +17,7 @@ """Encapsulating `neutron-openvswitch` testing.""" +import copy import logging import tenacity import unittest @@ -29,21 +30,79 @@ import zaza.openstack.configure.guest as guest import zaza.openstack.utilities.openstack as openstack_utils -class NeutronGatewayTest(test_utils.OpenStackBaseTest): +class NeutronPluginApiSharedTests(test_utils.OpenStackBaseTest): + """Shared tests for Neutron Plugin API Charms.""" + + def setUpClass(cls): + """Run class setup for running Neutron Openvswitch tests.""" + super(NeutronPluginApiSharedTests, cls).setUpClass() + + cls.current_os_release = openstack_utils.get_os_release() + cls.bionic_stein = openstack_utils.get_os_release('bionic_stein') + cls.trusty_mitaka = openstack_utils.get_os_release('trusty_mitaka') + + if cls.current_os_release >= cls.bionic_stein: + cls.pgrep_full = True + else: + cls.pgrep_full = False + + def test_211_ovs_use_veth(self): + """Verify proper handling of ovs-use-veth setting.""" + conf_file = "/etc/neutron/dhcp_agent.ini" + expected = {"DEFAULT": {"ovs_use_veth": ["False"]}} + test_config = zaza.charm_lifecycle.utils.get_charm_config(fatal=False) + states = test_config.get("target_deploy_status", {}) + alt_states = copy.deepcopy(states) + alt_states[self.application_name] = { + "workload-status": "blocked", + "workload-status-message": + "Mismatched existing and configured ovs-use-veth. See log."} + + if "neutron-openvswitch" in self.application_name: + logging.info("Turning on DHCP and metadata") + zaza.model.set_application_config( + self.application_name, + {"enable-local-dhcp-and-metadata": "True"}) + zaza.model.wait_for_application_states(states=states) + + logging.info("Check for expected default ovs-use-veth setting of " + "False") + zaza.model.block_until_oslo_config_entries_match( + self.application_name, + conf_file, + expected, + ) + logging.info("Setting conflicting ovs-use-veth to True") + zaza.model.set_application_config( + self.application_name, + {"ovs-use-veth": "True"}) + logging.info("Wait to go into a blocked workload status") + zaza.model.wait_for_application_states(states=alt_states) + # Check the value stayed the same + logging.info("Check that the value of ovs-use-veth setting " + "remained False") + zaza.model.block_until_oslo_config_entries_match( + self.application_name, + conf_file, + expected, + ) + logging.info("Setting ovs-use-veth to match existing.") + zaza.model.set_application_config( + self.application_name, + {"ovs-use-veth": "False"}) + logging.info("Wait to go into unit ready workload status") + zaza.model.wait_for_application_states(states=states) + + +class NeutronGatewayTest(NeutronPluginApiSharedTests): """Test basic Neutron Gateway Charm functionality.""" @classmethod def setUpClass(cls): """Run class setup for running Neutron Gateway tests.""" - super(NeutronGatewayTest, cls).setUpClass() - cls.current_os_release = openstack_utils.get_os_release() + super(NeutronGatewayTest, cls).setUpClass(cls) cls.services = cls._get_services() - bionic_stein = openstack_utils.get_os_release('bionic_stein') - - cls.pgrep_full = (True if cls.current_os_release >= bionic_stein - else False) - def test_900_restart_on_config_change(self): """Checking restart happens on config change. @@ -328,28 +387,18 @@ class SecurityTest(test_utils.OpenStackBaseTest): expected_to_pass=expected_to_pass) -class NeutronOpenvSwitchTest(test_utils.OpenStackBaseTest): +class NeutronOpenvSwitchTest(NeutronPluginApiSharedTests): """Test basic Neutron Openvswitch Charm functionality.""" @classmethod def setUpClass(cls): """Run class setup for running Neutron Openvswitch tests.""" - super(NeutronOpenvSwitchTest, cls).setUpClass() - - cls.current_os_release = openstack_utils.get_os_release() + super(NeutronOpenvSwitchTest, cls).setUpClass(cls) cls.compute_unit = zaza.model.get_units('nova-compute')[0] cls.neutron_api_unit = zaza.model.get_units('neutron-api')[0] cls.n_ovs_unit = zaza.model.get_units('neutron-openvswitch')[0] - cls.bionic_stein = openstack_utils.get_os_release('bionic_stein') - cls.trusty_mitaka = openstack_utils.get_os_release('trusty_mitaka') - - if cls.current_os_release >= cls.bionic_stein: - cls.pgrep_full = True - else: - cls.pgrep_full = False - # set up client cls.neutron_client = ( openstack_utils.get_neutron_session_client(cls.keystone_session)) From 9f67c8e032b0ae32cd601f951b215bddfa42c296 Mon Sep 17 00:00:00 2001 From: David Ames Date: Wed, 29 Jan 2020 16:19:56 -0800 Subject: [PATCH 3/3] Do not test Trusty --- zaza/openstack/charm_tests/neutron/tests.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/zaza/openstack/charm_tests/neutron/tests.py b/zaza/openstack/charm_tests/neutron/tests.py index 694b1fb..6161c88 100644 --- a/zaza/openstack/charm_tests/neutron/tests.py +++ b/zaza/openstack/charm_tests/neutron/tests.py @@ -48,6 +48,13 @@ class NeutronPluginApiSharedTests(test_utils.OpenStackBaseTest): def test_211_ovs_use_veth(self): """Verify proper handling of ovs-use-veth setting.""" + current_release = openstack_utils.get_os_release() + xenial_mitaka = openstack_utils.get_os_release('xenial_mitaka') + if current_release < xenial_mitaka: + logging.info( + "Skipping OVS use veth test. ovs_use_veth is always True on " + "Trusty.") + return conf_file = "/etc/neutron/dhcp_agent.ini" expected = {"DEFAULT": {"ovs_use_veth": ["False"]}} test_config = zaza.charm_lifecycle.utils.get_charm_config(fatal=False)