X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=src%2Femuvim%2Fapi%2Frest%2Fnetwork.py;h=9aab1e606eda51ad56788f8ca2170866c8599b51;hb=d7cbd218427bbfe573d062710006d56751e4406b;hp=13743731e924348d4207b329f5ec61c43acbb1a7;hpb=f693a3b7d6bc9190f180bbd23ae4c577143fe5a5;p=osm%2Fvim-emu.git diff --git a/src/emuvim/api/rest/network.py b/src/emuvim/api/rest/network.py index 1374373..9aab1e6 100755 --- a/src/emuvim/api/rest/network.py +++ b/src/emuvim/api/rest/network.py @@ -38,7 +38,7 @@ from flask import request import json import networkx -logging.basicConfig(level=logging.DEBUG) +logging.basicConfig() CORS_HEADER = {'Access-Control-Allow-Origin': '*'} @@ -80,15 +80,15 @@ class NetworkAction(Resource): # call DCNetwork method, not really datacenter specific API for now... # no check if vnfs are really connected to this datacenter... try: - # check if json data is a dict - data = request.args - # try json payload + # check json payload + logging.debug("json: {}".format(request.json)) + logging.debug("args: {}".format(request.args)) + data = request.json - # then no data + if data is None: + data = request.args if data is None: data = {} - elif type(data) is not dict: - data = json.loads(request.json) vnf_src_name = data.get("vnf_src_name") vnf_dst_name = data.get("vnf_dst_name") @@ -149,4 +149,4 @@ class DrawD3jsgraph(Resource): links.append(edge_dict) json = {"nodes":nodes, "links":links} - return json, 200, CORS_HEADER \ No newline at end of file + return json, 200, CORS_HEADER