From 7baeff219fe2af0c8789d7f35bac4fadcbf2ea06 Mon Sep 17 00:00:00 2001 From: shihanzhang Date: Fri, 30 Dec 2016 14:23:12 +0800 Subject: [PATCH] Change the order of installing flows for br-int For ovs-agent, it uses CANARY_TABLE table to check ovs status, when ovs-agent restarts, it should firstly install flows for CANARY_TABLE table. Closes-bug: #1642223 Change-Id: I2aebbe5faca2fd4ec137255f0413cc2c129a4588 (cherry picked from commit 0af6e6ded04c994b788836906d94fe097b581a0b) --- .../openvswitch/agent/openflow/native/br_int.py | 2 +- .../openvswitch/agent/openflow/ovs_ofctl/br_int.py | 2 +- .../openvswitch/agent/openflow/native/test_br_int.py | 12 ++++++------ .../agent/openflow/ovs_ofctl/test_br_int.py | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/neutron/plugins/ml2/drivers/openvswitch/agent/openflow/native/br_int.py b/neutron/plugins/ml2/drivers/openvswitch/agent/openflow/native/br_int.py index 5ac90784df3..fe59d2ee4cc 100644 --- a/neutron/plugins/ml2/drivers/openvswitch/agent/openflow/native/br_int.py +++ b/neutron/plugins/ml2/drivers/openvswitch/agent/openflow/native/br_int.py @@ -40,8 +40,8 @@ class OVSIntegrationBridge(ovs_bridge.OVSAgentBridge): """openvswitch agent br-int specific logic.""" def setup_default_table(self): - self.install_normal() self.setup_canary_table() + self.install_normal() self.install_drop(table_id=constants.ARP_SPOOF_TABLE) def setup_canary_table(self): diff --git a/neutron/plugins/ml2/drivers/openvswitch/agent/openflow/ovs_ofctl/br_int.py b/neutron/plugins/ml2/drivers/openvswitch/agent/openflow/ovs_ofctl/br_int.py index 34b6b7de815..7ca488d49da 100644 --- a/neutron/plugins/ml2/drivers/openvswitch/agent/openflow/ovs_ofctl/br_int.py +++ b/neutron/plugins/ml2/drivers/openvswitch/agent/openflow/ovs_ofctl/br_int.py @@ -34,8 +34,8 @@ class OVSIntegrationBridge(ovs_bridge.OVSAgentBridge): """openvswitch agent br-int specific logic.""" def setup_default_table(self): - self.install_normal() self.setup_canary_table() + self.install_normal() self.install_drop(table_id=constants.ARP_SPOOF_TABLE) def setup_canary_table(self): diff --git a/neutron/tests/unit/plugins/ml2/drivers/openvswitch/agent/openflow/native/test_br_int.py b/neutron/tests/unit/plugins/ml2/drivers/openvswitch/agent/openflow/native/test_br_int.py index 13b56fb05ac..417822e6d1d 100644 --- a/neutron/tests/unit/plugins/ml2/drivers/openvswitch/agent/openflow/native/test_br_int.py +++ b/neutron/tests/unit/plugins/ml2/drivers/openvswitch/agent/openflow/native/test_br_int.py @@ -33,6 +33,12 @@ class OVSIntegrationBridgeTest(ovs_bridge_test_base.OVSBridgeTestBase): self.br.setup_default_table() (dp, ofp, ofpp) = self._get_dp() expected = [ + call._send_msg(ofpp.OFPFlowMod(dp, + cookie=self.stamp, + instructions=[], + match=ofpp.OFPMatch(), + priority=0, + table_id=23)), call._send_msg(ofpp.OFPFlowMod(dp, cookie=self.stamp, instructions=[ @@ -44,12 +50,6 @@ class OVSIntegrationBridgeTest(ovs_bridge_test_base.OVSBridgeTestBase): match=ofpp.OFPMatch(), priority=0, table_id=0)), - call._send_msg(ofpp.OFPFlowMod(dp, - cookie=self.stamp, - instructions=[], - match=ofpp.OFPMatch(), - priority=0, - table_id=23)), call._send_msg(ofpp.OFPFlowMod(dp, cookie=self.stamp, instructions=[], diff --git a/neutron/tests/unit/plugins/ml2/drivers/openvswitch/agent/openflow/ovs_ofctl/test_br_int.py b/neutron/tests/unit/plugins/ml2/drivers/openvswitch/agent/openflow/ovs_ofctl/test_br_int.py index 2f70f30014b..1587a2b740b 100644 --- a/neutron/tests/unit/plugins/ml2/drivers/openvswitch/agent/openflow/ovs_ofctl/test_br_int.py +++ b/neutron/tests/unit/plugins/ml2/drivers/openvswitch/agent/openflow/ovs_ofctl/test_br_int.py @@ -33,8 +33,8 @@ class OVSIntegrationBridgeTest(ovs_bridge_test_base.OVSBridgeTestBase): def test_setup_default_table(self): self.br.setup_default_table() expected = [ - call.add_flow(priority=0, table=0, actions='normal'), call.add_flow(priority=0, table=23, actions='drop'), + call.add_flow(priority=0, table=0, actions='normal'), call.add_flow(priority=0, table=24, actions='drop'), ] self.assertEqual(expected, self.mock.mock_calls)