From 70e8d096d50bf70eaa179df7a5cf2db256f549a1 Mon Sep 17 00:00:00 2001 From: FUJITA Tomonori Date: Wed, 8 Feb 2012 22:51:42 +0900 Subject: 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 --- ryu/app/cbench.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 ryu/app/cbench.py 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 + +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) -- cgit v1.2.3