From 66abc6e5392047d4919a95cbafc9282f6a14c684 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Tue, 1 Jul 2014 16:07:39 +0900 Subject: [PATCH] ofagent: Fix an argument mismatch bug in commit 9d13ea88 recently merged commit 9d13ea884bff749b3975acb5eb5630e5aca4a665 had an argument mismatch bug which causes the following crash. TypeError: _get_ports() takes exactly 2 arguments (1 given) this commit fixes it. Closes-Bug: #1336175 Change-Id: I46bb1fc1aebf06274bb226014e4a9bc5a83f98ac --- neutron/plugins/ofagent/agent/ofa_neutron_agent.py | 3 ++- neutron/tests/unit/ofagent/test_ofa_neutron_agent.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/neutron/plugins/ofagent/agent/ofa_neutron_agent.py b/neutron/plugins/ofagent/agent/ofa_neutron_agent.py index 28223a5e9..8083c6ce0 100644 --- a/neutron/plugins/ofagent/agent/ofa_neutron_agent.py +++ b/neutron/plugins/ofagent/agent/ofa_neutron_agent.py @@ -1089,7 +1089,8 @@ class OFANeutronAgent(n_rpc.RpcCallback, def treat_devices_added_or_updated(self, devices): resync = False - all_ports = dict((p.port_name, p) for p in self._get_ports()) + all_ports = dict((p.port_name, p) for p in + self._get_ports(self.int_br)) for device in devices: LOG.debug(_("Processing port %s"), device) if device not in all_ports: diff --git a/neutron/tests/unit/ofagent/test_ofa_neutron_agent.py b/neutron/tests/unit/ofagent/test_ofa_neutron_agent.py index 3413c22b1..4ac50390b 100644 --- a/neutron/tests/unit/ofagent/test_ofa_neutron_agent.py +++ b/neutron/tests/unit/ofagent/test_ofa_neutron_agent.py @@ -438,9 +438,10 @@ class TestOFANeutronAgent(OFAAgentTestCase): mock.patch.object(self.agent.plugin_rpc, 'update_device_up'), mock.patch.object(self.agent.plugin_rpc, 'update_device_down'), mock.patch.object(self.agent, func_name) - ) as (get_dev_fn, get_vif_func, upd_dev_up, upd_dev_down, func): + ) as (get_dev_fn, _get_ports, upd_dev_up, upd_dev_down, func): self.assertFalse(self.agent.treat_devices_added_or_updated( [port.port_name])) + _get_ports.assert_called_once_with(self.agent.int_br) return func.called def test_treat_devices_added_updated_ignores_invalid_ofport(self): -- 2.45.2