It is useful to allow the backend to specify the uuid that we want neutron to
use. We currently do this same thing for networks. This patch enables the same
behavior for routers as well.
Change-Id: If675dfd2997217886976301270ef5f773ffa7a13
with context.session.begin(subtransactions=True):
# pre-generate id so it will be available when
# configuring external gw port
- router_db = Router(id=uuidutils.generate_uuid(),
+ router_db = Router(id=(router.get('id') or
+ uuidutils.generate_uuid()),
tenant_id=tenant_id,
name=router['name'],
admin_state_up=router['admin_state_up'],
floating_ip='10.0.0.10',
http_status=exc.HTTPConflict.code)
+ def test_router_specify_id_backend(self):
+ plugin = manager.NeutronManager.get_service_plugins()[
+ service_constants.L3_ROUTER_NAT]
+ router_req = {'router': {'id': _uuid(), 'name': 'router',
+ 'admin_state_up': True}}
+ result = plugin.create_router(context.Context('', 'foo'), router_req)
+ self.assertEqual(result['id'], router_req['router']['id'])
+
class L3AgentDbTestCaseBase(L3NatTestCaseMixin):