'Associates a router with a service provider.
Association is done by flavor_id if it\'s specified, otherwise it will
fallback to determining which loaded driver supports the ha/distributed
attributes associated with the router.'

@registry.receives(resources.ROUTER, [events.PRECOMMIT_CREATE])
def _set_router_provider(self, resource, event, trigger, context, router, router_db, **kwargs):

    if _flavor_specified(router):
        router_db.flavor_id = router['flavor_id']
    drv = self._get_provider_for_create(context, router)
    self._stm.add_resource_association(context, plugin_constants.L3, drv.name, router['id'])
