Fix bad call in port_update in linuxbridge agent

A call to update_device_down() was made on the wrong object.
Also adds unit tests for code paths to update_device_down() and
update_device_up().

Partial-Bug: 1256950
Change-Id: I34e364d4c29441d0b62b665a4ce1d02b5d08d465
This commit is contained in:
Darragh O'Reilly 2013-12-02 12:49:50 +00:00
parent 36c0d99076
commit 15c9a7e148
2 changed files with 30 additions and 4 deletions

View File

@ -661,10 +661,12 @@ class LinuxBridgeRpcCallbacks(sg_rpc.SecurityGroupAgentRpcCallbackMixin,
self.agent.agent_id, self.agent.agent_id,
cfg.CONF.host) cfg.CONF.host)
else: else:
self.plugin_rpc.update_device_down(self.context, self.agent.plugin_rpc.update_device_down(
tap_device_name, self.context,
self.agent.agent_id, tap_device_name,
cfg.CONF.host) self.agent.agent_id,
cfg.CONF.host
)
else: else:
bridge_name = self.agent.br_mgr.get_bridge_name( bridge_name = self.agent.br_mgr.get_bridge_name(
port['network_id']) port['network_id'])

View File

@ -770,6 +770,30 @@ class TestLinuxBridgeRpcCallbacks(base.BaseTestCase):
addif_fn.assert_called_with(port["network_id"], lconst.TYPE_LOCAL, addif_fn.assert_called_with(port["network_id"], lconst.TYPE_LOCAL,
None, None, port["id"]) None, None, port["id"])
addif_fn.return_value = True
self.lb_rpc.port_update("unused_context", port=port,
network_type=lconst.TYPE_LOCAL,
segmentation_id=None,
physical_network=None)
rpc_obj.update_device_up.assert_called_with(
self.lb_rpc.context,
"tap123",
self.lb_rpc.agent.agent_id,
cfg.CONF.host
)
addif_fn.return_value = False
self.lb_rpc.port_update("unused_context", port=port,
network_type=lconst.TYPE_LOCAL,
segmentation_id=None,
physical_network=None)
rpc_obj.update_device_down.assert_called_with(
self.lb_rpc.context,
"tap123",
self.lb_rpc.agent.agent_id,
cfg.CONF.host
)
port["admin_state_up"] = False port["admin_state_up"] = False
port["security_groups"] = True port["security_groups"] = True
getbr_fn.return_value = "br0" getbr_fn.return_value = "br0"