From a0f90115cc8306435d219923441ea5fda38c9a92 Mon Sep 17 00:00:00 2001 From: IWASE Yusuke Date: Thu, 8 Mar 2018 15:40:24 +0900 Subject: [PATCH] nicira_ext: Support DEC_NSH_TTL action Signed-off-by: IWASE Yusuke Signed-off-by: FUJITA Tomonori --- doc/source/nicira_ext_ref.rst | 1 + ryu/ofproto/nicira_ext.py | 1 + ryu/ofproto/nx_actions.py | 36 +++++++++++++++++++++++++++++++++++ 3 files changed, 38 insertions(+) diff --git a/doc/source/nicira_ext_ref.rst b/doc/source/nicira_ext_ref.rst index 739349c4..7ca1b0c7 100644 --- a/doc/source/nicira_ext_ref.rst +++ b/doc/source/nicira_ext_ref.rst @@ -54,6 +54,7 @@ The followings shows the supported NXAction classes in OpenFlow1.0 or later .. autoclass:: NXActionCT .. autoclass:: NXActionNAT .. autoclass:: NXActionOutputTrunc +.. autoclass:: NXActionDecNshTtl .. autoclass:: NXFlowSpecMatch .. autoclass:: NXFlowSpecLoad .. autoclass:: NXFlowSpecOutput diff --git a/ryu/ofproto/nicira_ext.py b/ryu/ofproto/nicira_ext.py index 94f38fc1..4a06b647 100644 --- a/ryu/ofproto/nicira_ext.py +++ b/ryu/ofproto/nicira_ext.py @@ -62,6 +62,7 @@ NXAST_NAT = 36 NXAST_CONTROLLER2 = 37 NXAST_SAMPLE2 = 38 NXAST_OUTPUT_TRUNC = 39 +NXAST_DEC_NSH_TTL = 48 NX_ACTION_RESUBMIT_PACK_STR = '!HHIHHB3x' NX_ACTION_RESUBMIT_SIZE = 16 diff --git a/ryu/ofproto/nx_actions.py b/ryu/ofproto/nx_actions.py index 89210070..18dc9210 100644 --- a/ryu/ofproto/nx_actions.py +++ b/ryu/ofproto/nx_actions.py @@ -2984,6 +2984,41 @@ def generate(ofp_name, ofpp_name): self.max_len) return data + class NXActionDecNshTtl(NXAction): + """ + Decrement NSH TTL action + + This action decrements the TTL in the Network Service Header(NSH). + + This action was added in OVS v2.9. + + And equivalent to the followings action of ovs-ofctl command. + + :: + + dec_nsh_ttl + + Example:: + + actions += [parser.NXActionDecNshTtl()] + """ + _subtype = nicira_ext.NXAST_DEC_NSH_TTL + + _fmt_str = '!6x' + + def __init__(self, + type_=None, len_=None, vendor=None, subtype=None): + super(NXActionDecNshTtl, self).__init__() + + @classmethod + def parser(cls, buf): + return cls() + + def serialize_body(self): + data = bytearray() + msg_pack_into(self._fmt_str, data, 0) + return data + def add_attr(k, v): v.__module__ = ofpp.__name__ # Necessary for stringify stuff setattr(ofpp, k, v) @@ -3032,6 +3067,7 @@ def generate(ofp_name, ofpp_name): 'NXFlowSpecMatch', 'NXFlowSpecLoad', 'NXFlowSpecOutput', + 'NXActionDecNshTtl', ] vars = locals() for name in classes: