cbench: specify OF1.0

cbench works with only OF1.0 and OF1.0 provides all cbench needs. So
specify OF1.0.

Also it doesn't need nxm so use OFPMatch and OFPFlowMod.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Reviewed-by: Isaku Yamahata <yamahata@valinux.co.jp>
This commit is contained in:
FUJITA Tomonori 2012-07-18 12:39:33 +09:00
parent 112c7e5496
commit e3e703970d

View File

@ -19,10 +19,12 @@ from ryu.base import app_manager
from ryu.controller import ofp_event from ryu.controller import ofp_event
from ryu.controller.handler import MAIN_DISPATCHER from ryu.controller.handler import MAIN_DISPATCHER
from ryu.controller.handler import set_ev_cls from ryu.controller.handler import set_ev_cls
from ryu.ofproto import nx_match from ryu.ofproto import ofproto_v1_0
class Cbench(app_manager.RyuApp): class Cbench(app_manager.RyuApp):
OFP_VERSIONS = [ofproto_v1_0.OFP_VERSION]
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(Cbench, self).__init__(*args, **kwargs) super(Cbench, self).__init__(*args, **kwargs)
@ -32,8 +34,13 @@ class Cbench(app_manager.RyuApp):
datapath = msg.datapath datapath = msg.datapath
ofproto = datapath.ofproto ofproto = datapath.ofproto
rule = nx_match.ClsRule() match = datapath.ofproto_parser.OFPMatch(
datapath.send_flow_mod( ofproto_v1_0.OFPFW_ALL, 0, 0, 0,
rule=rule, cookie=0, command=ofproto.OFPFC_ADD, 0, 0, 0, 0, 0, 0, 0, 0, 0)
mod = datapath.ofproto_parser.OFPFlowMod(
datapath, match=match, cookie=0, command=ofproto.OFPFC_ADD,
idle_timeout=0, hard_timeout=0, idle_timeout=0, hard_timeout=0,
priority=ofproto.OFP_DEFAULT_PRIORITY, flags=0, actions=None) priority=ofproto.OFP_DEFAULT_PRIORITY,
flags=0, actions=None)
datapath.send_msg(mod)