Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Dump Openflow message into json #107

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions ryu/controller/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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'
Expand Down Expand Up @@ -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)

Expand Down