From 012513848d869865a7cb50dc6aa5f0d6972094f6 Mon Sep 17 00:00:00 2001 From: FUJITA Tomonori Date: Tue, 27 Aug 2013 14:55:23 +0900 Subject: [PATCH] of12: set default args for FlowMod Signed-off-by: FUJITA Tomonori Acked-by: YAMAMOTO Takashi --- ryu/ofproto/ofproto_v1_2_parser.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/ryu/ofproto/ofproto_v1_2_parser.py b/ryu/ofproto/ofproto_v1_2_parser.py index 3ad700da..833f17bc 100644 --- a/ryu/ofproto/ofproto_v1_2_parser.py +++ b/ryu/ofproto/ofproto_v1_2_parser.py @@ -407,9 +407,13 @@ class OFPPacketOut(MsgBase): @_set_msg_type(ofproto_v1_2.OFPT_FLOW_MOD) class OFPFlowMod(MsgBase): - def __init__(self, datapath, cookie, cookie_mask, table_id, command, - idle_timeout, hard_timeout, priority, buffer_id, out_port, - out_group, flags, match, instructions): + def __init__(self, datapath, cookie=0, cookie_mask=0, table_id=0, + command=ofproto_v1_2.OFPFC_ADD, + idle_timeout=0, hard_timeout=0, priority=0, + buffer_id=ofproto_v1_2.OFP_NO_BUFFER, + out_port=0, out_group=0, flags=0, + match=None, + instructions=[]): super(OFPFlowMod, self).__init__(datapath) self.cookie = cookie self.cookie_mask = cookie_mask @@ -422,6 +426,8 @@ class OFPFlowMod(MsgBase): self.out_port = out_port self.out_group = out_group self.flags = flags + if match is None: + match = OFPMatch() self.match = match self.instructions = instructions