summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYAMAMOTO Takashi <yamamoto@valinux.co.jp>2013-12-19 16:17:59 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2013-12-25 12:13:01 +0900
commitf3060bff7dae5279f6abb8f9d676fc39a3d1b29f (patch)
treef05c50eebd8a8436e0a8a1be272f91aac393ff47
parentc5a36424640f9d3214ad86768bca92cc0cbc39b1 (diff)
of_config_cli: add add_queue command
totally untested as i have no access to switches which support the operation. Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rwxr-xr-xryu/cmd/of_config_cli.py43
1 files changed, 43 insertions, 0 deletions
diff --git a/ryu/cmd/of_config_cli.py b/ryu/cmd/of_config_cli.py
index 69b6c02c..db5b73ef 100755
--- a/ryu/cmd/of_config_cli.py
+++ b/ryu/cmd/of_config_cli.py
@@ -369,6 +369,49 @@ max-rate 100
self._request(line, f)
+ def do_add_queue(self, line):
+ """add_queue <peer> <target> <logical-switch> <queue>
+ eg. add_queue sw1 running LogicalSwitch7 NameOfNewQueue
+ """
+
+ def f(p, args):
+ try:
+ target, lsw, queue = args
+ except:
+ print "argument error"
+ print args
+ return
+
+ # get switch id
+ o = p.get()
+ capable_switch_id = o.id
+
+ try:
+ capable_switch = ofc.OFCapableSwitchType(
+ id=capable_switch_id,
+ resources=ofc.OFCapableSwitchResourcesType(
+ queue=[
+ ofc.OFQueueType(resource_id=queue)
+ ]
+ ),
+ logical_switches=ofc.OFCapableSwitchLogicalSwitchesType(
+ switch=[ofc.OFLogicalSwitchType(
+ id=lsw,
+ resources=ofc.OFLogicalSwitchResourcesType(
+ queue=[queue])
+ )]
+ )
+ )
+ except TypeError:
+ print "argument error"
+ return
+ try:
+ p.edit_config(target, capable_switch)
+ except Exception, e:
+ print e
+
+ self._request(line, f)
+
def do_list_logical_switch(self, line):
"""list_logical_switch <peer>
"""