Re: [Ryu-devel] FWD:[Adding queue to a switch using RYU QoS]
Brought to you by:
nz_gizmoguy
From: Iwase Y. <iwa...@gm...> - 2016-04-25 00:55:27
|
Hi, On 2016年04月23日 06:53, Isaku Yamahata wrote: > ----- Forwarded message from "Malekloo, Ashkan" <ASH...@UC...> ----- > > Date: Fri, 22 Apr 2016 20:27:53 +0000 > Subject: Adding queue to a switch using RYU QoS > x-mailer: Apple Mail (2.3124) > > Hello, > Hope you are doing well. > > I am using Ryu QoS on ubuntu 14.04 and mininet 2.2.1 > > All I've done is use the exact commands as said in the RYU SDN Framework book. and after this command: > curl -X POST -d '{"match": {"ip_dscp": "26"}, "actions":{"queue": "1"}}' http://localhost:8080/qos/rules/0000000000000001 > > I gtt this error: > Invalid rule parameter > > So, I've restarted everything then I tried Qos per-flow. like before I used ecaxt command as RYU SDN Framework book. After this command: > curl -X POST -d '{"match": {"nw_dst": "10.0.0.1", "nw_proto": "UDP", "tp_dst": "5002"}, "actions":{"queue": "1"}}' http://localhost:8080/qos/rules/0000000000000001 > > I’ve got the exact same error as before: > Invalid rule parameter A "numeric string" like {"queue": "1"} causes this problem. First, please try with non-string number like {"queue": 1}. To fix this problem, I wrote the following patch, but please note this patch is under reviewing in our team. >From 5bb93cca1dd5747be854737c6b78f8c2bb4f7532 Mon Sep 17 00:00:00 2001 From: IWASE Yusuke <iwa...@gm...> Date: Thu, 7 Apr 2016 11:46:00 +0900 Subject: [PATCH] ofctl_utils: Enhance user value conversion Currently, OFCtlUtil._reserved_num_from_user() fails to convert an user specified value when it is a numeric string. This patch enhances this conversion to enable to convert an user value as follows. e.g.) - Integer: 1 -> 1 - Numeric string: "1" -> 1 - Reserved number: "OFPP_ANY" -> 0xffffffff - Invalid value: "foobar" -> "foobar" (do not conversion) Signed-off-by: IWASE Yusuke <iwa...@gm...> --- ryu/lib/ofctl_utils.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/ryu/lib/ofctl_utils.py b/ryu/lib/ofctl_utils.py index b5fbc9b..832baf0 100644 --- a/ryu/lib/ofctl_utils.py +++ b/ryu/lib/ofctl_utils.py @@ -240,13 +240,18 @@ def __init__(self, ofproto): 'OFPQCFC_EPERM'] def _reserved_num_from_user(self, num, prefix): - if isinstance(num, int): - return num - else: - if num.startswith(prefix): - return getattr(self.ofproto, num) - else: - return getattr(self.ofproto, prefix + num.upper()) + try: + return str_to_int(num) + except ValueError: + try: + if num.startswith(prefix): + return getattr(self.ofproto, num.upper()) + else: + return getattr(self.ofproto, prefix + num.upper()) + except AttributeError: + LOG.warning( + "Cannot convert argument to reserved number: %s", num) + return num def _reserved_num_to_user(self, num, prefix): for k, v in self.ofproto.__dict__.items(): Thanks, Iwase > > on the other hand, when I use "mark" in my actions command it easily adds the rule and I can confirm it using get. > > can you help me please solve this? > Thank you in advance! > > ----- End forwarded message ----- > |