'Allow transition only when admin_state_up=False'

def _validate_router_migration(self, context, router_db, router_res):

    original_distributed_state = router_db.extra_attributes.distributed
    requested_distributed_state = router_res.get('distributed', None)
    distributed_changed = ((requested_distributed_state is not None) and (requested_distributed_state != original_distributed_state))
    if (not distributed_changed):
        return False
    if router_db.admin_state_up:
        msg = _("Cannot    change    the    'distributed'    attribute    of    active    routers.    Please    set    router    admin_state_up    to    False    prior    to    upgrade")
        raise n_exc.BadRequest(resource='router', msg=msg)
    try:
        kwargs = {'context': context, 'router': router_db}
        registry.notify(resources.ROUTER, events.BEFORE_UPDATE, self, **kwargs)
    except exceptions.CallbackFailure as e:
        if (len(e.errors) == 1):
            raise e.errors[0].error
        raise l3.RouterInUse(router_id=router_db['id'], reason=e)
    return True
