Currently, oxm_ids argument of OFPActionCopyField should be a list of
OFPOxmId instances, but this patch enables to specify with the OXM field
name as the str type value which is corresponding to the keywords of
OFPMatch.

Signed-off-by: IWASE Yusuke <iwase.yusu...@gmail.com>
---
 ryu/ofproto/ofproto_v1_5_parser.py | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/ryu/ofproto/ofproto_v1_5_parser.py 
b/ryu/ofproto/ofproto_v1_5_parser.py
index 316757d..6e11d8a 100644
--- a/ryu/ofproto/ofproto_v1_5_parser.py
+++ b/ryu/ofproto/ofproto_v1_5_parser.py
@@ -5948,7 +5948,16 @@ class OFPActionCopyField(OFPAction):
         self.n_bits = n_bits
         self.src_offset = src_offset
         self.dst_offset = dst_offset
-        self.oxm_ids = oxm_ids
+        assert len(oxm_ids) == 2
+        self.oxm_ids = []
+        for i in oxm_ids:
+            if isinstance(i, OFPOxmId):
+                i.hasmask = False  # fixup
+                self.oxm_ids.append(i)
+            elif isinstance(i, six.text_type):
+                self.oxm_ids.append(OFPOxmId(i, hasmask=False))
+            else:
+                raise ValueError('invalid value for oxm_ids: %s' % oxm_ids)
 
     @classmethod
     def parser(cls, buf, offset):
-- 
2.7.4


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to