summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--ryu/app/simple_switch_13.py2
-rw-r--r--ryu/app/simple_switch_rest_13.py8
2 files changed, 5 insertions, 5 deletions
diff --git a/ryu/app/simple_switch_13.py b/ryu/app/simple_switch_13.py
index 06a5d0ed..907425c9 100644
--- a/ryu/app/simple_switch_13.py
+++ b/ryu/app/simple_switch_13.py
@@ -85,7 +85,7 @@ class SimpleSwitch13(app_manager.RyuApp):
dst = eth.dst
src = eth.src
- dpid = datapath.id
+ dpid = format(datapath.id, "d").zfill(16)
self.mac_to_port.setdefault(dpid, {})
self.logger.info("packet in %s %s %s %s", dpid, src, dst, in_port)
diff --git a/ryu/app/simple_switch_rest_13.py b/ryu/app/simple_switch_rest_13.py
index aaf5d509..31f834f0 100644
--- a/ryu/app/simple_switch_rest_13.py
+++ b/ryu/app/simple_switch_rest_13.py
@@ -85,21 +85,21 @@ class SimpleSwitchController(ControllerBase):
def list_mac_table(self, req, **kwargs):
simple_switch = self.simple_switch_app
- dpid = dpid_lib.str_to_dpid(kwargs['dpid'])
+ dpid = kwargs['dpid']
if dpid not in simple_switch.mac_to_port:
return Response(status=404)
mac_table = simple_switch.mac_to_port.get(dpid, {})
body = json.dumps(mac_table)
- return Response(content_type='application/json', body=body)
+ return Response(content_type='application/json', text=body)
@route('simpleswitch', url, methods=['PUT'],
requirements={'dpid': dpid_lib.DPID_PATTERN})
def put_mac_table(self, req, **kwargs):
simple_switch = self.simple_switch_app
- dpid = dpid_lib.str_to_dpid(kwargs['dpid'])
+ dpid = kwargs['dpid']
try:
new_entry = req.json if req.body else {}
except ValueError:
@@ -111,6 +111,6 @@ class SimpleSwitchController(ControllerBase):
try:
mac_table = simple_switch.set_mac_to_port(dpid, new_entry)
body = json.dumps(mac_table)
- return Response(content_type='application/json', body=body)
+ return Response(content_type='application/json', text=body)
except Exception as e:
return Response(status=500)