Merge "Allow L3 base to handle extensions on router creation"

This commit is contained in:
Jenkins 2014-06-08 16:32:26 +00:00 committed by Gerrit Code Review
commit 1dc8cc9a15
3 changed files with 14 additions and 3 deletions

View File

@ -137,7 +137,7 @@ class L3_NAT_db_mixin(l3.RouterPluginBase):
router_db = self._create_router_db(context, r, tenant_id, gw_info)
if gw_info:
self._update_router_gw_info(context, router_db['id'], gw_info)
return self._make_router_dict(router_db, process_extensions=False)
return self._make_router_dict(router_db)
def _update_router_db(self, context, router_id, data, gw_info):
"""Update the DB object and related gw info, if available."""

View File

@ -757,8 +757,7 @@ class MidonetPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
self._update_router_gw_info(context, router_db['id'],
gw_info)
router_data = self._make_router_dict(router_db,
process_extensions=False)
router_data = self._make_router_dict(router_db)
except Exception:
# Try removing the midonet router

View File

@ -520,6 +520,18 @@ class L3NatTestCaseBase(L3NatTestCaseMixin):
for k, v in expected_value:
self.assertEqual(router['router'][k], v)
def test_router_create_call_extensions(self):
self.extension_called = False
def _extend_router_dict_test_attr(*args, **kwargs):
self.extension_called = True
db_base_plugin_v2.NeutronDbPluginV2.register_dict_extend_funcs(
l3.ROUTERS, [_extend_router_dict_test_attr])
self.assertFalse(self.extension_called)
with self.router():
self.assertTrue(self.extension_called)
def test_router_create_with_gwinfo(self):
with self.subnet() as s:
self._set_net_external(s['subnet']['network_id'])