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:
parent
fe73e8c9b3
commit
b09b44608b
@ -94,7 +94,7 @@ To confirm the agent's availability zone:
|
|||||||
| availability_zone | zone-1 |
|
| availability_zone | zone-1 |
|
||||||
| binary | neutron-l3-agent |
|
| binary | neutron-l3-agent |
|
||||||
| configurations | agent_mode='legacy', ex_gw_ports='2', |
|
| configurations | agent_mode='legacy', ex_gw_ports='2', |
|
||||||
| | external_network_bridge='', floating_ips='0', |
|
| | floating_ips='0', |
|
||||||
| | gateway_external_network_id='', |
|
| | gateway_external_network_id='', |
|
||||||
| | handle_internal_only_routers='True', |
|
| | handle_internal_only_routers='True', |
|
||||||
| | interface_driver='openvswitch', interfaces='4', |
|
| | interface_driver='openvswitch', interfaces='4', |
|
||||||
|
@ -136,13 +136,8 @@ Network nodes
|
|||||||
[DEFAULT]
|
[DEFAULT]
|
||||||
ha_vrrp_auth_password = password
|
ha_vrrp_auth_password = password
|
||||||
interface_driver = openvswitch
|
interface_driver = openvswitch
|
||||||
external_network_bridge =
|
|
||||||
agent_mode = dvr_snat
|
agent_mode = dvr_snat
|
||||||
|
|
||||||
.. note::
|
|
||||||
|
|
||||||
The ``external_network_bridge`` option intentionally contains
|
|
||||||
no value.
|
|
||||||
|
|
||||||
Compute nodes
|
Compute nodes
|
||||||
-------------
|
-------------
|
||||||
@ -170,7 +165,6 @@ Compute nodes
|
|||||||
|
|
||||||
[DEFAULT]
|
[DEFAULT]
|
||||||
interface_driver = openvswitch
|
interface_driver = openvswitch
|
||||||
external_network_bridge =
|
|
||||||
agent_mode = dvr
|
agent_mode = dvr
|
||||||
|
|
||||||
Replace ``TUNNEL_INTERFACE_IP_ADDRESS`` with the IP address of the interface
|
Replace ``TUNNEL_INTERFACE_IP_ADDRESS`` with the IP address of the interface
|
||||||
|
@ -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
|
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
|
loaded after the main ``neutron.conf`` file, so the agent configuration takes
|
||||||
precedence. The agent-specific configuration may contain configurations which
|
precedence. The agent-specific configuration may contain configurations which
|
||||||
vary between hosts in a neutron deployment such as the
|
vary between hosts in a neutron deployment such as the ``local_ip`` for an L2
|
||||||
``external_network_bridge`` for an L3 agent. If any agent requires access to
|
agent. If any agent requires access to additional external services beyond the
|
||||||
additional external services beyond the neutron RPC, those endpoints should be
|
neutron RPC, those endpoints should be defined in the agent-specific
|
||||||
defined in the agent-specific configuration file (for example, nova metadata
|
configuration file (for example, nova metadata for metadata agent).
|
||||||
for metadata agent).
|
|
||||||
|
@ -118,12 +118,6 @@ Network node 2
|
|||||||
|
|
||||||
[DEFAULT]
|
[DEFAULT]
|
||||||
interface_driver = linuxbridge
|
interface_driver = linuxbridge
|
||||||
external_network_bridge =
|
|
||||||
|
|
||||||
.. note::
|
|
||||||
|
|
||||||
The ``external_network_bridge`` option intentionally contains
|
|
||||||
no value.
|
|
||||||
|
|
||||||
#. Start the following services:
|
#. Start the following services:
|
||||||
|
|
||||||
|
@ -146,12 +146,6 @@ Network node
|
|||||||
|
|
||||||
[DEFAULT]
|
[DEFAULT]
|
||||||
interface_driver = linuxbridge
|
interface_driver = linuxbridge
|
||||||
external_network_bridge =
|
|
||||||
|
|
||||||
.. note::
|
|
||||||
|
|
||||||
The ``external_network_bridge`` option intentionally contains
|
|
||||||
no value.
|
|
||||||
|
|
||||||
#. Start the following services:
|
#. Start the following services:
|
||||||
|
|
||||||
|
@ -97,10 +97,6 @@ Network node
|
|||||||
[DEFAULT]
|
[DEFAULT]
|
||||||
agent_mode = dvr_snat
|
agent_mode = dvr_snat
|
||||||
|
|
||||||
.. note::
|
|
||||||
|
|
||||||
The ``external_network_bridge`` option intentionally contains
|
|
||||||
no value.
|
|
||||||
|
|
||||||
#. Restart the following services:
|
#. Restart the following services:
|
||||||
|
|
||||||
@ -125,14 +121,8 @@ Compute nodes
|
|||||||
|
|
||||||
[DEFAULT]
|
[DEFAULT]
|
||||||
interface_driver = openvswitch
|
interface_driver = openvswitch
|
||||||
external_network_bridge =
|
|
||||||
agent_mode = dvr
|
agent_mode = dvr
|
||||||
|
|
||||||
.. note::
|
|
||||||
|
|
||||||
The ``external_network_bridge`` option intentionally contains
|
|
||||||
no value.
|
|
||||||
|
|
||||||
#. Restart the following services:
|
#. Restart the following services:
|
||||||
|
|
||||||
* Open vSwitch agent
|
* Open vSwitch agent
|
||||||
|
@ -119,12 +119,6 @@ Network node 2
|
|||||||
|
|
||||||
[DEFAULT]
|
[DEFAULT]
|
||||||
interface_driver = openvswitch
|
interface_driver = openvswitch
|
||||||
external_network_bridge =
|
|
||||||
|
|
||||||
.. note::
|
|
||||||
|
|
||||||
The ``external_network_bridge`` option intentionally contains
|
|
||||||
no value.
|
|
||||||
|
|
||||||
#. Start the following services:
|
#. Start the following services:
|
||||||
|
|
||||||
|
@ -150,12 +150,6 @@ Network node
|
|||||||
|
|
||||||
[DEFAULT]
|
[DEFAULT]
|
||||||
interface_driver = openvswitch
|
interface_driver = openvswitch
|
||||||
external_network_bridge =
|
|
||||||
|
|
||||||
.. note::
|
|
||||||
|
|
||||||
The ``external_network_bridge`` option intentionally contains
|
|
||||||
no value.
|
|
||||||
|
|
||||||
#. Start the following services:
|
#. Start the following services:
|
||||||
|
|
||||||
|
@ -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
|
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
|
loaded after the main ```neutron.conf``` file, so the agent configuration takes
|
||||||
precedence. The agent specific configuration may contain configurations which
|
precedence. The agent specific configuration may contain configurations which
|
||||||
vary between hosts in a Neutron deployment such as the external_network_bridge
|
vary between hosts in a Neutron deployment such as the ``local_ip`` for an L2
|
||||||
for a L3 agent. If any agent requires access to additional external services
|
agent. If any agent requires access to additional external services beyond the
|
||||||
beyond the Neutron RPC, those endpoints should be defined in the agent specific
|
neutron RPC, those endpoints should be defined in the agent-specific
|
||||||
configuration file (e.g. nova metadata for metadata agent).
|
configuration file (e.g. nova metadata for metadata agent).
|
||||||
|
@ -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 legacy_router
|
||||||
from neutron.agent.l3 import namespace_manager
|
from neutron.agent.l3 import namespace_manager
|
||||||
from neutron.agent.linux import external_process
|
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 pd
|
||||||
from neutron.agent.linux import utils as linux_utils
|
from neutron.agent.linux import utils as linux_utils
|
||||||
from neutron.agent.metadata import driver as metadata_driver
|
from neutron.agent.metadata import driver as metadata_driver
|
||||||
@ -359,12 +358,6 @@ class L3NATAgent(ha.AgentMixin,
|
|||||||
if self.conf.gateway_external_network_id:
|
if self.conf.gateway_external_network_id:
|
||||||
return 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:
|
if not force and self.target_ex_net_id:
|
||||||
return self.target_ex_net_id
|
return self.target_ex_net_id
|
||||||
|
|
||||||
@ -542,12 +535,6 @@ class L3NATAgent(ha.AgentMixin,
|
|||||||
self._resync_router(update)
|
self._resync_router(update)
|
||||||
|
|
||||||
def _process_router_if_compatible(self, router):
|
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
|
# Either ex_net_id or handle_internal_only_routers must be set
|
||||||
ex_net_id = (router['external_gateway_info'] or {}).get('network_id')
|
ex_net_id = (router['external_gateway_info'] or {}).get('network_id')
|
||||||
if not ex_net_id and not self.conf.handle_internal_only_routers:
|
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,
|
'agent_mode': self.conf.agent_mode,
|
||||||
'handle_internal_only_routers':
|
'handle_internal_only_routers':
|
||||||
self.conf.handle_internal_only_routers,
|
self.conf.handle_internal_only_routers,
|
||||||
'external_network_bridge': self.conf.external_network_bridge,
|
|
||||||
'gateway_external_network_id':
|
'gateway_external_network_id':
|
||||||
self.conf.gateway_external_network_id,
|
self.conf.gateway_external_network_id,
|
||||||
'interface_driver': self.conf.interface_driver,
|
'interface_driver': self.conf.interface_driver,
|
||||||
|
@ -95,7 +95,6 @@ class DvrEdgeRouter(dvr_local_router.DvrLocalRouter):
|
|||||||
return
|
return
|
||||||
|
|
||||||
self.driver.unplug(interface_name,
|
self.driver.unplug(interface_name,
|
||||||
bridge=self.agent_conf.external_network_bridge,
|
|
||||||
namespace=self.snat_namespace.name,
|
namespace=self.snat_namespace.name,
|
||||||
prefix=router.EXTERNAL_DEV_PREFIX)
|
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)
|
LOG.debug('Deleting stale external router device: %s', d.name)
|
||||||
self.driver.unplug(
|
self.driver.unplug(
|
||||||
d.name,
|
d.name,
|
||||||
bridge=self.agent_conf.external_network_bridge,
|
|
||||||
namespace=self.snat_namespace.name,
|
namespace=self.snat_namespace.name,
|
||||||
prefix=router.EXTERNAL_DEV_PREFIX)
|
prefix=router.EXTERNAL_DEV_PREFIX)
|
||||||
|
|
||||||
|
@ -163,19 +163,9 @@ class FipNamespace(namespaces.Namespace):
|
|||||||
ex_gw_port['id'],
|
ex_gw_port['id'],
|
||||||
interface_name,
|
interface_name,
|
||||||
ex_gw_port['mac_address'],
|
ex_gw_port['mac_address'],
|
||||||
bridge=self.agent_conf.external_network_bridge,
|
|
||||||
namespace=ns_name,
|
namespace=ns_name,
|
||||||
prefix=FIP_EXT_DEV_PREFIX,
|
prefix=FIP_EXT_DEV_PREFIX,
|
||||||
mtu=ex_gw_port.get('mtu'))
|
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
|
# Remove stale fg devices
|
||||||
ip_wrapper = ip_lib.IPWrapper(namespace=ns_name)
|
ip_wrapper = ip_lib.IPWrapper(namespace=ns_name)
|
||||||
devices = ip_wrapper.get_devices()
|
devices = ip_wrapper.get_devices()
|
||||||
@ -183,9 +173,7 @@ class FipNamespace(namespaces.Namespace):
|
|||||||
name = device.name
|
name = device.name
|
||||||
if name.startswith(FIP_EXT_DEV_PREFIX) and name != interface_name:
|
if name.startswith(FIP_EXT_DEV_PREFIX) and name != interface_name:
|
||||||
LOG.debug('DVR: unplug: %s', name)
|
LOG.debug('DVR: unplug: %s', name)
|
||||||
ext_net_bridge = self.agent_conf.external_network_bridge
|
|
||||||
self.driver.unplug(name,
|
self.driver.unplug(name,
|
||||||
bridge=ext_net_bridge,
|
|
||||||
namespace=ns_name,
|
namespace=ns_name,
|
||||||
prefix=FIP_EXT_DEV_PREFIX)
|
prefix=FIP_EXT_DEV_PREFIX)
|
||||||
|
|
||||||
@ -232,9 +220,7 @@ class FipNamespace(namespaces.Namespace):
|
|||||||
# single port from FIP NS to br-ext
|
# single port from FIP NS to br-ext
|
||||||
# TODO(carl) Where does the port get deleted?
|
# TODO(carl) Where does the port get deleted?
|
||||||
LOG.debug('DVR: unplug: %s', d.name)
|
LOG.debug('DVR: unplug: %s', d.name)
|
||||||
ext_net_bridge = self.agent_conf.external_network_bridge
|
|
||||||
self.driver.unplug(d.name,
|
self.driver.unplug(d.name,
|
||||||
bridge=ext_net_bridge,
|
|
||||||
namespace=self.name,
|
namespace=self.name,
|
||||||
prefix=FIP_EXT_DEV_PREFIX)
|
prefix=FIP_EXT_DEV_PREFIX)
|
||||||
|
|
||||||
|
@ -53,7 +53,6 @@ class SnatNamespace(namespaces.Namespace):
|
|||||||
elif d.name.startswith(namespaces.EXTERNAL_DEV_PREFIX):
|
elif d.name.startswith(namespaces.EXTERNAL_DEV_PREFIX):
|
||||||
self.driver.unplug(
|
self.driver.unplug(
|
||||||
d.name,
|
d.name,
|
||||||
bridge=self.agent_conf.external_network_bridge,
|
|
||||||
namespace=self.name,
|
namespace=self.name,
|
||||||
prefix=namespaces.EXTERNAL_DEV_PREFIX)
|
prefix=namespaces.EXTERNAL_DEV_PREFIX)
|
||||||
|
|
||||||
|
@ -449,7 +449,6 @@ class HaRouter(router.RouterInfo):
|
|||||||
else:
|
else:
|
||||||
# We are not the master node, so no need to delete ip addresses.
|
# We are not the master node, so no need to delete ip addresses.
|
||||||
self.driver.unplug(interface_name,
|
self.driver.unplug(interface_name,
|
||||||
bridge=self.agent_conf.external_network_bridge,
|
|
||||||
namespace=self.ns_name,
|
namespace=self.ns_name,
|
||||||
prefix=router.EXTERNAL_DEV_PREFIX)
|
prefix=router.EXTERNAL_DEV_PREFIX)
|
||||||
|
|
||||||
|
@ -143,7 +143,6 @@ class RouterNamespace(Namespace):
|
|||||||
elif d.name.startswith(EXTERNAL_DEV_PREFIX):
|
elif d.name.startswith(EXTERNAL_DEV_PREFIX):
|
||||||
self.driver.unplug(
|
self.driver.unplug(
|
||||||
d.name,
|
d.name,
|
||||||
bridge=self.agent_conf.external_network_bridge,
|
|
||||||
namespace=self.name,
|
namespace=self.name,
|
||||||
prefix=EXTERNAL_DEV_PREFIX)
|
prefix=EXTERNAL_DEV_PREFIX)
|
||||||
|
|
||||||
|
@ -661,19 +661,9 @@ class RouterInfo(object):
|
|||||||
ex_gw_port['id'],
|
ex_gw_port['id'],
|
||||||
interface_name,
|
interface_name,
|
||||||
ex_gw_port['mac_address'],
|
ex_gw_port['mac_address'],
|
||||||
bridge=self.agent_conf.external_network_bridge,
|
|
||||||
namespace=ns_name,
|
namespace=ns_name,
|
||||||
prefix=EXTERNAL_DEV_PREFIX,
|
prefix=EXTERNAL_DEV_PREFIX,
|
||||||
mtu=ex_gw_port.get('mtu'))
|
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):
|
def _get_external_gw_ips(self, ex_gw_port):
|
||||||
gateway_ips = []
|
gateway_ips = []
|
||||||
@ -802,7 +792,6 @@ class RouterInfo(object):
|
|||||||
ip_addr['ip_address'],
|
ip_addr['ip_address'],
|
||||||
prefixlen))
|
prefixlen))
|
||||||
self.driver.unplug(interface_name,
|
self.driver.unplug(interface_name,
|
||||||
bridge=self.agent_conf.external_network_bridge,
|
|
||||||
namespace=self.ns_name,
|
namespace=self.ns_name,
|
||||||
prefix=EXTERNAL_DEV_PREFIX)
|
prefix=EXTERNAL_DEV_PREFIX)
|
||||||
|
|
||||||
@ -819,7 +808,6 @@ class RouterInfo(object):
|
|||||||
LOG.debug('Deleting stale external router device: %s', stale_dev)
|
LOG.debug('Deleting stale external router device: %s', stale_dev)
|
||||||
self.agent.pd.remove_gw_interface(self.router['id'])
|
self.agent.pd.remove_gw_interface(self.router['id'])
|
||||||
self.driver.unplug(stale_dev,
|
self.driver.unplug(stale_dev,
|
||||||
bridge=self.agent_conf.external_network_bridge,
|
|
||||||
namespace=self.ns_name,
|
namespace=self.ns_name,
|
||||||
prefix=EXTERNAL_DEV_PREFIX)
|
prefix=EXTERNAL_DEV_PREFIX)
|
||||||
|
|
||||||
|
@ -238,17 +238,6 @@ class LinuxInterfaceDriver(object):
|
|||||||
def get_device_name(self, port):
|
def get_device_name(self, port):
|
||||||
return (self.DEV_NAME_PREFIX + port.id)[:self.DEV_NAME_LEN]
|
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
|
@staticmethod
|
||||||
def configure_ipv6_ra(namespace, dev_name, value):
|
def configure_ipv6_ra(namespace, dev_name, value):
|
||||||
"""Configure handling of IPv6 Router Advertisements on an
|
"""Configure handling of IPv6 Router Advertisements on an
|
||||||
@ -348,10 +337,6 @@ class OVSInterfaceDriver(LinuxInterfaceDriver):
|
|||||||
ovs = ovs_lib.OVSBridge(bridge)
|
ovs = ovs_lib.OVSBridge(bridge)
|
||||||
ovs.replace_port(device_name, *attrs)
|
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,
|
def plug_new(self, network_id, port_id, device_name, mac_address,
|
||||||
bridge=None, namespace=None, prefix=None, mtu=None):
|
bridge=None, namespace=None, prefix=None, mtu=None):
|
||||||
"""Plug in the interface."""
|
"""Plug in the interface."""
|
||||||
|
@ -60,8 +60,7 @@ def main():
|
|||||||
|
|
||||||
|
|
||||||
def do_main(conf):
|
def do_main(conf):
|
||||||
configuration_bridges = set([conf.ovs_integration_bridge,
|
configuration_bridges = set([conf.ovs_integration_bridge])
|
||||||
conf.external_network_bridge])
|
|
||||||
ovs = ovs_lib.BaseOVS()
|
ovs = ovs_lib.BaseOVS()
|
||||||
ovs_bridges = set(ovs.get_bridges())
|
ovs_bridges = set(ovs.get_bridges())
|
||||||
available_configuration_bridges = configuration_bridges & ovs_bridges
|
available_configuration_bridges = configuration_bridges & ovs_bridges
|
||||||
|
@ -154,17 +154,6 @@ AVAILABILITY_ZONE_OPTS = [
|
|||||||
help=_("Availability zone of this node")),
|
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):
|
def get_log_args(conf, log_file_name, **kwargs):
|
||||||
cmd_args = []
|
cmd_args = []
|
||||||
|
@ -18,7 +18,6 @@ from neutron_lib import constants
|
|||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
|
|
||||||
from neutron._i18n import _
|
from neutron._i18n import _
|
||||||
from neutron.conf.agent import common as config
|
|
||||||
|
|
||||||
|
|
||||||
OPTS = [
|
OPTS = [
|
||||||
@ -58,12 +57,10 @@ OPTS = [
|
|||||||
"False for all agents if all routers must have an "
|
"False for all agents if all routers must have an "
|
||||||
"external network gateway.")),
|
"external network gateway.")),
|
||||||
cfg.StrOpt('gateway_external_network_id', default='',
|
cfg.StrOpt('gateway_external_network_id', default='',
|
||||||
help=_("When external_network_bridge is set, each L3 agent can "
|
help=_("To allow the L3 agent to support multiple external "
|
||||||
"be associated with no more than one external network. "
|
"networks, gateway_external_network_id must be left "
|
||||||
"This value should be set to the UUID of that external "
|
"empty. Otherwise this value should be set to the UUID "
|
||||||
"network. To allow L3 agent support multiple external "
|
"of the single external network to be used."),
|
||||||
"networks, both the external_network_bridge and "
|
|
||||||
"gateway_external_network_id must be left empty."),
|
|
||||||
deprecated_for_removal=True),
|
deprecated_for_removal=True),
|
||||||
cfg.StrOpt('ipv6_gateway', default='',
|
cfg.StrOpt('ipv6_gateway', default='',
|
||||||
help=_("With IPv6, the network used for the external gateway "
|
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.')),
|
'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):
|
def register_l3_agent_config_opts(opts, cfg=cfg.CONF):
|
||||||
cfg.register_opts(opts)
|
cfg.register_opts(opts)
|
||||||
|
@ -303,13 +303,6 @@ class L3_NAT_dbonly_mixin(l3.RouterPluginBase,
|
|||||||
def _check_router_needs_rescheduling(self, context, router_id, gw_info):
|
def _check_router_needs_rescheduling(self, context, router_id, gw_info):
|
||||||
"""Checks whether router's l3 agent can handle the given network
|
"""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,
|
:return: list of candidate agents if rescheduling needed,
|
||||||
None otherwise; raises exception if there is no eligible l3 agent
|
None otherwise; raises exception if there is no eligible l3 agent
|
||||||
associated with target external network
|
associated with target external network
|
||||||
@ -344,10 +337,7 @@ class L3_NAT_dbonly_mixin(l3.RouterPluginBase,
|
|||||||
for agent in cur_agents:
|
for agent in cur_agents:
|
||||||
ext_net_id = agent['configurations'].get(
|
ext_net_id = agent['configurations'].get(
|
||||||
'gateway_external_network_id')
|
'gateway_external_network_id')
|
||||||
ext_bridge = agent['configurations'].get(
|
if ext_net_id == network_id or not ext_net_id:
|
||||||
'external_network_bridge', '')
|
|
||||||
if (ext_net_id == network_id or
|
|
||||||
(not ext_net_id and not ext_bridge)):
|
|
||||||
return
|
return
|
||||||
|
|
||||||
# otherwise find l3 agent with matching gateway_external_network_id
|
# otherwise find l3 agent with matching gateway_external_network_id
|
||||||
|
@ -43,9 +43,6 @@ class NeutronDebugAgent(object):
|
|||||||
|
|
||||||
def create_probe(self, network_id, device_owner='network'):
|
def create_probe(self, network_id, device_owner='network'):
|
||||||
network = self._get_network(network_id)
|
network = self._get_network(network_id)
|
||||||
bridge = None
|
|
||||||
if network.external:
|
|
||||||
bridge = self.conf.external_network_bridge
|
|
||||||
|
|
||||||
port = self._create_port(network, device_owner)
|
port = self._create_port(network, device_owner)
|
||||||
interface_name = self.driver.get_device_name(port)
|
interface_name = self.driver.get_device_name(port)
|
||||||
@ -58,7 +55,6 @@ class NeutronDebugAgent(object):
|
|||||||
port.id,
|
port.id,
|
||||||
interface_name,
|
interface_name,
|
||||||
port.mac_address,
|
port.mac_address,
|
||||||
bridge=bridge,
|
|
||||||
namespace=namespace)
|
namespace=namespace)
|
||||||
ip_cidrs = []
|
ip_cidrs = []
|
||||||
for fixed_ip in port.fixed_ips:
|
for fixed_ip in port.fixed_ips:
|
||||||
@ -94,22 +90,16 @@ class NeutronDebugAgent(object):
|
|||||||
|
|
||||||
def delete_probe(self, port_id):
|
def delete_probe(self, port_id):
|
||||||
port = dhcp.DictModel(self.client.show_port(port_id)['port'])
|
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)
|
namespace = self._get_namespace(port)
|
||||||
if ip_lib.network_namespace_exists(namespace):
|
if ip_lib.network_namespace_exists(namespace):
|
||||||
self.driver.unplug(self.driver.get_device_name(port),
|
self.driver.unplug(self.driver.get_device_name(port),
|
||||||
bridge=bridge,
|
|
||||||
namespace=namespace)
|
namespace=namespace)
|
||||||
try:
|
try:
|
||||||
ip_lib.delete_network_namespace(namespace)
|
ip_lib.delete_network_namespace(namespace)
|
||||||
except Exception:
|
except Exception:
|
||||||
LOG.warning('Failed to delete namespace %s', namespace)
|
LOG.warning('Failed to delete namespace %s', namespace)
|
||||||
else:
|
else:
|
||||||
self.driver.unplug(self.driver.get_device_name(port),
|
self.driver.unplug(self.driver.get_device_name(port))
|
||||||
bridge=bridge)
|
|
||||||
self.client.delete_port(port.id)
|
self.client.delete_port(port.id)
|
||||||
|
|
||||||
def list_probes(self):
|
def list_probes(self):
|
||||||
|
@ -71,7 +71,6 @@ class NeutronDebugShell(shell.NeutronShell):
|
|||||||
" either --config-file or env[NEUTRON_TEST_CONFIG_FILE]"))
|
" either --config-file or env[NEUTRON_TEST_CONFIG_FILE]"))
|
||||||
client = self.client_manager.neutron
|
client = self.client_manager.neutron
|
||||||
config.register_interface_opts()
|
config.register_interface_opts()
|
||||||
cfg.CONF.register_opts(config.EXT_NET_BRIDGE_OPTS)
|
|
||||||
config.register_interface_driver_opts_helper(cfg.CONF)
|
config.register_interface_driver_opts_helper(cfg.CONF)
|
||||||
cfg.CONF(['--config-file', self.options.config_file])
|
cfg.CONF(['--config-file', self.options.config_file])
|
||||||
config.setup_logging()
|
config.setup_logging()
|
||||||
|
@ -58,8 +58,7 @@ class FakePlugin(common_db_mixin.CommonDbMixin,
|
|||||||
|
|
||||||
|
|
||||||
def _get_l3_agent_dict(host, agent_mode, internal_only=True,
|
def _get_l3_agent_dict(host, agent_mode, internal_only=True,
|
||||||
ext_net_id='', ext_bridge='',
|
ext_net_id='', az=DEFAULT_AZ):
|
||||||
az=DEFAULT_AZ):
|
|
||||||
return {
|
return {
|
||||||
'agent_type': constants.AGENT_TYPE_L3,
|
'agent_type': constants.AGENT_TYPE_L3,
|
||||||
'binary': 'neutron-l3-agent',
|
'binary': 'neutron-l3-agent',
|
||||||
@ -68,7 +67,6 @@ def _get_l3_agent_dict(host, agent_mode, internal_only=True,
|
|||||||
'availability_zone': az,
|
'availability_zone': az,
|
||||||
'configurations': {'agent_mode': agent_mode,
|
'configurations': {'agent_mode': agent_mode,
|
||||||
'handle_internal_only_routers': internal_only,
|
'handle_internal_only_routers': internal_only,
|
||||||
'external_network_bridge': ext_bridge,
|
|
||||||
'gateway_external_network_id': ext_net_id}}
|
'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,
|
def register_l3_agent(host=HOST, agent_mode=constants.L3_AGENT_MODE_LEGACY,
|
||||||
internal_only=True, ext_net_id='', ext_bridge='',
|
internal_only=True, ext_net_id='', az=DEFAULT_AZ):
|
||||||
az=DEFAULT_AZ):
|
agent = _get_l3_agent_dict(host, agent_mode, internal_only, ext_net_id, az)
|
||||||
agent = _get_l3_agent_dict(host, agent_mode, internal_only, ext_net_id,
|
|
||||||
ext_bridge, az)
|
|
||||||
return _register_agent(agent)
|
return _register_agent(agent)
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@ from neutron.common import utils as common_utils
|
|||||||
from neutron.conf.agent import common as config
|
from neutron.conf.agent import common as config
|
||||||
from neutron.tests import base as tests_base
|
from neutron.tests import base as tests_base
|
||||||
from neutron.tests.common import helpers
|
from neutron.tests.common import helpers
|
||||||
|
from neutron.tests.common import machine_fixtures
|
||||||
from neutron.tests.common import net_helpers
|
from neutron.tests.common import net_helpers
|
||||||
from neutron.tests.fullstack.resources import client as client_resource
|
from neutron.tests.fullstack.resources import client as client_resource
|
||||||
from neutron.tests import tools
|
from neutron.tests import tools
|
||||||
@ -137,3 +138,15 @@ class BaseFullStackTestCase(testlib_api.MySQLTestCaseMixin,
|
|||||||
return available_ips
|
return available_ips
|
||||||
|
|
||||||
self.fail("Cannot find enough free IP addresses.")
|
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
|
||||||
|
@ -166,11 +166,13 @@ class OVSConfigFixture(ConfigFixture):
|
|||||||
base_filename='openvswitch_agent.ini')
|
base_filename='openvswitch_agent.ini')
|
||||||
|
|
||||||
self.tunneling_enabled = self.env_desc.tunneling_enabled
|
self.tunneling_enabled = self.env_desc.tunneling_enabled
|
||||||
|
ext_dev = utils.get_rand_device_name(prefix='br-eth')
|
||||||
self.config.update({
|
self.config.update({
|
||||||
'ovs': {
|
'ovs': {
|
||||||
'local_ip': local_ip,
|
'local_ip': local_ip,
|
||||||
'integration_bridge': self._generate_integration_bridge(),
|
'integration_bridge': self._generate_integration_bridge(),
|
||||||
'of_interface': host_desc.of_interface,
|
'of_interface': host_desc.of_interface,
|
||||||
|
'bridge_mappings': '%s:%s' % (PHYSICAL_NETWORK_NAME, ext_dev)
|
||||||
},
|
},
|
||||||
'securitygroup': {
|
'securitygroup': {
|
||||||
'firewall_driver': host_desc.firewall_driver,
|
'firewall_driver': host_desc.firewall_driver,
|
||||||
@ -190,12 +192,9 @@ class OVSConfigFixture(ConfigFixture):
|
|||||||
'int_peer_patch_port': self._generate_int_peer(),
|
'int_peer_patch_port': self._generate_int_peer(),
|
||||||
'tun_peer_patch_port': self._generate_tun_peer()})
|
'tun_peer_patch_port': self._generate_tun_peer()})
|
||||||
else:
|
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:
|
if env_desc.report_bandwidths:
|
||||||
self.config['ovs'][c_const.RP_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)
|
MINIMUM_BANDWIDTH_INGRESS_KBPS)
|
||||||
|
|
||||||
if env_desc.qos:
|
if env_desc.qos:
|
||||||
@ -350,7 +349,6 @@ class L3ConfigFixture(ConfigFixture):
|
|||||||
'interface_driver': ('neutron.agent.linux.interface.'
|
'interface_driver': ('neutron.agent.linux.interface.'
|
||||||
'OVSInterfaceDriver'),
|
'OVSInterfaceDriver'),
|
||||||
'ovs_integration_bridge': integration_bridge,
|
'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):
|
class DhcpConfigFixture(ConfigFixture):
|
||||||
|
|
||||||
|
@ -143,15 +143,15 @@ class Host(fixtures.Fixture):
|
|||||||
self.local_ip, test_name=self.test_name)
|
self.local_ip, test_name=self.test_name)
|
||||||
self.useFixture(agent_cfg_fixture)
|
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:
|
if self.env_desc.tunneling_enabled:
|
||||||
self.useFixture(
|
self.useFixture(
|
||||||
net_helpers.OVSBridgeFixture(
|
net_helpers.OVSBridgeFixture(
|
||||||
agent_cfg_fixture.get_br_tun_name())).bridge
|
agent_cfg_fixture.get_br_tun_name())).bridge
|
||||||
self.connect_to_central_network_via_tunneling()
|
self.connect_to_central_network_via_tunneling()
|
||||||
else:
|
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.connect_to_central_network_via_vlans(self.br_phys)
|
||||||
|
|
||||||
self.ovs_agent = self.useFixture(
|
self.ovs_agent = self.useFixture(
|
||||||
@ -165,10 +165,6 @@ class Host(fixtures.Fixture):
|
|||||||
self.env_desc, self.host_desc,
|
self.env_desc, self.host_desc,
|
||||||
self.neutron_config.temp_dir,
|
self.neutron_config.temp_dir,
|
||||||
self.ovs_agent.agent_cfg_fixture.get_br_int_name()))
|
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:
|
if self.host_desc.dhcp_agent:
|
||||||
self.dhcp_agent_cfg_fixture = self.useFixture(
|
self.dhcp_agent_cfg_fixture = self.useFixture(
|
||||||
|
@ -25,7 +25,6 @@ from neutron.agent.l3 import namespaces
|
|||||||
from neutron.agent.linux import ip_lib
|
from neutron.agent.linux import ip_lib
|
||||||
from neutron.common import utils as common_utils
|
from neutron.common import utils as common_utils
|
||||||
from neutron.tests.common.exclusive_resources import ip_network
|
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 import base
|
||||||
from neutron.tests.fullstack.resources import environment
|
from neutron.tests.fullstack.resources import environment
|
||||||
from neutron.tests.fullstack.resources import machine
|
from neutron.tests.fullstack.resources import machine
|
||||||
@ -80,10 +79,7 @@ class TestL3Agent(base.BaseFullStackTestCase):
|
|||||||
def _test_gateway_ip_changed(self):
|
def _test_gateway_ip_changed(self):
|
||||||
tenant_id = uuidutils.generate_uuid()
|
tenant_id = uuidutils.generate_uuid()
|
||||||
ext_net, ext_sub = self._create_external_network_and_subnet(tenant_id)
|
ext_net, ext_sub = self._create_external_network_and_subnet(tenant_id)
|
||||||
external_vm = self.useFixture(
|
external_vm = self._create_external_vm(ext_net, ext_sub)
|
||||||
machine_fixtures.FakeMachine(
|
|
||||||
self.environment.central_bridge,
|
|
||||||
common_utils.ip_to_cidr(ext_sub['gateway_ip'], 24)))
|
|
||||||
|
|
||||||
router = self.safe_client.create_router(tenant_id,
|
router = self.safe_client.create_router(tenant_id,
|
||||||
external_network=ext_net['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.
|
# 3. IPv6 ext connectivity: using ping6 from tenant vm to external_vm.
|
||||||
tenant_id = uuidutils.generate_uuid()
|
tenant_id = uuidutils.generate_uuid()
|
||||||
ext_net, ext_sub = self._create_external_network_and_subnet(tenant_id)
|
ext_net, ext_sub = self._create_external_network_and_subnet(tenant_id)
|
||||||
external_vm = self.useFixture(
|
external_vm = self._create_external_vm(ext_net, ext_sub)
|
||||||
machine_fixtures.FakeMachine(
|
|
||||||
self.environment.central_bridge,
|
|
||||||
common_utils.ip_to_cidr(ext_sub['gateway_ip'], 24)))
|
|
||||||
# Create an IPv6 subnet in the external network
|
# Create an IPv6 subnet in the external network
|
||||||
v6network = self.useFixture(
|
v6network = self.useFixture(
|
||||||
ip_network.ExclusiveIPNetwork(
|
ip_network.ExclusiveIPNetwork(
|
||||||
@ -278,7 +271,7 @@ class TestHAL3Agent(TestL3Agent):
|
|||||||
for _ in range(2)]
|
for _ in range(2)]
|
||||||
env = environment.Environment(
|
env = environment.Environment(
|
||||||
environment.EnvironmentDescription(
|
environment.EnvironmentDescription(
|
||||||
network_type='vxlan', l2_pop=True),
|
network_type='vlan', l2_pop=True),
|
||||||
host_descriptions)
|
host_descriptions)
|
||||||
super(TestHAL3Agent, self).setUp(env)
|
super(TestHAL3Agent, self).setUp(env)
|
||||||
|
|
||||||
@ -386,10 +379,7 @@ class TestHAL3Agent(TestL3Agent):
|
|||||||
router = self.safe_client.create_router(tenant_id, ha=True,
|
router = self.safe_client.create_router(tenant_id, ha=True,
|
||||||
external_network=ext_net['id'])
|
external_network=ext_net['id'])
|
||||||
|
|
||||||
external_vm = self.useFixture(
|
external_vm = self._create_external_vm(ext_net, ext_sub)
|
||||||
machine_fixtures.FakeMachine(
|
|
||||||
self.environment.central_bridge,
|
|
||||||
common_utils.ip_to_cidr(ext_sub['gateway_ip'], 24)))
|
|
||||||
|
|
||||||
common_utils.wait_until_true(
|
common_utils.wait_until_true(
|
||||||
lambda:
|
lambda:
|
||||||
|
@ -79,9 +79,7 @@ class L3AgentTestFramework(base.BaseSudoTestCase):
|
|||||||
conf.set_override('interface_driver', self.INTERFACE_DRIVER)
|
conf.set_override('interface_driver', self.INTERFACE_DRIVER)
|
||||||
|
|
||||||
br_int = self.useFixture(net_helpers.OVSBridgeFixture()).bridge
|
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('ovs_integration_bridge', br_int.br_name)
|
||||||
conf.set_override('external_network_bridge', br_ex.br_name)
|
|
||||||
|
|
||||||
temp_dir = self.get_new_temp_dir()
|
temp_dir = self.get_new_temp_dir()
|
||||||
get_temp_file_path = functools.partial(self.get_temp_file_path,
|
get_temp_file_path = functools.partial(self.get_temp_file_path,
|
||||||
@ -542,14 +540,9 @@ class L3AgentTestFramework(base.BaseSudoTestCase):
|
|||||||
self.assertIn(extra_subnet, routes)
|
self.assertIn(extra_subnet, routes)
|
||||||
|
|
||||||
def _assert_interfaces_deleted_from_ovs(self):
|
def _assert_interfaces_deleted_from_ovs(self):
|
||||||
|
bridge = ovs_lib.OVSBridge(self.agent.conf.ovs_integration_bridge)
|
||||||
def assert_ovs_bridge_empty(bridge_name):
|
|
||||||
bridge = ovs_lib.OVSBridge(bridge_name)
|
|
||||||
self.assertFalse(bridge.get_port_name_list())
|
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)
|
|
||||||
|
|
||||||
def floating_ips_configured(self, router):
|
def floating_ips_configured(self, router):
|
||||||
floating_ips = router.router[constants.FLOATINGIP_KEY]
|
floating_ips = router.router[constants.FLOATINGIP_KEY]
|
||||||
external_port = router.get_ex_gw_port()
|
external_port = router.get_ex_gw_port()
|
||||||
@ -594,7 +587,7 @@ class L3AgentTestFramework(base.BaseSudoTestCase):
|
|||||||
router1 = self._create_router(router_info, self.agent)
|
router1 = self._create_router(router_info, self.agent)
|
||||||
self._add_fip(router1, '192.168.111.12')
|
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.addr.add('19.4.4.1/24')
|
||||||
r1_br.link.set_up()
|
r1_br.link.set_up()
|
||||||
|
|
||||||
@ -604,7 +597,7 @@ class L3AgentTestFramework(base.BaseSudoTestCase):
|
|||||||
mac='22:22:22:22:22:22'))
|
mac='22:22:22:22:22:22'))
|
||||||
router2 = self._create_router(router_info_2, self.failover_agent)
|
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.addr.add('19.4.4.1/24')
|
||||||
r2_br.link.set_up()
|
r2_br.link.set_up()
|
||||||
|
|
||||||
@ -642,12 +635,12 @@ class L3AgentTestFramework(base.BaseSudoTestCase):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def fail_gw_router_port(router):
|
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()
|
r_br.link.set_down()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def restore_gw_router_port(router):
|
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()
|
r_br.link.set_up()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -148,9 +148,7 @@ class TestDvrRouter(framework.L3AgentTestFramework):
|
|||||||
self._validate_fips_for_external_network(
|
self._validate_fips_for_external_network(
|
||||||
router, router.fip_ns.get_name())
|
router, router.fip_ns.get_name())
|
||||||
# Now delete the fg- port that was created
|
# 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,
|
router.fip_ns.driver.unplug(fg_port_name,
|
||||||
bridge=ext_net_bridge,
|
|
||||||
namespace=router.fip_ns.name,
|
namespace=router.fip_ns.name,
|
||||||
prefix=dvr_fip_ns.FIP_EXT_DEV_PREFIX)
|
prefix=dvr_fip_ns.FIP_EXT_DEV_PREFIX)
|
||||||
# Now check if the fg- port is missing.
|
# Now check if the fg- port is missing.
|
||||||
@ -203,9 +201,7 @@ class TestDvrRouter(framework.L3AgentTestFramework):
|
|||||||
self._validate_fips_for_external_network(
|
self._validate_fips_for_external_network(
|
||||||
router, router.fip_ns.get_name())
|
router, router.fip_ns.get_name())
|
||||||
# Now delete the fg- port that was created
|
# 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,
|
router.fip_ns.driver.unplug(fg_port_name,
|
||||||
bridge=ext_net_bridge,
|
|
||||||
namespace=router.fip_ns.name,
|
namespace=router.fip_ns.name,
|
||||||
prefix=dvr_fip_ns.FIP_EXT_DEV_PREFIX)
|
prefix=dvr_fip_ns.FIP_EXT_DEV_PREFIX)
|
||||||
# Now check if the fg- port is missing.
|
# Now check if the fg- port is missing.
|
||||||
@ -1995,10 +1991,10 @@ class TestDvrRouter(framework.L3AgentTestFramework):
|
|||||||
fixed_ip_address_scope='scope2')
|
fixed_ip_address_scope='scope2')
|
||||||
router.process()
|
router.process()
|
||||||
|
|
||||||
br_ex = framework.get_ovs_bridge(
|
br_int = framework.get_ovs_bridge(
|
||||||
self.agent.conf.external_network_bridge)
|
self.agent.conf.ovs_integration_bridge)
|
||||||
src_machine = self.useFixture(
|
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
|
# 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_same_scope)
|
||||||
net_helpers.assert_ping(src_machine.namespace, fip_diff_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_port = router.get_ex_gw_port()
|
||||||
gw_ip = self._port_first_ip_cidr(gw_port).partition('/')[0]
|
gw_ip = self._port_first_ip_cidr(gw_port).partition('/')[0]
|
||||||
br_ex = framework.get_ovs_bridge(
|
br_int = framework.get_ovs_bridge(
|
||||||
self.agent.conf.external_network_bridge)
|
self.agent.conf.ovs_integration_bridge)
|
||||||
|
|
||||||
src_machine = self.useFixture(
|
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
|
# For the internal networks that are in the same address scope as
|
||||||
# external network, they can directly route to external network
|
# external network, they can directly route to external network
|
||||||
net_helpers.assert_ping(src_machine.namespace, machine_same_scope.ip)
|
net_helpers.assert_ping(src_machine.namespace, machine_same_scope.ip)
|
||||||
|
@ -19,6 +19,7 @@ import mock
|
|||||||
from neutron_lib import constants
|
from neutron_lib import constants
|
||||||
import testtools
|
import testtools
|
||||||
|
|
||||||
|
from neutron.agent.common import ovs_lib
|
||||||
from neutron.agent.l3 import agent as neutron_l3_agent
|
from neutron.agent.l3 import agent as neutron_l3_agent
|
||||||
from neutron.agent.linux import ip_lib
|
from neutron.agent.linux import ip_lib
|
||||||
from neutron.common import ipv6_utils
|
from neutron.common import ipv6_utils
|
||||||
@ -381,6 +382,28 @@ class L3HATestFailover(framework.L3AgentTestFramework):
|
|||||||
br_int_1.add_port(veth1.name)
|
br_int_1.add_port(veth1.name)
|
||||||
br_int_2.add_port(veth2.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):
|
def test_ha_router_failover(self):
|
||||||
router1, router2 = self.create_ha_routers()
|
router1, router2 = self.create_ha_routers()
|
||||||
|
|
||||||
|
@ -156,33 +156,6 @@ class L3AgentTestCase(framework.L3AgentTestFramework):
|
|||||||
self.addCleanup(bridge.destroy)
|
self.addCleanup(bridge.destroy)
|
||||||
return bridge
|
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):
|
def test_legacy_router_ns_rebuild(self):
|
||||||
router_info = self.generate_router_info(False)
|
router_info = self.generate_router_info(False)
|
||||||
router = self.manage_router(self.agent, router_info)
|
router = self.manage_router(self.agent, router_info)
|
||||||
@ -420,10 +393,10 @@ class L3AgentTestCase(framework.L3AgentTestFramework):
|
|||||||
fixed_ip_address_scope='scope2')
|
fixed_ip_address_scope='scope2')
|
||||||
router.process()
|
router.process()
|
||||||
|
|
||||||
br_ex = framework.get_ovs_bridge(
|
br_int = framework.get_ovs_bridge(
|
||||||
self.agent.conf.external_network_bridge)
|
self.agent.conf.ovs_integration_bridge)
|
||||||
src_machine = self.useFixture(
|
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
|
# 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_same_scope)
|
||||||
net_helpers.assert_ping(src_machine.namespace, fip_diff_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_port = router.get_ex_gw_port()
|
||||||
gw_ip = self._port_first_ip_cidr(gw_port).partition('/')[0]
|
gw_ip = self._port_first_ip_cidr(gw_port).partition('/')[0]
|
||||||
br_ex = framework.get_ovs_bridge(
|
br_int = framework.get_ovs_bridge(
|
||||||
self.agent.conf.external_network_bridge)
|
self.agent.conf.ovs_integration_bridge)
|
||||||
|
|
||||||
src_machine = self.useFixture(
|
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
|
# For the internal networks that are in the same address scope as
|
||||||
# external network, they can directly route to external network
|
# external network, they can directly route to external network
|
||||||
net_helpers.assert_ping(src_machine.namespace, machine_same_scope.ip)
|
net_helpers.assert_ping(src_machine.namespace, machine_same_scope.ip)
|
||||||
|
@ -34,26 +34,23 @@ class TestOVSCLIConfig(base.BaseOVSLinuxTestCase):
|
|||||||
|
|
||||||
def test_do_main_default_options(self):
|
def test_do_main_default_options(self):
|
||||||
int_br = self.useFixture(net_helpers.OVSBridgeFixture()).bridge
|
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("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)
|
self.conf.set_override("ovs_all_ports", False)
|
||||||
|
|
||||||
noskip = collections.defaultdict(list)
|
noskip = collections.defaultdict(list)
|
||||||
skip = collections.defaultdict(list)
|
skip = collections.defaultdict(list)
|
||||||
# add two vifs, one skipped, and a non-vif port to int_br and ext_br
|
# add two vifs, one skipped, and a non-vif port to int_br
|
||||||
for br in (int_br, ext_br):
|
|
||||||
for collection in (noskip, skip):
|
for collection in (noskip, skip):
|
||||||
collection[br].append(
|
collection[int_br].append(
|
||||||
self.useFixture(net_helpers.OVSPortFixture(br)).port.name)
|
self.useFixture(net_helpers.OVSPortFixture(int_br)).port.name)
|
||||||
# set skippable vif to be skipped
|
# set skippable vif to be skipped
|
||||||
br.ovsdb.db_set(
|
int_br.ovsdb.db_set(
|
||||||
'Interface', skip[br][0],
|
'Interface', skip[int_br][0],
|
||||||
('external_ids', {constants.SKIP_CLEANUP: "True"})
|
('external_ids', {constants.SKIP_CLEANUP: "True"})
|
||||||
).execute(check_error=True)
|
).execute(check_error=True)
|
||||||
device_name = utils.get_rand_name()
|
device_name = utils.get_rand_name()
|
||||||
skip[br].append(device_name)
|
skip[int_br].append(device_name)
|
||||||
br.add_port(device_name, ('type', 'internal'))
|
int_br.add_port(device_name, ('type', 'internal'))
|
||||||
# sanity check
|
# sanity check
|
||||||
for collection in (noskip, skip):
|
for collection in (noskip, skip):
|
||||||
for bridge, ports in collection.items():
|
for bridge, ports in collection.items():
|
||||||
@ -61,9 +58,8 @@ class TestOVSCLIConfig(base.BaseOVSLinuxTestCase):
|
|||||||
for port in ports:
|
for port in ports:
|
||||||
self.assertIn(port, port_list)
|
self.assertIn(port, port_list)
|
||||||
ovs_cleanup.do_main(self.conf)
|
ovs_cleanup.do_main(self.conf)
|
||||||
for br in (int_br, ext_br):
|
ports = int_br.get_port_name_list()
|
||||||
ports = br.get_port_name_list()
|
for vif in noskip[int_br]:
|
||||||
for vif in noskip[br]:
|
|
||||||
self.assertNotIn(vif, ports)
|
self.assertNotIn(vif, ports)
|
||||||
for port in skip[br]:
|
for port in skip[int_br]:
|
||||||
self.assertIn(port, ports)
|
self.assertIn(port, ports)
|
||||||
|
@ -750,7 +750,6 @@ class TestBasicRouterOperations(BasicRouterOperationsFramework):
|
|||||||
if not router.get('distributed'):
|
if not router.get('distributed'):
|
||||||
self.mock_driver.unplug.assert_called_once_with(
|
self.mock_driver.unplug.assert_called_once_with(
|
||||||
interface_name,
|
interface_name,
|
||||||
bridge=agent.conf.external_network_bridge,
|
|
||||||
namespace=mock.ANY,
|
namespace=mock.ANY,
|
||||||
prefix=mock.ANY)
|
prefix=mock.ANY)
|
||||||
else:
|
else:
|
||||||
@ -934,7 +933,6 @@ class TestBasicRouterOperations(BasicRouterOperationsFramework):
|
|||||||
# snat namespace was deleted
|
# snat namespace was deleted
|
||||||
self.mock_driver.unplug.assert_called_with(
|
self.mock_driver.unplug.assert_called_with(
|
||||||
interface_name,
|
interface_name,
|
||||||
bridge=self.conf.external_network_bridge,
|
|
||||||
namespace=snat_ns_name,
|
namespace=snat_ns_name,
|
||||||
prefix=namespaces.EXTERNAL_DEV_PREFIX)
|
prefix=namespaces.EXTERNAL_DEV_PREFIX)
|
||||||
else:
|
else:
|
||||||
@ -2107,6 +2105,8 @@ class TestBasicRouterOperations(BasicRouterOperationsFramework):
|
|||||||
ri.process = mock.Mock()
|
ri.process = mock.Mock()
|
||||||
ri.initialize = mock.Mock(side_effect=RuntimeError())
|
ri.initialize = mock.Mock(side_effect=RuntimeError())
|
||||||
agent._create_router = mock.Mock(return_value=ri)
|
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()
|
agent._process_router_update()
|
||||||
log_exception.assert_has_calls(calls)
|
log_exception.assert_has_calls(calls)
|
||||||
|
|
||||||
@ -2355,7 +2355,6 @@ class TestBasicRouterOperations(BasicRouterOperationsFramework):
|
|||||||
|
|
||||||
self.mock_driver.unplug.assert_called_with(
|
self.mock_driver.unplug.assert_called_with(
|
||||||
stale_devnames[0],
|
stale_devnames[0],
|
||||||
bridge="",
|
|
||||||
namespace=ri.ns_name,
|
namespace=ri.ns_name,
|
||||||
prefix=namespaces.EXTERNAL_DEV_PREFIX)
|
prefix=namespaces.EXTERNAL_DEV_PREFIX)
|
||||||
|
|
||||||
@ -2376,7 +2375,6 @@ class TestBasicRouterOperations(BasicRouterOperationsFramework):
|
|||||||
|
|
||||||
self.mock_driver.unplug.assert_called_with(
|
self.mock_driver.unplug.assert_called_with(
|
||||||
stale_devnames[0],
|
stale_devnames[0],
|
||||||
bridge=agent.conf.external_network_bridge,
|
|
||||||
namespace=ri.snat_namespace.name,
|
namespace=ri.snat_namespace.name,
|
||||||
prefix=namespaces.EXTERNAL_DEV_PREFIX)
|
prefix=namespaces.EXTERNAL_DEV_PREFIX)
|
||||||
|
|
||||||
@ -2496,7 +2494,6 @@ class TestBasicRouterOperations(BasicRouterOperationsFramework):
|
|||||||
|
|
||||||
ns.delete()
|
ns.delete()
|
||||||
calls = [mock.call('qg-aaaa',
|
calls = [mock.call('qg-aaaa',
|
||||||
bridge=agent.conf.external_network_bridge,
|
|
||||||
namespace=namespace,
|
namespace=namespace,
|
||||||
prefix=namespaces.EXTERNAL_DEV_PREFIX),
|
prefix=namespaces.EXTERNAL_DEV_PREFIX),
|
||||||
mock.call('sg-aaaa',
|
mock.call('sg-aaaa',
|
||||||
@ -2725,7 +2722,6 @@ class TestBasicRouterOperations(BasicRouterOperationsFramework):
|
|||||||
self.assertFalse(chsfr.called)
|
self.assertFalse(chsfr.called)
|
||||||
|
|
||||||
def test_process_router_if_compatible_with_no_ext_net_in_conf(self):
|
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)
|
agent = l3_agent.L3NATAgent(HOSTNAME, self.conf)
|
||||||
self.plugin_api.get_external_network_id.return_value = 'aaa'
|
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)
|
self.assertFalse(self.plugin_api.get_external_network_id.called)
|
||||||
|
|
||||||
def test_process_router_if_compatible_with_stale_cached_ext_net(self):
|
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)
|
agent = l3_agent.L3NATAgent(HOSTNAME, self.conf)
|
||||||
self.plugin_api.get_external_network_id.return_value = 'aaa'
|
self.plugin_api.get_external_network_id.return_value = 'aaa'
|
||||||
agent.target_ex_net_id = 'bbb'
|
agent.target_ex_net_id = 'bbb'
|
||||||
@ -2770,7 +2765,6 @@ class TestBasicRouterOperations(BasicRouterOperationsFramework):
|
|||||||
agent.context)
|
agent.context)
|
||||||
|
|
||||||
def test_process_router_if_compatible_w_no_ext_net_and_2_net_plugin(self):
|
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)
|
agent = l3_agent.L3NATAgent(HOSTNAME, self.conf)
|
||||||
|
|
||||||
router = {'id': _uuid(),
|
router = {'id': _uuid(),
|
||||||
|
@ -107,9 +107,6 @@ class TestDvrFipNs(base.BaseTestCase):
|
|||||||
self.fip_ns.create_or_update_gateway_port(agent_gw_port)
|
self.fip_ns.create_or_update_gateway_port(agent_gw_port)
|
||||||
self.assertTrue(fip_create.called)
|
self.assertTrue(fip_create.called)
|
||||||
self.assertEqual(1, self.driver.plug.call_count)
|
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)
|
self.assertEqual(1, self.driver.init_l3.call_count)
|
||||||
interface_name = self.fip_ns.get_ext_device_name(agent_gw_port['id'])
|
interface_name = self.fip_ns.get_ext_device_name(agent_gw_port['id'])
|
||||||
gw_cidrs = [sn['cidr'] for sn in agent_gw_port['subnets']
|
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)
|
exists.assert_called_once_with(self.fip_ns.name)
|
||||||
delete.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()
|
ns_name = self.fip_ns.get_name()
|
||||||
self.driver.unplug.assert_called_once_with('fg-aaaa',
|
self.driver.unplug.assert_called_once_with('fg-aaaa',
|
||||||
bridge=ext_net_bridge,
|
|
||||||
prefix='fg-',
|
prefix='fg-',
|
||||||
namespace=ns_name)
|
namespace=ns_name)
|
||||||
ip_wrapper.del_veth.assert_called_once_with('fpr-aaaa')
|
ip_wrapper.del_veth.assert_called_once_with('fpr-aaaa')
|
||||||
|
@ -564,9 +564,9 @@ class TestDvrRouterOperations(base.BaseTestCase):
|
|||||||
'foo_router_id',
|
'foo_router_id',
|
||||||
{'distributed': True, 'gw_port_host': HOSTNAME})
|
{'distributed': True, 'gw_port_host': HOSTNAME})
|
||||||
ri = dvr_router.DvrLocalRouter(HOSTNAME, **self.ri_kwargs)
|
ri = dvr_router.DvrLocalRouter(HOSTNAME, **self.ri_kwargs)
|
||||||
with mock.patch.object(l3_agent.ip_lib, 'IPDevice') as f:
|
ri.get_internal_device_name = mock.Mock()
|
||||||
ri._update_arp_entry(mock.ANY, mock.ANY, 'foo_subnet_id', 'add')
|
ri._update_arp_entry(mock.ANY, mock.ANY, 'foo_subnet_id', 'add')
|
||||||
self.assertFalse(f.call_count)
|
self.assertFalse(ri.get_internal_device_name.call_count)
|
||||||
|
|
||||||
def _setup_test_for_arp_entry_cache(self):
|
def _setup_test_for_arp_entry_cache(self):
|
||||||
agent = l3_agent.L3NATAgent(HOSTNAME, self.conf)
|
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):
|
def test__update_arp_entry_calls_arp_cache_with_no_device(self):
|
||||||
ri, subnet_id = self._setup_test_for_arp_entry_cache()
|
ri, subnet_id = self._setup_test_for_arp_entry_cache()
|
||||||
state = True
|
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:
|
mock.patch.object(ri, '_cache_arp_entry') as arp_cache:
|
||||||
rtrdev.return_value.exists.return_value = False
|
rtrdev.return_value.exists.return_value = False
|
||||||
state = ri._update_arp_entry(
|
state = ri._update_arp_entry(
|
||||||
|
@ -37,7 +37,6 @@ class TestDebugCommands(base.BaseTestCase):
|
|||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestDebugCommands, self).setUp()
|
super(TestDebugCommands, self).setUp()
|
||||||
config.register_interface_opts()
|
config.register_interface_opts()
|
||||||
cfg.CONF.register_opts(config.EXT_NET_BRIDGE_OPTS)
|
|
||||||
common_config.init([])
|
common_config.init([])
|
||||||
config.register_interface_driver_opts_helper(cfg.CONF)
|
config.register_interface_driver_opts_helper(cfg.CONF)
|
||||||
|
|
||||||
@ -132,7 +131,6 @@ class TestDebugCommands(base.BaseTestCase):
|
|||||||
'fake_port',
|
'fake_port',
|
||||||
'tap12345678-12',
|
'tap12345678-12',
|
||||||
'aa:bb:cc:dd:ee:ffa',
|
'aa:bb:cc:dd:ee:ffa',
|
||||||
bridge=None,
|
|
||||||
namespace=namespace),
|
namespace=namespace),
|
||||||
mock.call.init_l3('tap12345678-12',
|
mock.call.init_l3('tap12345678-12',
|
||||||
['10.0.0.3/24'],
|
['10.0.0.3/24'],
|
||||||
@ -177,7 +175,6 @@ class TestDebugCommands(base.BaseTestCase):
|
|||||||
'fake_port',
|
'fake_port',
|
||||||
'tap12345678-12',
|
'tap12345678-12',
|
||||||
'aa:bb:cc:dd:ee:ffa',
|
'aa:bb:cc:dd:ee:ffa',
|
||||||
bridge='',
|
|
||||||
namespace=namespace),
|
namespace=namespace),
|
||||||
mock.call.init_l3('tap12345678-12',
|
mock.call.init_l3('tap12345678-12',
|
||||||
['10.0.0.3/24'],
|
['10.0.0.3/24'],
|
||||||
@ -200,13 +197,10 @@ class TestDebugCommands(base.BaseTestCase):
|
|||||||
cmd.run(parsed_args)
|
cmd.run(parsed_args)
|
||||||
namespace = 'qprobe-fake_port'
|
namespace = 'qprobe-fake_port'
|
||||||
self.client.assert_has_calls([mock.call.show_port('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')])
|
mock.call.delete_port('fake_port')])
|
||||||
self.driver.assert_has_calls([mock.call.get_device_name(mock.ANY),
|
self.driver.assert_has_calls([mock.call.get_device_name(mock.ANY),
|
||||||
mock.call.unplug('tap12345678-12',
|
mock.call.unplug('tap12345678-12',
|
||||||
namespace=namespace,
|
namespace=namespace)])
|
||||||
bridge=None)])
|
|
||||||
|
|
||||||
def test_delete_probe_external(self):
|
def test_delete_probe_external(self):
|
||||||
fake_network = {'network': {'id': 'fake_net',
|
fake_network = {'network': {'id': 'fake_net',
|
||||||
@ -221,13 +215,10 @@ class TestDebugCommands(base.BaseTestCase):
|
|||||||
cmd.run(parsed_args)
|
cmd.run(parsed_args)
|
||||||
namespace = 'qprobe-fake_port'
|
namespace = 'qprobe-fake_port'
|
||||||
self.client.assert_has_calls([mock.call.show_port('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')])
|
mock.call.delete_port('fake_port')])
|
||||||
self.driver.assert_has_calls([mock.call.get_device_name(mock.ANY),
|
self.driver.assert_has_calls([mock.call.get_device_name(mock.ANY),
|
||||||
mock.call.unplug('tap12345678-12',
|
mock.call.unplug('tap12345678-12',
|
||||||
namespace=namespace,
|
namespace=namespace)])
|
||||||
bridge='')])
|
|
||||||
|
|
||||||
def test_list_probe(self):
|
def test_list_probe(self):
|
||||||
cmd = commands.ListProbe(self.app, None)
|
cmd = commands.ListProbe(self.app, None)
|
||||||
@ -263,13 +254,10 @@ class TestDebugCommands(base.BaseTestCase):
|
|||||||
device_owner=[debug_agent.DEVICE_OWNER_NETWORK_PROBE,
|
device_owner=[debug_agent.DEVICE_OWNER_NETWORK_PROBE,
|
||||||
debug_agent.DEVICE_OWNER_COMPUTE_PROBE]),
|
debug_agent.DEVICE_OWNER_COMPUTE_PROBE]),
|
||||||
mock.call.show_port('fake_port'),
|
mock.call.show_port('fake_port'),
|
||||||
mock.call.show_network('fake_net'),
|
|
||||||
mock.call.show_subnet('fake_subnet'),
|
|
||||||
mock.call.delete_port('fake_port')])
|
mock.call.delete_port('fake_port')])
|
||||||
self.driver.assert_has_calls([mock.call.get_device_name(mock.ANY),
|
self.driver.assert_has_calls([mock.call.get_device_name(mock.ANY),
|
||||||
mock.call.unplug('tap12345678-12',
|
mock.call.unplug('tap12345678-12',
|
||||||
namespace=namespace,
|
namespace=namespace)])
|
||||||
bridge=None)])
|
|
||||||
|
|
||||||
def test_ping_all_with_ensure_port(self):
|
def test_ping_all_with_ensure_port(self):
|
||||||
fake_ports = self.fake_ports
|
fake_ports = self.fake_ports
|
||||||
|
@ -4111,8 +4111,7 @@ class L3NatDBIntAgentSchedulingTestCase(L3BaseForIntTests,
|
|||||||
host='host1',
|
host='host1',
|
||||||
ext_net_id=s1['subnet']['network_id'])
|
ext_net_id=s1['subnet']['network_id'])
|
||||||
helpers.register_l3_agent(
|
helpers.register_l3_agent(
|
||||||
host='host2', internal_only=False,
|
host='host2', internal_only=False, ext_net_id='')
|
||||||
ext_net_id='', ext_bridge='')
|
|
||||||
l3_rpc_cb.get_router_ids(self.adminContext,
|
l3_rpc_cb.get_router_ids(self.adminContext,
|
||||||
host='host1')
|
host='host1')
|
||||||
self._assert_router_on_agent(r['router']['id'], 'host1')
|
self._assert_router_on_agent(r['router']['id'], 'host1')
|
||||||
|
@ -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.
|
Loading…
Reference in New Issue
Block a user