From 12f03a09e5d792d11cdea109481e7e2b980137ba Mon Sep 17 00:00:00 2001 From: Simon Horman Date: Wed, 29 Jan 2014 12:06:00 +0900 Subject: [PATCH] Add OF1.4 PopMpls action support Signed-off-by: Simon Horman Signed-off-by: FUJITA Tomonori --- ryu/ofproto/ofproto_v1_4_parser.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/ryu/ofproto/ofproto_v1_4_parser.py b/ryu/ofproto/ofproto_v1_4_parser.py index 08d89b9a..28965da0 100644 --- a/ryu/ofproto/ofproto_v1_4_parser.py +++ b/ryu/ofproto/ofproto_v1_4_parser.py @@ -2362,6 +2362,29 @@ class OFPActionCopyTtlIn(OFPAction): return cls() +@OFPAction.register_action_type(ofproto.OFPAT_POP_MPLS, + ofproto.OFP_ACTION_POP_MPLS_SIZE) +class OFPActionPopMpls(OFPAction): + """ + Pop MPLS action + + This action pops the MPLS header from the packet. + """ + def __init__(self, ethertype, type_=None, len_=None): + super(OFPActionPopMpls, self).__init__() + self.ethertype = ethertype + + @classmethod + def parser(cls, buf, offset): + (type_, len_, ethertype) = struct.unpack_from( + ofproto.OFP_ACTION_POP_MPLS_PACK_STR, buf, offset) + return cls(ethertype) + + def serialize(self, buf, offset): + msg_pack_into(ofproto.OFP_ACTION_POP_MPLS_PACK_STR, buf, offset, + self.type, self.len, self.ethertype) + + @OFPAction.register_action_type(ofproto.OFPAT_SET_FIELD, ofproto.OFP_ACTION_SET_FIELD_SIZE) class OFPActionSetField(OFPAction):