From: stevenvanrossem Date: Thu, 1 Jun 2017 14:45:42 +0000 (+0200) Subject: fix son-emu-cli monitor CLI X-Git-Tag: v3.1~23^2 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=167aa3cfe3a4c7d8dcb738f4f80ecfa6095b8db8;p=osm%2Fvim-emu.git fix son-emu-cli monitor CLI --- diff --git a/src/emuvim/api/rest/monitor.py b/src/emuvim/api/rest/monitor.py index eac10ef..30422c1 100755 --- a/src/emuvim/api/rest/monitor.py +++ b/src/emuvim/api/rest/monitor.py @@ -199,13 +199,16 @@ class MonitorLinkAction(Resource): # 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") diff --git a/src/emuvim/api/rest/network.py b/src/emuvim/api/rest/network.py index f68507c..bce10fc 100755 --- a/src/emuvim/api/rest/network.py +++ b/src/emuvim/api/rest/network.py @@ -81,10 +81,9 @@ class NetworkAction(Resource): # no check if vnfs are really connected to this datacenter... try: # check json payload - logging.info("json: {}".format(request.json)) - logging.info("args: {}".format(request.args)) + logging.debug("json: {}".format(request.json)) + logging.debug("args: {}".format(request.args)) - # when called directly with curl via REST data = request.json if data is None: data = request.args diff --git a/src/emuvim/cli/rest/monitor.py b/src/emuvim/cli/rest/monitor.py index 3f95884..8be1e7f 100755 --- a/src/emuvim/cli/rest/monitor.py +++ b/src/emuvim/cli/rest/monitor.py @@ -53,7 +53,7 @@ class RestApiClient(): metric = args.get("metric")) url = "{0}/restapi/monitor/interface".format(args.get("endpoint")) - response = put(url, json=params) + response = put(url, params=params) pp.pprint(response.text) def stop_metric(self, args): @@ -63,7 +63,7 @@ class RestApiClient(): metric=args.get("metric")) url = "{0}/restapi/monitor/interface".format(args.get("endpoint")) - response = put(url, json=params) + response = put(url, params=params) pp.pprint(response.text) def setup_flow(self, args): @@ -74,7 +74,7 @@ class RestApiClient(): cookie=args.get("cookie")) url = "{0}/restapi/monitor/flow".format(args.get("endpoint")) - response = put(url, json=params) + response = put(url, params=params) pp.pprint(response.text) def stop_flow(self, args): @@ -85,7 +85,7 @@ class RestApiClient(): cookie=args.get("cookie")) url = "{0}/restapi/monitor/flow".format(args.get("endpoint")) - response = put(url, json=params) + response = put(url, params=params) pp.pprint(response.text) def prometheus(self, args):