summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2012-02-08 22:51:42 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2012-02-08 22:51:42 +0900
commit70e8d096d50bf70eaa179df7a5cf2db256f549a1 (patch)
tree58574ebe213a6f5aeaedaec07f97848bd9e08ff2
parentf4063f2f0614923baadca50a0046869674eca26d (diff)
add cbench application
This simple application does _only_ what cbench expects. As usual, you can use this application in the following way: $ ryu-manager --app_lists ryu.app.cbench.Cbench Currently, this supports only the latency mode. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r--ryu/app/cbench.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/ryu/app/cbench.py b/ryu/app/cbench.py
new file mode 100644
index 00000000..a85415d3
--- /dev/null
+++ b/ryu/app/cbench.py
@@ -0,0 +1,26 @@
+# Copyright (C) 2012 Nippon Telegraph and Telephone Corporation.
+# Copyright (C) 2012 Isaku Yamahata <yamahata at valinux co jp>
+
+from ryu.controller import ofp_event
+from ryu.controller.handler import MAIN_DISPATCHER
+from ryu.controller.handler import set_ev_cls
+
+
+class Cbench(object):
+ def __init__(self, *_args, **kwargs):
+ pass
+
+ @set_ev_cls(ofp_event.EventOFPPacketIn, MAIN_DISPATCHER)
+ def packet_in_handler(self, ev):
+ msg = ev.msg
+ datapath = msg.datapath
+ ofproto = datapath.ofproto
+
+ match = datapath.ofproto_parser.OFPMatch(ofproto.OFPFW_ALL,
+ 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0)
+
+ datapath.send_flow_mod(
+ match=match, cookie=0, command=ofproto.OFPFC_ADD,
+ idle_timeout=0, hard_timeout=0, priority=32768,
+ flags=0, actions=None)