Beispiel #1
0
def _check_fwg(context, fwg_id):
    try:
        fwg = fwg_plugin.get_firewall_group(context, id=fwg_id)
    except orm_exc.NoResultFound:
        raise log_exc.ResourceNotFound(resource_id=fwg_id)

    if fwg['status'] != nl_const.ACTIVE:
        raise fwg_log_exc.FWGIsNotReadyForLogging(
            fwg_id=fwg_id, fwg_status=fwg['status'])
def _check_sg_exists(context, sg_id):
    if sg_object.SecurityGroup.count(context, id=sg_id) < 1:
        raise log_exc.ResourceNotFound(resource_id=sg_id)
Beispiel #3
0
def _get_router(context, router_id):
    router_obj = router.Router.get_object(context, id=router_id)
    if not router_obj:
        raise log_exc.ResourceNotFound(resource_id=router_id)
    return router_obj
Beispiel #4
0
def _check_secgroup_exists(context, sg_id):
    number_of_matching = sg_object.SecurityGroup.count(context, id=sg_id)
    if number_of_matching < 1:
        raise log_exc.ResourceNotFound(resource_id=sg_id)