diff options
author | Minoru TAKAHASHI <takahashi.minoru7@gmail.com> | 2014-12-08 14:49:30 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2014-12-08 15:15:09 +0900 |
commit | 76e3903e3855661cd9db6da586dad005d66f0efc (patch) | |
tree | 9ba7ea2d22ca1631a82981d84ab2f362d2766a3b | |
parent | d160f78d83a06509bb8e803d3edb18cf62d8606d (diff) |
rest_qos: fix error of additional a qos rule with "priority"
Currently, rest_qos is impossible to set the "priority" of QoS rule on a switch.
Also, "priority" is should be described in the same depth as "match" and "actions".
This patch fixes these problems.
Now, rest_qos is possible to set the "priority" with the following curl command.
e.g.)
$ curl -X POST -d '{"priority":"5",
"match": {"nw_dst": "10.0.0.1", "nw_proto": "UDP", "tp_dst": "5002"},
"actions":{"queue": "1"}}' http://localhost:8080/qos/rules/0000000000000001
Reported-by: Jace Liang <b436412@gmail.com>
Signed-off-by: Minoru TAKAHASHI <takahashi.minoru7@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r-- | ryu/app/rest_qos.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/ryu/app/rest_qos.py b/ryu/app/rest_qos.py index c7a3b13e..f9ab9362 100644 --- a/ryu/app/rest_qos.py +++ b/ryu/app/rest_qos.py @@ -106,14 +106,21 @@ from ryu.ofproto import inet # POST /qos/{switch-id}/{vlan-id} # # request body format: -# {"match": {"<field1>": "<value1>", "<field2>": "<value2>",...}, +# {"priority": "<value>", +# "match": {"<field1>": "<value1>", "<field2>": "<value2>",...}, # "actions": {"<action1>": "<value1>", "<action2>": "<value2>",...} # } # # Description +# * priority field +# <value> +# "0 to 65533" +# +# Note: When "priority" has not been set up, +# "priority: 1" is set to "priority". +# # * match field # <field> : <value> -# "priority": "0 to 65533" # "in_port" : "<int>" # "dl_src" : "<xx:xx:xx:xx:xx:xx>" # "dl_dst" : "<xx:xx:xx:xx:xx:xx>" @@ -127,7 +134,8 @@ from ryu.ofproto import inet # "tp_dst" : "<int>" # "ip_dscp" : "<int>" # -# * action field +# * actions field +# <field> : <value> # "mark": <dscp-value> # sets the IPv4 ToS/DSCP field to tos. # "meter": <meter-id> @@ -732,7 +740,7 @@ class QoS(object): if vlan_id: match_value[REST_DL_VLAN] = vlan_id - priority = int(match_value.get(REST_PRIORITY, QOS_PRIORITY_MIN)) + priority = int(rest.get(REST_PRIORITY, QOS_PRIORITY_MIN)) if (QOS_PRIORITY_MAX < priority): raise ValueError('Invalid priority value. Set [%d-%d]' % (QOS_PRIORITY_MIN, QOS_PRIORITY_MAX)) |