Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,7 @@ def _unbind_port_on_dvr_subnet(self, port, lvm):
self.context, self.host, sub_uuid))
local_aap_macs = set()
for lport in local_compute_ports:
if lport.id != port.vif_id:
if lport['id'] != port.vif_id:
local_aap_macs.update({
aap["mac_address"] for aap in lport.get(
"allowed_address_pairs", [])})
Expand Down
5 changes: 3 additions & 2 deletions neutron/tests/fullstack/test_l3_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -566,8 +566,9 @@ def is_one_host_active_for_router():
netcat_udp.stop_processes()

# With the default advert_int of 2s the keepalived master timeout is
# about 6s. Assert less than 90 lost packets (9 seconds)
threshold = 90
# about 6s. Assert less than 90 lost packets (9 seconds) plus 30 to
# account for CI infrastructure variability
threshold = 120

lost = pinger.sent - pinger.received
message = (f'Sent {pinger.sent} packets, received {pinger.received} '
Expand Down
2 changes: 2 additions & 0 deletions neutron/tests/functional/agent/l3/test_dvr_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
from neutron.agent.linux import ip_lib
from neutron.agent.linux import iptables_manager
from neutron.common import utils
from neutron.tests import base as test_base
from neutron.tests.common import l3_test_common
from neutron.tests.common import machine_fixtures
from neutron.tests.common import net_helpers
Expand Down Expand Up @@ -2180,6 +2181,7 @@ def test_connection_from_diff_address_scope(self):
test_machine1.assert_no_ping(test_machine2.ip)
test_machine2.assert_no_ping(test_machine1.ip)

@test_base.unstable_test('bug 2115026')
def test_fip_connection_for_address_scope(self):
self.agent.conf.agent_mode = 'dvr_snat'
(machine_same_scope, machine_diff_scope,
Expand Down
15 changes: 12 additions & 3 deletions neutron/tests/functional/agent/ovsdb/native/test_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import threading

from oslo_utils import uuidutils
from ovsdbapp import event

from neutron.agent.common import ovs_lib
Expand All @@ -25,7 +26,7 @@ class WaitForBridgesEvent(event.RowEvent):
event_name = 'WaitForBridgesEvent'
ONETIME = True

def __init__(self, bridges, timeout=5):
def __init__(self, bridges, timeout=20):
self.bridges_not_seen = set(bridges)
self.timeout = timeout
self.event = threading.Event()
Expand All @@ -52,9 +53,17 @@ def _delete_bridges(self, bridges):
self.ovs.delete_bridge(bridge)

def test_create_bridges(self):
bridges_to_monitor = ['br01', 'br02', 'br03']
bridges_to_create = ['br01', 'br02', 'br03', 'br04', 'br05']
bridges_to_create = [
'br_' + uuidutils.generate_uuid()[:12],
'br_' + uuidutils.generate_uuid()[:12],
'br_' + uuidutils.generate_uuid()[:12],
'br_' + uuidutils.generate_uuid()[:12],
'br_' + uuidutils.generate_uuid()[:12],
]
bridges_to_monitor = bridges_to_create[:3]
self.ovs = ovs_lib.BaseOVS()
self._delete_bridges(bridges_to_create)

self.ovs.ovsdb.idl_monitor.start_bridge_monitor(bridges_to_monitor)
self.addCleanup(self._delete_bridges, bridges_to_create)
event = WaitForBridgesEvent(bridges_to_monitor)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4083,6 +4083,7 @@ def _test_treat_devices_removed_for_dvr(
self, device_owner, ip_version=n_const.IP_VERSION_4, aaps=False):
self._setup_for_dvr_test()
port_obj = {"id": "fake-port-uuid"}
local_port_obj = {"id": "fake-port-uuid"}
aap_mac = 'aa:bb:cc:dd:ee:ff'
aap_mac2 = 'aa:bb:cc:dd:ee:fe'
aap_mac3 = 'aa:bb:cc:dd:ee:fd'
Expand All @@ -4107,7 +4108,7 @@ def _test_treat_devices_removed_for_dvr(
'mac_address': aap_mac},
{'ip_address': '2001:100::11',
'mac_address': aap_mac2},
{'ip_address': '2001:100::0/0',
{'ip_address': '::/0',
'mac_address': aap_mac3}
]
self._port.dvr_mac = self.agent.dvr_agent.dvr_mac_address
Expand Down Expand Up @@ -4185,6 +4186,9 @@ def _test_treat_devices_removed_for_dvr(
self._compute_port.vif_id],
'failed_devices_up': [],
'failed_devices_down': []}),\
mock.patch.object(self.agent.dvr_agent.plugin_rpc,
'get_ports_on_host_by_subnet',
return_value=[local_port_obj]),\
mock.patch.object(self.agent.dvr_agent.plugin_rpc,
'get_ports',
return_value=[port_obj]),\
Expand Down Expand Up @@ -4223,6 +4227,11 @@ def test_treat_devices_removed_for_dvr_with_compute_ports(self):
device_owner=DEVICE_OWNER_COMPUTE)
self._test_treat_devices_removed_for_dvr(
device_owner=DEVICE_OWNER_COMPUTE, ip_version=n_const.IP_VERSION_6)
self._test_treat_devices_removed_for_dvr(
device_owner=DEVICE_OWNER_COMPUTE, aaps=True)
self._test_treat_devices_removed_for_dvr(
device_owner=DEVICE_OWNER_COMPUTE, ip_version=n_const.IP_VERSION_6,
aaps=True)

def test_treat_devices_removed_for_dvr_with_dhcp_ports(self):
self._test_treat_devices_removed_for_dvr(
Expand Down