From 3484e6e57358a706be850e6123782a0225a8f23d Mon Sep 17 00:00:00 2001 From: Minoru TAKAHASHI Date: Fri, 25 Mar 2016 16:58:24 +0900 Subject: lib/ofctl_v1_0: Fix a small bug in get_desc_stats() and get_aggregate_flow_stats() If there is an empty value in the reply msg, there are cases where those methods cause an error. This patch fixes this problem. Signed-off-by: Minoru TAKAHASHI Signed-off-by: FUJITA Tomonori --- ryu/lib/ofctl_v1_0.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ryu/lib/ofctl_v1_0.py b/ryu/lib/ofctl_v1_0.py index 5fe5778d..e75e51a4 100644 --- a/ryu/lib/ofctl_v1_0.py +++ b/ryu/lib/ofctl_v1_0.py @@ -302,6 +302,7 @@ def get_desc_stats(dp, waiters): stats = dp.ofproto_parser.OFPDescStatsRequest(dp, 0) msgs = [] send_stats_request(dp, stats, waiters, msgs) + s = {} for msg in msgs: stats = msg.body @@ -400,7 +401,7 @@ def get_aggregate_flow_stats(dp, waiters, flow=None): s = {'packet_count': st.packet_count, 'byte_count': st.byte_count, 'flow_count': st.flow_count} - flows.append(s) + flows.append(s) flows = {str(dp.id): flows} return flows -- cgit v1.2.3