Hi, On 2015年08月20日 01:15, Liu, Weijie wrote: > Hi, > > I am using ofctl_rest.py and maybe find a bug. > > I used "match = parser.OFPMatch(metadata=(15,255), tunnel_id=(31,255))" as > the match with OpenFlow 1.3. > > After that, I used "/stats/flow/<dpid>" of ofctl_rest.py to see the flow > rules. But it returned: > > Traceback (most recent call last): > File "/home/weijie/.local/lib/python2.7/site-packages/eventlet/wsgi.py", > line 454, in handle_one_response > result = self.application(self.environ, start_response) > File "/usr/local/lib/python2.7/dist-packages/ryu/app/wsgi.py", line 201, in > __call__ > return super(wsgify_hack, self).__call__(environ, start_response) > File "/home/weijie/.local/lib/python2.7/site-packages/webob/dec.py", line > 130, in __call__ > resp = self.call_func(req, *args, **self.kwargs) > File "/home/weijie/.local/lib/python2.7/site-packages/webob/dec.py", line > 195, in call_func > return self.func(req, *args, **kwargs) > File "/usr/local/lib/python2.7/dist-packages/ryu/app/wsgi.py", line 263, in > __call__ > return controller(req) > File "/usr/local/lib/python2.7/dist-packages/ryu/app/wsgi.py", line 125, in > __call__ > return getattr(self, action)(req, **kwargs) > File "/home/weijie/ryu/ryu/app/ofctl_rest.py", line 202, in get_flow_stats > flows = _ofctl.get_flow_stats(dp, self.waiters, flow) > File "/usr/local/lib/python2.7/dist-packages/ryu/lib/ofctl_v1_3.py", line > 482, in get_flow_stats > match = match_to_str(stats.match) > File "/usr/local/lib/python2.7/dist-packages/ryu/lib/ofctl_v1_3.py", line > 380, in match_to_str > value = value + '/' + mask > TypeError: unsupported operand type(s) for +: 'int' and 'str' > > > I think the reason is because the type of mask is integer here. Did I do > anything wrong? Or is it a bug of ofctl_rest.py?
Thank you for reporting the bug. I think it is a bug of ofctl_v1_3.py which used by ofctl_rest.py. How about the following patch? If it works well, I will post this patch later. diff --git a/ryu/lib/ofctl_v1_3.py b/ryu/lib/ofctl_v1_3.py index 5b709f3..83a07c9 100644 --- a/ryu/lib/ofctl_v1_3.py +++ b/ryu/lib/ofctl_v1_3.py @@ -250,7 +250,7 @@ def to_match(dp, attrs): 'mpls_tc': int, 'mpls_bos': int, 'pbb_isid': int, - 'tunnel_id': int, + 'tunnel_id': to_match_masked_int, 'ipv6_exthdr': to_match_masked_int} keys = {'dl_dst': 'eth_dst', @@ -377,7 +377,7 @@ def match_to_str(ofmatch): value = match_masked_int_to_str(value, mask) else: if mask is not None: - value = value + '/' + mask + value = str(value) + '/' + str(mask) else: value = value match.setdefault(key, value) Thanks, Iwase > > > -- > Weijie Liu > Department of Computer Science > University of Illinois at Urbana-Champaign > (217)819-6113 > ------------------------------------------------------------------------------ > _______________________________________________ > Ryu-devel mailing list > Ryu-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/ryu-devel > ------------------------------------------------------------------------------ _______________________________________________ Ryu-devel mailing list Ryu-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ryu-devel