[Emu] Defining classes for ODU SIGID and SIGTYPE Fields in Flow Criteria and Instruction - Data Model and Tests only

Change-Id: I3a71520caa286a1fcc509c581036ef4848de9b5b
diff --git a/core/api/src/main/java/org/onosproject/net/OduSignalId.java b/core/api/src/main/java/org/onosproject/net/OduSignalId.java
new file mode 100644
index 0000000..e19a673
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/net/OduSignalId.java
@@ -0,0 +1,139 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.net;
+
+import static com.google.common.base.Preconditions.checkArgument;
+
+import java.util.Arrays;
+import java.util.Objects;
+
+import org.onlab.util.HexString;
+
+import com.google.common.base.MoreObjects;
+/**
+ * Implementation of ODU Signal ID.
+ *
+ * <p>
+ * See ITU G.709 "Interfaces for the Optical Transport Network (OTN)".
+ * </p>
+ */
+public class OduSignalId {
+
+    private final int tributaryPortNumber;     // Tributary Port number
+    private final int tributarySlotLength;        // Number of Tributary Slots included in tsmap
+    private final byte[] tributarySlotBitmap; // Tributary slot bitmap
+
+    public static final int TRIBUTARY_SLOT_BITMAP_SIZE = 10;
+
+    /**
+     * Creates an instance with the specified arguments.
+     *
+     * @param tributaryPortNumber   tributary port number
+     * @param tributarySlotLen      tributary slot len
+     * @param tributarySlotBitmap   tributary slot bitmap
+     */
+    public OduSignalId(int tributaryPortNumber, int tributarySlotLen,
+            byte[] tributarySlotBitmap) {
+
+        checkArgument(tributaryPortNumber <= 80  ,
+                "tributaryPortNumber %s must be <= 80 ",
+                 tributaryPortNumber);
+
+        checkArgument(tributarySlotBitmap.length == TRIBUTARY_SLOT_BITMAP_SIZE,
+                "number of elements in list " + HexString.toHexString(tributarySlotBitmap)
+                + " must be equal to " + TRIBUTARY_SLOT_BITMAP_SIZE);
+
+        checkArgument(tributarySlotLen <= 80  ,
+                "tributarySlotLen %s must be <= 80 ",
+                tributarySlotLen);
+
+        this.tributaryPortNumber = tributaryPortNumber;
+        this.tributarySlotLength = tributarySlotLen;
+        this.tributarySlotBitmap = Arrays.copyOf(tributarySlotBitmap, tributarySlotBitmap.length);
+    }
+
+    /**
+     * Returns the OduSignalId representing the specified parameters.
+     *
+     * @param tributaryPortNumber   tributary port number
+     * @param tributarySlotLen      tributary slot len
+     * @param tributarySlotBitmap   tributary slot bitmap
+     * @return OduSignalId
+     */
+    public static OduSignalId oduSignalId(int tributaryPortNumber, int tributarySlotLen,
+            byte[] tributarySlotBitmap) {
+        return new OduSignalId(tributaryPortNumber, tributarySlotLen, tributarySlotBitmap);
+    }
+
+
+    /**
+     * Returns tributary port number.
+     *
+     * @return the tributaryPortNumber
+     */
+    public int tributaryPortNumber() {
+        return tributaryPortNumber;
+    }
+
+    /**
+     * Returns tributary slot length.
+     *
+     * @return the tributarySlotLen
+     */
+    public int tributarySlotLength() {
+        return tributarySlotLength;
+    }
+
+    /**
+     * Returns tributary slot bitmap.
+     *
+     * @return the tributarySlotBitmap
+     */
+    public byte[] tributarySlotBitmap() {
+        return Arrays.copyOf(tributarySlotBitmap, tributarySlotBitmap.length);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(tributaryPortNumber, tributarySlotLength, Arrays.hashCode(tributarySlotBitmap));
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (!(obj instanceof OduSignalId)) {
+            return false;
+        }
+        final OduSignalId other = (OduSignalId) obj;
+        return   Objects.equals(this.tributaryPortNumber, other.tributaryPortNumber)
+                 && Objects.equals(this.tributarySlotLength, other.tributarySlotLength)
+                 && Arrays.equals(tributarySlotBitmap, other.tributarySlotBitmap);
+    }
+
+    @Override
+    public String toString() {
+        return MoreObjects.toStringHelper(this)
+                .omitNullValues()
+                .add("tributaryPortNumber", tributaryPortNumber)
+                .add("tributarySlotLength", tributarySlotLength)
+                .add("tributarySlotBitmap", HexString.toHexString(tributarySlotBitmap))
+                .toString();
+    }
+
+}
+
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/Criteria.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/Criteria.java
index 7e1d43a..ae940bd 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/Criteria.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/Criteria.java
@@ -25,6 +25,8 @@
 import org.onosproject.net.IndexedLambda;
 import org.onosproject.net.Lambda;
 import org.onosproject.net.OchSignal;
+import org.onosproject.net.OduSignalId;
+import org.onosproject.net.OduSignalType;
 import org.onosproject.net.PortNumber;
 import org.onosproject.net.flow.criteria.Criterion.Type;
 import org.onosproject.net.OchSignalType;
@@ -486,6 +488,26 @@
         return new OchSignalTypeCriterion(signalType);
     }
 
+    /**
+     * Creates a match on ODU (Optical channel Data Unit) signal ID using the specified value.
+     *
+     * @param oduSignalId ODU Signal Id
+     * @return match criterion
+     */
+    public static Criterion matchOduSignalId(OduSignalId oduSignalId) {
+        return new OduSignalIdCriterion(oduSignalId);
+    }
+
+    /**
+     * Creates a match on ODU (Optical channel Data Unit) signal Type using the specified value.
+     *
+     * @param signalType ODU Signal Type
+     * @return match criterion
+     */
+    public static Criterion matchOduSignalType(OduSignalType signalType) {
+        return new OduSignalTypeCriterion(signalType);
+    }
+
     public static Criterion dummy() {
         return new DummyCriterion();
     }
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/Criterion.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/Criterion.java
index 12ab57d..10cb629 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/Criterion.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/Criterion.java
@@ -125,6 +125,10 @@
         OCH_SIGID,
         /** Optical channel signal type (fixed or flexible). */
         OCH_SIGTYPE,
+        /** ODU (Optical channel Data Unit) signal ID. */
+        ODU_SIGID,
+        /** ODU (Optical channel Data Unit) signal type. */
+        ODU_SIGTYPE,
 
         /**
          * An empty criterion.
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/OduSignalIdCriterion.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/OduSignalIdCriterion.java
new file mode 100644
index 0000000..cb51339
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/OduSignalIdCriterion.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.net.flow.criteria;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Objects;
+
+import org.onosproject.net.OduSignalId;
+
+/**
+ * Implementation of ODU (Optical channel Data Unit) signal ID signal criterion.
+ * This criterion is based on the specification of "OFPXMT_EXP_ODU_SIGID" in
+ * Open Networking Foundation "Optical Transport Protocol Extension Version 1.0", but
+ * defined in protocol agnostic way.
+ */
+public final class OduSignalIdCriterion implements Criterion {
+
+    private final OduSignalId oduSignalId;
+
+    /**
+     * Create an instance with the specified ODU signal ID.
+     *
+     * @param oduSignalId - ODU signal ID
+     */
+    OduSignalIdCriterion(OduSignalId oduSignalId) {
+        this.oduSignalId = checkNotNull(oduSignalId);
+    }
+
+    @Override
+    public Type type() {
+        return Type.ODU_SIGID;
+    }
+
+    /**
+     * Returns the ODU Signal to match.
+     *
+     * @return the ODU signal to match
+     */
+    public OduSignalId oduSignalId() {
+        return oduSignalId;
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(type(), oduSignalId);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (!(obj instanceof OduSignalIdCriterion)) {
+            return false;
+        }
+        final OduSignalIdCriterion that = (OduSignalIdCriterion) obj;
+        return Objects.equals(this.oduSignalId, that.oduSignalId);
+    }
+
+    @Override
+    public String toString() {
+        return  toStringHelper(type().toString())
+                .add("oduSignalId", oduSignalId)
+                .toString();
+    }
+
+}
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/OduSignalTypeCriterion.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/OduSignalTypeCriterion.java
new file mode 100644
index 0000000..d92880d
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/OduSignalTypeCriterion.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.net.flow.criteria;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Objects;
+
+import org.onosproject.net.OduSignalType;
+
+/**
+ * Implementation of ODU (Optical channel Data Unit) signal Type criterion.
+ * This criterion is based on the specification of "OFPXMT_EXP_ODU_SIGTYPE" in
+ * Open Networking Foundation "Optical Transport Protocol Extension Version 1.0", but
+ * defined in protocol agnostic way.
+ */
+public final class OduSignalTypeCriterion implements Criterion {
+
+    private final OduSignalType signalType;
+
+    /**
+     * Create an instance with the specified ODU signal Type.
+     *
+     * @param signalType - ODU signal Type
+     */
+    OduSignalTypeCriterion(OduSignalType signalType) {
+        this.signalType = checkNotNull(signalType);
+    }
+
+    @Override
+    public Type type() {
+        return Type.ODU_SIGTYPE;
+    }
+
+    /**
+     * Returns the ODU Signal Type to match.
+     *
+     * @return the ODU signal Type to match
+     */
+    public OduSignalType signalType() {
+        return signalType;
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(type(), signalType);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (!(obj instanceof OduSignalTypeCriterion)) {
+            return false;
+        }
+        final OduSignalTypeCriterion that = (OduSignalTypeCriterion) obj;
+        return Objects.equals(this.signalType, that.signalType);
+    }
+
+    @Override
+    public String toString() {
+        return toStringHelper(type().toString())
+                .add("signalType", signalType)
+                .toString();
+    }
+}
diff --git a/core/api/src/main/java/org/onosproject/net/flow/instructions/Instruction.java b/core/api/src/main/java/org/onosproject/net/flow/instructions/Instruction.java
index d01ea29..eddbbb7 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/instructions/Instruction.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/instructions/Instruction.java
@@ -59,6 +59,11 @@
         L0MODIFICATION,
 
         /**
+         * Signifies that the traffic should be modified in L1 way.
+         */
+        L1MODIFICATION,
+
+        /**
          * Signifies that the traffic should be modified in L2 way.
          */
         L2MODIFICATION,
@@ -86,6 +91,7 @@
 
     /**
      * Returns the type of instruction.
+     *
      * @return type of instruction
      */
     Type type();
diff --git a/core/api/src/main/java/org/onosproject/net/flow/instructions/Instructions.java b/core/api/src/main/java/org/onosproject/net/flow/instructions/Instructions.java
index c9f1068..26981e5 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/instructions/Instructions.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/instructions/Instructions.java
@@ -25,10 +25,12 @@
 import org.onosproject.net.IndexedLambda;
 import org.onosproject.net.Lambda;
 import org.onosproject.net.OchSignal;
+import org.onosproject.net.OduSignalId;
 import org.onosproject.net.PortNumber;
 import org.onosproject.net.flow.instructions.L0ModificationInstruction.L0SubType;
 import org.onosproject.net.flow.instructions.L0ModificationInstruction.ModLambdaInstruction;
 import org.onosproject.net.flow.instructions.L0ModificationInstruction.ModOchSignalInstruction;
+import org.onosproject.net.flow.instructions.L1ModificationInstruction.ModOduSignalIdInstruction;
 import org.onosproject.net.flow.instructions.L3ModificationInstruction.L3SubType;
 import org.onosproject.net.flow.instructions.L3ModificationInstruction.ModIPInstruction;
 import org.onosproject.net.flow.instructions.L3ModificationInstruction.ModIPv6FlowLabelInstruction;
@@ -47,7 +49,6 @@
  */
 public final class Instructions {
 
-
     // Ban construction
     private Instructions() {}
 
@@ -117,6 +118,16 @@
     }
 
     /**
+     * Creates an L1 modification with the specified ODU signal Id.
+     *
+     * @param oduSignalId ODU Signal Id
+     * @return a L1 modification
+     */
+    public static L1ModificationInstruction modL1OduSignalId(OduSignalId oduSignalId) {
+        checkNotNull(oduSignalId, "L1 ODU signal ID cannot be null");
+        return new ModOduSignalIdInstruction(oduSignalId);
+    }
+    /**
      * Creates a l2 src modification.
      *
      * @param addr the mac address to modify to
diff --git a/core/api/src/main/java/org/onosproject/net/flow/instructions/L1ModificationInstruction.java b/core/api/src/main/java/org/onosproject/net/flow/instructions/L1ModificationInstruction.java
new file mode 100644
index 0000000..c6847d1
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/net/flow/instructions/L1ModificationInstruction.java
@@ -0,0 +1,88 @@
+/*
+ * Copyright 2014-2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.net.flow.instructions;
+
+import org.onosproject.net.OduSignalId;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+
+import java.util.Objects;
+
+public abstract class L1ModificationInstruction implements Instruction {
+
+    /**
+     * Represents the type of traffic treatment.
+     */
+    public enum L1SubType {
+        /**
+         * ODU (Optical channel Data Unit) Signal Id modification.
+         */
+        ODU_SIGID
+    }
+
+    public abstract L1SubType subtype();
+
+    @Override
+    public final Type type() {
+        return Type.L1MODIFICATION;
+    }
+
+    /**
+     * Represents an L1 ODU (Optical channel Data Unit) Signal Id modification instruction.
+     */
+    public static final class ModOduSignalIdInstruction extends L1ModificationInstruction {
+
+        private final OduSignalId oduSignalId;
+
+        ModOduSignalIdInstruction(OduSignalId oduSignalId) {
+            this.oduSignalId = oduSignalId;
+        }
+
+        @Override
+        public L1SubType subtype() {
+            return L1SubType.ODU_SIGID;
+        }
+
+        public OduSignalId oduSignalId() {
+            return oduSignalId;
+        }
+
+        @Override
+        public int hashCode() {
+            return Objects.hash(oduSignalId);
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (this == obj) {
+                return true;
+            }
+            if (!(obj instanceof ModOduSignalIdInstruction)) {
+                return false;
+            }
+            final ModOduSignalIdInstruction that = (ModOduSignalIdInstruction) obj;
+            return Objects.equals(this.oduSignalId, that.oduSignalId);
+        }
+
+        @Override
+        public String toString() {
+            return toStringHelper(this)
+                    .add("oduSignalId", oduSignalId)
+                    .toString();
+        }
+    }
+
+}
diff --git a/core/api/src/test/java/org/onosproject/net/OduSignalIdTest.java b/core/api/src/test/java/org/onosproject/net/OduSignalIdTest.java
new file mode 100644
index 0000000..2ed15ff
--- /dev/null
+++ b/core/api/src/test/java/org/onosproject/net/OduSignalIdTest.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.net;
+
+import com.google.common.testing.EqualsTester;
+import org.junit.Test;
+import static org.onosproject.net.OduSignalId.oduSignalId;
+
+/**
+ * Test for OduSignalId.
+ */
+public class OduSignalIdTest {
+
+    private final OduSignalId odu1 = oduSignalId(7, 80, new byte[] {16, 16, 16, 16, 16, 16, 16, 16, 16, 16});
+    private final OduSignalId sameOdu1 = oduSignalId(7, 80, new byte[] {16, 16, 16, 16, 16, 16, 16, 16, 16, 16});
+    private final OduSignalId odu2 = oduSignalId(21, 80, new byte[] {10, 5, 10, 5, 10, 5, 10, 5, 10, 5});
+    private final OduSignalId sameOdu2 = oduSignalId(21, 80, new byte[] {10, 5, 10, 5, 10, 5, 10, 5, 10, 5});
+
+    @Test
+    public void testEquality() {
+        new EqualsTester()
+                .addEqualityGroup(odu1, sameOdu1)
+                .addEqualityGroup(odu2, sameOdu2)
+                .testEquals();
+    }
+}
diff --git a/core/api/src/test/java/org/onosproject/net/flow/criteria/CriteriaTest.java b/core/api/src/test/java/org/onosproject/net/flow/criteria/CriteriaTest.java
index 95d605c..d86744d 100644
--- a/core/api/src/test/java/org/onosproject/net/flow/criteria/CriteriaTest.java
+++ b/core/api/src/test/java/org/onosproject/net/flow/criteria/CriteriaTest.java
@@ -15,6 +15,16 @@
  */
 package org.onosproject.net.flow.criteria;
 
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.equalTo;
+import static org.hamcrest.Matchers.instanceOf;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.notNullValue;
+import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable;
+import static org.onlab.junit.UtilityClassChecker.assertThatClassIsUtility;
+import static org.onosproject.net.OduSignalId.oduSignalId;
+import static org.onosproject.net.PortNumber.portNumber;
+
 import org.junit.Test;
 import org.onlab.packet.EthType;
 import org.onlab.packet.Ip6Address;
@@ -26,20 +36,12 @@
 import org.onosproject.net.ChannelSpacing;
 import org.onosproject.net.GridType;
 import org.onosproject.net.Lambda;
+import org.onosproject.net.OchSignalType;
+import org.onosproject.net.OduSignalId;
+import org.onosproject.net.OduSignalType;
 import org.onosproject.net.PortNumber;
 
 import com.google.common.testing.EqualsTester;
-import org.onosproject.net.OchSignalType;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.equalTo;
-import static org.hamcrest.Matchers.instanceOf;
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.notNullValue;
-import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable;
-import static org.onlab.junit.UtilityClassChecker.assertThatClassIsUtility;
-import static org.onosproject.net.PortNumber.portNumber;
-
 /**
  * Unit tests for the Criteria class and its subclasses.
  */
@@ -240,6 +242,18 @@
     Criterion matchOchSignal2 =
             Criteria.matchLambda(Lambda.ochSignal(GridType.DWDM, ChannelSpacing.CHL_50GHZ, 4, 8));
 
+    final OduSignalId odu1 = oduSignalId(1, 80, new byte [] {1, 1, 2, 2, 1, 2, 2, 1, 2, 2});
+    final OduSignalId odu2 = oduSignalId(3, 8, new byte [] {1, 0, 0, 0, 0, 0, 0, 0, 0, 0});
+    Criterion matchOduSignalId1 = Criteria.matchOduSignalId(odu1);
+    Criterion sameAsMatchOduSignalId1 = Criteria.matchOduSignalId(odu1);
+    Criterion matchOduSignalId2 = Criteria.matchOduSignalId(odu2);
+
+    final OduSignalType oduSigType1 = OduSignalType.ODU2;
+    final OduSignalType oduSigType2 = OduSignalType.ODU4;
+    Criterion matchOduSignalType1 = Criteria.matchOduSignalType(oduSigType1);
+    Criterion sameAsMatchOduSignalType1 = Criteria.matchOduSignalType(oduSigType1);
+    Criterion matchOduSignalType2 = Criteria.matchOduSignalType(oduSigType2);
+
     /**
      * Checks that a Criterion object has the proper type, and then converts
      * it to the proper type.
@@ -294,6 +308,8 @@
         assertThatClassIsImmutable(MplsCriterion.class);
         assertThatClassIsImmutable(IPv6ExthdrFlagsCriterion.class);
         assertThatClassIsImmutable(LambdaCriterion.class);
+        assertThatClassIsImmutable(OduSignalIdCriterion.class);
+        assertThatClassIsImmutable(OduSignalTypeCriterion.class);
     }
 
     // PortCriterion class
@@ -1070,4 +1086,57 @@
                 .addEqualityGroup(matchOchSignalType2)
                 .testEquals();
     }
+
+    /**
+     * Test the OduSignalId method.
+     */
+    @Test
+    public void testMatchOduSignalIdMethod() {
+        OduSignalId odu = oduSignalId(1, 80, new byte[]{2, 1, 1, 3, 1, 1, 3, 1, 1, 3});
+
+        Criterion matchoduSignalId = Criteria.matchOduSignalId(odu);
+        OduSignalIdCriterion oduSignalIdCriterion =
+                checkAndConvert(matchoduSignalId,
+                                Criterion.Type.ODU_SIGID,
+                                OduSignalIdCriterion.class);
+        assertThat(oduSignalIdCriterion.oduSignalId(), is(equalTo(odu)));
+    }
+
+    /**
+     * Test the equals() method of the OduSignalIdCriterion class.
+     */
+    @Test
+    public void testOduSignalIdCriterionEquals() {
+        new EqualsTester()
+                .addEqualityGroup(matchOduSignalId1, sameAsMatchOduSignalId1)
+                .addEqualityGroup(matchOduSignalId2)
+                .testEquals();
+    }
+
+    // OduSignalTypeCriterion class
+
+    /**
+     * Test the OduSignalType method.
+     */
+    @Test
+    public void testMatchOduSignalTypeMethod() {
+        OduSignalType oduSigType = OduSignalType.ODU2;
+        Criterion matchoduSignalType = Criteria.matchOduSignalType(oduSigType);
+        OduSignalTypeCriterion oduSignalTypeCriterion =
+                checkAndConvert(matchoduSignalType,
+                                Criterion.Type.ODU_SIGTYPE,
+                                OduSignalTypeCriterion.class);
+        assertThat(oduSignalTypeCriterion.signalType(), is(equalTo(oduSigType)));
+    }
+
+    /**
+     * Test the equals() method of the OduSignalTypeCriterion class.
+     */
+    @Test
+    public void testOduSignalTypeCriterionEquals() {
+        new EqualsTester()
+                .addEqualityGroup(matchOduSignalType1, sameAsMatchOduSignalType1)
+                .addEqualityGroup(matchOduSignalType2)
+                .testEquals();
+    }
 }
diff --git a/core/api/src/test/java/org/onosproject/net/flow/instructions/InstructionsTest.java b/core/api/src/test/java/org/onosproject/net/flow/instructions/InstructionsTest.java
index 410349b..a25783f 100644
--- a/core/api/src/test/java/org/onosproject/net/flow/instructions/InstructionsTest.java
+++ b/core/api/src/test/java/org/onosproject/net/flow/instructions/InstructionsTest.java
@@ -25,6 +25,7 @@
 import org.onosproject.net.GridType;
 import org.onosproject.net.IndexedLambda;
 import org.onosproject.net.Lambda;
+import org.onosproject.net.OduSignalId;
 import org.onosproject.net.PortNumber;
 
 import com.google.common.testing.EqualsTester;
@@ -38,6 +39,7 @@
 import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable;
 import static org.onlab.junit.UtilityClassChecker.assertThatClassIsUtility;
 import static org.onosproject.net.PortNumber.portNumber;
+import static org.onosproject.net.OduSignalId.oduSignalId;
 
 /**
  * Unit tests for the Instructions class.
@@ -96,6 +98,7 @@
         assertThatClassIsImmutable(Instructions.OutputInstruction.class);
         assertThatClassIsImmutable(L0ModificationInstruction.ModLambdaInstruction.class);
         assertThatClassIsImmutable(L0ModificationInstruction.ModOchSignalInstruction.class);
+        assertThatClassIsImmutable(L1ModificationInstruction.ModOduSignalIdInstruction.class);
         assertThatClassIsImmutable(L2ModificationInstruction.ModEtherInstruction.class);
         assertThatClassIsImmutable(L2ModificationInstruction.ModVlanIdInstruction.class);
         assertThatClassIsImmutable(L2ModificationInstruction.ModVlanPcpInstruction.class);
@@ -259,6 +262,44 @@
         assertThat(ochInstruction1.hashCode(), is(not(ochInstruction2.hashCode())));
     }
 
+    //  ModOduSignalIdInstruction
+
+    private final OduSignalId odu1 = oduSignalId(1, 80, new byte[] {8, 7, 6, 5, 7, 6, 5, 7, 6, 5});
+    private final OduSignalId odu2 = oduSignalId(2, 80, new byte[] {1, 1, 2, 2, 1, 2, 2, 1, 2, 2});
+    private final Instruction oduInstruction1 = Instructions.modL1OduSignalId(odu1);
+    private final Instruction sameAsOduInstruction1 = Instructions.modL1OduSignalId(odu1);
+    private final Instruction oduInstruction2 = Instructions.modL1OduSignalId(odu2);
+
+    /**
+     * Test the modL1OduSignalId().
+     */
+    @Test
+    public void testModL1OduSignalIdMethod() {
+        Instruction instruction = Instructions.modL1OduSignalId(odu1);
+        L1ModificationInstruction.ModOduSignalIdInstruction oduInstruction =
+                checkAndConvert(instruction, Instruction.Type.L1MODIFICATION,
+                        L1ModificationInstruction.ModOduSignalIdInstruction.class);
+        assertThat(oduInstruction.oduSignalId(), is(odu1));
+    }
+
+    /**
+     * Test the equals() method of the ModOduSignalInstruction class.
+     */
+    @Test
+    public void testModOduSignalIdInstructionEquals() {
+        checkEqualsAndToString(oduInstruction1, sameAsOduInstruction1, oduInstruction2);
+    }
+
+    /**
+     * Test the hashCode() method of the ModOduSignalInstruction class.
+     */
+    @Test
+    public void testModOduSignalIdInstructionHashCode() {
+        assertThat(oduInstruction1.hashCode(), is(sameAsOduInstruction1.hashCode()));
+        assertThat(oduInstruction1.hashCode(), is(not(oduInstruction2.hashCode())));
+    }
+
+
     //  ModEtherInstruction
 
     private static final String MAC1 = "00:00:00:00:00:01";
diff --git a/core/common/src/main/java/org/onosproject/codec/impl/CriterionCodec.java b/core/common/src/main/java/org/onosproject/codec/impl/CriterionCodec.java
index 76f621f..975503b 100644
--- a/core/common/src/main/java/org/onosproject/codec/impl/CriterionCodec.java
+++ b/core/common/src/main/java/org/onosproject/codec/impl/CriterionCodec.java
@@ -61,6 +61,12 @@
     protected static final String SLOT_GRANULARITY = "slotGranularity";
     protected static final String OCH_SIGNAL_ID = "ochSignalId";
     protected static final String TUNNEL_ID = "tunnelId";
+    protected static final String OCH_SIGNAL_TYPE = "ochSignalType";
+    protected static final String ODU_SIGNAL_ID = "oduSignalId";
+    protected static final String TRIBUTARY_PORT_NUMBER = "tributaryPortNumber";
+    protected static final String TRIBUTARY_SLOT_LEN = "tributarySlotLen";
+    protected static final String TRIBUTARY_SLOT_BITMAP = "tributarySlotBitmap";
+    protected static final String ODU_SIGNAL_TYPE = "oduSignalType";
 
     @Override
     public ObjectNode encode(Criterion criterion, CodecContext context) {
@@ -73,6 +79,4 @@
         DecodeCriterionCodecHelper decoder = new DecodeCriterionCodecHelper(json);
         return decoder.decode();
     }
-
-
 }
diff --git a/core/common/src/main/java/org/onosproject/codec/impl/EncodeCriterionCodecHelper.java b/core/common/src/main/java/org/onosproject/codec/impl/EncodeCriterionCodecHelper.java
index a962c0d..f7af736 100644
--- a/core/common/src/main/java/org/onosproject/codec/impl/EncodeCriterionCodecHelper.java
+++ b/core/common/src/main/java/org/onosproject/codec/impl/EncodeCriterionCodecHelper.java
@@ -38,6 +38,8 @@
 import org.onosproject.net.flow.criteria.MplsCriterion;
 import org.onosproject.net.flow.criteria.OchSignalCriterion;
 import org.onosproject.net.flow.criteria.OchSignalTypeCriterion;
+import org.onosproject.net.flow.criteria.OduSignalIdCriterion;
+import org.onosproject.net.flow.criteria.OduSignalTypeCriterion;
 import org.onosproject.net.flow.criteria.PortCriterion;
 import org.onosproject.net.flow.criteria.SctpPortCriterion;
 import org.onosproject.net.flow.criteria.TcpPortCriterion;
@@ -108,7 +110,8 @@
         formatMap.put(Criterion.Type.OCH_SIGTYPE, new FormatOchSigType());
         formatMap.put(Criterion.Type.TUNNEL_ID, new FormatTunnelId());
         formatMap.put(Criterion.Type.DUMMY, new FormatDummyType());
-
+        formatMap.put(Criterion.Type.ODU_SIGID, new FormatOduSignalId());
+        formatMap.put(Criterion.Type.ODU_SIGTYPE, new FormatOduSignalType());
         // Currently unimplemented
         formatMap.put(Criterion.Type.ARP_OP, new FormatUnknown());
         formatMap.put(Criterion.Type.ARP_SPA, new FormatUnknown());
@@ -351,7 +354,7 @@
         public ObjectNode encodeCriterion(ObjectNode root, Criterion criterion) {
             final OchSignalTypeCriterion ochSignalTypeCriterion =
                     (OchSignalTypeCriterion) criterion;
-            return root.put("ochSignalType", ochSignalTypeCriterion.signalType().name());
+            return root.put(CriterionCodec.OCH_SIGNAL_TYPE, ochSignalTypeCriterion.signalType().name());
         }
     }
 
@@ -364,6 +367,24 @@
         }
     }
 
+    private static class FormatOduSignalId implements CriterionTypeFormatter {
+        @Override
+        public ObjectNode encodeCriterion(ObjectNode root, Criterion criterion) {
+            final OduSignalIdCriterion oduSignalIdCriterion =
+                    (OduSignalIdCriterion) criterion;
+            return root.put(CriterionCodec.ODU_SIGNAL_ID, oduSignalIdCriterion.oduSignalId().toString());
+        }
+    }
+
+    private static class FormatOduSignalType implements CriterionTypeFormatter {
+        @Override
+        public ObjectNode encodeCriterion(ObjectNode root, Criterion criterion) {
+            final OduSignalTypeCriterion oduSignalTypeCriterion =
+                    (OduSignalTypeCriterion) criterion;
+            return root.put(CriterionCodec.ODU_SIGNAL_TYPE, oduSignalTypeCriterion.signalType().name());
+        }
+    }
+
     private class FormatDummyType implements CriterionTypeFormatter {
 
         @Override