Add port tunnels support according to OFConfig specification.

Signed-off-by: Raman Budny <raman_bu...@epam.com>
---
Port tunnel support in of_config library seems to be supported
in not full manner. There are four kind of port tunnels listed in
OFConfig specification (v1.1.1, p. 47):
- OFPortBaseTunnelType,
- OFPortIPGRETunnelType,
- OFPortVXLANTunnelType,
- OFPortNVGRETunnelType,
but currently there is no way to get/modify parameters of these tunnels in
of_config library. This patch should add required classes and link them
to OFPortType.

Unfortunately,
    1) last three classes should inherit elements from
       OFPortBaseTunnelType, but I haven't found simple way to implement it
       without deep code rewriting (because of _ELEMENTS is class variable).
    
    2) I haven't found suitable way to represent the relation of
       mutual exclusion between different tunnel type objects
       (i. e. port object should refer to only one tunnel object of
       specific type).

I will be glad to receive your advices, how to implement these features,
and ready to improve this patch according to them.  

Actual patch body:
diff --git a/ryu/lib/of_config/generated_classes.py 
b/ryu/lib/of_config/generated_classes.py
index 14038b5..2513eef 100644
--- a/ryu/lib/of_config/generated_classes.py
+++ b/ryu/lib/of_config/generated_classes.py
@@ -37,6 +37,58 @@ class OFPortStateType(_Base):
         _e('live', is_list=False),
     ]
 
+class OFPortBaseTunnelType(_Base):
+    _ELEMENTS = [
+        _e('local-endpoint-ipv4-adress', is_list=False),
+        _e('remote-endpoint-ipv4-adress', is_list=False),
+        _e('local-endpoint-ipv6-adress', is_list=False),
+        _e('remote-endpoint-ipv6-adress', is_list=False),
+        _e('local-endpoint-mac-adress', is_list=False),
+        _e('remote-endpoint-mac-adress', is_list=False),
+    ]
+
+class OFPortIPGRETunnelType(_Base):
+    _ELEMENTS = [
+        _e('local-endpoint-ipv4-adress', is_list=False),
+        _e('remote-endpoint-ipv4-adress', is_list=False),
+        _e('local-endpoint-ipv6-adress', is_list=False),
+        _e('remote-endpoint-ipv6-adress', is_list=False),
+        _e('local-endpoint-mac-adress', is_list=False),
+        _e('remote-endpoint-mac-adress', is_list=False),
+        _e('checksum-present', is_list=False),
+        _e('key-present', is_list=False),
+        _e('key', is_list=False),
+        _e('sequence-number-present', is_list=False),
+    ]
+
+class OFPortVXLANTunnelType(_Base):
+    _ELEMENTS = [
+        _e('local-endpoint-ipv4-adress', is_list=False),
+        _e('remote-endpoint-ipv4-adress', is_list=False),
+        _e('local-endpoint-ipv6-adress', is_list=False),
+        _e('remote-endpoint-ipv6-adress', is_list=False),
+        _e('local-endpoint-mac-adress', is_list=False),
+        _e('remote-endpoint-mac-adress', is_list=False),
+        _e('vni-valid', is_list=False),
+        _e('vni', is_list=False),
+        _e('vni-multicast-group', is_list=False),
+        _e('udp-source-port', is_list=False),
+        _e('udp-dest-port', is_list=False),
+        _e('udp-dest-portchecksum', is_list=False),
+    ]
+
+class OFPortNVGRETunnelType(_Base):
+    _ELEMENTS = [
+        _e('local-endpoint-ipv4-adress', is_list=False),
+        _e('remote-endpoint-ipv4-adress', is_list=False),
+        _e('local-endpoint-ipv6-adress', is_list=False),
+        _e('remote-endpoint-ipv6-adress', is_list=False),
+        _e('local-endpoint-mac-adress', is_list=False),
+        _e('remote-endpoint-mac-adress', is_list=False),
+        _e('tni', is_list=False),
+        _e('tni-resv', is_list=False),
+        _e('tni-multicast-group', is_list=False),
+    ]
 
 class OFPortType(_Base):
     _ELEMENTS = [
@@ -48,7 +100,10 @@ class OFPortType(_Base):
         _ct('configuration', OFPortConfigurationType, is_list=False),
         _ct('state', OFPortStateType, is_list=False),
         _ct('features', None, is_list=False),
-        _ct('tunnel-type', None, is_list=False),
+        _ct('tunnel', OFPortBaseTunnelType, is_list=False),
+        _ct('ipgre-tunnel', OFPortIPGRETunnelType, is_list=False),
+        _ct('vxlan-tunnel', OFPortVXLANTunnelType, is_list=False),
+        _ct('nvgre-tunnel', OFPortNVGRETunnelType, is_list=False),
     ]

 

------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to