>From cff0194df9d93b72ba989db1628bad655eb16719 Mon Sep 17 00:00:00 2001
From: Ozgur Yurekten <ozgur.yurek...@gmail.com>
Date: Wed, 25 Dec 2019 21:06:38 +0300
Subject: [PATCH 1/1] NXActionEncap init function fix and NXActionDecap class
 is defined

Signed-off-by: Ozgur Yurekten <ozgur.yurek...@gmail.com>
---
 ryu/ofproto/nx_actions.py | 40 ++++++++++++++++++++++++++++++++++++++-
 1 file changed, 39 insertions(+), 1 deletion(-)

diff --git a/ryu/ofproto/nx_actions.py b/ryu/ofproto/nx_actions.py
index 5707ca17..b21a38d3 100644
--- a/ryu/ofproto/nx_actions.py
+++ b/ryu/ofproto/nx_actions.py
@@ -3059,7 +3059,7 @@ def generate(ofp_name, ofpp_name):
         def __init__(self,
                      type_=None, len_=None, vendor=None, subtype=None):
             super(NXActionEncapNsh, self).__init__()
-            self.hdr_size = hdr_size
+            self.hdr_size = 0
             self.new_pkt_type = 0x0001894F

         @classmethod
@@ -3071,6 +3071,43 @@ def generate(ofp_name, ofpp_name):
             msg_pack_into(self._fmt_str, data, 0, self.hdr_size,
self.new_pkt_type)
             return data

+
+
+    class NXActionDecap(NXAction):
+        """
+        Decap nsh
+
+        This action decaps package
+
+        And equivalent to the followings action of ovs-ofctl command.
+
+        ::
+
+            decap()
+
+        Example::
+
+            actions += [parser.NXActionDecap()]
+        """
+        _subtype = nicira_ext.NXAST_RAW_DECAP
+
+        _fmt_str = '!2x'
+
+        def __init__(self,
+                     type_=None, len_=None, vendor=None, subtype=None):
+            super(NXActionDecap, 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
+
+
+
     class NXActionDecNshTtl(NXAction):
         """
         Decrement NSH TTL action
@@ -3157,6 +3194,7 @@ def generate(ofp_name, ofpp_name):
         'NXFlowSpecOutput',
         'NXActionEncapNsh',
         'NXActionEncapEther',
+        'NXActionDecap',
         'NXActionDecNshTtl',
     ]
     vars = locals()
-- 
2.17.1
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to