ONOS-2711 Replaced short to TpPort for tcp/udp ports

Change-Id: Ibf0474b5369d11d377fd33cf5ab48083cbca3308
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 97f57db..c5358a2 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
@@ -19,6 +19,7 @@
 import org.onlab.packet.IpAddress;
 import org.onlab.packet.MacAddress;
 import org.onlab.packet.MplsLabel;
+import org.onlab.packet.TpPort;
 import org.onlab.packet.VlanId;
 import org.onosproject.core.GroupId;
 import org.onosproject.net.IndexedLambda;
@@ -383,9 +384,22 @@
      *
      * @param port the TCP port number to modify to
      * @return a L4 modification
+     * @deprecated in Drake release
      */
+    @Deprecated
     public static L4ModificationInstruction modTcpSrc(short port) {
        checkNotNull(port, "Src TCP port cannot be null");
+       return new ModTransportPortInstruction(L4SubType.TCP_SRC, TpPort.tpPort(port));
+    }
+
+    /**
+     * Creates a TCP src modification.
+     *
+     * @param port the TCP port number to modify to
+     * @return a L4 modification
+     */
+    public static L4ModificationInstruction modTcpSrc(TpPort port) {
+       checkNotNull(port, "Src TCP port cannot be null");
        return new ModTransportPortInstruction(L4SubType.TCP_SRC, port);
     }
 
@@ -394,9 +408,22 @@
      *
      * @param port the TCP port number to modify to
      * @return a L4 modification
+     * @deprecated in Drake release
      */
+    @Deprecated
     public static L4ModificationInstruction modTcpDst(short port) {
         checkNotNull(port, "Dst TCP port cannot be null");
+        return new ModTransportPortInstruction(L4SubType.TCP_DST, TpPort.tpPort(port));
+    }
+
+    /**
+     * Creates a TCP dst modification.
+     *
+     * @param port the TCP port number to modify to
+     * @return a L4 modification
+     */
+    public static L4ModificationInstruction modTcpDst(TpPort port) {
+        checkNotNull(port, "Dst TCP port cannot be null");
         return new ModTransportPortInstruction(L4SubType.TCP_DST, port);
     }
 
@@ -405,9 +432,22 @@
      *
      * @param port the UDP port number to modify to
      * @return a L4 modification
+     * @deprecated in Drake release
      */
+    @Deprecated
     public static L4ModificationInstruction modUdpSrc(short port) {
         checkNotNull(port, "Src UDP port cannot be null");
+        return new ModTransportPortInstruction(L4SubType.UDP_SRC, TpPort.tpPort(port));
+    }
+
+    /**
+     * Creates a UDP src modification.
+     *
+     * @param port the UDP port number to modify to
+     * @return a L4 modification
+     */
+    public static L4ModificationInstruction modUdpSrc(TpPort port) {
+        checkNotNull(port, "Src UDP port cannot be null");
         return new ModTransportPortInstruction(L4SubType.UDP_SRC, port);
     }
 
@@ -416,9 +456,22 @@
      *
      * @param port the UDP port number to modify to
      * @return a L4 modification
+     * @deprecated in Drake release
      */
+    @Deprecated
     public static L4ModificationInstruction modUdpDst(short port) {
         checkNotNull(port, "Dst UDP port cannot be null");
+        return new ModTransportPortInstruction(L4SubType.UDP_DST, TpPort.tpPort(port));
+    }
+
+    /**
+     * Creates a UDP dst modification.
+     *
+     * @param port the UDP port number to modify to
+     * @return a L4 modification
+     */
+    public static L4ModificationInstruction modUdpDst(TpPort port) {
+        checkNotNull(port, "Dst UDP port cannot be null");
         return new ModTransportPortInstruction(L4SubType.UDP_DST, port);
     }
 
diff --git a/core/api/src/main/java/org/onosproject/net/flow/instructions/L4ModificationInstruction.java b/core/api/src/main/java/org/onosproject/net/flow/instructions/L4ModificationInstruction.java
index c78f639..441a2c5 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/instructions/L4ModificationInstruction.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/instructions/L4ModificationInstruction.java
@@ -15,6 +15,8 @@
  */
 package org.onosproject.net.flow.instructions;
 
+import org.onlab.packet.TpPort;
+
 import java.util.Objects;
 
 import static com.google.common.base.MoreObjects.toStringHelper;
@@ -69,9 +71,9 @@
     public static final class ModTransportPortInstruction extends L4ModificationInstruction {
 
         private final L4SubType subtype;
-        private final short port;
+        private final TpPort port;
 
-        public ModTransportPortInstruction(L4SubType subtype, short port) {
+        public ModTransportPortInstruction(L4SubType subtype, TpPort port) {
             this.subtype = subtype;
             this.port = port;
         }
@@ -81,7 +83,7 @@
             return this.subtype;
         }
 
-        public short port() {
+        public TpPort port() {
             return this.port;
         }