From: YAMAMOTO Takashi Date: Wed, 30 Apr 2014 05:39:10 +0000 (+0900) Subject: ML2: Make get_device_details report mac address as well X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=b5a2da73bcbc58d3cb5d3d5fb97ddb16c75ec943;p=openstack-build%2Fneutron-build.git 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 --- diff --git a/neutron/plugins/ml2/rpc.py b/neutron/plugins/ml2/rpc.py index ae447fa8e..18338b042 100644 --- a/neutron/plugins/ml2/rpc.py +++ b/neutron/plugins/ml2/rpc.py @@ -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], diff --git a/neutron/tests/unit/ml2/test_port_binding.py b/neutron/tests/unit/ml2/test_port_binding.py index b4aa19a9c..3f3c4b205 100644 --- a/neutron/tests/unit/ml2/test_port_binding.py +++ b/neutron/tests/unit/ml2/test_port_binding.py @@ -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("",