From c5fafcb30a5b86e87309ad4650f7d05a2ca038dc Mon Sep 17 00:00:00 2001 From: Carl Baldwin Date: Fri, 8 Aug 2014 17:31:59 +0000 Subject: [PATCH] Remove unneeded device_owner field from l2pop tuple The DVR development added this device_owner to the middle of this tuple during early development because it was thought to be needed. Over the course of development, it was found to be unnecessary and much of the code that read it from this value was removed or obsoleted. That job went unfinished and so this commit completes it. This essentially restores the code to what it was before and fixes the regression that was caused. Change-Id: Ia901f925883b53e9880dd25688e16e0ffe402bf4 Partial-bug: #1352801 --- neutron/plugins/ml2/drivers/l2pop/mech_driver.py | 16 +++++++--------- .../openvswitch/agent/ovs_neutron_agent.py | 13 ++++++------- .../tests/unit/ml2/drivers/test_l2population.py | 15 --------------- 3 files changed, 13 insertions(+), 31 deletions(-) diff --git a/neutron/plugins/ml2/drivers/l2pop/mech_driver.py b/neutron/plugins/ml2/drivers/l2pop/mech_driver.py index 18141cd86..210586307 100644 --- a/neutron/plugins/ml2/drivers/l2pop/mech_driver.py +++ b/neutron/plugins/ml2/drivers/l2pop/mech_driver.py @@ -45,7 +45,7 @@ class L2populationMechanismDriver(api.MechanismDriver, self.remove_fdb_entries = {} def _get_port_fdb_entries(self, port): - return [[port['mac_address'], port['device_owner'], + return [[port['mac_address'], ip['ip_address']] for ip in port['fixed_ips']] def delete_port_precommit(self, context): @@ -93,19 +93,17 @@ class L2populationMechanismDriver(api.MechanismDriver, return agent, agent_host, agent_ip, segment, port_fdb_entries = port_infos - orig_mac_devowner_ip = [[port['mac_address'], port['device_owner'], ip] - for ip in orig_ips] - port_mac_devowner_ip = [[port['mac_address'], port['device_owner'], ip] - for ip in port_ips] + orig_mac_ip = [[port['mac_address'], ip] for ip in orig_ips] + port_mac_ip = [[port['mac_address'], ip] for ip in port_ips] upd_fdb_entries = {port['network_id']: {agent_ip: {}}} ports = upd_fdb_entries[port['network_id']][agent_ip] - if orig_mac_devowner_ip: - ports['before'] = orig_mac_devowner_ip + if orig_mac_ip: + ports['before'] = orig_mac_ip - if port_mac_devowner_ip: - ports['after'] = port_mac_devowner_ip + if port_mac_ip: + ports['after'] = port_mac_ip self.L2populationAgentNotify.update_fdb_entries( self.rpc_ctx, {'chg_ip': upd_fdb_entries}) diff --git a/neutron/plugins/openvswitch/agent/ovs_neutron_agent.py b/neutron/plugins/openvswitch/agent/ovs_neutron_agent.py index d373126cf..b176b9417 100644 --- a/neutron/plugins/openvswitch/agent/ovs_neutron_agent.py +++ b/neutron/plugins/openvswitch/agent/ovs_neutron_agent.py @@ -374,13 +374,12 @@ class OVSNeutronAgent(n_rpc.RpcCallback, else: self.setup_entry_for_arp_reply(br, 'add', lvm.vlan, port_info[0], port_info[1]) - if not self.dvr_agent.is_dvr_router_interface(port_info[1]): - br.add_flow(table=constants.UCAST_TO_TUN, - priority=2, - dl_vlan=lvm.vlan, - dl_dst=port_info[0], - actions="strip_vlan,set_tunnel:%s,output:%s" % - (lvm.segmentation_id, ofport)) + br.add_flow(table=constants.UCAST_TO_TUN, + priority=2, + dl_vlan=lvm.vlan, + dl_dst=port_info[0], + actions="strip_vlan,set_tunnel:%s,output:%s" % + (lvm.segmentation_id, ofport)) def del_fdb_flow(self, br, port_info, remote_ip, lvm, ofport): if port_info == q_const.FLOODING_ENTRY: diff --git a/neutron/tests/unit/ml2/drivers/test_l2population.py b/neutron/tests/unit/ml2/drivers/test_l2population.py index bffcaae50..12a88b83d 100644 --- a/neutron/tests/unit/ml2/drivers/test_l2population.py +++ b/neutron/tests/unit/ml2/drivers/test_l2population.py @@ -180,7 +180,6 @@ class TestL2PopulationRpcTestCase(test_plugin.NeutronDbPluginV2TestCase): {'ports': {'20.0.0.1': [constants.FLOODING_ENTRY, [p1['mac_address'], - p1['device_owner'], p1_ips[0]]]}, 'network_type': 'vxlan', 'segment_id': 1}}}, @@ -249,7 +248,6 @@ class TestL2PopulationRpcTestCase(test_plugin.NeutronDbPluginV2TestCase): {'ports': {'20.0.0.2': [constants.FLOODING_ENTRY, [p2['mac_address'], - p2['device_owner'], p2_ips[0]]]}, 'network_type': 'vxlan', 'segment_id': 1}}}, @@ -271,7 +269,6 @@ class TestL2PopulationRpcTestCase(test_plugin.NeutronDbPluginV2TestCase): {'ports': {'20.0.0.1': [constants.FLOODING_ENTRY, [p1['mac_address'], - p1['device_owner'], p1_ips[0]]]}, 'network_type': 'vxlan', 'segment_id': 1}}}, @@ -320,7 +317,6 @@ class TestL2PopulationRpcTestCase(test_plugin.NeutronDbPluginV2TestCase): {'20.0.0.2': [constants.FLOODING_ENTRY, [p1['mac_address'], - p1['device_owner'], p1_ips[0]]]}, 'network_type': 'vxlan', 'segment_id': 1}}}, @@ -345,7 +341,6 @@ class TestL2PopulationRpcTestCase(test_plugin.NeutronDbPluginV2TestCase): {'20.0.0.1': [constants.FLOODING_ENTRY, [p3['mac_address'], - p3['device_owner'], p3_ips[0]]]}, 'network_type': 'vxlan', 'segment_id': 1}}}, @@ -394,7 +389,6 @@ class TestL2PopulationRpcTestCase(test_plugin.NeutronDbPluginV2TestCase): {p2['network_id']: {'ports': {'20.0.0.1': [[p2['mac_address'], - p2['device_owner'], p2_ips[0]]]}, 'network_type': 'vxlan', 'segment_id': 1}}}, @@ -436,7 +430,6 @@ class TestL2PopulationRpcTestCase(test_plugin.NeutronDbPluginV2TestCase): {'ports': {'20.0.0.1': [constants.FLOODING_ENTRY, [p2['mac_address'], - p2['device_owner'], p2_ips[0]]]}, 'network_type': 'vxlan', 'segment_id': 1}}}, @@ -481,7 +474,6 @@ class TestL2PopulationRpcTestCase(test_plugin.NeutronDbPluginV2TestCase): {p2['network_id']: {'ports': {'20.0.0.1': [[p2['mac_address'], - p2['device_owner'], p2_ips[0]]]}, 'network_type': 'vxlan', 'segment_id': 1}}}, @@ -519,7 +511,6 @@ class TestL2PopulationRpcTestCase(test_plugin.NeutronDbPluginV2TestCase): {'ports': {'20.0.0.1': [constants.FLOODING_ENTRY, [p1['mac_address'], - p1['device_owner'], p1_ips[0]]]}, 'network_type': 'vxlan', 'segment_id': 1}}}, @@ -561,7 +552,6 @@ class TestL2PopulationRpcTestCase(test_plugin.NeutronDbPluginV2TestCase): {p1['network_id']: {'20.0.0.1': {'after': [[p1['mac_address'], - p1['device_owner'], '10.0.0.10']]}}}}}, 'namespace': None, 'method': 'update_fdb_entries'} @@ -584,10 +574,8 @@ class TestL2PopulationRpcTestCase(test_plugin.NeutronDbPluginV2TestCase): {p1['network_id']: {'20.0.0.1': {'before': [[p1['mac_address'], - p1['device_owner'], '10.0.0.10']], 'after': [[p1['mac_address'], - p1['device_owner'], '10.0.0.16']]}}}}}, 'namespace': None, 'method': 'update_fdb_entries'} @@ -609,7 +597,6 @@ class TestL2PopulationRpcTestCase(test_plugin.NeutronDbPluginV2TestCase): {p1['network_id']: {'20.0.0.1': {'before': [[p1['mac_address'], - p1['device_owner'], '10.0.0.2']]}}}}}, 'namespace': None, 'method': 'update_fdb_entries'} @@ -690,7 +677,6 @@ class TestL2PopulationRpcTestCase(test_plugin.NeutronDbPluginV2TestCase): {'ports': {'20.0.0.1': [constants.FLOODING_ENTRY, [p1['mac_address'], - p1['device_owner'], p1_ips[0]]]}, 'network_type': 'vxlan', 'segment_id': 1}}}, @@ -749,7 +735,6 @@ class TestL2PopulationRpcTestCase(test_plugin.NeutronDbPluginV2TestCase): {'ports': {'20.0.0.1': [constants.FLOODING_ENTRY, [p1['mac_address'], - p1['device_owner'], p1_ips[0]]]}, 'network_type': 'vxlan', 'segment_id': 1}}}, -- 2.45.2