From 0bb84af4a444f01a70f952cca35b766fae1ccbbf Mon Sep 17 00:00:00 2001 From: Dmitrii Shcherbakov Date: Wed, 7 Jun 2023 23:41:29 +0300 Subject: [PATCH] Reuse the existing net setup code As a prerequisite to testing the data plane connectivity with routes advertised by NDR, this change makes the configuration step reuse the existing network config code that is able to do things like plugging an extra interface to be used in bridge-interface-mappings. --- .../charm_tests/dragent/configure.py | 52 ++----------------- 1 file changed, 5 insertions(+), 47 deletions(-) diff --git a/zaza/openstack/charm_tests/dragent/configure.py b/zaza/openstack/charm_tests/dragent/configure.py index 7a7ab7e..b9588d4 100644 --- a/zaza/openstack/charm_tests/dragent/configure.py +++ b/zaza/openstack/charm_tests/dragent/configure.py @@ -18,46 +18,15 @@ import logging import zaza.model -from zaza.openstack.configure import ( - network, - bgp_speaker, -) +from zaza.openstack.configure import bgp_speaker from zaza.openstack.utilities import ( - cli as cli_utils, generic as generic_utils, openstack as openstack_utils, ) +from zaza.openstack.charm_tests.neutron.setup import basic_overcloud_network DEFAULT_PEER_APPLICATION_NAME = "osci-frr" -# The overcloud network configuration settings are declared. -# These are the network configuration settings under test. -OVERCLOUD_NETWORK_CONFIG = { - "network_type": "gre", - "router_name": openstack_utils.PROVIDER_ROUTER, - "ip_version": "4", - "address_scope": "public", - "external_net_name": openstack_utils.EXT_NET, - "external_subnet_name": openstack_utils.EXT_NET_SUBNET, - "prefix_len": "24", - "subnetpool_name": "pooled_subnets", - "subnetpool_prefix": "192.168.0.0/16", -} - -# The undercloud network configuration settings are substrate specific to -# the environment where the tests are being executed. These settings may be -# overridden by environment variables. See the doc string documentation for -# zaza.openstack.utilities.generic_utils.get_undercloud_env_vars for the -# environment variables required to be exported and available to zaza. -# These are default settings provided as an example. -DEFAULT_UNDERCLOUD_NETWORK_CONFIG = { - "start_floating_ip": "10.5.150.0", - "end_floating_ip": "10.5.150.254", - "external_dns": "10.5.0.2", - "external_net_cidr": "10.5.0.0/16", - "default_gateway": "10.5.0.1", -} - def setup(): """Run setup for BGP networking. @@ -72,23 +41,12 @@ def setup(): :returns: None :rtype: None """ - cli_utils.setup_logging() + # Reuse the existing network configuration code. + basic_overcloud_network() - # Get network configuration settings - network_config = {} - # Declared overcloud settings - network_config.update(OVERCLOUD_NETWORK_CONFIG) - # Default undercloud settings - network_config.update(DEFAULT_UNDERCLOUD_NETWORK_CONFIG) - # Environment specific settings - network_config.update(generic_utils.get_undercloud_env_vars()) - - # Get keystone session + # Get a keystone session keystone_session = openstack_utils.get_overcloud_keystone_session() - # Confugre the overcloud network - network.setup_sdn(network_config, keystone_session=keystone_session) - # LP Bugs #1784083 and #1841459, require a late restart of the # neutron-bgp-dragent service logging.warning("Due to LP Bugs #1784083 and #1841459, we require a late "