Add Optional match fields support to PI subsystem
Change-Id: Ic458f59cab98340e40c04a0ad060d3c725ac5dbb
diff --git a/core/common/src/main/java/org/onosproject/codec/impl/DecodeCriterionCodecHelper.java b/core/common/src/main/java/org/onosproject/codec/impl/DecodeCriterionCodecHelper.java
index 9516ed3..cf4cfa2 100644
--- a/core/common/src/main/java/org/onosproject/codec/impl/DecodeCriterionCodecHelper.java
+++ b/core/common/src/main/java/org/onosproject/codec/impl/DecodeCriterionCodecHelper.java
@@ -666,9 +666,18 @@
CriterionCodec.PI_MATCH_LOW_VALUE +
MISSING_MEMBER_MESSAGE).asText(), null),
HexString.fromHexString(nullIsIllegal(node.get(CriterionCodec.PI_MATCH_HIGH_VALUE),
- CriterionCodec.PI_MATCH_HIGH_VALUE +
- MISSING_MEMBER_MESSAGE).asText(), null)
- );
+ CriterionCodec.PI_MATCH_HIGH_VALUE +
+ MISSING_MEMBER_MESSAGE).asText(), null));
+ break;
+ case OPTIONAL:
+ builder.matchOptional(
+ PiMatchFieldId.of(
+ nullIsIllegal(node.get(CriterionCodec.PI_MATCH_FIELD_ID),
+ CriterionCodec.PI_MATCH_FIELD_ID +
+ MISSING_MEMBER_MESSAGE).asText()),
+ HexString.fromHexString(nullIsIllegal(node.get(CriterionCodec.PI_MATCH_VALUE),
+ CriterionCodec.PI_MATCH_VALUE +
+ MISSING_MEMBER_MESSAGE).asText(), null));
break;
default:
throw new IllegalArgumentException("Type " + type + " is unsupported");