diff --git a/ryu/controller/controller.py b/ryu/controller/controller.py index d79f290ad..da288124f 100644 --- a/ryu/controller/controller.py +++ b/ryu/controller/controller.py @@ -31,6 +31,7 @@ from socket import timeout as SocketTimeout import ssl import sys +import requests from ryu import cfg from ryu.lib import hub @@ -50,6 +51,7 @@ from ryu.lib.dpid import dpid_to_str from ryu.lib import ip + LOG = logging.getLogger('ryu.controller.controller') DEFAULT_OFP_HOST = '0.0.0.0' @@ -447,6 +449,12 @@ def send_msg(self, msg, close_socket=False): if msg.xid is None: self.set_xid(msg) msg.serialize() + #Dump msg into json + msg_dict = msg.to_jsondict() + payload = json.dumps(msg_dict) + # Send as payload to http dummy url + #headers = {'content-type': 'application/json'} + #op_http = requests.post('http://localhost:5000/tasks', data=json.dumps(payload), headers=headers) # LOG.debug('send_msg %s', msg) return self.send(msg.buf, close_socket=close_socket)