Remove deprecated 'external_network_bridge' option

This option is deprecated and marked to be deleted in Ocata. So
as we are now in Stein development cycle I think that it's good time
to remove it.

Change-Id: I07474713206c218710544ad98c08caaa37dbf53a
This commit is contained in:
Sławek Kapłoński 2018-05-09 21:41:05 +02:00 committed by Slawek Kaplonski
parent fe73e8c9b3
commit b09b44608b
39 changed files with 115 additions and 304 deletions

View File

@ -94,7 +94,7 @@ To confirm the agent's availability zone:
| availability_zone | zone-1 |
| binary | neutron-l3-agent |
| configurations | agent_mode='legacy', ex_gw_ports='2', |
| | external_network_bridge='', floating_ips='0', |
| | floating_ips='0', |
| | gateway_external_network_id='', |
| | handle_internal_only_routers='True', |
| | interface_driver='openvswitch', interfaces='4', |

View File

@ -136,13 +136,8 @@ Network nodes
[DEFAULT]
ha_vrrp_auth_password = password
interface_driver = openvswitch
external_network_bridge =
agent_mode = dvr_snat
.. note::
The ``external_network_bridge`` option intentionally contains
no value.
Compute nodes
-------------
@ -170,7 +165,6 @@ Compute nodes
[DEFAULT]
interface_driver = openvswitch
external_network_bridge =
agent_mode = dvr
Replace ``TUNNEL_INTERFACE_IP_ADDRESS`` with the IP address of the interface

View File

@ -39,8 +39,7 @@ should be instructed to act upon these values through RPC.
Each individual agent may have its own configuration file. This file should be
loaded after the main ``neutron.conf`` file, so the agent configuration takes
precedence. The agent-specific configuration may contain configurations which
vary between hosts in a neutron deployment such as the
``external_network_bridge`` for an L3 agent. If any agent requires access to
additional external services beyond the neutron RPC, those endpoints should be
defined in the agent-specific configuration file (for example, nova metadata
for metadata agent).
vary between hosts in a neutron deployment such as the ``local_ip`` for an L2
agent. If any agent requires access to additional external services beyond the
neutron RPC, those endpoints should be defined in the agent-specific
configuration file (for example, nova metadata for metadata agent).

View File

@ -118,12 +118,6 @@ Network node 2
[DEFAULT]
interface_driver = linuxbridge
external_network_bridge =
.. note::
The ``external_network_bridge`` option intentionally contains
no value.
#. Start the following services:

View File

@ -146,12 +146,6 @@ Network node
[DEFAULT]
interface_driver = linuxbridge
external_network_bridge =
.. note::
The ``external_network_bridge`` option intentionally contains
no value.
#. Start the following services:

View File

@ -97,10 +97,6 @@ Network node
[DEFAULT]
agent_mode = dvr_snat
.. note::
The ``external_network_bridge`` option intentionally contains
no value.
#. Restart the following services:
@ -125,14 +121,8 @@ Compute nodes
[DEFAULT]
interface_driver = openvswitch
external_network_bridge =
agent_mode = dvr
.. note::
The ``external_network_bridge`` option intentionally contains
no value.
#. Restart the following services:
* Open vSwitch agent

View File

@ -119,12 +119,6 @@ Network node 2
[DEFAULT]
interface_driver = openvswitch
external_network_bridge =
.. note::
The ``external_network_bridge`` option intentionally contains
no value.
#. Start the following services:

View File

@ -150,12 +150,6 @@ Network node
[DEFAULT]
interface_driver = openvswitch
external_network_bridge =
.. note::
The ``external_network_bridge`` option intentionally contains
no value.
#. Start the following services:

View File

@ -103,7 +103,7 @@ should be instructed to act upon these values via RPC.
Each individual agent may have its own configuration file. This file should be
loaded after the main ```neutron.conf``` file, so the agent configuration takes
precedence. The agent specific configuration may contain configurations which
vary between hosts in a Neutron deployment such as the external_network_bridge
for a L3 agent. If any agent requires access to additional external services
beyond the Neutron RPC, those endpoints should be defined in the agent specific
vary between hosts in a Neutron deployment such as the ``local_ip`` for an L2
agent. If any agent requires access to additional external services beyond the
neutron RPC, those endpoints should be defined in the agent-specific
configuration file (e.g. nova metadata for metadata agent).

View File

@ -50,7 +50,6 @@ from neutron.agent.l3 import l3_agent_extensions_manager as l3_ext_manager
from neutron.agent.l3 import legacy_router
from neutron.agent.l3 import namespace_manager
from neutron.agent.linux import external_process
from neutron.agent.linux import ip_lib
from neutron.agent.linux import pd
from neutron.agent.linux import utils as linux_utils
from neutron.agent.metadata import driver as metadata_driver
@ -359,12 +358,6 @@ class L3NATAgent(ha.AgentMixin,
if self.conf.gateway_external_network_id:
return self.conf.gateway_external_network_id
# L3 agent doesn't use external_network_bridge to handle external
# networks, so bridge_mappings with provider networks will be used
# and the L3 agent is able to handle any external networks.
if not self.conf.external_network_bridge:
return
if not force and self.target_ex_net_id:
return self.target_ex_net_id
@ -542,12 +535,6 @@ class L3NATAgent(ha.AgentMixin,
self._resync_router(update)
def _process_router_if_compatible(self, router):
if (self.conf.external_network_bridge and
not ip_lib.device_exists(self.conf.external_network_bridge)):
LOG.error("The external network bridge '%s' does not exist",
self.conf.external_network_bridge)
return
# Either ex_net_id or handle_internal_only_routers must be set
ex_net_id = (router['external_gateway_info'] or {}).get('network_id')
if not ex_net_id and not self.conf.handle_internal_only_routers:
@ -844,7 +831,6 @@ class L3NATAgentWithStateReport(L3NATAgent):
'agent_mode': self.conf.agent_mode,
'handle_internal_only_routers':
self.conf.handle_internal_only_routers,
'external_network_bridge': self.conf.external_network_bridge,
'gateway_external_network_id':
self.conf.gateway_external_network_id,
'interface_driver': self.conf.interface_driver,

View File

@ -95,7 +95,6 @@ class DvrEdgeRouter(dvr_local_router.DvrLocalRouter):
return
self.driver.unplug(interface_name,
bridge=self.agent_conf.external_network_bridge,
namespace=self.snat_namespace.name,
prefix=router.EXTERNAL_DEV_PREFIX)
@ -270,7 +269,6 @@ class DvrEdgeRouter(dvr_local_router.DvrLocalRouter):
LOG.debug('Deleting stale external router device: %s', d.name)
self.driver.unplug(
d.name,
bridge=self.agent_conf.external_network_bridge,
namespace=self.snat_namespace.name,
prefix=router.EXTERNAL_DEV_PREFIX)

View File

@ -163,19 +163,9 @@ class FipNamespace(namespaces.Namespace):
ex_gw_port['id'],
interface_name,
ex_gw_port['mac_address'],
bridge=self.agent_conf.external_network_bridge,
namespace=ns_name,
prefix=FIP_EXT_DEV_PREFIX,
mtu=ex_gw_port.get('mtu'))
if self.agent_conf.external_network_bridge:
# NOTE(Swami): for OVS implementations remove the DEAD VLAN tag
# on ports. DEAD VLAN tag is added to each newly created port
# and should be removed by L2 agent but if
# external_network_bridge is set than external gateway port is
# created in this bridge and will not be touched by L2 agent.
# This is related to lp#1767422
self.driver.remove_vlan_tag(
self.agent_conf.external_network_bridge, interface_name)
# Remove stale fg devices
ip_wrapper = ip_lib.IPWrapper(namespace=ns_name)
devices = ip_wrapper.get_devices()
@ -183,9 +173,7 @@ class FipNamespace(namespaces.Namespace):
name = device.name
if name.startswith(FIP_EXT_DEV_PREFIX) and name != interface_name:
LOG.debug('DVR: unplug: %s', name)
ext_net_bridge = self.agent_conf.external_network_bridge
self.driver.unplug(name,
bridge=ext_net_bridge,
namespace=ns_name,
prefix=FIP_EXT_DEV_PREFIX)
@ -232,9 +220,7 @@ class FipNamespace(namespaces.Namespace):
# single port from FIP NS to br-ext
# TODO(carl) Where does the port get deleted?
LOG.debug('DVR: unplug: %s', d.name)
ext_net_bridge = self.agent_conf.external_network_bridge
self.driver.unplug(d.name,
bridge=ext_net_bridge,
namespace=self.name,
prefix=FIP_EXT_DEV_PREFIX)

View File

@ -53,7 +53,6 @@ class SnatNamespace(namespaces.Namespace):
elif d.name.startswith(namespaces.EXTERNAL_DEV_PREFIX):
self.driver.unplug(
d.name,
bridge=self.agent_conf.external_network_bridge,
namespace=self.name,
prefix=namespaces.EXTERNAL_DEV_PREFIX)

View File

@ -449,7 +449,6 @@ class HaRouter(router.RouterInfo):
else:
# We are not the master node, so no need to delete ip addresses.
self.driver.unplug(interface_name,
bridge=self.agent_conf.external_network_bridge,
namespace=self.ns_name,
prefix=router.EXTERNAL_DEV_PREFIX)

View File

@ -143,7 +143,6 @@ class RouterNamespace(Namespace):
elif d.name.startswith(EXTERNAL_DEV_PREFIX):
self.driver.unplug(
d.name,
bridge=self.agent_conf.external_network_bridge,
namespace=self.name,
prefix=EXTERNAL_DEV_PREFIX)

View File

@ -661,19 +661,9 @@ class RouterInfo(object):
ex_gw_port['id'],
interface_name,
ex_gw_port['mac_address'],
bridge=self.agent_conf.external_network_bridge,
namespace=ns_name,
prefix=EXTERNAL_DEV_PREFIX,
mtu=ex_gw_port.get('mtu'))
if self.agent_conf.external_network_bridge:
# NOTE(slaweq): for OVS implementations remove the DEAD VLAN tag
# on ports. DEAD VLAN tag is added to each newly created port
# and should be removed by L2 agent but if
# external_network_bridge is set than external gateway port is
# created in this bridge and will not be touched by L2 agent.
# This is related to lp#1767422
self.driver.remove_vlan_tag(
self.agent_conf.external_network_bridge, interface_name)
def _get_external_gw_ips(self, ex_gw_port):
gateway_ips = []
@ -802,7 +792,6 @@ class RouterInfo(object):
ip_addr['ip_address'],
prefixlen))
self.driver.unplug(interface_name,
bridge=self.agent_conf.external_network_bridge,
namespace=self.ns_name,
prefix=EXTERNAL_DEV_PREFIX)
@ -819,7 +808,6 @@ class RouterInfo(object):
LOG.debug('Deleting stale external router device: %s', stale_dev)
self.agent.pd.remove_gw_interface(self.router['id'])
self.driver.unplug(stale_dev,
bridge=self.agent_conf.external_network_bridge,
namespace=self.ns_name,
prefix=EXTERNAL_DEV_PREFIX)

View File

@ -238,17 +238,6 @@ class LinuxInterfaceDriver(object):
def get_device_name(self, port):
return (self.DEV_NAME_PREFIX + port.id)[:self.DEV_NAME_LEN]
def remove_vlan_tag(self, bridge, interface_name):
"""Remove vlan tag from given interface.
This method is necessary only for the case when deprecated
option 'external_network_bridge' is used in L3 agent as
external gateway port is then created in this external bridge
directly and it will have DEAD_VLAN_TAG added by default.
"""
# TODO(slaweq): remove it when external_network_bridge option will be
# removed
@staticmethod
def configure_ipv6_ra(namespace, dev_name, value):
"""Configure handling of IPv6 Router Advertisements on an
@ -348,10 +337,6 @@ class OVSInterfaceDriver(LinuxInterfaceDriver):
ovs = ovs_lib.OVSBridge(bridge)
ovs.replace_port(device_name, *attrs)
def remove_vlan_tag(self, bridge, interface):
ovs = ovs_lib.OVSBridge(bridge)
ovs.clear_db_attribute("Port", interface, "tag")
def plug_new(self, network_id, port_id, device_name, mac_address,
bridge=None, namespace=None, prefix=None, mtu=None):
"""Plug in the interface."""

View File

@ -60,8 +60,7 @@ def main():
def do_main(conf):
configuration_bridges = set([conf.ovs_integration_bridge,
conf.external_network_bridge])
configuration_bridges = set([conf.ovs_integration_bridge])
ovs = ovs_lib.BaseOVS()
ovs_bridges = set(ovs.get_bridges())
available_configuration_bridges = configuration_bridges & ovs_bridges

View File

@ -154,17 +154,6 @@ AVAILABILITY_ZONE_OPTS = [
help=_("Availability zone of this node")),
]
EXT_NET_BRIDGE_OPTS = [
cfg.StrOpt('external_network_bridge', default='',
deprecated_for_removal=True,
help=_("Name of bridge used for external network "
"traffic. When this parameter is set, the L3 agent will "
"plug an interface directly into an external bridge "
"which will not allow any wiring by the L2 agent. Using "
"this will result in incorrect port statuses. This "
"option is deprecated and will be removed in Ocata."))
]
def get_log_args(conf, log_file_name, **kwargs):
cmd_args = []

View File

@ -18,7 +18,6 @@ from neutron_lib import constants
from oslo_config import cfg
from neutron._i18n import _
from neutron.conf.agent import common as config
OPTS = [
@ -58,12 +57,10 @@ OPTS = [
"False for all agents if all routers must have an "
"external network gateway.")),
cfg.StrOpt('gateway_external_network_id', default='',
help=_("When external_network_bridge is set, each L3 agent can "
"be associated with no more than one external network. "
"This value should be set to the UUID of that external "
"network. To allow L3 agent support multiple external "
"networks, both the external_network_bridge and "
"gateway_external_network_id must be left empty."),
help=_("To allow the L3 agent to support multiple external "
"networks, gateway_external_network_id must be left "
"empty. Otherwise this value should be set to the UUID "
"of the single external network to be used."),
deprecated_for_removal=True),
cfg.StrOpt('ipv6_gateway', default='',
help=_("With IPv6, the network used for the external gateway "
@ -103,8 +100,6 @@ OPTS = [
'0xffff so that only the lower 16 bits will be used.')),
]
OPTS += config.EXT_NET_BRIDGE_OPTS
def register_l3_agent_config_opts(opts, cfg=cfg.CONF):
cfg.register_opts(opts)

View File

@ -303,13 +303,6 @@ class L3_NAT_dbonly_mixin(l3.RouterPluginBase,
def _check_router_needs_rescheduling(self, context, router_id, gw_info):
"""Checks whether router's l3 agent can handle the given network
When external_network_bridge is set, each L3 agent can be associated
with at most one external network. If router's new external gateway
is on other network then the router needs to be rescheduled to the
proper l3 agent.
If external_network_bridge is not set then the agent
can support multiple external networks and rescheduling is not needed
:return: list of candidate agents if rescheduling needed,
None otherwise; raises exception if there is no eligible l3 agent
associated with target external network
@ -344,10 +337,7 @@ class L3_NAT_dbonly_mixin(l3.RouterPluginBase,
for agent in cur_agents:
ext_net_id = agent['configurations'].get(
'gateway_external_network_id')
ext_bridge = agent['configurations'].get(
'external_network_bridge', '')
if (ext_net_id == network_id or
(not ext_net_id and not ext_bridge)):
if ext_net_id == network_id or not ext_net_id:
return
# otherwise find l3 agent with matching gateway_external_network_id

View File

@ -43,9 +43,6 @@ class NeutronDebugAgent(object):
def create_probe(self, network_id, device_owner='network'):
network = self._get_network(network_id)
bridge = None
if network.external:
bridge = self.conf.external_network_bridge
port = self._create_port(network, device_owner)
interface_name = self.driver.get_device_name(port)
@ -58,7 +55,6 @@ class NeutronDebugAgent(object):
port.id,
interface_name,
port.mac_address,
bridge=bridge,
namespace=namespace)
ip_cidrs = []
for fixed_ip in port.fixed_ips:
@ -94,22 +90,16 @@ class NeutronDebugAgent(object):
def delete_probe(self, port_id):
port = dhcp.DictModel(self.client.show_port(port_id)['port'])
network = self._get_network(port.network_id)
bridge = None
if network.external:
bridge = self.conf.external_network_bridge
namespace = self._get_namespace(port)
if ip_lib.network_namespace_exists(namespace):
self.driver.unplug(self.driver.get_device_name(port),
bridge=bridge,
namespace=namespace)
try:
ip_lib.delete_network_namespace(namespace)
except Exception:
LOG.warning('Failed to delete namespace %s', namespace)
else:
self.driver.unplug(self.driver.get_device_name(port),
bridge=bridge)
self.driver.unplug(self.driver.get_device_name(port))
self.client.delete_port(port.id)
def list_probes(self):

View File

@ -71,7 +71,6 @@ class NeutronDebugShell(shell.NeutronShell):
" either --config-file or env[NEUTRON_TEST_CONFIG_FILE]"))
client = self.client_manager.neutron
config.register_interface_opts()
cfg.CONF.register_opts(config.EXT_NET_BRIDGE_OPTS)
config.register_interface_driver_opts_helper(cfg.CONF)
cfg.CONF(['--config-file', self.options.config_file])
config.setup_logging()

View File

@ -58,8 +58,7 @@ class FakePlugin(common_db_mixin.CommonDbMixin,
def _get_l3_agent_dict(host, agent_mode, internal_only=True,
ext_net_id='', ext_bridge='',
az=DEFAULT_AZ):
ext_net_id='', az=DEFAULT_AZ):
return {
'agent_type': constants.AGENT_TYPE_L3,
'binary': 'neutron-l3-agent',
@ -68,7 +67,6 @@ def _get_l3_agent_dict(host, agent_mode, internal_only=True,
'availability_zone': az,
'configurations': {'agent_mode': agent_mode,
'handle_internal_only_routers': internal_only,
'external_network_bridge': ext_bridge,
'gateway_external_network_id': ext_net_id}}
@ -82,10 +80,8 @@ def _register_agent(agent, plugin=None):
def register_l3_agent(host=HOST, agent_mode=constants.L3_AGENT_MODE_LEGACY,
internal_only=True, ext_net_id='', ext_bridge='',
az=DEFAULT_AZ):
agent = _get_l3_agent_dict(host, agent_mode, internal_only, ext_net_id,
ext_bridge, az)
internal_only=True, ext_net_id='', az=DEFAULT_AZ):
agent = _get_l3_agent_dict(host, agent_mode, internal_only, ext_net_id, az)
return _register_agent(agent)

View File

@ -23,6 +23,7 @@ from neutron.common import utils as common_utils
from neutron.conf.agent import common as config
from neutron.tests import base as tests_base
from neutron.tests.common import helpers
from neutron.tests.common import machine_fixtures
from neutron.tests.common import net_helpers
from neutron.tests.fullstack.resources import client as client_resource
from neutron.tests import tools
@ -137,3 +138,15 @@ class BaseFullStackTestCase(testlib_api.MySQLTestCaseMixin,
return available_ips
self.fail("Cannot find enough free IP addresses.")
def _create_external_vm(self, network, subnet):
vm = self.useFixture(
machine_fixtures.FakeMachine(
self.environment.central_bridge,
common_utils.ip_to_cidr(subnet['gateway_ip'], 24)))
# NOTE(slaweq): as ext_net is 'vlan' network type external_vm needs to
# send packets with proper vlan also
vm.bridge.set_db_attribute(
"Port", vm.port.name,
"tag", network.get("provider:segmentation_id"))
return vm

View File

@ -166,11 +166,13 @@ class OVSConfigFixture(ConfigFixture):
base_filename='openvswitch_agent.ini')
self.tunneling_enabled = self.env_desc.tunneling_enabled
ext_dev = utils.get_rand_device_name(prefix='br-eth')
self.config.update({
'ovs': {
'local_ip': local_ip,
'integration_bridge': self._generate_integration_bridge(),
'of_interface': host_desc.of_interface,
'bridge_mappings': '%s:%s' % (PHYSICAL_NETWORK_NAME, ext_dev)
},
'securitygroup': {
'firewall_driver': host_desc.firewall_driver,
@ -190,12 +192,9 @@ class OVSConfigFixture(ConfigFixture):
'int_peer_patch_port': self._generate_int_peer(),
'tun_peer_patch_port': self._generate_tun_peer()})
else:
device = utils.get_rand_device_name(prefix='br-eth')
self.config['ovs']['bridge_mappings'] = '%s:%s' % (
PHYSICAL_NETWORK_NAME, device)
if env_desc.report_bandwidths:
self.config['ovs'][c_const.RP_BANDWIDTHS] = \
'%s:%s:%s' % (device, MINIMUM_BANDWIDTH_EGRESS_KBPS,
'%s:%s:%s' % (ext_dev, MINIMUM_BANDWIDTH_EGRESS_KBPS,
MINIMUM_BANDWIDTH_INGRESS_KBPS)
if env_desc.qos:
@ -350,7 +349,6 @@ class L3ConfigFixture(ConfigFixture):
'interface_driver': ('neutron.agent.linux.interface.'
'OVSInterfaceDriver'),
'ovs_integration_bridge': integration_bridge,
'external_network_bridge': self._generate_external_bridge(),
}
})
@ -362,12 +360,6 @@ class L3ConfigFixture(ConfigFixture):
}
})
def _generate_external_bridge(self):
return utils.get_rand_device_name(prefix='br-ex')
def get_external_bridge(self):
return self.config.DEFAULT.external_network_bridge
class DhcpConfigFixture(ConfigFixture):

View File

@ -143,15 +143,15 @@ class Host(fixtures.Fixture):
self.local_ip, test_name=self.test_name)
self.useFixture(agent_cfg_fixture)
self.br_phys = self.useFixture(
net_helpers.OVSBridgeFixture(
agent_cfg_fixture.get_br_phys_name())).bridge
if self.env_desc.tunneling_enabled:
self.useFixture(
net_helpers.OVSBridgeFixture(
agent_cfg_fixture.get_br_tun_name())).bridge
self.connect_to_central_network_via_tunneling()
else:
self.br_phys = self.useFixture(
net_helpers.OVSBridgeFixture(
agent_cfg_fixture.get_br_phys_name())).bridge
self.connect_to_central_network_via_vlans(self.br_phys)
self.ovs_agent = self.useFixture(
@ -165,10 +165,6 @@ class Host(fixtures.Fixture):
self.env_desc, self.host_desc,
self.neutron_config.temp_dir,
self.ovs_agent.agent_cfg_fixture.get_br_int_name()))
br_ex = self.useFixture(
net_helpers.OVSBridgeFixture(
self.l3_agent_cfg_fixture.get_external_bridge())).bridge
self.connect_to_central_network_via_vlans(br_ex)
if self.host_desc.dhcp_agent:
self.dhcp_agent_cfg_fixture = self.useFixture(

View File

@ -25,7 +25,6 @@ from neutron.agent.l3 import namespaces
from neutron.agent.linux import ip_lib
from neutron.common import utils as common_utils
from neutron.tests.common.exclusive_resources import ip_network
from neutron.tests.common import machine_fixtures
from neutron.tests.fullstack import base
from neutron.tests.fullstack.resources import environment
from neutron.tests.fullstack.resources import machine
@ -80,10 +79,7 @@ class TestL3Agent(base.BaseFullStackTestCase):
def _test_gateway_ip_changed(self):
tenant_id = uuidutils.generate_uuid()
ext_net, ext_sub = self._create_external_network_and_subnet(tenant_id)
external_vm = self.useFixture(
machine_fixtures.FakeMachine(
self.environment.central_bridge,
common_utils.ip_to_cidr(ext_sub['gateway_ip'], 24)))
external_vm = self._create_external_vm(ext_net, ext_sub)
router = self.safe_client.create_router(tenant_id,
external_network=ext_net['id'])
@ -209,10 +205,7 @@ class TestLegacyL3Agent(TestL3Agent):
# 3. IPv6 ext connectivity: using ping6 from tenant vm to external_vm.
tenant_id = uuidutils.generate_uuid()
ext_net, ext_sub = self._create_external_network_and_subnet(tenant_id)
external_vm = self.useFixture(
machine_fixtures.FakeMachine(
self.environment.central_bridge,
common_utils.ip_to_cidr(ext_sub['gateway_ip'], 24)))
external_vm = self._create_external_vm(ext_net, ext_sub)
# Create an IPv6 subnet in the external network
v6network = self.useFixture(
ip_network.ExclusiveIPNetwork(
@ -278,7 +271,7 @@ class TestHAL3Agent(TestL3Agent):
for _ in range(2)]
env = environment.Environment(
environment.EnvironmentDescription(
network_type='vxlan', l2_pop=True),
network_type='vlan', l2_pop=True),
host_descriptions)
super(TestHAL3Agent, self).setUp(env)
@ -386,10 +379,7 @@ class TestHAL3Agent(TestL3Agent):
router = self.safe_client.create_router(tenant_id, ha=True,
external_network=ext_net['id'])
external_vm = self.useFixture(
machine_fixtures.FakeMachine(
self.environment.central_bridge,
common_utils.ip_to_cidr(ext_sub['gateway_ip'], 24)))
external_vm = self._create_external_vm(ext_net, ext_sub)
common_utils.wait_until_true(
lambda:

View File

@ -79,9 +79,7 @@ class L3AgentTestFramework(base.BaseSudoTestCase):
conf.set_override('interface_driver', self.INTERFACE_DRIVER)
br_int = self.useFixture(net_helpers.OVSBridgeFixture()).bridge
br_ex = self.useFixture(net_helpers.OVSBridgeFixture()).bridge
conf.set_override('ovs_integration_bridge', br_int.br_name)
conf.set_override('external_network_bridge', br_ex.br_name)
temp_dir = self.get_new_temp_dir()
get_temp_file_path = functools.partial(self.get_temp_file_path,
@ -542,13 +540,8 @@ class L3AgentTestFramework(base.BaseSudoTestCase):
self.assertIn(extra_subnet, routes)
def _assert_interfaces_deleted_from_ovs(self):
def assert_ovs_bridge_empty(bridge_name):
bridge = ovs_lib.OVSBridge(bridge_name)
self.assertFalse(bridge.get_port_name_list())
assert_ovs_bridge_empty(self.agent.conf.ovs_integration_bridge)
assert_ovs_bridge_empty(self.agent.conf.external_network_bridge)
bridge = ovs_lib.OVSBridge(self.agent.conf.ovs_integration_bridge)
self.assertFalse(bridge.get_port_name_list())
def floating_ips_configured(self, router):
floating_ips = router.router[constants.FLOATINGIP_KEY]
@ -594,7 +587,7 @@ class L3AgentTestFramework(base.BaseSudoTestCase):
router1 = self._create_router(router_info, self.agent)
self._add_fip(router1, '192.168.111.12')
r1_br = ip_lib.IPDevice(router1.driver.conf.external_network_bridge)
r1_br = ip_lib.IPDevice(router1.driver.conf.ovs_integration_bridge)
r1_br.addr.add('19.4.4.1/24')
r1_br.link.set_up()
@ -604,7 +597,7 @@ class L3AgentTestFramework(base.BaseSudoTestCase):
mac='22:22:22:22:22:22'))
router2 = self._create_router(router_info_2, self.failover_agent)
r2_br = ip_lib.IPDevice(router2.driver.conf.external_network_bridge)
r2_br = ip_lib.IPDevice(router2.driver.conf.ovs_integration_bridge)
r2_br.addr.add('19.4.4.1/24')
r2_br.link.set_up()
@ -642,12 +635,12 @@ class L3AgentTestFramework(base.BaseSudoTestCase):
@staticmethod
def fail_gw_router_port(router):
r_br = ip_lib.IPDevice(router.driver.conf.external_network_bridge)
r_br = ip_lib.IPDevice(router.driver.conf.ovs_integration_bridge)
r_br.link.set_down()
@staticmethod
def restore_gw_router_port(router):
r_br = ip_lib.IPDevice(router.driver.conf.external_network_bridge)
r_br = ip_lib.IPDevice(router.driver.conf.ovs_integration_bridge)
r_br.link.set_up()
@classmethod

View File

@ -148,9 +148,7 @@ class TestDvrRouter(framework.L3AgentTestFramework):
self._validate_fips_for_external_network(
router, router.fip_ns.get_name())
# Now delete the fg- port that was created
ext_net_bridge = self.agent.conf.external_network_bridge
router.fip_ns.driver.unplug(fg_port_name,
bridge=ext_net_bridge,
namespace=router.fip_ns.name,
prefix=dvr_fip_ns.FIP_EXT_DEV_PREFIX)
# Now check if the fg- port is missing.
@ -203,9 +201,7 @@ class TestDvrRouter(framework.L3AgentTestFramework):
self._validate_fips_for_external_network(
router, router.fip_ns.get_name())
# Now delete the fg- port that was created
ext_net_bridge = self.agent.conf.external_network_bridge
router.fip_ns.driver.unplug(fg_port_name,
bridge=ext_net_bridge,
namespace=router.fip_ns.name,
prefix=dvr_fip_ns.FIP_EXT_DEV_PREFIX)
# Now check if the fg- port is missing.
@ -1995,10 +1991,10 @@ class TestDvrRouter(framework.L3AgentTestFramework):
fixed_ip_address_scope='scope2')
router.process()
br_ex = framework.get_ovs_bridge(
self.agent.conf.external_network_bridge)
br_int = framework.get_ovs_bridge(
self.agent.conf.ovs_integration_bridge)
src_machine = self.useFixture(
machine_fixtures.FakeMachine(br_ex, '19.4.4.12/24'))
machine_fixtures.FakeMachine(br_int, '19.4.4.12/24'))
# Floating ip should work no matter of address scope
net_helpers.assert_ping(src_machine.namespace, fip_same_scope)
net_helpers.assert_ping(src_machine.namespace, fip_diff_scope)
@ -2010,11 +2006,11 @@ class TestDvrRouter(framework.L3AgentTestFramework):
gw_port = router.get_ex_gw_port()
gw_ip = self._port_first_ip_cidr(gw_port).partition('/')[0]
br_ex = framework.get_ovs_bridge(
self.agent.conf.external_network_bridge)
br_int = framework.get_ovs_bridge(
self.agent.conf.ovs_integration_bridge)
src_machine = self.useFixture(
machine_fixtures.FakeMachine(br_ex, '19.4.4.12/24', gw_ip))
machine_fixtures.FakeMachine(br_int, '19.4.4.12/24', gw_ip))
# For the internal networks that are in the same address scope as
# external network, they can directly route to external network
net_helpers.assert_ping(src_machine.namespace, machine_same_scope.ip)

View File

@ -19,6 +19,7 @@ import mock
from neutron_lib import constants
import testtools
from neutron.agent.common import ovs_lib
from neutron.agent.l3 import agent as neutron_l3_agent
from neutron.agent.linux import ip_lib
from neutron.common import ipv6_utils
@ -381,6 +382,28 @@ class L3HATestFailover(framework.L3AgentTestFramework):
br_int_1.add_port(veth1.name)
br_int_2.add_port(veth2.name)
@staticmethod
def fail_gw_router_port(router):
# NOTE(slaweq): in HA failover tests there are two integration bridges
# connected with veth pair to each other. To stop traffic from router's
# namespace to gw ip (19.4.4.1) it needs to be blocked by openflow rule
# as simple setting ovs_integration_bridge device DOWN will not be
# enough because same IP address is also configured on
# ovs_integration_bridge device from second router and it will still
# respond to ping
r_br = ovs_lib.OVSBridge(router.driver.conf.ovs_integration_bridge)
external_port = router.get_ex_gw_port()
for subnet in external_port['subnets']:
r_br.add_flow(
proto='ip', nw_dst=subnet['gateway_ip'], actions='drop')
@staticmethod
def restore_gw_router_port(router):
r_br = ovs_lib.OVSBridge(router.driver.conf.ovs_integration_bridge)
external_port = router.get_ex_gw_port()
for subnet in external_port['subnets']:
r_br.delete_flows(proto='ip', nw_dst=subnet['gateway_ip'])
def test_ha_router_failover(self):
router1, router2 = self.create_ha_routers()

View File

@ -156,33 +156,6 @@ class L3AgentTestCase(framework.L3AgentTestFramework):
self.addCleanup(bridge.destroy)
return bridge
def test_external_network_bridge_change(self):
bridge1, bridge2 = self._make_bridge(), self._make_bridge()
self.agent.conf.set_override('external_network_bridge',
bridge1.br_name)
router_info = self.generate_router_info(False)
router = self.manage_router(self.agent, router_info)
gw_port = router.router['gw_port']
gw_inf_name = router.get_external_device_name(gw_port['id'])
self.assertIn(gw_inf_name,
[v.port_name for v in bridge1.get_vif_ports()])
# changeing the external_network_bridge should have no impact since
# the interface exists.
self.agent.conf.set_override('external_network_bridge',
bridge2.br_name)
self.manage_router(self.agent, router_info)
self.assertIn(gw_inf_name,
[v.port_name for v in bridge1.get_vif_ports()])
self.assertNotIn(gw_inf_name,
[v.port_name for v in bridge2.get_vif_ports()])
namespaces.Namespace.delete(router.router_namespace)
self.manage_router(self.agent, router_info)
self.assertIn(gw_inf_name,
[v.port_name for v in bridge2.get_vif_ports()])
self.assertNotIn(gw_inf_name,
[v.port_name for v in bridge1.get_vif_ports()])
def test_legacy_router_ns_rebuild(self):
router_info = self.generate_router_info(False)
router = self.manage_router(self.agent, router_info)
@ -420,10 +393,10 @@ class L3AgentTestCase(framework.L3AgentTestFramework):
fixed_ip_address_scope='scope2')
router.process()
br_ex = framework.get_ovs_bridge(
self.agent.conf.external_network_bridge)
br_int = framework.get_ovs_bridge(
self.agent.conf.ovs_integration_bridge)
src_machine = self.useFixture(
machine_fixtures.FakeMachine(br_ex, '19.4.4.12/24'))
machine_fixtures.FakeMachine(br_int, '19.4.4.12/24'))
# Floating ip should work no matter of address scope
net_helpers.assert_ping(src_machine.namespace, fip_same_scope)
net_helpers.assert_ping(src_machine.namespace, fip_diff_scope)
@ -434,11 +407,11 @@ class L3AgentTestCase(framework.L3AgentTestFramework):
gw_port = router.get_ex_gw_port()
gw_ip = self._port_first_ip_cidr(gw_port).partition('/')[0]
br_ex = framework.get_ovs_bridge(
self.agent.conf.external_network_bridge)
br_int = framework.get_ovs_bridge(
self.agent.conf.ovs_integration_bridge)
src_machine = self.useFixture(
machine_fixtures.FakeMachine(br_ex, '19.4.4.12/24', gw_ip))
machine_fixtures.FakeMachine(br_int, '19.4.4.12/24', gw_ip))
# For the internal networks that are in the same address scope as
# external network, they can directly route to external network
net_helpers.assert_ping(src_machine.namespace, machine_same_scope.ip)

View File

@ -34,26 +34,23 @@ class TestOVSCLIConfig(base.BaseOVSLinuxTestCase):
def test_do_main_default_options(self):
int_br = self.useFixture(net_helpers.OVSBridgeFixture()).bridge
ext_br = self.useFixture(net_helpers.OVSBridgeFixture()).bridge
self.conf.set_override("ovs_integration_bridge", int_br.br_name)
self.conf.set_override("external_network_bridge", ext_br.br_name)
self.conf.set_override("ovs_all_ports", False)
noskip = collections.defaultdict(list)
skip = collections.defaultdict(list)
# add two vifs, one skipped, and a non-vif port to int_br and ext_br
for br in (int_br, ext_br):
for collection in (noskip, skip):
collection[br].append(
self.useFixture(net_helpers.OVSPortFixture(br)).port.name)
# set skippable vif to be skipped
br.ovsdb.db_set(
'Interface', skip[br][0],
('external_ids', {constants.SKIP_CLEANUP: "True"})
).execute(check_error=True)
device_name = utils.get_rand_name()
skip[br].append(device_name)
br.add_port(device_name, ('type', 'internal'))
# add two vifs, one skipped, and a non-vif port to int_br
for collection in (noskip, skip):
collection[int_br].append(
self.useFixture(net_helpers.OVSPortFixture(int_br)).port.name)
# set skippable vif to be skipped
int_br.ovsdb.db_set(
'Interface', skip[int_br][0],
('external_ids', {constants.SKIP_CLEANUP: "True"})
).execute(check_error=True)
device_name = utils.get_rand_name()
skip[int_br].append(device_name)
int_br.add_port(device_name, ('type', 'internal'))
# sanity check
for collection in (noskip, skip):
for bridge, ports in collection.items():
@ -61,9 +58,8 @@ class TestOVSCLIConfig(base.BaseOVSLinuxTestCase):
for port in ports:
self.assertIn(port, port_list)
ovs_cleanup.do_main(self.conf)
for br in (int_br, ext_br):
ports = br.get_port_name_list()
for vif in noskip[br]:
self.assertNotIn(vif, ports)
for port in skip[br]:
self.assertIn(port, ports)
ports = int_br.get_port_name_list()
for vif in noskip[int_br]:
self.assertNotIn(vif, ports)
for port in skip[int_br]:
self.assertIn(port, ports)

View File

@ -750,7 +750,6 @@ class TestBasicRouterOperations(BasicRouterOperationsFramework):
if not router.get('distributed'):
self.mock_driver.unplug.assert_called_once_with(
interface_name,
bridge=agent.conf.external_network_bridge,
namespace=mock.ANY,
prefix=mock.ANY)
else:
@ -934,7 +933,6 @@ class TestBasicRouterOperations(BasicRouterOperationsFramework):
# snat namespace was deleted
self.mock_driver.unplug.assert_called_with(
interface_name,
bridge=self.conf.external_network_bridge,
namespace=snat_ns_name,
prefix=namespaces.EXTERNAL_DEV_PREFIX)
else:
@ -2107,6 +2105,8 @@ class TestBasicRouterOperations(BasicRouterOperationsFramework):
ri.process = mock.Mock()
ri.initialize = mock.Mock(side_effect=RuntimeError())
agent._create_router = mock.Mock(return_value=ri)
agent._fetch_external_net_id = mock.Mock(
return_value=router['external_gateway_info']['network_id'])
agent._process_router_update()
log_exception.assert_has_calls(calls)
@ -2355,7 +2355,6 @@ class TestBasicRouterOperations(BasicRouterOperationsFramework):
self.mock_driver.unplug.assert_called_with(
stale_devnames[0],
bridge="",
namespace=ri.ns_name,
prefix=namespaces.EXTERNAL_DEV_PREFIX)
@ -2376,7 +2375,6 @@ class TestBasicRouterOperations(BasicRouterOperationsFramework):
self.mock_driver.unplug.assert_called_with(
stale_devnames[0],
bridge=agent.conf.external_network_bridge,
namespace=ri.snat_namespace.name,
prefix=namespaces.EXTERNAL_DEV_PREFIX)
@ -2496,7 +2494,6 @@ class TestBasicRouterOperations(BasicRouterOperationsFramework):
ns.delete()
calls = [mock.call('qg-aaaa',
bridge=agent.conf.external_network_bridge,
namespace=namespace,
prefix=namespaces.EXTERNAL_DEV_PREFIX),
mock.call('sg-aaaa',
@ -2725,7 +2722,6 @@ class TestBasicRouterOperations(BasicRouterOperationsFramework):
self.assertFalse(chsfr.called)
def test_process_router_if_compatible_with_no_ext_net_in_conf(self):
self.conf.set_override('external_network_bridge', 'br-ex')
agent = l3_agent.L3NATAgent(HOSTNAME, self.conf)
self.plugin_api.get_external_network_id.return_value = 'aaa'
@ -2754,7 +2750,6 @@ class TestBasicRouterOperations(BasicRouterOperationsFramework):
self.assertFalse(self.plugin_api.get_external_network_id.called)
def test_process_router_if_compatible_with_stale_cached_ext_net(self):
self.conf.set_override('external_network_bridge', 'br-ex')
agent = l3_agent.L3NATAgent(HOSTNAME, self.conf)
self.plugin_api.get_external_network_id.return_value = 'aaa'
agent.target_ex_net_id = 'bbb'
@ -2770,7 +2765,6 @@ class TestBasicRouterOperations(BasicRouterOperationsFramework):
agent.context)
def test_process_router_if_compatible_w_no_ext_net_and_2_net_plugin(self):
self.conf.set_override('external_network_bridge', 'br-ex')
agent = l3_agent.L3NATAgent(HOSTNAME, self.conf)
router = {'id': _uuid(),

View File

@ -107,9 +107,6 @@ class TestDvrFipNs(base.BaseTestCase):
self.fip_ns.create_or_update_gateway_port(agent_gw_port)
self.assertTrue(fip_create.called)
self.assertEqual(1, self.driver.plug.call_count)
ext_net_bridge = self.conf.external_network_bridge
if ext_net_bridge:
self.assertEqual(1, self.driver.remove_vlan_tag.call_count)
self.assertEqual(1, self.driver.init_l3.call_count)
interface_name = self.fip_ns.get_ext_device_name(agent_gw_port['id'])
gw_cidrs = [sn['cidr'] for sn in agent_gw_port['subnets']
@ -253,10 +250,8 @@ class TestDvrFipNs(base.BaseTestCase):
exists.assert_called_once_with(self.fip_ns.name)
delete.assert_called_once_with(self.fip_ns.name)
ext_net_bridge = self.conf.external_network_bridge
ns_name = self.fip_ns.get_name()
self.driver.unplug.assert_called_once_with('fg-aaaa',
bridge=ext_net_bridge,
prefix='fg-',
namespace=ns_name)
ip_wrapper.del_veth.assert_called_once_with('fpr-aaaa')

View File

@ -564,9 +564,9 @@ class TestDvrRouterOperations(base.BaseTestCase):
'foo_router_id',
{'distributed': True, 'gw_port_host': HOSTNAME})
ri = dvr_router.DvrLocalRouter(HOSTNAME, **self.ri_kwargs)
with mock.patch.object(l3_agent.ip_lib, 'IPDevice') as f:
ri._update_arp_entry(mock.ANY, mock.ANY, 'foo_subnet_id', 'add')
self.assertFalse(f.call_count)
ri.get_internal_device_name = mock.Mock()
ri._update_arp_entry(mock.ANY, mock.ANY, 'foo_subnet_id', 'add')
self.assertFalse(ri.get_internal_device_name.call_count)
def _setup_test_for_arp_entry_cache(self):
agent = l3_agent.L3NATAgent(HOSTNAME, self.conf)
@ -581,7 +581,7 @@ class TestDvrRouterOperations(base.BaseTestCase):
def test__update_arp_entry_calls_arp_cache_with_no_device(self):
ri, subnet_id = self._setup_test_for_arp_entry_cache()
state = True
with mock.patch.object(l3_agent.ip_lib, 'IPDevice') as rtrdev,\
with mock.patch('neutron.agent.linux.ip_lib.IPDevice') as rtrdev,\
mock.patch.object(ri, '_cache_arp_entry') as arp_cache:
rtrdev.return_value.exists.return_value = False
state = ri._update_arp_entry(

View File

@ -37,7 +37,6 @@ class TestDebugCommands(base.BaseTestCase):
def setUp(self):
super(TestDebugCommands, self).setUp()
config.register_interface_opts()
cfg.CONF.register_opts(config.EXT_NET_BRIDGE_OPTS)
common_config.init([])
config.register_interface_driver_opts_helper(cfg.CONF)
@ -132,7 +131,6 @@ class TestDebugCommands(base.BaseTestCase):
'fake_port',
'tap12345678-12',
'aa:bb:cc:dd:ee:ffa',
bridge=None,
namespace=namespace),
mock.call.init_l3('tap12345678-12',
['10.0.0.3/24'],
@ -177,7 +175,6 @@ class TestDebugCommands(base.BaseTestCase):
'fake_port',
'tap12345678-12',
'aa:bb:cc:dd:ee:ffa',
bridge='',
namespace=namespace),
mock.call.init_l3('tap12345678-12',
['10.0.0.3/24'],
@ -200,13 +197,10 @@ class TestDebugCommands(base.BaseTestCase):
cmd.run(parsed_args)
namespace = 'qprobe-fake_port'
self.client.assert_has_calls([mock.call.show_port('fake_port'),
mock.call.show_network('fake_net'),
mock.call.show_subnet('fake_subnet'),
mock.call.delete_port('fake_port')])
self.driver.assert_has_calls([mock.call.get_device_name(mock.ANY),
mock.call.unplug('tap12345678-12',
namespace=namespace,
bridge=None)])
namespace=namespace)])
def test_delete_probe_external(self):
fake_network = {'network': {'id': 'fake_net',
@ -221,13 +215,10 @@ class TestDebugCommands(base.BaseTestCase):
cmd.run(parsed_args)
namespace = 'qprobe-fake_port'
self.client.assert_has_calls([mock.call.show_port('fake_port'),
mock.call.show_network('fake_net'),
mock.call.show_subnet('fake_subnet'),
mock.call.delete_port('fake_port')])
self.driver.assert_has_calls([mock.call.get_device_name(mock.ANY),
mock.call.unplug('tap12345678-12',
namespace=namespace,
bridge='')])
namespace=namespace)])
def test_list_probe(self):
cmd = commands.ListProbe(self.app, None)
@ -263,13 +254,10 @@ class TestDebugCommands(base.BaseTestCase):
device_owner=[debug_agent.DEVICE_OWNER_NETWORK_PROBE,
debug_agent.DEVICE_OWNER_COMPUTE_PROBE]),
mock.call.show_port('fake_port'),
mock.call.show_network('fake_net'),
mock.call.show_subnet('fake_subnet'),
mock.call.delete_port('fake_port')])
self.driver.assert_has_calls([mock.call.get_device_name(mock.ANY),
mock.call.unplug('tap12345678-12',
namespace=namespace,
bridge=None)])
namespace=namespace)])
def test_ping_all_with_ensure_port(self):
fake_ports = self.fake_ports

View File

@ -4111,8 +4111,7 @@ class L3NatDBIntAgentSchedulingTestCase(L3BaseForIntTests,
host='host1',
ext_net_id=s1['subnet']['network_id'])
helpers.register_l3_agent(
host='host2', internal_only=False,
ext_net_id='', ext_bridge='')
host='host2', internal_only=False, ext_net_id='')
l3_rpc_cb.get_router_ids(self.adminContext,
host='host1')
self._assert_router_on_agent(r['router']['id'], 'host1')

View File

@ -0,0 +1,6 @@
---
upgrade:
- The ``external_network_bridge`` config option has been removed.
Existing users of this option will now have their router's gateway
interface created in the integration bridge and it will be wired by
the L2 agent.