From 252a83890abfb825497f308147aeafc6ee1e0731 Mon Sep 17 00:00:00 2001 From: Kyle Mestery Date: Fri, 21 Mar 2014 09:41:31 +0000 Subject: [PATCH] Don't set priority when calling mod_flow This commit [1] changed the behavior of modifying flows to not allow priority to be set on flow modification. The agent code which was calling mod_flow was not updated to respect this behavior. The unit tests were also not updated in this regard. I've corrected this behavior now, and added a negative UT case to catch this in the future. [1] https://review.openstack.org/#/c/58533/ Closes-Bug: #1295703 Change-Id: I20737637cc84567a5ec19efaad18e7f334007f18 --- neutron/plugins/openvswitch/agent/ovs_neutron_agent.py | 4 ---- neutron/tests/unit/openvswitch/test_ovs_lib.py | 8 ++++++++ neutron/tests/unit/openvswitch/test_ovs_neutron_agent.py | 2 -- neutron/tests/unit/openvswitch/test_ovs_tunnel.py | 1 - 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/neutron/plugins/openvswitch/agent/ovs_neutron_agent.py b/neutron/plugins/openvswitch/agent/ovs_neutron_agent.py index b072c2659..3081f8798 100644 --- a/neutron/plugins/openvswitch/agent/ovs_neutron_agent.py +++ b/neutron/plugins/openvswitch/agent/ovs_neutron_agent.py @@ -371,7 +371,6 @@ class OVSNeutronAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin, lvm.tun_ofports.add(ofport) ofports = ','.join(lvm.tun_ofports) self.tun_br.mod_flow(table=constants.FLOOD_TO_TUN, - priority=1, dl_vlan=lvm.vlan, actions="strip_vlan,set_tunnel:%s," "output:%s" % (lvm.segmentation_id, ofports)) @@ -390,7 +389,6 @@ class OVSNeutronAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin, if len(lvm.tun_ofports) > 0: ofports = ','.join(lvm.tun_ofports) self.tun_br.mod_flow(table=constants.FLOOD_TO_TUN, - priority=1, dl_vlan=lvm.vlan, actions="strip_vlan," "set_tunnel:%s,output:%s" % @@ -452,7 +450,6 @@ class OVSNeutronAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin, ofports = ','.join(self.tun_br_ofports[network_type].values()) if ofports: self.tun_br.mod_flow(table=constants.FLOOD_TO_TUN, - priority=1, dl_vlan=lvid, actions="strip_vlan," "set_tunnel:%s,output:%s" % @@ -927,7 +924,6 @@ class OVSNeutronAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin, for network_id, vlan_mapping in self.local_vlan_map.iteritems(): if vlan_mapping.network_type == tunnel_type: self.tun_br.mod_flow(table=constants.FLOOD_TO_TUN, - priority=1, dl_vlan=vlan_mapping.vlan, actions="strip_vlan," "set_tunnel:%s,output:%s" % diff --git a/neutron/tests/unit/openvswitch/test_ovs_lib.py b/neutron/tests/unit/openvswitch/test_ovs_lib.py index fccd34171..56a085972 100644 --- a/neutron/tests/unit/openvswitch/test_ovs_lib.py +++ b/neutron/tests/unit/openvswitch/test_ovs_lib.py @@ -359,6 +359,14 @@ class OVS_Lib_Test(base.BaseTestCase): self.br.delete_flows, **params) + def test_mod_flow_with_priority_set(self): + params = {'in_port': '1', + 'priority': '1'} + + self.assertRaises(exceptions.InvalidInput, + self.br.mod_flow, + **params) + def test_mod_flow_no_actions_set(self): params = {'in_port': '1'} diff --git a/neutron/tests/unit/openvswitch/test_ovs_neutron_agent.py b/neutron/tests/unit/openvswitch/test_ovs_neutron_agent.py index dc6723cf6..b2415a6d5 100644 --- a/neutron/tests/unit/openvswitch/test_ovs_neutron_agent.py +++ b/neutron/tests/unit/openvswitch/test_ovs_neutron_agent.py @@ -602,7 +602,6 @@ class TestOvsNeutronAgent(base.BaseTestCase): actions='strip_vlan,' 'set_tunnel:seg1,output:2') mod_flow_fn.assert_called_with(table=constants.FLOOD_TO_TUN, - priority=1, dl_vlan='vlan1', actions='strip_vlan,' 'set_tunnel:seg1,output:1,2') @@ -625,7 +624,6 @@ class TestOvsNeutronAgent(base.BaseTestCase): dl_vlan='vlan2', dl_dst='mac') mod_flow_fn.assert_called_with(table=constants.FLOOD_TO_TUN, - priority=1, dl_vlan='vlan2', actions='strip_vlan,' 'set_tunnel:seg2,output:1') diff --git a/neutron/tests/unit/openvswitch/test_ovs_tunnel.py b/neutron/tests/unit/openvswitch/test_ovs_tunnel.py index 8de601a04..fa1b11017 100644 --- a/neutron/tests/unit/openvswitch/test_ovs_tunnel.py +++ b/neutron/tests/unit/openvswitch/test_ovs_tunnel.py @@ -262,7 +262,6 @@ class TunnelTest(base.BaseTestCase): ofports = ','.join(TUN_OFPORTS[p_const.TYPE_GRE].values()) self.mock_tun_bridge_expected += [ mock.call.mod_flow(table=constants.FLOOD_TO_TUN, - priority=1, dl_vlan=LV_ID, actions="strip_vlan," "set_tunnel:%s,output:%s" %