from flask import request
import json
-logging.basicConfig(level=logging.INFO)
+logging.basicConfig()
CORS_HEADER = {'Access-Control-Allow-Origin': '*'}
# no check if vnfs are really connected to this datacenter...
try:
- # get URL parameters
- data = request.args
- #then no data
+ # check json payload
+ logging.debug("json: {}".format(request.json))
+ logging.debug("args: {}".format(request.args))
+
+ data = request.json
+ if data is None:
+ data = request.args
if data is None:
data = {}
-
vnf_src_name = data.get("vnf_src_name")
vnf_dst_name = data.get("vnf_dst_name")
vnf_src_interface = data.get("vnf_src_interface")
return str(c), 200, CORS_HEADER
except Exception as ex:
logging.exception("API error.")
- return ex.message, 500, CORS_HEADER
\ No newline at end of file
+ return ex.message, 500, CORS_HEADER