Example #1
0
def do_nst_selection():
    request_json = request.get_json()
    req_id = request_json['requestInfo']['requestId']
    audit_log.info(MH.received_request(request.url, request.remote_addr, json.dumps(request_json)))
    NSTSelectionAPI(request_json).validate()
    audit_log.info(MH.new_worker_thread(req_id, "[for NST selection]"))
    nst_selection = NstSelection(osdf_config, request_json)
    nst_selection.start()
    return req_accept(request_id=req_id,
                      transaction_id=request_json['requestInfo']['transactionId'],
                      request_status="accepted", status_message="")
Example #2
0
def do_nssi_selection():
    request_json = request.get_json()
    req_id = request_json['requestInfo']['requestId']
    g.request_id = req_id
    audit_log.info(MH.received_request(request.url, request.remote_addr, json.dumps(request_json)))
    NSSISelectionAPI(request_json).validate()
    audit_log.info(MH.new_worker_thread(req_id, "[for NSSI selection]"))
    slice_opt = SliceSelectionOptimizer(osdf_config, slice_config, request_json, 'NSSI')
    slice_opt.start()
    return req_accept(request_id=req_id,
                      transaction_id=request_json['requestInfo']['transactionId'],
                      request_status="accepted", status_message="")
Example #3
0
def placement_rest_api():
    """Perform placement optimization after validating the request and fetching policies
    Make a call to the call-back URL with the output of the placement request.
    Note: Call to Conductor for placement optimization may have redirects, so account for them
    """
    request_json = request.get_json()
    req_id = request_json['requestInfo']['requestId']
    g.request_id = req_id
    audit_log.info(MH.received_request(request.url, request.remote_addr, json.dumps(request_json)))
    api_version_info = api_data_utils.retrieve_version_info(request, req_id)
    PlacementAPI(request_json).validate()
    policies = get_policies(request_json, "placement")
    audit_log.info(MH.new_worker_thread(req_id, "[for placement]"))
    t = Thread(target=process_placement_opt, args=(request_json, policies, osdf_config))
    t.start()
    audit_log.info(MH.accepted_valid_request(req_id, request))
    return req_accept(request_id=req_id,
                      transaction_id=request_json['requestInfo']['transactionId'],
                      version_info=api_version_info, request_status="accepted", status_message="")
Example #4
0
def do_pci_optimization():
    request_json = request.get_json()
    audit_log.info('request json obtained==>')
    audit_log.info(request_json)

    req_id = request_json['requestInfo']['requestId']
    audit_log.info('requestID obtained==>')
    audit_log.info(req_id)

    g.request_id = req_id
    audit_log.info(MH.received_request(request.url, request.remote_addr, json.dumps(request_json)))
    PCIOptimizationAPI(request_json).validate()
    # disable policy retrieval
    # policies = get_policies(request_json, "pciopt")
    audit_log.info(MH.new_worker_thread(req_id, "[for pciopt]"))
    t = Thread(target=process_pci_optimation, args=(request_json, osdf_config, None))
    t.start()
    audit_log.info(MH.accepted_valid_request(req_id, request))
    audit_log.info('reached upto return')
    return req_accept(request_id=req_id,
                      transaction_id=request_json['requestInfo']['transactionId'],
                      request_status="accepted", status_message="")