From 0c3dd305c61e51de6a03084c5eee28397d82772c Mon Sep 17 00:00:00 2001 From: Isaku Yamahata Date: Tue, 2 Oct 2012 19:35:03 +0900 Subject: [PATCH] of1.0: fix/add PortMod message Signed-off-by: Isaku Yamahata Signed-off-by: FUJITA Tomonori --- ryu/ofproto/ofproto_v1_0.py | 2 +- ryu/ofproto/ofproto_v1_0_parser.py | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/ryu/ofproto/ofproto_v1_0.py b/ryu/ofproto/ofproto_v1_0.py index d1bdceef..685cc71a 100644 --- a/ryu/ofproto/ofproto_v1_0.py +++ b/ryu/ofproto/ofproto_v1_0.py @@ -154,7 +154,7 @@ OFP_PORT_STATUS_SIZE = 64 assert (calcsize(OFP_PORT_STATUS_PACK_STR) + OFP_HEADER_SIZE == OFP_PORT_STATUS_SIZE) -OFP_PORT_MOD_PACK_STR = '!H' + OFP_ETH_ALEN_STR + 'BIII4x' +OFP_PORT_MOD_PACK_STR = '!H' + OFP_ETH_ALEN_STR + 'sIII4x' OFP_PORT_MOD_SIZE = 32 assert calcsize(OFP_PORT_MOD_PACK_STR) + OFP_HEADER_SIZE == OFP_PORT_MOD_SIZE diff --git a/ryu/ofproto/ofproto_v1_0_parser.py b/ryu/ofproto/ofproto_v1_0_parser.py index 1af2bb6c..8a141bde 100644 --- a/ryu/ofproto/ofproto_v1_0_parser.py +++ b/ryu/ofproto/ofproto_v1_0_parser.py @@ -1879,6 +1879,23 @@ class OFPFlowMod(MsgBase): offset += a.len +@_set_msg_type(ofproto_v1_0.OFPT_PORT_MOD) +class OFPPortMod(MsgBase): + def __init__(self, datapath, port_no, hw_addr, config, mask, advertise): + super(OFPPortMod, self).__init__(datapath) + self.port_no = port_no + self.hw_addr = hw_addr + self.config = config + self.mask = mask + self.advertise = advertise + + def _serialize_body(self): + msg_pack_into(ofproto_v1_0.OFP_PORT_MOD_PACK_STR, + self.buf, ofproto_v1_0.OFP_HEADER_SIZE, + self.port_no, self.hw_addr, + self.config, self.mask, self.advertise) + + @_set_msg_reply(OFPBarrierReply) @_set_msg_type(ofproto_v1_0.OFPT_BARRIER_REQUEST) class OFPBarrierRequest(MsgBase):