Merge "Pass correct port ID back to RPC caller"

This commit is contained in:
Jenkins 2015-04-15 09:42:47 +00:00 committed by Gerrit Code Review
commit 3d5564c6a1
2 changed files with 16 additions and 1 deletions

View File

@ -106,7 +106,7 @@ class RpcCallbacks(type_tunnel.TunnelRpcCallbackMixin):
entry = {'device': device,
'network_id': port['network_id'],
'port_id': port_id,
'port_id': port['id'],
'mac_address': port['mac_address'],
'admin_state_up': port['admin_state_up'],
'network_type': segment[api.NETWORK_TYPE],

View File

@ -781,6 +781,21 @@ class TestL2PopulationRpcTestCase(test_plugin.Ml2PluginV2TestCase):
self.assertFalse(mock_fanout.called)
fanout_patch.stop()
def test_get_device_details_port_id(self):
self._register_ml2_agents()
host_arg = {portbindings.HOST_ID: L2_AGENT['host']}
with self.port(arg_list=(portbindings.HOST_ID,),
**host_arg) as port:
port_id = port['port']['id']
# ensure various formats all result in correct port_id
formats = ['tap' + port_id[0:8], port_id,
port['port']['mac_address']]
for device in formats:
details = self.callbacks.get_device_details(
self.adminContext, device=device,
agent_id=L2_AGENT_2['host'])
self.assertEqual(port_id, details['port_id'])
def test_host_changed(self):
self._register_ml2_agents()
with self.subnet(network=self._network) as subnet: