Signed-off-by: YAMAMOTO Takashi <[email protected]>
---
 ryu/lib/stringify.py      | 19 +++++++++++++++++++
 ryu/ofproto/nx_actions.py |  6 ++++++
 2 files changed, 25 insertions(+)

diff --git a/ryu/lib/stringify.py b/ryu/lib/stringify.py
index d279fad..96a83a6 100644
--- a/ryu/lib/stringify.py
+++ b/ryu/lib/stringify.py
@@ -76,9 +76,28 @@ class Utf8StringType(TypeDescr):
         return v.encode('utf-8')
 
 
+class NXFlowSpecFieldType(TypeDescr):
+    # ("field_name", 0) <-> ["field_name", 0]
+
+    @staticmethod
+    def encode(v):
+        if not isinstance(v, tuple):
+            return v
+        field, ofs = v
+        return [AsciiStringType.encode(field), ofs]
+
+    @staticmethod
+    def decode(v):
+        if not isinstance(v, list):
+            return v
+        field, ofs = v
+        return (AsciiStringType.decode(field), ofs)
+
+
 _types = {
     'ascii': AsciiStringType,
     'utf-8': Utf8StringType,
+    'nx-flow-spec-field': NXFlowSpecFieldType,  # XXX this should not be here
 }
 
 
diff --git a/ryu/ofproto/nx_actions.py b/ryu/ofproto/nx_actions.py
index ebc1665..1f2324e 100644
--- a/ryu/ofproto/nx_actions.py
+++ b/ryu/ofproto/nx_actions.py
@@ -36,6 +36,12 @@ def generate(ofp_name, ofpp_name):
         _hdr_fmt_str = '!H'  # 2 bit 0s, 1 bit src, 2 bit dst, 11 bit n_bits
         _dst_type = None
         _subclasses = {}
+        _TYPE = {
+            'nx-flow-spec-field': [
+                'src',
+                'dst',
+            ]
+        }
 
         def __init__(self, src, dst, n_bits):
             self.src = src
-- 
2.2.1


------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to