ofctl: Fix type of fields of DescStat

With Python3 and OpenFlow v1.0/v1.2/v1.3, Ryu can't dump
the description statistics reply message into JSON,
because the message has byte type values.
This patch fixes it by using to_jsondict().

Signed-off-by: Satoshi Fujimoto <satoshi.fujimoto7@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
Satoshi Fujimoto 2017-03-17 14:29:43 +09:00 committed by FUJITA Tomonori
parent ab902d2b5e
commit d0f25d639b
3 changed files with 3 additions and 15 deletions

View File

@ -286,11 +286,7 @@ def get_desc_stats(dp, waiters):
for msg in msgs:
stats = msg.body
s = {'mfr_desc': stats.mfr_desc,
'hw_desc': stats.hw_desc,
'sw_desc': stats.sw_desc,
'serial_num': stats.serial_num,
'dp_desc': stats.dp_desc}
s = stats.to_jsondict()[stats.__class__.__name__]
return {str(dp.id): s}

View File

@ -306,11 +306,7 @@ def get_desc_stats(dp, waiters):
s = {}
for msg in msgs:
stats = msg.body
s = {'mfr_desc': stats.mfr_desc,
'hw_desc': stats.hw_desc,
'sw_desc': stats.sw_desc,
'serial_num': stats.serial_num,
'dp_desc': stats.dp_desc}
s = stats.to_jsondict()[stats.__class__.__name__]
return {str(dp.id): s}

View File

@ -345,11 +345,7 @@ def get_desc_stats(dp, waiters, to_user=True):
for msg in msgs:
stats = msg.body
s = {'mfr_desc': stats.mfr_desc,
'hw_desc': stats.hw_desc,
'sw_desc': stats.sw_desc,
'serial_num': stats.serial_num,
'dp_desc': stats.dp_desc}
s = stats.to_jsondict()[stats.__class__.__name__]
return wrap_dpid_dict(dp, s, to_user)