import json
import networkx
-logging.basicConfig(level=logging.DEBUG)
+logging.basicConfig(level=logging.INFO)
CORS_HEADER = {'Access-Control-Allow-Origin': '*'}
# 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))
+
+ # when called directly with curl via REST
data = request.json
- # then no data
if data is None:
data = {}
+ # check if json data is a dict
elif type(data) is not dict:
data = json.loads(request.json)
+ logging.info("data: {}".format(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")
metric = args.get("metric"))
url = "{0}/restapi/monitor/interface".format(args.get("endpoint"))
- response = put(url, params=params)
+ response = put(url, json=params)
pp.pprint(response.text)
def stop_metric(self, args):
metric=args.get("metric"))
url = "{0}/restapi/monitor/interface".format(args.get("endpoint"))
- response = put(url, params=params)
+ response = put(url, json=params)
pp.pprint(response.text)
def setup_flow(self, args):
cookie=args.get("cookie"))
url = "{0}/restapi/monitor/flow".format(args.get("endpoint"))
- response = put(url, params=params)
+ response = put(url, json=params)
pp.pprint(response.text)
def stop_flow(self, args):
cookie=args.get("cookie"))
url = "{0}/restapi/monitor/flow".format(args.get("endpoint"))
- response = put(url, params=params)
+ response = put(url, json=params)
pp.pprint(response.text)
def prometheus(self, args):
priority=args.get("priority"))
response = put("{0}/restapi/network".format(args.get("endpoint")),
- params=params)
+ json=params)
pp.pprint(response.text)
def remove(self, args):
priority=args.get("priority"))
response = delete("{0}/restapi/network".format(args.get("endpoint")),
- params=params)
+ json=params)
pp.pprint(response.text)
def _parse_vnf_name(self, vnf_name_str):