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>
This commit is contained in:
IWASE Yusuke 2017-12-15 10:00:11 +09:00 committed by FUJITA Tomonori
parent 4602651b2c
commit 870dcab678
1 changed files with 10 additions and 1 deletions

View File

@ -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):