Getting router interface config into the corsa dataplane pipeline

Change-Id: I67d5bf7a20190b07a7bf55c7b60f771877ca8dbb
diff --git a/core/api/src/main/java/org/onosproject/net/flow/DefaultTrafficTreatment.java b/core/api/src/main/java/org/onosproject/net/flow/DefaultTrafficTreatment.java
index a8880b0..f20d6cc 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/DefaultTrafficTreatment.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/DefaultTrafficTreatment.java
@@ -255,6 +255,11 @@
         }
 
         @Override
+        public Builder popVlan() {
+            return add(Instructions.popVlan());
+        }
+
+        @Override
         public TrafficTreatment build() {
 
             //If we are dropping should we just return an empty list?
diff --git a/core/api/src/main/java/org/onosproject/net/flow/TrafficTreatment.java b/core/api/src/main/java/org/onosproject/net/flow/TrafficTreatment.java
index e890e62..9926751 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/TrafficTreatment.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/TrafficTreatment.java
@@ -205,6 +205,13 @@
         public Builder transition(FlowRule.Type type);
 
         /**
+         * Pops outermost VLAN tag.
+         *
+         * @return a treatment builder.
+         */
+        public Builder popVlan();
+
+        /**
          * Builds an immutable traffic treatment descriptor.
          *
          * @return traffic treatment
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 926d267..e0a5ca6 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
@@ -255,6 +255,19 @@
         return new PushHeaderInstructions(L2SubType.MPLS_POP, etherType);
     }
 
+    /**
+     * Creates a vlan header instruction.
+     * @return a L2 modification.
+     */
+    public static Instruction popVlan() {
+        return new PopVlanInstruction(L2SubType.VLAN_POP);
+    }
+
+    /**
+     * Sends the packet to the table described in 'type'.
+     * @param type
+     * @return
+     */
     public static Instruction transition(FlowRule.Type type) {
         checkNotNull(type, "Table type cannot be null");
         return new TableTypeTransition(type);
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 2288898..4702266 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
@@ -70,8 +70,12 @@
         /**
          * MPLS TTL modification.
          */
-        DEC_MPLS_TTL
+        DEC_MPLS_TTL,
 
+        /**
+         * VLAN Pop modification.
+         */
+        VLAN_POP
     }
 
     // TODO: Create factory class 'Instructions' that will have various factory
@@ -269,6 +273,44 @@
         }
     }
 
+    /**
+     * Represents a VLAN POP modification instruction.
+     */
+    public static final class PopVlanInstruction extends L2ModificationInstruction {
+        private final L2SubType subtype;
+
+        PopVlanInstruction(L2SubType subType) {
+            this.subtype = subType;
+        }
+
+        @Override
+        public L2SubType subtype() {
+            return subtype;
+        }
+
+        @Override
+        public String toString() {
+            return toStringHelper(subtype().toString())
+                    .toString();
+        }
+
+        @Override
+        public int hashCode() {
+            return Objects.hash(type(), subtype);
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (this == obj) {
+                return true;
+            }
+            if (obj instanceof PushHeaderInstructions) {
+                PushHeaderInstructions that = (PushHeaderInstructions) obj;
+                return  Objects.equals(subtype, that.subtype);
+            }
+            return false;
+        }
+    }
 
     /**
      * Represents a MPLS label modification.