(ONOS-684) Added a few new OF actions, which are required for Segment Routing Application
- MPLS POP (Ethernet type)
- Dec MPLS TTL
- Dec NW TTL
- Copy TTL In
- Copy TTL Out
Change-Id: I639a1bfff9ba3ae8c372c0a4b36f132cb2610b7b
diff --git a/core/api/src/main/java/org/onosproject/net/flow/instructions/L2ModificationInstruction.java b/core/api/src/main/java/org/onosproject/net/flow/instructions/L2ModificationInstruction.java
index 6baeceb..b005bfc 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/instructions/L2ModificationInstruction.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/instructions/L2ModificationInstruction.java
@@ -65,7 +65,13 @@
/**
* MPLS Pop modification.
*/
- MPLS_POP
+ MPLS_POP,
+
+ /**
+ * MPLS TTL modification.
+ */
+ DEC_MPLS_TTL
+
}
// TODO: Create factory class 'Instructions' that will have various factory
@@ -322,4 +328,41 @@
return false;
}
}
+
+ /**
+ * Represents a MPLS label modification.
+ */
+ public static final class ModMplsTtlInstruction extends
+ L2ModificationInstruction {
+
+ public ModMplsTtlInstruction() {
+ }
+
+ @Override
+ public L2SubType subtype() {
+ return L2SubType.DEC_MPLS_TTL;
+ }
+
+ @Override
+ public String toString() {
+ return type().toString();
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(type(), L2SubType.DEC_MPLS_TTL);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj instanceof ModMplsLabelInstruction) {
+ ModMplsTtlInstruction that = (ModMplsTtlInstruction) obj;
+ return Objects.equals(this.type(), that.type());
+ }
+ return false;
+ }
+ }
}