diff options
author | Satoshi Fujimoto <satoshi.fujimoto7@gmail.com> | 2017-03-17 14:29:43 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2017-03-28 11:00:17 +0900 |
commit | d0f25d639b8f6d22ffcbb356ba0c7f902b0193c3 (patch) | |
tree | 109b8ee705677d5cc96b8c9e21b90050d6a1a515 | |
parent | ab902d2b5e73cc12a576715db4cf76cee112905f (diff) |
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>
-rw-r--r-- | ryu/lib/ofctl_v1_0.py | 6 | ||||
-rw-r--r-- | ryu/lib/ofctl_v1_2.py | 6 | ||||
-rw-r--r-- | 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 b9a0823f..b15073d8 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 e5e0a63c..f458d767 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 5a521811..c52fb644 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) |