diff options
author | Simon Horman <horms@verge.net.au> | 2014-01-29 12:06:06 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2014-01-29 12:42:56 +0900 |
commit | 688b26e858d445a68a34b315160f59faa05039ee (patch) | |
tree | a2237bc429064d4c3a92a7be7b7953b06fafef06 | |
parent | ec6438d1ee6fc839cbb25891069f057908010fbd (diff) |
Add OF1.4 SetNwTtl action support
Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r-- | ryu/ofproto/ofproto_v1_4_parser.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/ryu/ofproto/ofproto_v1_4_parser.py b/ryu/ofproto/ofproto_v1_4_parser.py index 72dd61a2..6ccb25a2 100644 --- a/ryu/ofproto/ofproto_v1_4_parser.py +++ b/ryu/ofproto/ofproto_v1_4_parser.py @@ -2371,6 +2371,35 @@ class OFPActionDecMplsTtl(OFPAction): return cls() +@OFPAction.register_action_type(ofproto.OFPAT_SET_NW_TTL, + ofproto.OFP_ACTION_NW_TTL_SIZE) +class OFPActionSetNwTtl(OFPAction): + """ + Set IP TTL action + + This action sets the IP TTL. + + ================ ====================================================== + Attribute Description + ================ ====================================================== + nw_ttl IP TTL + ================ ====================================================== + """ + def __init__(self, nw_ttl, type_=None, len_=None): + super(OFPActionSetNwTtl, self).__init__() + self.nw_ttl = nw_ttl + + @classmethod + def parser(cls, buf, offset): + (type_, len_, nw_ttl) = struct.unpack_from( + ofproto.OFP_ACTION_NW_TTL_PACK_STR, buf, offset) + return cls(nw_ttl) + + def serialize(self, buf, offset): + msg_pack_into(ofproto.OFP_ACTION_NW_TTL_PACK_STR, buf, offset, + self.type, self.len, self.nw_ttl) + + @OFPAction.register_action_type(ofproto.OFPAT_DEC_NW_TTL, ofproto.OFP_ACTION_HEADER_SIZE) class OFPActionDecNwTtl(OFPAction): |