summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVarma, Vikas <vv8305@att.com>2018-09-19 00:42:44 -0400
committerVikas Varma <vv8305@att.com>2018-09-19 16:29:02 +0000
commitb84ac0be84c53d3a93b44b9a6ffc2d262e9b213a (patch)
tree65266f62655fd89327e27f514eecab641bb718d3
parent276119f2d54b2e8f49b8595ecfcc6545aeb77fef (diff)
Initial checkin for pci optimization code
Change-Id: I1ed1c2d6d73161eae86aefd22ea3819fa80b8b40 Signed-off-by: Varma, Vikas <vv8305@att.com> Issue-ID: OPTFRA-342
-rwxr-xr-xosdfapp.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/osdfapp.py b/osdfapp.py
index 6ae84cc..5f13108 100755
--- a/osdfapp.py
+++ b/osdfapp.py
@@ -45,8 +45,10 @@ from requests import RequestException
from schematics.exceptions import DataError
from osdf.logging.osdf_logging import MH, audit_log, error_log, debug_log
from osdf.models.api.placementRequest import PlacementAPI
+from osdf.models.api.pciOptimizationRequest import PCIOptimizationAPI
from osdf.operation.responses import osdf_response_for_request_accept as req_accept
from osdf.optimizers.routeopt.simple_route_opt import RouteOpt
+from osdf.optimizers.pciopt.pci_opt_processor import process_pci_optimation
ERROR_TEMPLATE = osdf.ERROR_TEMPLATE
@@ -158,6 +160,23 @@ def do_route_calc():
else:
return RouteOpt.getRoute(request_json)
+@app.route("/api/oof/v1/pci", methods=["POST"])
+@auth_basic.login_required
+def do_pci_optimization():
+ 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)))
+ PCIOptimizationAPI(request_json).validate()
+ 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, 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'],
+ request_status="accepted", status_message="")
+
@app.errorhandler(500)
def internal_failure(error):
"""Returned when unexpected coding errors occur during initial synchronous processing"""