Add REST support for MPLS_POP, TTL_IN and DEC_TTL instructions, MPLS_BOS criterion
Change-Id: Idde10b7f25717507b7a08c11d41921f3ce39fdd3
diff --git a/core/common/src/main/java/org/onosproject/codec/impl/EncodeInstructionCodecHelper.java b/core/common/src/main/java/org/onosproject/codec/impl/EncodeInstructionCodecHelper.java
index 5393eef..2727223 100644
--- a/core/common/src/main/java/org/onosproject/codec/impl/EncodeInstructionCodecHelper.java
+++ b/core/common/src/main/java/org/onosproject/codec/impl/EncodeInstructionCodecHelper.java
@@ -35,6 +35,7 @@
import org.onosproject.net.flow.instructions.L4ModificationInstruction;
import org.slf4j.Logger;
+import static org.onlab.util.Tools.toHexWithPrefix;
import static org.slf4j.LoggerFactory.getLogger;
/**
@@ -162,6 +163,10 @@
(L2ModificationInstruction.ModMplsBosInstruction) l2Instruction;
result.put(InstructionCodec.MPLS_BOS, modMplsBosInstruction.mplsBos());
case MPLS_POP:
+ final L2ModificationInstruction.ModMplsHeaderInstruction popHeaderInstruction =
+ (L2ModificationInstruction.ModMplsHeaderInstruction) l2Instruction;
+ result.put(InstructionCodec.ETHERNET_TYPE,
+ toHexWithPrefix(popHeaderInstruction.ethernetType().toShort()));
case DEC_MPLS_TTL:
break;
default:
@@ -196,6 +201,7 @@
case TTL_IN:
case TTL_OUT:
case DEC_TTL:
+ // These instructions have no values to be encoded
break;
default:
log.info("Cannot convert L3 subtype of {}", l3Instruction.subtype());