ONOS-2581 Add codec for tunnel id
Change-Id: I6ff456b0419b427945cc53fb74fd0a91cdfa758e
diff --git a/core/common/src/test/java/org/onosproject/codec/impl/FlowRuleCodecTest.java b/core/common/src/test/java/org/onosproject/codec/impl/FlowRuleCodecTest.java
index 9c778fb..f2786b6 100644
--- a/core/common/src/test/java/org/onosproject/codec/impl/FlowRuleCodecTest.java
+++ b/core/common/src/test/java/org/onosproject/codec/impl/FlowRuleCodecTest.java
@@ -58,6 +58,7 @@
import org.onosproject.net.flow.criteria.PortCriterion;
import org.onosproject.net.flow.criteria.SctpPortCriterion;
import org.onosproject.net.flow.criteria.TcpPortCriterion;
+import org.onosproject.net.flow.criteria.TunnelIdCriterion;
import org.onosproject.net.flow.criteria.UdpPortCriterion;
import org.onosproject.net.flow.criteria.VlanIdCriterion;
import org.onosproject.net.flow.criteria.VlanPcpCriterion;
@@ -205,7 +206,7 @@
instruction.type().name() + "/" + subType, instruction);
});
- assertThat(rule.treatment().allInstructions().size(), is(19));
+ assertThat(rule.treatment().allInstructions().size(), is(20));
Instruction instruction;
@@ -273,6 +274,12 @@
assertThat(instruction.type(), is(Instruction.Type.L2MODIFICATION));
assertThat(instruction, instanceOf(L2ModificationInstruction.PushHeaderInstructions.class));
+ instruction = getInstruction(Instruction.Type.L2MODIFICATION,
+ L2ModificationInstruction.L2SubType.TUNNEL_ID.name());
+ assertThat(instruction.type(), is(Instruction.Type.L2MODIFICATION));
+ assertThat(((L2ModificationInstruction.ModTunnelIdInstruction) instruction)
+ .tunnelId(), is(100L));
+
instruction = getInstruction(Instruction.Type.L3MODIFICATION,
L3ModificationInstruction.L3SubType.IPV4_SRC.name());
assertThat(instruction.type(), is(Instruction.Type.L3MODIFICATION));
@@ -347,7 +354,7 @@
checkCommonData(rule);
- assertThat(rule.selector().criteria().size(), is(32));
+ assertThat(rule.selector().criteria().size(), is(33));
rule.selector().criteria()
.stream()
@@ -479,6 +486,10 @@
criterion = getCriterion(Criterion.Type.OCH_SIGID);
assertThat(((IndexedLambdaCriterion) criterion).lambda(),
is(Lambda.indexedLambda(122)));
+
+ criterion = getCriterion(Criterion.Type.TUNNEL_ID);
+ assertThat(((TunnelIdCriterion) criterion).tunnelId(),
+ is(100L));
}
/**