summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorIWASE Yusuke <iwase.yusuke0@gmail.com>2017-12-15 10:00:11 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2017-12-17 19:27:33 +0900
commit870dcab678b57c3ef1f223a020796dc13920baef (patch)
tree56b1a29d514c42bde7a7b21e81fd5710239c936f
parent4602651b2c18647f71667da7989a5a4edb8e35a2 (diff)
ofproto_v1_5_parser: oxm_ids with name str in OFPActionCopyField
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.yusuke0@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r--ryu/ofproto/ofproto_v1_5_parser.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/ryu/ofproto/ofproto_v1_5_parser.py b/ryu/ofproto/ofproto_v1_5_parser.py
index 316757da..6e11d8a9 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):