+ if dpid:
+ url = self.ryu_REST_api + '/' + str(prefix) + '/' + str(dpid)
+ else:
+ url = self.ryu_REST_api + '/' + str(prefix)
+ if data:
+ req = self.RyuSession.post(url, json=data)
+ else:
+ req = self.RyuSession.get(url)
+
+
+ # do extra logging if status code is not 200 (OK)
+ if req.status_code is not requests.codes.ok:
+ logging.info(
+ 'type {0} encoding: {1} text: {2} headers: {3} history: {4}'.format(req.headers['content-type'],
+ req.encoding, req.text,
+ req.headers, req.history))
+ LOG.info('url: {0}'.format(str(url)))
+ if data: LOG.info('POST: {0}'.format(str(data)))
+ LOG.info('status: {0} reason: {1}'.format(req.status_code, req.reason))
+
+
+ if 'json' in req.headers['content-type']:
+ ret = req.json()