diff options
Diffstat (limited to 'osdfapp.py')
-rwxr-xr-x | osdfapp.py | 34 |
1 files changed, 4 insertions, 30 deletions
@@ -34,15 +34,15 @@ import osdf.config.loader import osdf.operation.error_handling import osdf.operation.responses import traceback +from schematics.exceptions import DataError +from requests import RequestException +from optparse import OptionParser from osdf.adapters.policy.interface import get_policies from osdf.config.base import osdf_config from osdf.optimizers.placementopt.conductor.remote_opt_processor import process_placement_opt from osdf.webapp.appcontroller import auth_basic -from optparse import OptionParser from osdf.operation.exceptions import BusinessException from osdf.operation.error_handling import request_exception_to_json_body, internal_error_message -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 @@ -145,32 +145,7 @@ def do_route_calc(): """ request_json = request.get_json() audit_log.info("Calculate Route request received!") - src_access_node_id = "" - dst_access_node_id = "" - try: - src_access_node_id = request_json["srcPort"]["src-access-node-id"] - audit_log.info( src_access_node_id ) - dst_access_node_id = request_json["dstPort"]["dst-access-node-id"] - except Exception as ex: - error_log.error("Exception while retriving the src and dst node info") - # for the case of request_json for same domain, return the same node with destination update - if src_access_node_id == dst_access_node_id: - audit_log.info("src and dst are same") - data = '{'\ - '"vpns":['\ - '{'\ - '"access-topology-id": "' + request_json["srcPort"]["src-access-topology-id"] + '",'\ - '"access-client-id": "' + request_json["srcPort"]["src-access-client-id"] + '",'\ - '"access-provider-id": "' + request_json["srcPort"]["src-access-provider-id"]+ '",'\ - '"access-node-id": "' + request_json["srcPort"]["src-access-node-id"]+ '",'\ - '"src-access-ltp-id": "' + request_json["srcPort"]["src-access-ltp-id"]+ '",'\ - '"dst-access-ltp-id": "' + request_json["dstPort"]["dst-access-ltp-id"] +'"'\ - '}'\ - ']'\ - '}' - return data - else: - return RouteOpt.getRoute(request_json) + return RouteOpt().getRoute(request_json) @app.route("/api/oof/v1/pci", methods=["POST"]) @auth_basic.login_required @@ -197,7 +172,6 @@ def internal_failure(error): response.status_code = 500 return response - def get_options(argv): program_version_string = '%%prog %s' % "v1.0" program_longdesc = "" |