]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
ML2: Make get_device_details report mac address as well
authorYAMAMOTO Takashi <yamamoto@valinux.co.jp>
Wed, 30 Apr 2014 05:39:10 +0000 (14:39 +0900)
committerYAMAMOTO Takashi <yamamoto@valinux.co.jp>
Wed, 13 Aug 2014 23:35:31 +0000 (08:35 +0900)
This will be used by ofagent to route packets to local VMs.

Partially-implements: blueprint ofagent-merge-bridges
Change-Id: Icaa26448a370dd75d09e95ed439df5b486a862cf

neutron/plugins/ml2/rpc.py
neutron/tests/unit/ml2/test_port_binding.py

index ae447fa8e431d08d7cd03654652d8d5d34313961..18338b042583fd95189780efe9e07c5b3ff06bb9 100644 (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],
index b4aa19a9ca66c480df185892d11649a6a6de4681..3f3c4b20533295f23e5f4fa48f8c25929cb9bfb9 100644 (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("",