Allow L3 base to handle extensions on router creation
By changing the boolean flag, API extensions made to the router model can be handled correctly: this means that on router creation, the response body will contain all the extension attributes being part of the resource. Prior to this fix, it was only on GETs or PUTs, leaving the user at loss as to whether the flag was actually being processed. Closes-bug: #1325608 Supports-blueprint: neutron-ovs-dvr Change-Id: I6f913c8417676a789177e00f30eb5875e7aaa3ae
This commit is contained in:
parent
8e0d33e23b
commit
0371b33e95
@ -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."""
|
||||
|
@ -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
|
||||
|
@ -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'])
|
||||
|
Loading…
x
Reference in New Issue
Block a user