ML2: Make get_device_details report mac address as well

This will be used by ofagent to route packets to local VMs.

Partially-implements: blueprint ofagent-merge-bridges
Change-Id: Icaa26448a370dd75d09e95ed439df5b486a862cf
This commit is contained in:
YAMAMOTO Takashi 2014-04-30 14:39:10 +09:00
parent 39ca279703
commit 515ce28bc2
2 changed files with 6 additions and 1 deletions

View File

@ -123,6 +123,7 @@ class RpcCallbacks(n_rpc.RpcCallback,
entry = {'device': device,
'network_id': port['network_id'],
'port_id': port_id,
'mac_address': port['mac_address'],
'admin_state_up': port['admin_state_up'],
'network_type': segment[api.NETWORK_TYPE],
'segmentation_id': segment[api.SEGMENTATION_ID],

View File

@ -55,7 +55,9 @@ class PortBindingTestCase(test_plugin.NeutronDbPluginV2TestCase):
def _test_port_binding(self, host, vif_type, has_port_filter, bound,
status=None):
host_arg = {portbindings.HOST_ID: host}
mac_address = 'aa:aa:aa:aa:aa:aa'
host_arg = {portbindings.HOST_ID: host,
'mac_address': mac_address}
with self.port(name='name', arg_list=(portbindings.HOST_ID,),
**host_arg) as port:
self._check_response(port['port'], vif_type, has_port_filter,
@ -66,8 +68,10 @@ class PortBindingTestCase(test_plugin.NeutronDbPluginV2TestCase):
neutron_context, agent_id="theAgentId", device=port_id)
if bound:
self.assertEqual(details['network_type'], 'local')
self.assertEqual(mac_address, details['mac_address'])
else:
self.assertNotIn('network_type', details)
self.assertNotIn('mac_address', details)
def test_unbound(self):
self._test_port_binding("",