Exemplo n.º 1
0
def terminate_ns(nfvo_id, ns_id):
    try:
        driver = manager.get_driver(nfvo_id, database)
        empty_body, headers = driver.terminate_ns(ns_id,
                                                  args={
                                                      'payload':
                                                      request.json,
                                                      'args':
                                                      request.args.to_dict()
                                                  })
        return make_response('', 202, headers)
    except BadRequest as e:
        abort(400, description=e.description)
    except Unauthorized as e:
        abort(401, description=e.description)
    except Forbidden as e:
        abort(403, description=e.description)
    except (NfvoNotFound, NfvoCredentialsNotFound, NsNotFound) as e:
        abort(404, description=e.description)
    except Conflict as e:
        abort(409, description=e.description)
    except Unprocessable as e:
        abort(422, description=e.description)
    except ServerError as e:
        abort(500, description=e.description)
Exemplo n.º 2
0
def get_ns_list(nfvo_id):
    try:
        driver = manager.get_driver(nfvo_id, database)
        ns_list, headers = driver.get_ns_list(
            args={'args': request.args.to_dict()})
        return make_response(jsonify(ns_list), 200, headers)
    except BadRequest as e:
        abort(400, description=e.description)
    except Unauthorized as e:
        abort(401, description=e.description)
    except (NfvoNotFound, NfvoCredentialsNotFound) as e:
        abort(404, description=e.description)
    except ServerError as e:
        abort(500, description=e.description)
Exemplo n.º 3
0
def delete_ns(nfvo_id, ns_id):
    try:
        driver = manager.get_driver(nfvo_id, database)
        empty_body, headers = driver.delete_ns(
            ns_id, args={'args': request.args.to_dict()})
        return make_response('', 204, headers)
    except BadRequest as e:
        abort(400, description=e.description)
    except Unauthorized as e:
        abort(401, description=e.description)
    except (NfvoNotFound, NfvoCredentialsNotFound) as e:
        abort(404, description=e.description)
    except NsNotFound as e:
        abort(404, description=e.description)
    except ServerError as e:
        abort(500, description=e.description)