diff options
Diffstat (limited to 'osdfapp.py')
-rwxr-xr-x | osdfapp.py | 17 |
1 files changed, 11 insertions, 6 deletions
@@ -37,16 +37,18 @@ from apps.placement.optimizers.conductor.remote_opt_processor import process_pla from apps.route.optimizers.inter_domain_route_opt import InterDomainRouteOpt from apps.route.optimizers.simple_route_opt import RouteOpt from apps.slice_selection.models.api.nsi_selection_request import NSISelectionAPI -from apps.slice_selection.optimizers.conductor.remote_opt_processor import process_nsi_selection_opt +from apps.slice_selection.models.api.nssi_selection_request import NSSISelectionAPI +from apps.slice_selection.optimizers.conductor.remote_opt_processor import SliceSelectionOptimizer from osdf.adapters.policy.interface import get_policies from osdf.adapters.policy.interface import upload_policy_models from osdf.config.base import osdf_config +from osdf.config.base import slice_config from osdf.logging.osdf_logging import MH, audit_log from osdf.operation.responses import osdf_response_for_request_accept as req_accept from osdf.utils import api_data_utils from osdf.webapp.appcontroller import auth_basic from apps.nxi_termination.optimizers.remote_opt_processor import process_nxi_termination_opt -from apps.nxi_termination.models.api.nxi_termination_request import NxiTerminationApi +from apps.nxi_termination.models.api.nxi_termination_request import NxiTerminationApi @app.route("/api/oof/v1/healthcheck", methods=["GET"]) @@ -128,6 +130,7 @@ def do_nst_selection(): response = process_nst_selection(request_json, osdf_config) return response + @app.route("/api/oof/v1/pci", methods=["POST"]) @app.route("/api/oof/pci/v1", methods=["POST"]) @auth_basic.login_required @@ -163,8 +166,8 @@ def do_nsi_selection(): audit_log.info(MH.received_request(request.url, request.remote_addr, json.dumps(request_json))) NSISelectionAPI(request_json).validate() audit_log.info(MH.new_worker_thread(req_id, "[for NSI selection]")) - t = Thread(target=process_nsi_selection_opt, args=(request_json, osdf_config)) - t.start() + slice_opt = SliceSelectionOptimizer(osdf_config, slice_config, request_json, 'NSI') + slice_opt.start() return req_accept(request_id=req_id, transaction_id=request_json['requestInfo']['transactionId'], request_status="accepted", status_message="") @@ -178,12 +181,13 @@ def do_nssi_selection(): 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]")) - t = Thread(target=process_nsi_selection_opt, args=(request_json, osdf_config)) - t.start() + 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="") + @app.route("/api/oof/terminate/nxi/v1",methods=["POST"]) def do_nxi_terminaton(): request_json = request.get_json() @@ -193,5 +197,6 @@ def do_nxi_terminaton(): NxiTerminationApi(request_json).validate() return process_nxi_termination_opt(request_json,osdf_config) + if __name__ == "__main__": run_app() |