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 <[email protected]> --- ryu/lib/ofctl_v1_0.py | 6 +----- ryu/lib/ofctl_v1_2.py | 6 +----- ryu/lib/ofctl_v1_3.py | 6 +----- 3 files changed, 3 insertions(+), 15 deletions(-) diff --git a/ryu/lib/ofctl_v1_0.py b/ryu/lib/ofctl_v1_0.py index b9a0823..b15073d 100644 --- a/ryu/lib/ofctl_v1_0.py +++ b/ryu/lib/ofctl_v1_0.py @@ -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} diff --git a/ryu/lib/ofctl_v1_2.py b/ryu/lib/ofctl_v1_2.py index e5e0a63..f458d76 100644 --- a/ryu/lib/ofctl_v1_2.py +++ b/ryu/lib/ofctl_v1_2.py @@ -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} diff --git a/ryu/lib/ofctl_v1_3.py b/ryu/lib/ofctl_v1_3.py index 5a52181..c52fb64 100644 --- a/ryu/lib/ofctl_v1_3.py +++ b/ryu/lib/ofctl_v1_3.py @@ -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) -- 2.7.4 ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Ryu-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ryu-devel
