From 0125cf7815acb677b619905e2d9d258a9bae1c48 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Mon, 11 Aug 2014 08:39:59 +0900 Subject: [PATCH] l2pop: get_agent_ports: Don't yield (None, {}) There's no point to yield None lvm with empty entries. Closes-Bug: #1355759 Related: blueprint ofagent-l2pop Change-Id: I42aeb48a062d35038116978d70c8dac4139a5583 --- neutron/agent/l2population_rpc.py | 4 +++- neutron/tests/unit/agent/test_l2population_rpc.py | 1 - 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/neutron/agent/l2population_rpc.py b/neutron/agent/l2population_rpc.py index b3dbc015e..93f6395dd 100644 --- a/neutron/agent/l2population_rpc.py +++ b/neutron/agent/l2population_rpc.py @@ -166,7 +166,9 @@ class L2populationRpcCallBackTunnelMixin(L2populationRpcCallBackMixin): def get_agent_ports(self, fdb_entries, local_vlan_map): for network_id, values in fdb_entries.items(): lvm = local_vlan_map.get(network_id) - agent_ports = values.get('ports') if lvm else {} + if lvm is None: + continue + agent_ports = values.get('ports') yield (lvm, agent_ports) @log.log diff --git a/neutron/tests/unit/agent/test_l2population_rpc.py b/neutron/tests/unit/agent/test_l2population_rpc.py index e6b626a22..5bb697c98 100644 --- a/neutron/tests/unit/agent/test_l2population_rpc.py +++ b/neutron/tests/unit/agent/test_l2population_rpc.py @@ -40,7 +40,6 @@ class TestL2populationRpcCallBackTunnelMixin( self.lvm1: { self.ports[0].ip: [[self.lvms[0].mac, self.lvms[0].ip]], self.local_ip: []}, - None: {}, self.lvm3: { self.ports[2].ip: [[self.lvms[2].mac, self.lvms[2].ip]], self.local_ip: []}, -- 2.45.2