diff --git a/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_neutron_agent.py b/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_neutron_agent.py index 46574cd5e25..50987c02852 100644 --- a/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_neutron_agent.py +++ b/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_neutron_agent.py @@ -981,8 +981,11 @@ class OVSNeutronAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin, self.int_br.set_secure_mode() self.int_br.setup_controllers(self.conf) - self.int_br.delete_port(self.conf.OVS.int_peer_patch_port) if self.conf.AGENT.drop_flows_on_start: + # Delete the patch port between br-int and br-tun if we're deleting + # the flows on br-int, so that traffic doesn't get flooded over + # while flows are missing. + self.int_br.delete_port(self.conf.OVS.int_peer_patch_port) self.int_br.delete_flows() self.int_br.setup_default_table() diff --git a/neutron/tests/functional/agent/test_l2_ovs_agent.py b/neutron/tests/functional/agent/test_l2_ovs_agent.py index 7e9a5930e75..2d983844e39 100644 --- a/neutron/tests/functional/agent/test_l2_ovs_agent.py +++ b/neutron/tests/functional/agent/test_l2_ovs_agent.py @@ -227,6 +227,17 @@ class TestOVSAgent(base.OVSAgentTestFramework): self.agent.setup_integration_br() time.sleep(0.25) + def test_assert_patch_port_ofports_dont_change(self): + # When the integration bridge is setup, it should reuse the existing + # patch ports between br-int and br-tun. + self.setup_agent_and_ports(port_dicts=[], create_tunnels=True) + patch_int_ofport_before = self.agent.patch_int_ofport + patch_tun_ofport_before = self.agent.patch_tun_ofport + + self.setup_agent_and_ports(port_dicts=[], create_tunnels=True) + self.assertEqual(patch_int_ofport_before, self.agent.patch_int_ofport) + self.assertEqual(patch_tun_ofport_before, self.agent.patch_tun_ofport) + def test_noresync_after_port_gone(self): '''This will test the scenario where a port is removed after listing it but before getting vif info about it. diff --git a/neutron/tests/unit/plugins/ml2/drivers/openvswitch/agent/test_ovs_tunnel.py b/neutron/tests/unit/plugins/ml2/drivers/openvswitch/agent/test_ovs_tunnel.py index 7f43246494e..8d3f9b9e761 100644 --- a/neutron/tests/unit/plugins/ml2/drivers/openvswitch/agent/test_ovs_tunnel.py +++ b/neutron/tests/unit/plugins/ml2/drivers/openvswitch/agent/test_ovs_tunnel.py @@ -182,7 +182,6 @@ class TunnelTest(object): mock.call.create(), mock.call.set_secure_mode(), mock.call.setup_controllers(mock.ANY), - mock.call.delete_port('patch-tun'), mock.call.setup_default_table(), ] @@ -628,7 +627,6 @@ class TunnelTestUseVethInterco(TunnelTest): mock.call.create(), mock.call.set_secure_mode(), mock.call.setup_controllers(mock.ANY), - mock.call.delete_port('patch-tun'), mock.call.setup_default_table(), ]