diff options
author | seshukm <seshu.kumar.m@huawei.com> | 2018-09-01 21:51:44 +0800 |
---|---|---|
committer | Seshu Kumar M <seshu.kumar.m@huawei.com> | 2018-09-03 08:44:31 +0000 |
commit | 20341f67d4cc4be4e048aa26840ec55b66341c3f (patch) | |
tree | f948c40786b2e42e8cf2eb40f98496a717cc878a /osdfapp.py | |
parent | 0c5c12ce1b84a1a26362eac5c98d9eb47d8b0ec3 (diff) |
Fix return message format
Change-Id: Ia52cf0675449fdabdaba33928daa0cbcd99df781
Issue-ID: OPTFRA-334
Signed-off-by: seshukm <seshu.kumar.m@huawei.com>
Diffstat (limited to 'osdfapp.py')
-rwxr-xr-x | osdfapp.py | 33 |
1 files changed, 28 insertions, 5 deletions
@@ -125,15 +125,38 @@ def do_placement_opt(): @app.route("/api/oof/v1/route", methods=["POST"]) -@auth_basic.login_required def do_route_calc(): - """Perform the basic route calculations and returnn the vpn-bindings - TODO:Need to add the new class for the route in the API and model to provide this function + """ + Perform the basic route calculations and returnn the vpn-bindings """ request_json = request.get_json() audit_log.info("Calculate Route request received!") - return RouteOpt.getRoute(request_json) - + 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) @app.errorhandler(500) def internal_failure(error): |