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

Change-Id: Ibf0474b5369d11d377fd33cf5ab48083cbca3308
diff --git a/apps/aaa/src/main/java/org/onosproject/aaa/AAA.java b/apps/aaa/src/main/java/org/onosproject/aaa/AAA.java
index c386365..7e3de88 100644
--- a/apps/aaa/src/main/java/org/onosproject/aaa/AAA.java
+++ b/apps/aaa/src/main/java/org/onosproject/aaa/AAA.java
@@ -35,6 +35,7 @@
 import org.onlab.packet.MacAddress;
 import org.onlab.packet.RADIUS;
 import org.onlab.packet.RADIUSAttribute;
+import org.onlab.packet.TpPort;
 import org.onlab.packet.UDP;
 import org.onlab.packet.VlanId;
 import org.onlab.util.Tools;
@@ -236,8 +237,8 @@
         TrafficSelector radSelector = DefaultTrafficSelector.builder()
                 .matchEthType(EthType.EtherType.IPV4.ethType().toShort())
                 .matchIPProtocol(IPv4.PROTOCOL_UDP)
-                .matchUdpDst((short) 1812)
-                .matchUdpSrc((short) 1812)
+                .matchUdpDst(TpPort.tpPort(1812))
+                .matchUdpSrc(TpPort.tpPort(1812))
                 .build();
         packetService.requestPackets(radSelector, CONTROL, appId);
     }
@@ -253,8 +254,8 @@
         TrafficSelector radSelector = DefaultTrafficSelector.builder()
                 .matchEthType(EthType.EtherType.IPV4.ethType().toShort())
                 .matchIPProtocol(IPv4.PROTOCOL_UDP)
-                .matchUdpDst((short) 1812)
-                .matchUdpSrc((short) 1812)
+                .matchUdpDst(TpPort.tpPort(1812))
+                .matchUdpSrc(TpPort.tpPort(1812))
                 .build();
         packetService.cancelPackets(radSelector, CONTROL, appId);
     }
diff --git a/apps/acl/src/main/java/org/onos/acl/impl/AclManager.java b/apps/acl/src/main/java/org/onos/acl/impl/AclManager.java
index dd8355e..dbab8ca 100644
--- a/apps/acl/src/main/java/org/onos/acl/impl/AclManager.java
+++ b/apps/acl/src/main/java/org/onos/acl/impl/AclManager.java
@@ -19,6 +19,12 @@
  */
 package org.onos.acl.impl;
 
+import org.onlab.packet.Ethernet;
+import org.onlab.packet.IPv4;
+import org.onlab.packet.Ip4Address;
+import org.onlab.packet.Ip4Prefix;
+import org.onlab.packet.IpAddress;
+import org.onlab.packet.TpPort;
 import org.onos.acl.AclRule;
 import org.onos.acl.AclService;
 import org.onos.acl.AclStore;
@@ -28,11 +34,6 @@
 import org.apache.felix.scr.annotations.Reference;
 import org.apache.felix.scr.annotations.ReferenceCardinality;
 import org.apache.felix.scr.annotations.Service;
-import org.onlab.packet.Ethernet;
-import org.onlab.packet.IPv4;
-import org.onlab.packet.Ip4Address;
-import org.onlab.packet.Ip4Prefix;
-import org.onlab.packet.IpAddress;
 import org.onos.acl.RuleId;
 import org.onosproject.core.ApplicationId;
 import org.onosproject.core.CoreService;
@@ -278,10 +279,10 @@
         if (rule.dstTpPort() != 0) {
             switch (rule.ipProto()) {
                 case IPv4.PROTOCOL_TCP:
-                    selectorBuilder.matchTcpDst(rule.dstTpPort());
+                    selectorBuilder.matchTcpDst(TpPort.tpPort(rule.dstTpPort()));
                     break;
                 case IPv4.PROTOCOL_UDP:
-                    selectorBuilder.matchUdpDst(rule.dstTpPort());
+                    selectorBuilder.matchUdpDst(TpPort.tpPort(rule.dstTpPort()));
                     break;
                 default:
                     break;
diff --git a/apps/bgprouter/src/main/java/org/onosproject/bgprouter/TunnellingConnectivityManager.java b/apps/bgprouter/src/main/java/org/onosproject/bgprouter/TunnellingConnectivityManager.java
index bc6be2b..06420c1 100644
--- a/apps/bgprouter/src/main/java/org/onosproject/bgprouter/TunnellingConnectivityManager.java
+++ b/apps/bgprouter/src/main/java/org/onosproject/bgprouter/TunnellingConnectivityManager.java
@@ -21,6 +21,7 @@
 import org.onlab.packet.IPv4;
 import org.onlab.packet.IpAddress;
 import org.onlab.packet.TCP;
+import org.onlab.packet.TpPort;
 import org.onosproject.core.ApplicationId;
 import org.onosproject.net.ConnectPoint;
 import org.onosproject.net.flow.DefaultTrafficSelector;
@@ -101,13 +102,13 @@
         TrafficSelector selectorDst = DefaultTrafficSelector.builder()
                 .matchEthType(Ethernet.TYPE_IPV4)
                 .matchIPProtocol(IPv4.PROTOCOL_TCP)
-                .matchTcpDst(BGP_PORT)
+                .matchTcpDst(TpPort.tpPort(BGP_PORT))
                 .build();
 
         TrafficSelector selectorSrc = DefaultTrafficSelector.builder()
                 .matchEthType(Ethernet.TYPE_IPV4)
                 .matchIPProtocol(IPv4.PROTOCOL_TCP)
-                .matchTcpSrc(BGP_PORT)
+                .matchTcpSrc(TpPort.tpPort(BGP_PORT))
                 .build();
 
         TrafficTreatment treatment = DefaultTrafficTreatment.builder()
diff --git a/apps/cordfabric/src/main/java/org/onosproject/cordfabric/CordFabricManager.java b/apps/cordfabric/src/main/java/org/onosproject/cordfabric/CordFabricManager.java
index c5395e8..67f5dd8 100644
--- a/apps/cordfabric/src/main/java/org/onosproject/cordfabric/CordFabricManager.java
+++ b/apps/cordfabric/src/main/java/org/onosproject/cordfabric/CordFabricManager.java
@@ -27,6 +27,7 @@
 import org.onlab.packet.Ethernet;
 import org.onlab.packet.IPv4;
 import org.onlab.packet.MacAddress;
+import org.onlab.packet.TpPort;
 import org.onlab.packet.VlanId;
 import org.onosproject.core.ApplicationId;
 import org.onosproject.core.CoreService;
@@ -119,14 +120,14 @@
         TrafficSelector ofInBandMatchUp = DefaultTrafficSelector.builder()
                 .matchEthType(Ethernet.TYPE_IPV4)
                 .matchIPProtocol(IPv4.PROTOCOL_TCP)
-                .matchTcpDst(ofPort)
+                .matchTcpDst(TpPort.tpPort(ofPort))
                 .matchInPort(PortNumber.portNumber(6))
                 .build();
 
         TrafficSelector ofInBandMatchDown = DefaultTrafficSelector.builder()
                 .matchEthType(Ethernet.TYPE_IPV4)
                 .matchIPProtocol(IPv4.PROTOCOL_TCP)
-                .matchTcpSrc(ofPort)
+                .matchTcpSrc(TpPort.tpPort(ofPort))
                 .matchInPort(PortNumber.portNumber(1))
                 .build();
 
@@ -152,14 +153,14 @@
                 .matchInPort(PortNumber.portNumber(2))
                 .matchEthType(Ethernet.TYPE_IPV4)
                 .matchIPProtocol(IPv4.PROTOCOL_UDP)
-                .matchUdpDst(radiusPort)
+                .matchUdpDst(TpPort.tpPort(radiusPort))
                 .build();
 
         TrafficSelector fromRadius = DefaultTrafficSelector.builder()
                 .matchInPort(PortNumber.portNumber(5))
                 .matchEthType(Ethernet.TYPE_IPV4)
                 .matchIPProtocol(IPv4.PROTOCOL_UDP)
-                .matchUdpDst(radiusPort)
+                .matchUdpDst(TpPort.tpPort(radiusPort))
                 .build();
 
         TrafficTreatment toOlt = DefaultTrafficTreatment.builder()
diff --git a/apps/fwd/src/main/java/org/onosproject/fwd/ReactiveForwarding.java b/apps/fwd/src/main/java/org/onosproject/fwd/ReactiveForwarding.java
index f9bb3eb..8540ba1 100644
--- a/apps/fwd/src/main/java/org/onosproject/fwd/ReactiveForwarding.java
+++ b/apps/fwd/src/main/java/org/onosproject/fwd/ReactiveForwarding.java
@@ -32,6 +32,7 @@
 import org.onlab.packet.Ip6Prefix;
 import org.onlab.packet.MacAddress;
 import org.onlab.packet.TCP;
+import org.onlab.packet.TpPort;
 import org.onlab.packet.UDP;
 import org.onlab.packet.VlanId;
 import org.onosproject.cfg.ComponentConfigService;
@@ -587,14 +588,14 @@
                 if (matchTcpUdpPorts && ipv4Protocol == IPv4.PROTOCOL_TCP) {
                     TCP tcpPacket = (TCP) ipv4Packet.getPayload();
                     selectorBuilder.matchIPProtocol(ipv4Protocol)
-                            .matchTcpSrc(tcpPacket.getSourcePort())
-                            .matchTcpDst(tcpPacket.getDestinationPort());
+                            .matchTcpSrc(TpPort.tpPort(tcpPacket.getSourcePort()))
+                            .matchTcpDst(TpPort.tpPort(tcpPacket.getDestinationPort()));
                 }
                 if (matchTcpUdpPorts && ipv4Protocol == IPv4.PROTOCOL_UDP) {
                     UDP udpPacket = (UDP) ipv4Packet.getPayload();
                     selectorBuilder.matchIPProtocol(ipv4Protocol)
-                            .matchUdpSrc(udpPacket.getSourcePort())
-                            .matchUdpDst(udpPacket.getDestinationPort());
+                            .matchUdpSrc(TpPort.tpPort(udpPacket.getSourcePort()))
+                            .matchUdpDst(TpPort.tpPort(udpPacket.getDestinationPort()));
                 }
                 if (matchIcmpFields && ipv4Protocol == IPv4.PROTOCOL_ICMP) {
                     ICMP icmpPacket = (ICMP) ipv4Packet.getPayload();
@@ -628,14 +629,14 @@
                 if (matchTcpUdpPorts && ipv6NextHeader == IPv6.PROTOCOL_TCP) {
                     TCP tcpPacket = (TCP) ipv6Packet.getPayload();
                     selectorBuilder.matchIPProtocol(ipv6NextHeader)
-                            .matchTcpSrc(tcpPacket.getSourcePort())
-                            .matchTcpDst(tcpPacket.getDestinationPort());
+                            .matchTcpSrc(TpPort.tpPort(tcpPacket.getSourcePort()))
+                            .matchTcpDst(TpPort.tpPort(tcpPacket.getDestinationPort()));
                 }
                 if (matchTcpUdpPorts && ipv6NextHeader == IPv6.PROTOCOL_UDP) {
                     UDP udpPacket = (UDP) ipv6Packet.getPayload();
                     selectorBuilder.matchIPProtocol(ipv6NextHeader)
-                            .matchUdpSrc(udpPacket.getSourcePort())
-                            .matchUdpDst(udpPacket.getDestinationPort());
+                            .matchUdpSrc(TpPort.tpPort(udpPacket.getSourcePort()))
+                            .matchUdpDst(TpPort.tpPort(udpPacket.getDestinationPort()));
                 }
                 if (matchIcmpFields && ipv6NextHeader == IPv6.PROTOCOL_ICMP6) {
                     ICMP6 icmp6Packet = (ICMP6) ipv6Packet.getPayload();
diff --git a/apps/sdnip/src/main/java/org/onosproject/sdnip/PeerConnectivityManager.java b/apps/sdnip/src/main/java/org/onosproject/sdnip/PeerConnectivityManager.java
index 0bb18ed..ce85945 100644
--- a/apps/sdnip/src/main/java/org/onosproject/sdnip/PeerConnectivityManager.java
+++ b/apps/sdnip/src/main/java/org/onosproject/sdnip/PeerConnectivityManager.java
@@ -20,6 +20,7 @@
 import org.onlab.packet.IPv6;
 import org.onlab.packet.IpAddress;
 import org.onlab.packet.IpPrefix;
+import org.onlab.packet.TpPort;
 import org.onosproject.core.ApplicationId;
 import org.onosproject.net.ConnectPoint;
 import org.onosproject.net.flow.DefaultTrafficSelector;
@@ -321,11 +322,11 @@
         }
 
         if (srcTcpPort != null) {
-            builder.matchTcpSrc(srcTcpPort);
+            builder.matchTcpSrc(TpPort.tpPort(srcTcpPort));
         }
 
         if (dstTcpPort != null) {
-            builder.matchTcpDst(dstTcpPort);
+            builder.matchTcpDst(TpPort.tpPort(dstTcpPort));
         }
 
         return builder.build();
diff --git a/apps/sdnip/src/test/java/org/onosproject/sdnip/PeerConnectivityManagerTest.java b/apps/sdnip/src/test/java/org/onosproject/sdnip/PeerConnectivityManagerTest.java
index fd7bb46..19c1d50 100644
--- a/apps/sdnip/src/test/java/org/onosproject/sdnip/PeerConnectivityManagerTest.java
+++ b/apps/sdnip/src/test/java/org/onosproject/sdnip/PeerConnectivityManagerTest.java
@@ -26,6 +26,7 @@
 import org.onlab.packet.IpAddress;
 import org.onlab.packet.IpPrefix;
 import org.onlab.packet.MacAddress;
+import org.onlab.packet.TpPort;
 import org.onlab.packet.VlanId;
 import org.onosproject.core.ApplicationId;
 import org.onosproject.net.ConnectPoint;
@@ -290,10 +291,10 @@
                 .matchIPDst(IpPrefix.valueOf(dstPrefix));
 
         if (srcTcpPort != null) {
-            builder.matchTcpSrc(srcTcpPort);
+            builder.matchTcpSrc(TpPort.tpPort(srcTcpPort));
         }
         if (dstTcpPort != null) {
-            builder.matchTcpDst(dstTcpPort);
+            builder.matchTcpDst(TpPort.tpPort(dstTcpPort));
         }
 
         PointToPointIntent intent = PointToPointIntent.builder()
diff --git a/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/PolicyHandler.java b/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/PolicyHandler.java
index 9a2a891..e773e10 100644
--- a/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/PolicyHandler.java
+++ b/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/PolicyHandler.java
@@ -18,6 +18,7 @@
 
 import org.onlab.packet.Ethernet;
 import org.onlab.packet.IpPrefix;
+import org.onlab.packet.TpPort;
 import org.onosproject.cli.net.IpProtocol;
 import org.onosproject.core.ApplicationId;
 import org.onosproject.net.DeviceId;
@@ -193,17 +194,17 @@
             tsb.matchIPProtocol(ipProto.byteValue());
             if (IpProtocol.valueOf(policy.ipProto()).equals(IpProtocol.TCP)) {
                 if (policy.srcPort() != 0) {
-                    tsb.matchTcpSrc(policy.srcPort());
+                    tsb.matchTcpSrc(TpPort.tpPort(policy.srcPort()));
                 }
                 if (policy.dstPort() != 0) {
-                    tsb.matchTcpDst(policy.dstPort());
+                    tsb.matchTcpDst(TpPort.tpPort(policy.dstPort()));
                 }
             } else if (IpProtocol.valueOf(policy.ipProto()).equals(IpProtocol.UDP)) {
                 if (policy.srcPort() != 0) {
-                    tsb.matchUdpSrc(policy.srcPort());
+                    tsb.matchUdpSrc(TpPort.tpPort(policy.srcPort()));
                 }
                 if (policy.dstPort() != 0) {
-                    tsb.matchUdpDst(policy.dstPort());
+                    tsb.matchUdpDst(TpPort.tpPort(policy.dstPort()));
                 }
             }
         }
diff --git a/cli/src/main/java/org/onosproject/cli/net/ConnectivityIntentCommand.java b/cli/src/main/java/org/onosproject/cli/net/ConnectivityIntentCommand.java
index 42c2662..6c33f45 100644
--- a/cli/src/main/java/org/onosproject/cli/net/ConnectivityIntentCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/ConnectivityIntentCommand.java
@@ -24,6 +24,9 @@
 import org.apache.karaf.shell.commands.Option;
 import org.onlab.packet.Ip6Address;
 import org.onlab.packet.IpAddress;
+import org.onlab.packet.IpPrefix;
+import org.onlab.packet.MacAddress;
+import org.onlab.packet.TpPort;
 import org.onlab.packet.VlanId;
 import org.onlab.util.Bandwidth;
 import org.onosproject.cli.AbstractShellCommand;
@@ -42,8 +45,6 @@
 import org.onosproject.net.intent.constraint.LinkTypeConstraint;
 import org.onosproject.net.intent.constraint.PartialFailureConstraint;
 import org.onosproject.net.resource.link.BandwidthResource;
-import org.onlab.packet.IpPrefix;
-import org.onlab.packet.MacAddress;
 
 /**
  * Base class for command line operations for connectivity based intents.
@@ -266,11 +267,11 @@
         }
 
         if (!isNullOrEmpty(srcTcpString)) {
-            selectorBuilder.matchTcpSrc((short) Integer.parseInt(srcTcpString));
+            selectorBuilder.matchTcpSrc(TpPort.tpPort(Integer.parseInt(srcTcpString)));
         }
 
         if (!isNullOrEmpty(dstTcpString)) {
-            selectorBuilder.matchTcpDst((short) Integer.parseInt(dstTcpString));
+            selectorBuilder.matchTcpDst(TpPort.tpPort(Integer.parseInt(dstTcpString)));
         }
 
         if (extHdrStringList != null) {
diff --git a/core/api/src/main/java/org/onosproject/net/flow/DefaultTrafficSelector.java b/core/api/src/main/java/org/onosproject/net/flow/DefaultTrafficSelector.java
index ece32d4..c97b66a 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/DefaultTrafficSelector.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/DefaultTrafficSelector.java
@@ -21,6 +21,7 @@
 import org.onlab.packet.IpPrefix;
 import org.onlab.packet.MacAddress;
 import org.onlab.packet.MplsLabel;
+import org.onlab.packet.TpPort;
 import org.onlab.packet.VlanId;
 import org.onosproject.net.IndexedLambda;
 import org.onosproject.net.PortNumber;
@@ -208,37 +209,73 @@
             return add(Criteria.matchIPDst(ip));
         }
 
+        @Deprecated
         @Override
         public Builder matchTcpSrc(short tcpPort) {
             return add(Criteria.matchTcpSrc(tcpPort));
         }
 
         @Override
+        public Builder matchTcpSrc(TpPort tcpPort) {
+            return add(Criteria.matchTcpSrc(tcpPort));
+        }
+
+        @Deprecated
+        @Override
         public Builder matchTcpDst(short tcpPort) {
             return add(Criteria.matchTcpDst(tcpPort));
         }
 
         @Override
+        public Builder matchTcpDst(TpPort tcpPort) {
+            return add(Criteria.matchTcpDst(tcpPort));
+        }
+
+        @Deprecated
+        @Override
         public Builder matchUdpSrc(short udpPort) {
             return add(Criteria.matchUdpSrc(udpPort));
         }
 
         @Override
+        public Builder matchUdpSrc(TpPort udpPort) {
+            return add(Criteria.matchUdpSrc(udpPort));
+        }
+
+        @Deprecated
+        @Override
         public Builder matchUdpDst(short udpPort) {
             return add(Criteria.matchUdpDst(udpPort));
         }
 
         @Override
+        public Builder matchUdpDst(TpPort udpPort) {
+            return add(Criteria.matchUdpDst(udpPort));
+        }
+
+        @Deprecated
+        @Override
         public Builder matchSctpSrc(short sctpPort) {
             return add(Criteria.matchSctpSrc(sctpPort));
         }
 
         @Override
+        public Builder matchSctpSrc(TpPort sctpPort) {
+            return add(Criteria.matchSctpSrc(sctpPort));
+        }
+
+        @Deprecated
+        @Override
         public Builder matchSctpDst(short sctpPort) {
             return add(Criteria.matchSctpDst(sctpPort));
         }
 
         @Override
+        public Builder matchSctpDst(TpPort sctpPort) {
+            return add(Criteria.matchSctpDst(sctpPort));
+        }
+
+        @Override
         public Builder matchIcmpType(byte icmpType) {
             return add(Criteria.matchIcmpType(icmpType));
         }
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 f0937a7..8d787c4 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
@@ -22,6 +22,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;
@@ -416,27 +417,51 @@
             return add(Instructions.modTunnelId(tunnelId));
         }
 
+        @Deprecated
         @Override
         public TrafficTreatment.Builder setTcpSrc(short port) {
             return add(Instructions.modTcpSrc(port));
         }
 
         @Override
+        public TrafficTreatment.Builder setTcpSrc(TpPort port) {
+            return add(Instructions.modTcpSrc(port));
+        }
+
+        @Deprecated
+        @Override
         public TrafficTreatment.Builder setTcpDst(short port) {
             return add(Instructions.modTcpDst(port));
         }
 
         @Override
+        public TrafficTreatment.Builder setTcpDst(TpPort port) {
+            return add(Instructions.modTcpDst(port));
+        }
+
+        @Deprecated
+        @Override
         public TrafficTreatment.Builder setUdpSrc(short port) {
             return add(Instructions.modUdpSrc(port));
         }
 
         @Override
+        public TrafficTreatment.Builder setUdpSrc(TpPort port) {
+            return add(Instructions.modUdpSrc(port));
+        }
+
+        @Deprecated
+        @Override
         public TrafficTreatment.Builder setUdpDst(short port) {
             return add(Instructions.modUdpDst(port));
         }
 
         @Override
+        public TrafficTreatment.Builder setUdpDst(TpPort port) {
+            return add(Instructions.modUdpDst(port));
+        }
+
+        @Override
         public TrafficTreatment build() {
             //Don't add DROP instruction by default when instruction
             //set is empty. This will be handled in DefaultSingleTablePipeline
diff --git a/core/api/src/main/java/org/onosproject/net/flow/TrafficSelector.java b/core/api/src/main/java/org/onosproject/net/flow/TrafficSelector.java
index 8ccc531..f2de9a0 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/TrafficSelector.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/TrafficSelector.java
@@ -17,14 +17,15 @@
 
 import java.util.Set;
 
+import org.onlab.packet.Ip6Address;
+import org.onlab.packet.IpPrefix;
+import org.onlab.packet.MacAddress;
+import org.onlab.packet.MplsLabel;
+import org.onlab.packet.TpPort;
+import org.onlab.packet.VlanId;
 import org.onosproject.net.PortNumber;
 import org.onosproject.net.flow.DefaultTrafficSelector.Builder;
 import org.onosproject.net.flow.criteria.Criterion;
-import org.onlab.packet.IpPrefix;
-import org.onlab.packet.Ip6Address;
-import org.onlab.packet.MacAddress;
-import org.onlab.packet.MplsLabel;
-import org.onlab.packet.VlanId;
 
 /**
  * Abstraction of a slice of network traffic.
@@ -170,16 +171,46 @@
          *
          * @param tcpPort a TCP source port number
          * @return a selection builder
+         * @deprecated in Drake release
          */
+        @Deprecated
         Builder matchTcpSrc(short tcpPort);
 
         /**
+         * Matches a TCP source port number.
+         *
+         * @param tcpPort a TCP source port number
+         * @return a selection builder
+         */
+        Builder matchTcpSrc(TpPort tcpPort);
+
+        /**
+         * Matches a TCP destination port number.
+         *
+         * @param tcpPort a TCP destination port number
+         * @return a selection builder
+         * @deprecated in Drake release
+         */
+        @Deprecated
+        Builder matchTcpDst(short tcpPort);
+
+        /**
          * Matches a TCP destination port number.
          *
          * @param tcpPort a TCP destination port number
          * @return a selection builder
          */
-        Builder matchTcpDst(short tcpPort);
+        Builder matchTcpDst(TpPort tcpPort);
+
+        /**
+         * Matches an UDP source port number.
+         *
+         * @param udpPort an UDP source port number
+         * @return a selection builder
+         * @deprecated in Drake release
+         */
+        @Deprecated
+        Builder matchUdpSrc(short udpPort);
 
         /**
          * Matches an UDP source port number.
@@ -187,7 +218,17 @@
          * @param udpPort an UDP source port number
          * @return a selection builder
          */
-        Builder matchUdpSrc(short udpPort);
+        Builder matchUdpSrc(TpPort udpPort);
+
+        /**
+         * Matches an UDP destination port number.
+         *
+         * @param udpPort an UDP destination port number
+         * @return a selection builder
+         * @deprecated in Drake release
+         */
+        @Deprecated
+        Builder matchUdpDst(short udpPort);
 
         /**
          * Matches an UDP destination port number.
@@ -195,7 +236,17 @@
          * @param udpPort an UDP destination port number
          * @return a selection builder
          */
-        Builder matchUdpDst(short udpPort);
+        Builder matchUdpDst(TpPort udpPort);
+
+        /**
+         * Matches a SCTP source port number.
+         *
+         * @param sctpPort a SCTP source port number
+         * @return a selection builder
+         * @deprecated in Drake release
+         */
+        @Deprecated
+        Builder matchSctpSrc(short sctpPort);
 
         /**
          * Matches a SCTP source port number.
@@ -203,7 +254,17 @@
          * @param sctpPort a SCTP source port number
          * @return a selection builder
          */
-        Builder matchSctpSrc(short sctpPort);
+        Builder matchSctpSrc(TpPort sctpPort);
+
+        /**
+         * Matches a SCTP destination port number.
+         *
+         * @param sctpPort a SCTP destination port number
+         * @return a selection builder
+         * @deprecated in Drake release
+         */
+        @Deprecated
+        Builder matchSctpDst(short sctpPort);
 
         /**
          * Matches a SCTP destination port number.
@@ -211,7 +272,7 @@
          * @param sctpPort a SCTP destination port number
          * @return a selection builder
          */
-        Builder matchSctpDst(short sctpPort);
+        Builder matchSctpDst(TpPort sctpPort);
 
         /**
          * Matches an ICMP type.
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 b982199..1ce669c 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
@@ -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.PortNumber;
@@ -346,16 +347,46 @@
          *
          * @param port a port number
          * @return a treatment builder
+         * @deprecated in Drake release
          */
+        @Deprecated
         Builder setTcpSrc(short port);
 
         /**
+         * Sets the src TCP port.
+         *
+         * @param port a port number
+         * @return a treatment builder
+         */
+        Builder setTcpSrc(TpPort port);
+
+        /**
+         * Sets the dst TCP port.
+         *
+         * @param port a port number
+         * @return a treatment builder
+         * @deprecated in Drake release
+         */
+        @Deprecated
+        Builder setTcpDst(short port);
+
+        /**
          * Sets the dst TCP port.
          *
          * @param port a port number
          * @return a treatment builder
          */
-        Builder setTcpDst(short port);
+        Builder setTcpDst(TpPort port);
+
+        /**
+         * Sets the src UDP port.
+         *
+         * @param port a port number
+         * @return a treatment builder
+         * @deprecated in Drake release
+         */
+        @Deprecated
+        Builder setUdpSrc(short port);
 
         /**
          * Sets the src UDP port.
@@ -363,7 +394,17 @@
          * @param port a port number
          * @return a treatment builder
          */
-        Builder setUdpSrc(short port);
+        Builder setUdpSrc(TpPort port);
+
+        /**
+         * Sets the dst UDP port.
+         *
+         * @param port a port number
+         * @return a treatment builder
+         * @deprecated in Drake release
+         */
+        @Deprecated
+        Builder setUdpDst(short port);
 
         /**
          * Sets the dst UDP port.
@@ -371,7 +412,7 @@
          * @param port a port number
          * @return a treatment builder
          */
-        Builder setUdpDst(short port);
+        Builder setUdpDst(TpPort port);
 
         /**
          * Builds an immutable traffic treatment descriptor.
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 4d05be1..0252cfb 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
@@ -16,16 +16,17 @@
 package org.onosproject.net.flow.criteria;
 
 import org.onlab.packet.EthType;
+import org.onlab.packet.Ip6Address;
+import org.onlab.packet.IpPrefix;
+import org.onlab.packet.MacAddress;
+import org.onlab.packet.MplsLabel;
+import org.onlab.packet.TpPort;
+import org.onlab.packet.VlanId;
 import org.onosproject.net.IndexedLambda;
 import org.onosproject.net.Lambda;
 import org.onosproject.net.OchSignal;
 import org.onosproject.net.PortNumber;
 import org.onosproject.net.flow.criteria.Criterion.Type;
-import org.onlab.packet.IpPrefix;
-import org.onlab.packet.Ip6Address;
-import org.onlab.packet.MacAddress;
-import org.onlab.packet.MplsLabel;
-import org.onlab.packet.VlanId;
 import org.onosproject.net.OchSignalType;
 
 /**
@@ -184,50 +185,110 @@
     /**
      * Creates a match on TCP source port field using the specified value.
      *
-     * @param tcpPort TCP source port (16 bits unsigned integer)
+     * @param tcpPort TCP source port
+     * @return match criterion
+     * @deprecated in Drake release
+     */
+    @Deprecated
+    public static Criterion matchTcpSrc(short tcpPort) {
+        return new TcpPortCriterion(TpPort.tpPort(tcpPort), Type.TCP_SRC);
+    }
+
+    /**
+     * Creates a match on TCP source port field using the specified value.
+     *
+     * @param tcpPort TCP source port
      * @return match criterion
      */
-    public static Criterion matchTcpSrc(int tcpPort) {
+    public static Criterion matchTcpSrc(TpPort tcpPort) {
         return new TcpPortCriterion(tcpPort, Type.TCP_SRC);
     }
 
     /**
      * Creates a match on TCP destination port field using the specified value.
      *
-     * @param tcpPort TCP destination port (16 bits unsigned integer)
+     * @param tcpPort TCP destination port
+     * @return match criterion
+     * @deprecated in Drake release
+     */
+    @Deprecated
+    public static Criterion matchTcpDst(short tcpPort) {
+        return new TcpPortCriterion(TpPort.tpPort(tcpPort), Type.TCP_DST);
+    }
+
+    /**
+     * Creates a match on TCP destination port field using the specified value.
+     *
+     * @param tcpPort TCP destination port
      * @return match criterion
      */
-    public static Criterion matchTcpDst(int tcpPort) {
+    public static Criterion matchTcpDst(TpPort tcpPort) {
         return new TcpPortCriterion(tcpPort, Type.TCP_DST);
     }
 
     /**
      * Creates a match on UDP source port field using the specified value.
      *
-     * @param udpPort UDP source port (16 bits unsigned integer)
+     * @param udpPort UDP source port
+     * @return match criterion
+     * @deprecated in Drake release
+     */
+    @Deprecated
+    public static Criterion matchUdpSrc(short udpPort) {
+        return new UdpPortCriterion(TpPort.tpPort(udpPort), Type.UDP_SRC);
+    }
+
+    /**
+     * Creates a match on UDP source port field using the specified value.
+     *
+     * @param udpPort UDP source port
      * @return match criterion
      */
-    public static Criterion matchUdpSrc(int udpPort) {
+    public static Criterion matchUdpSrc(TpPort udpPort) {
         return new UdpPortCriterion(udpPort, Type.UDP_SRC);
     }
 
     /**
      * Creates a match on UDP destination port field using the specified value.
      *
-     * @param udpPort UDP destination port (16 bits unsigned integer)
+     * @param udpPort UDP destination port
+     * @return match criterion
+     * @deprecated in Drake release
+     */
+    @Deprecated
+    public static Criterion matchUdpDst(short udpPort) {
+        return new UdpPortCriterion(TpPort.tpPort(udpPort), Type.UDP_DST);
+    }
+
+    /**
+     * Creates a match on UDP destination port field using the specified value.
+     *
+     * @param udpPort UDP destination port
      * @return match criterion
      */
-    public static Criterion matchUdpDst(int udpPort) {
+    public static Criterion matchUdpDst(TpPort udpPort) {
         return new UdpPortCriterion(udpPort, Type.UDP_DST);
     }
 
     /**
      * Creates a match on SCTP source port field using the specified value.
      *
-     * @param sctpPort SCTP source port (16 bits unsigned integer)
+     * @param sctpPort SCTP source port
+     * @return match criterion
+     * @deprecated in Drake release
+     */
+    @Deprecated
+    public static Criterion matchSctpSrc(short sctpPort) {
+        return new SctpPortCriterion(TpPort.tpPort(sctpPort), Type.SCTP_SRC);
+    }
+
+    /**
+     * Creates a match on SCTP source port field using the specified value.
+     *
+     * @param sctpPort SCTP source port
      * @return match criterion
      */
-    public static Criterion matchSctpSrc(int sctpPort) {
+    public static Criterion matchSctpSrc(TpPort sctpPort) {
         return new SctpPortCriterion(sctpPort, Type.SCTP_SRC);
     }
 
@@ -235,10 +296,23 @@
      * Creates a match on SCTP destination port field using the specified
      * value.
      *
-     * @param sctpPort SCTP destination port (16 bits unsigned integer)
+     * @param sctpPort SCTP destination port
+     * @return match criterion
+     * @deprecated in Drake release
+     */
+    @Deprecated
+    public static Criterion matchSctpDst(short sctpPort) {
+        return new SctpPortCriterion(TpPort.tpPort(sctpPort), Type.SCTP_DST);
+    }
+
+    /**
+     * Creates a match on SCTP destination port field using the specified
+     * value.
+     *
+     * @param sctpPort SCTP destination port
      * @return match criterion
      */
-    public static Criterion matchSctpDst(int sctpPort) {
+    public static Criterion matchSctpDst(TpPort sctpPort) {
         return new SctpPortCriterion(sctpPort, Type.SCTP_DST);
     }
 
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/SctpPortCriterion.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/SctpPortCriterion.java
index a8e8e56..2d4cf15 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/SctpPortCriterion.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/SctpPortCriterion.java
@@ -15,6 +15,8 @@
  */
 package org.onosproject.net.flow.criteria;
 
+import org.onlab.packet.TpPort;
+
 import java.util.Objects;
 
 import static com.google.common.base.MoreObjects.toStringHelper;
@@ -23,19 +25,18 @@
  * Implementation of SCTP port criterion (16 bits unsigned integer).
  */
 public final class SctpPortCriterion implements Criterion {
-    private static final int MASK = 0xffff;
-    private final int sctpPort;             // Port value: 16 bits
+    private final TpPort sctpPort;
     private final Type type;
 
     /**
      * Constructor.
      *
-     * @param sctpPort the SCTP port to match (16 bits unsigned integer)
+     * @param sctpPort the SCTP port to match
      * @param type the match type. Should be either Type.SCTP_SRC or
      * Type.SCTP_DST
      */
-    SctpPortCriterion(int sctpPort, Type type) {
-        this.sctpPort = sctpPort & MASK;
+    SctpPortCriterion(TpPort sctpPort, Type type) {
+        this.sctpPort = sctpPort;
         this.type = type;
     }
 
@@ -47,9 +48,9 @@
     /**
      * Gets the SCTP port to match.
      *
-     * @return the SCTP port to match (16 bits unsigned integer)
+     * @return the SCTP port to match
      */
-    public int sctpPort() {
+    public TpPort sctpPort() {
         return this.sctpPort;
     }
 
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/TcpPortCriterion.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/TcpPortCriterion.java
index 3f15375..e682b23 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/TcpPortCriterion.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/TcpPortCriterion.java
@@ -15,6 +15,8 @@
  */
 package org.onosproject.net.flow.criteria;
 
+import org.onlab.packet.TpPort;
+
 import java.util.Objects;
 
 import static com.google.common.base.MoreObjects.toStringHelper;
@@ -23,19 +25,18 @@
  * Implementation of TCP port criterion (16 bits unsigned integer).
  */
 public final class TcpPortCriterion implements Criterion {
-    private static final int MASK = 0xffff;
-    private final int tcpPort;              // Port value: 16 bits
+    private final TpPort tcpPort;
     private final Type type;
 
     /**
      * Constructor.
      *
-     * @param tcpPort the TCP port to match (16 bits unsigned integer)
+     * @param tcpPort the TCP port to match
      * @param type the match type. Should be either Type.TCP_SRC or
      * Type.TCP_DST
      */
-    TcpPortCriterion(int tcpPort, Type type) {
-        this.tcpPort = tcpPort & MASK;
+    TcpPortCriterion(TpPort tcpPort, Type type) {
+        this.tcpPort = tcpPort;
         this.type = type;
     }
 
@@ -47,9 +48,9 @@
     /**
      * Gets the TCP port to match.
      *
-     * @return the TCP port to match (16 bits unsigned integer)
+     * @return the TCP port to match
      */
-    public int tcpPort() {
+    public TpPort tcpPort() {
         return this.tcpPort;
     }
 
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/UdpPortCriterion.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/UdpPortCriterion.java
index 9764021..8a29f47 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/UdpPortCriterion.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/UdpPortCriterion.java
@@ -15,6 +15,8 @@
  */
 package org.onosproject.net.flow.criteria;
 
+import org.onlab.packet.TpPort;
+
 import java.util.Objects;
 
 import static com.google.common.base.MoreObjects.toStringHelper;
@@ -23,19 +25,18 @@
  * Implementation of UDP port criterion (16 bits unsigned integer).
  */
 public final class UdpPortCriterion implements Criterion {
-    private static final int MASK = 0xffff;
-    private final int udpPort;              // Port value: 16 bits
+    private final TpPort udpPort;
     private final Type type;
 
     /**
      * Constructor.
      *
-     * @param udpPort the UDP port to match (16 bits unsigned integer)
+     * @param udpPort the UDP port to match
      * @param type the match type. Should be either Type.UDP_SRC or
      * Type.UDP_DST
      */
-    UdpPortCriterion(int udpPort, Type type) {
-        this.udpPort = udpPort & MASK;
+    UdpPortCriterion(TpPort udpPort, Type type) {
+        this.udpPort = udpPort;
         this.type = type;
     }
 
@@ -47,9 +48,9 @@
     /**
      * Gets the UDP port to match.
      *
-     * @return the UDP port to match (16 bits unsigned integer)
+     * @return the UDP port to match
      */
-    public int udpPort() {
+    public TpPort udpPort() {
         return this.udpPort;
     }
 
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;
         }
 
diff --git a/core/api/src/test/java/org/onosproject/net/flow/DefaultTrafficSelectorTest.java b/core/api/src/test/java/org/onosproject/net/flow/DefaultTrafficSelectorTest.java
index f7050ec..b871397 100644
--- a/core/api/src/test/java/org/onosproject/net/flow/DefaultTrafficSelectorTest.java
+++ b/core/api/src/test/java/org/onosproject/net/flow/DefaultTrafficSelectorTest.java
@@ -22,15 +22,16 @@
 import org.hamcrest.Matcher;
 import org.hamcrest.TypeSafeMatcher;
 import org.junit.Test;
-import org.onosproject.net.IndexedLambda;
-import org.onosproject.net.PortNumber;
-import org.onosproject.net.flow.criteria.Criteria;
-import org.onosproject.net.flow.criteria.Criterion;
 import org.onlab.packet.Ip6Address;
 import org.onlab.packet.IpPrefix;
 import org.onlab.packet.MacAddress;
 import org.onlab.packet.MplsLabel;
+import org.onlab.packet.TpPort;
 import org.onlab.packet.VlanId;
+import org.onosproject.net.IndexedLambda;
+import org.onosproject.net.PortNumber;
+import org.onosproject.net.flow.criteria.Criteria;
+import org.onosproject.net.flow.criteria.Criterion;
 
 import com.google.common.testing.EqualsTester;
 
@@ -196,27 +197,27 @@
         assertThat(selector, hasCriterionWithType(Type.IPV4_DST));
 
         selector = DefaultTrafficSelector.builder()
-                .matchTcpSrc(shortValue).build();
+                .matchTcpSrc(TpPort.tpPort(intValue)).build();
         assertThat(selector, hasCriterionWithType(Type.TCP_SRC));
 
         selector = DefaultTrafficSelector.builder()
-                .matchTcpDst(shortValue).build();
+                .matchTcpDst(TpPort.tpPort(intValue)).build();
         assertThat(selector, hasCriterionWithType(Type.TCP_DST));
 
         selector = DefaultTrafficSelector.builder()
-                .matchUdpSrc(shortValue).build();
+                .matchUdpSrc(TpPort.tpPort(intValue)).build();
         assertThat(selector, hasCriterionWithType(Type.UDP_SRC));
 
         selector = DefaultTrafficSelector.builder()
-                .matchUdpDst(shortValue).build();
+                .matchUdpDst(TpPort.tpPort(intValue)).build();
         assertThat(selector, hasCriterionWithType(Type.UDP_DST));
 
         selector = DefaultTrafficSelector.builder()
-                .matchSctpSrc(shortValue).build();
+                .matchSctpSrc(TpPort.tpPort(intValue)).build();
         assertThat(selector, hasCriterionWithType(Type.SCTP_SRC));
 
         selector = DefaultTrafficSelector.builder()
-                .matchSctpDst(shortValue).build();
+                .matchSctpDst(TpPort.tpPort(intValue)).build();
         assertThat(selector, hasCriterionWithType(Type.SCTP_DST));
 
         selector = DefaultTrafficSelector.builder()
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 de60b69..ee294f6 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
@@ -17,15 +17,16 @@
 
 import org.junit.Test;
 import org.onlab.packet.EthType;
+import org.onlab.packet.Ip6Address;
+import org.onlab.packet.IpPrefix;
+import org.onlab.packet.MacAddress;
+import org.onlab.packet.MplsLabel;
+import org.onlab.packet.TpPort;
+import org.onlab.packet.VlanId;
 import org.onosproject.net.ChannelSpacing;
 import org.onosproject.net.GridType;
 import org.onosproject.net.Lambda;
 import org.onosproject.net.PortNumber;
-import org.onlab.packet.IpPrefix;
-import org.onlab.packet.Ip6Address;
-import org.onlab.packet.MacAddress;
-import org.onlab.packet.MplsLabel;
-import org.onlab.packet.VlanId;
 
 import com.google.common.testing.EqualsTester;
 import org.onosproject.net.OchSignalType;
@@ -122,17 +123,19 @@
     Criterion sameAsMatchIpv61 = Criteria.matchIPSrc(ipv61);
     Criterion matchIpv62 = Criteria.matchIPSrc(ipv62);
 
-    Criterion matchTcpPort1 = Criteria.matchTcpSrc(1);
-    Criterion sameAsMatchTcpPort1 = Criteria.matchTcpSrc(1);
-    Criterion matchTcpPort2 = Criteria.matchTcpDst(2);
+    private TpPort tpPort1 = TpPort.tpPort(1);
+    private TpPort tpPort2 = TpPort.tpPort(2);
+    Criterion matchTcpPort1 = Criteria.matchTcpSrc(tpPort1);
+    Criterion sameAsMatchTcpPort1 = Criteria.matchTcpSrc(tpPort1);
+    Criterion matchTcpPort2 = Criteria.matchTcpDst(tpPort2);
 
-    Criterion matchUdpPort1 = Criteria.matchUdpSrc(1);
-    Criterion sameAsMatchUdpPort1 = Criteria.matchUdpSrc(1);
-    Criterion matchUdpPort2 = Criteria.matchUdpDst(2);
+    Criterion matchUdpPort1 = Criteria.matchUdpSrc(tpPort1);
+    Criterion sameAsMatchUdpPort1 = Criteria.matchUdpSrc(tpPort1);
+    Criterion matchUdpPort2 = Criteria.matchUdpDst(tpPort2);
 
-    Criterion matchSctpPort1 = Criteria.matchSctpSrc(1);
-    Criterion sameAsMatchSctpPort1 = Criteria.matchSctpSrc(1);
-    Criterion matchSctpPort2 = Criteria.matchSctpDst(2);
+    Criterion matchSctpPort1 = Criteria.matchSctpSrc(tpPort1);
+    Criterion sameAsMatchSctpPort1 = Criteria.matchSctpSrc(tpPort1);
+    Criterion matchSctpPort2 = Criteria.matchSctpDst(tpPort2);
 
     short icmpType1 = 1;
     short icmpType2 = 2;
@@ -652,12 +655,12 @@
      */
     @Test
     public void testMatchTcpSrcMethod() {
-        Criterion matchTcpSrc = Criteria.matchTcpSrc(1);
+        Criterion matchTcpSrc = Criteria.matchTcpSrc(tpPort1);
         TcpPortCriterion tcpPortCriterion =
                 checkAndConvert(matchTcpSrc,
                                 Criterion.Type.TCP_SRC,
                                 TcpPortCriterion.class);
-        assertThat(tcpPortCriterion.tcpPort(), is(equalTo(1)));
+        assertThat(tcpPortCriterion.tcpPort(), is(equalTo(tpPort1)));
     }
 
     /**
@@ -665,12 +668,12 @@
      */
     @Test
     public void testMatchTcpDstMethod() {
-        Criterion matchTcpDst = Criteria.matchTcpDst(1);
+        Criterion matchTcpDst = Criteria.matchTcpDst(tpPort1);
         TcpPortCriterion tcpPortCriterion =
                 checkAndConvert(matchTcpDst,
                         Criterion.Type.TCP_DST,
                         TcpPortCriterion.class);
-        assertThat(tcpPortCriterion.tcpPort(), is(equalTo(1)));
+        assertThat(tcpPortCriterion.tcpPort(), is(equalTo(tpPort1)));
     }
 
     /**
@@ -691,12 +694,12 @@
      */
     @Test
     public void testMatchUdpSrcMethod() {
-        Criterion matchUdpSrc = Criteria.matchUdpSrc(1);
+        Criterion matchUdpSrc = Criteria.matchUdpSrc(tpPort1);
         UdpPortCriterion udpPortCriterion =
                 checkAndConvert(matchUdpSrc,
                                 Criterion.Type.UDP_SRC,
                                 UdpPortCriterion.class);
-        assertThat(udpPortCriterion.udpPort(), is(equalTo(1)));
+        assertThat(udpPortCriterion.udpPort(), is(equalTo(tpPort1)));
     }
 
     /**
@@ -704,12 +707,12 @@
      */
     @Test
     public void testMatchUdpDstMethod() {
-        Criterion matchUdpDst = Criteria.matchUdpDst(1);
+        Criterion matchUdpDst = Criteria.matchUdpDst(tpPort1);
         UdpPortCriterion udpPortCriterion =
                 checkAndConvert(matchUdpDst,
                         Criterion.Type.UDP_DST,
                         UdpPortCriterion.class);
-        assertThat(udpPortCriterion.udpPort(), is(equalTo(1)));
+        assertThat(udpPortCriterion.udpPort(), is(equalTo(tpPort1)));
     }
 
     /**
@@ -730,12 +733,12 @@
      */
     @Test
     public void testMatchSctpSrcMethod() {
-        Criterion matchSctpSrc = Criteria.matchSctpSrc(1);
+        Criterion matchSctpSrc = Criteria.matchSctpSrc(tpPort1);
         SctpPortCriterion sctpPortCriterion =
                 checkAndConvert(matchSctpSrc,
                                 Criterion.Type.SCTP_SRC,
                                 SctpPortCriterion.class);
-        assertThat(sctpPortCriterion.sctpPort(), is(equalTo(1)));
+        assertThat(sctpPortCriterion.sctpPort(), is(equalTo(tpPort1)));
     }
 
     /**
@@ -743,12 +746,12 @@
      */
     @Test
     public void testMatchSctpDstMethod() {
-        Criterion matchSctpDst = Criteria.matchSctpDst(1);
+        Criterion matchSctpDst = Criteria.matchSctpDst(tpPort1);
         SctpPortCriterion sctpPortCriterion =
                 checkAndConvert(matchSctpDst,
                         Criterion.Type.SCTP_DST,
                         SctpPortCriterion.class);
-        assertThat(sctpPortCriterion.sctpPort(), is(equalTo(1)));
+        assertThat(sctpPortCriterion.sctpPort(), is(equalTo(tpPort1)));
     }
 
     /**
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 e33e9d7f..d365e92 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
@@ -16,15 +16,16 @@
 package org.onosproject.net.flow.instructions;
 
 import org.junit.Test;
+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.net.ChannelSpacing;
 import org.onosproject.net.GridType;
 import org.onosproject.net.IndexedLambda;
 import org.onosproject.net.Lambda;
 import org.onosproject.net.PortNumber;
-import org.onlab.packet.IpAddress;
-import org.onlab.packet.MacAddress;
-import org.onlab.packet.MplsLabel;
-import org.onlab.packet.VlanId;
 
 import com.google.common.testing.EqualsTester;
 
@@ -638,22 +639,22 @@
 
     // ModTransportPortInstruction
 
-    private final short l4port1 = 1;
-    private final short l4port2 = 2;
-    private final Instruction modTransportPortInstruction1 = Instructions.modTcpSrc(l4port1);
-    private final Instruction sameAsModTransportPortInstruction1 = Instructions.modTcpSrc(l4port1);
-    private final Instruction modTransportPortInstruction2 = Instructions.modTcpSrc(l4port2);
+    private final TpPort tpPort1 = TpPort.tpPort(1);
+    private final TpPort tpPort2 = TpPort.tpPort(2);
+    private final Instruction modTransportPortInstruction1 = Instructions.modTcpSrc(tpPort1);
+    private final Instruction sameAsModTransportPortInstruction1 = Instructions.modTcpSrc(tpPort1);
+    private final Instruction modTransportPortInstruction2 = Instructions.modTcpSrc(tpPort2);
 
     /**
      * Test the modTcpSrc() method.
      */
     @Test
     public void testModTcpSrcMethod() {
-        final Instruction instruction = Instructions.modTcpSrc(l4port1);
+        final Instruction instruction = Instructions.modTcpSrc(tpPort1);
         final L4ModificationInstruction.ModTransportPortInstruction modTransportPortInstruction =
                 checkAndConvert(instruction, Instruction.Type.L4MODIFICATION,
                                 L4ModificationInstruction.ModTransportPortInstruction.class);
-        assertThat(modTransportPortInstruction.port(), is(equalTo(l4port1)));
+        assertThat(modTransportPortInstruction.port(), is(equalTo(tpPort1)));
         assertThat(modTransportPortInstruction.subtype(),
                    is(equalTo(L4ModificationInstruction.L4SubType.TCP_SRC)));
     }
@@ -663,11 +664,11 @@
      */
     @Test
     public void testModTcpDstMethod() {
-        final Instruction instruction = Instructions.modTcpDst(l4port1);
+        final Instruction instruction = Instructions.modTcpDst(tpPort1);
         final L4ModificationInstruction.ModTransportPortInstruction modTransportPortInstruction =
                 checkAndConvert(instruction, Instruction.Type.L4MODIFICATION,
                                 L4ModificationInstruction.ModTransportPortInstruction.class);
-        assertThat(modTransportPortInstruction.port(), is(equalTo(l4port1)));
+        assertThat(modTransportPortInstruction.port(), is(equalTo(tpPort1)));
         assertThat(modTransportPortInstruction.subtype(),
                    is(equalTo(L4ModificationInstruction.L4SubType.TCP_DST)));
     }
@@ -677,11 +678,11 @@
      */
     @Test
     public void testModUdpSrcMethod() {
-        final Instruction instruction = Instructions.modUdpSrc(l4port1);
+        final Instruction instruction = Instructions.modUdpSrc(tpPort1);
         final L4ModificationInstruction.ModTransportPortInstruction modTransportPortInstruction =
                 checkAndConvert(instruction, Instruction.Type.L4MODIFICATION,
                                 L4ModificationInstruction.ModTransportPortInstruction.class);
-        assertThat(modTransportPortInstruction.port(), is(equalTo(l4port1)));
+        assertThat(modTransportPortInstruction.port(), is(equalTo(tpPort1)));
         assertThat(modTransportPortInstruction.subtype(),
                    is(equalTo(L4ModificationInstruction.L4SubType.UDP_SRC)));
     }
@@ -691,11 +692,11 @@
      */
     @Test
     public void testModUdpDstMethod() {
-        final Instruction instruction = Instructions.modUdpDst(l4port1);
+        final Instruction instruction = Instructions.modUdpDst(tpPort1);
         final L4ModificationInstruction.ModTransportPortInstruction modTransportPortInstruction =
                 checkAndConvert(instruction, Instruction.Type.L4MODIFICATION,
                                 L4ModificationInstruction.ModTransportPortInstruction.class);
-        assertThat(modTransportPortInstruction.port(), is(equalTo(l4port1)));
+        assertThat(modTransportPortInstruction.port(), is(equalTo(tpPort1)));
         assertThat(modTransportPortInstruction.subtype(),
                    is(equalTo(L4ModificationInstruction.L4SubType.UDP_DST)));
     }
diff --git a/core/common/src/main/java/org/onosproject/codec/impl/DecodeCriterionCodecHelper.java b/core/common/src/main/java/org/onosproject/codec/impl/DecodeCriterionCodecHelper.java
index e5f8896..4e0f2bd 100644
--- a/core/common/src/main/java/org/onosproject/codec/impl/DecodeCriterionCodecHelper.java
+++ b/core/common/src/main/java/org/onosproject/codec/impl/DecodeCriterionCodecHelper.java
@@ -22,6 +22,7 @@
 import org.onlab.packet.IpPrefix;
 import org.onlab.packet.MacAddress;
 import org.onlab.packet.MplsLabel;
+import org.onlab.packet.TpPort;
 import org.onlab.packet.VlanId;
 import org.onosproject.net.ChannelSpacing;
 import org.onosproject.net.GridType;
@@ -241,8 +242,8 @@
     private class TcpSrcDecoder implements CriterionDecoder {
         @Override
         public Criterion decodeCriterion(ObjectNode json) {
-            int tcpPort = nullIsIllegal(json.get(CriterionCodec.TCP_PORT),
-                    CriterionCodec.TCP_PORT + MISSING_MEMBER_MESSAGE).asInt();
+            TpPort tcpPort = TpPort.tpPort(nullIsIllegal(json.get(CriterionCodec.TCP_PORT),
+                    CriterionCodec.TCP_PORT + MISSING_MEMBER_MESSAGE).asInt());
             return Criteria.matchTcpSrc(tcpPort);
         }
     }
@@ -250,8 +251,8 @@
     private class TcpDstDecoder implements CriterionDecoder {
         @Override
         public Criterion decodeCriterion(ObjectNode json) {
-            int tcpPort = nullIsIllegal(json.get(CriterionCodec.TCP_PORT),
-                    CriterionCodec.TCP_PORT + MISSING_MEMBER_MESSAGE).asInt();
+            TpPort tcpPort = TpPort.tpPort(nullIsIllegal(json.get(CriterionCodec.TCP_PORT),
+                    CriterionCodec.TCP_PORT + MISSING_MEMBER_MESSAGE).asInt());
             return Criteria.matchTcpDst(tcpPort);
         }
     }
@@ -259,8 +260,8 @@
     private class UdpSrcDecoder implements CriterionDecoder {
         @Override
         public Criterion decodeCriterion(ObjectNode json) {
-            int udpPort = nullIsIllegal(json.get(CriterionCodec.UDP_PORT),
-                    CriterionCodec.UDP_PORT + MISSING_MEMBER_MESSAGE).asInt();
+            TpPort udpPort = TpPort.tpPort(nullIsIllegal(json.get(CriterionCodec.UDP_PORT),
+                    CriterionCodec.UDP_PORT + MISSING_MEMBER_MESSAGE).asInt());
             return Criteria.matchUdpSrc(udpPort);
         }
     }
@@ -268,8 +269,8 @@
     private class UdpDstDecoder implements CriterionDecoder {
         @Override
         public Criterion decodeCriterion(ObjectNode json) {
-            int udpPort = nullIsIllegal(json.get(CriterionCodec.UDP_PORT),
-                    CriterionCodec.UDP_PORT + MISSING_MEMBER_MESSAGE).asInt();
+            TpPort udpPort = TpPort.tpPort(nullIsIllegal(json.get(CriterionCodec.UDP_PORT),
+                    CriterionCodec.UDP_PORT + MISSING_MEMBER_MESSAGE).asInt());
             return Criteria.matchUdpDst(udpPort);
         }
     }
@@ -277,8 +278,8 @@
     private class SctpSrcDecoder implements CriterionDecoder {
         @Override
         public Criterion decodeCriterion(ObjectNode json) {
-            int sctpPort = nullIsIllegal(json.get(CriterionCodec.SCTP_PORT),
-                    CriterionCodec.SCTP_PORT + MISSING_MEMBER_MESSAGE).asInt();
+            TpPort sctpPort = TpPort.tpPort(nullIsIllegal(json.get(CriterionCodec.SCTP_PORT),
+                    CriterionCodec.SCTP_PORT + MISSING_MEMBER_MESSAGE).asInt());
             return Criteria.matchSctpSrc(sctpPort);
         }
     }
@@ -286,8 +287,8 @@
     private class SctpDstDecoder implements CriterionDecoder {
         @Override
         public Criterion decodeCriterion(ObjectNode json) {
-            int sctpPort = nullIsIllegal(json.get(CriterionCodec.SCTP_PORT),
-                    CriterionCodec.SCTP_PORT + MISSING_MEMBER_MESSAGE).asInt();
+            TpPort sctpPort = TpPort.tpPort(nullIsIllegal(json.get(CriterionCodec.SCTP_PORT),
+                    CriterionCodec.SCTP_PORT + MISSING_MEMBER_MESSAGE).asInt());
             return Criteria.matchSctpDst(sctpPort);
         }
     }
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 7edbd78..a962c0d 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
@@ -228,7 +228,7 @@
         public ObjectNode encodeCriterion(ObjectNode root, Criterion criterion) {
             final TcpPortCriterion tcpPortCriterion =
                     (TcpPortCriterion) criterion;
-            return root.put(CriterionCodec.TCP_PORT, tcpPortCriterion.tcpPort());
+            return root.put(CriterionCodec.TCP_PORT, tcpPortCriterion.tcpPort().toInt());
         }
     }
 
@@ -237,7 +237,7 @@
         public ObjectNode encodeCriterion(ObjectNode root, Criterion criterion) {
             final UdpPortCriterion udpPortCriterion =
                     (UdpPortCriterion) criterion;
-            return root.put(CriterionCodec.UDP_PORT, udpPortCriterion.udpPort());
+            return root.put(CriterionCodec.UDP_PORT, udpPortCriterion.udpPort().toInt());
         }
     }
 
@@ -246,7 +246,7 @@
         public ObjectNode encodeCriterion(ObjectNode root, Criterion criterion) {
             final SctpPortCriterion sctpPortCriterion =
                     (SctpPortCriterion) criterion;
-            return root.put(CriterionCodec.SCTP_PORT, sctpPortCriterion.sctpPort());
+            return root.put(CriterionCodec.SCTP_PORT, sctpPortCriterion.sctpPort().toInt());
         }
     }
 
diff --git a/core/common/src/test/java/org/onosproject/codec/impl/CriterionCodecTest.java b/core/common/src/test/java/org/onosproject/codec/impl/CriterionCodecTest.java
index a61689e..6bf4680 100644
--- a/core/common/src/test/java/org/onosproject/codec/impl/CriterionCodecTest.java
+++ b/core/common/src/test/java/org/onosproject/codec/impl/CriterionCodecTest.java
@@ -23,6 +23,7 @@
 import org.onlab.packet.IpPrefix;
 import org.onlab.packet.MacAddress;
 import org.onlab.packet.MplsLabel;
+import org.onlab.packet.TpPort;
 import org.onlab.packet.VlanId;
 import org.onosproject.codec.CodecContext;
 import org.onosproject.codec.JsonCodec;
@@ -54,6 +55,7 @@
     final IpPrefix ipPrefix4 = IpPrefix.valueOf("10.1.1.0/24");
     final IpPrefix ipPrefix6 = IpPrefix.valueOf("fe80::/64");
     final MacAddress mac1 = MacAddress.valueOf("00:00:11:00:00:01");
+    final TpPort tpPort = TpPort.tpPort(40000);
 
     /**
      * Sets up for each test.  Creates a context and fetches the criterion
@@ -219,7 +221,7 @@
      */
     @Test
     public void matchTcpSrcTest() {
-        Criterion criterion = Criteria.matchTcpSrc((short) 40000);
+        Criterion criterion = Criteria.matchTcpSrc(tpPort);
         ObjectNode result = criterionCodec.encode(criterion, context);
         assertThat(result, matchesCriterion(criterion));
     }
@@ -229,7 +231,7 @@
      */
     @Test
     public void matchTcpDstTest() {
-        Criterion criterion = Criteria.matchTcpDst((short) 40000);
+        Criterion criterion = Criteria.matchTcpDst(tpPort);
         ObjectNode result = criterionCodec.encode(criterion, context);
         assertThat(result, matchesCriterion(criterion));
     }
@@ -239,7 +241,7 @@
      */
     @Test
     public void matchUdpSrcTest() {
-        Criterion criterion = Criteria.matchUdpSrc(40000);
+        Criterion criterion = Criteria.matchUdpSrc(tpPort);
         ObjectNode result = criterionCodec.encode(criterion, context);
         assertThat(result, matchesCriterion(criterion));
     }
@@ -249,7 +251,7 @@
      */
     @Test
     public void matchUdpDstTest() {
-        Criterion criterion = Criteria.matchUdpDst(40000);
+        Criterion criterion = Criteria.matchUdpDst(tpPort);
         ObjectNode result = criterionCodec.encode(criterion, context);
         assertThat(result, matchesCriterion(criterion));
     }
@@ -259,7 +261,7 @@
      */
     @Test
     public void matchSctpSrcTest() {
-        Criterion criterion = Criteria.matchSctpSrc(40000);
+        Criterion criterion = Criteria.matchSctpSrc(tpPort);
         ObjectNode result = criterionCodec.encode(criterion, context);
         assertThat(result, matchesCriterion(criterion));
     }
@@ -269,7 +271,7 @@
      */
     @Test
     public void matchSctpDstTest() {
-        Criterion criterion = Criteria.matchSctpDst(40000);
+        Criterion criterion = Criteria.matchSctpDst(tpPort);
         ObjectNode result = criterionCodec.encode(criterion, context);
         assertThat(result, matchesCriterion(criterion));
     }
diff --git a/core/common/src/test/java/org/onosproject/codec/impl/CriterionJsonMatcher.java b/core/common/src/test/java/org/onosproject/codec/impl/CriterionJsonMatcher.java
index 2a4c138..bb3acad 100644
--- a/core/common/src/test/java/org/onosproject/codec/impl/CriterionJsonMatcher.java
+++ b/core/common/src/test/java/org/onosproject/codec/impl/CriterionJsonMatcher.java
@@ -249,7 +249,7 @@
      * @return true if the JSON matches the criterion, false otherwise.
      */
     private boolean matchCriterion(TcpPortCriterion criterion) {
-        final int tcpPort = criterion.tcpPort();
+        final int tcpPort = criterion.tcpPort().toInt();
         final int jsonTcpPort = jsonCriterion.get("tcpPort").intValue();
         if (tcpPort != jsonTcpPort) {
             description.appendText("tcp port was "
@@ -266,7 +266,7 @@
      * @return true if the JSON matches the criterion, false otherwise.
      */
     private boolean matchCriterion(UdpPortCriterion criterion) {
-        final int udpPort = criterion.udpPort();
+        final int udpPort = criterion.udpPort().toInt();
         final int jsonUdpPort = jsonCriterion.get("udpPort").intValue();
         if (udpPort != jsonUdpPort) {
             description.appendText("udp port was "
@@ -283,7 +283,7 @@
      * @return true if the JSON matches the criterion, false otherwise.
      */
     private boolean matchCriterion(SctpPortCriterion criterion) {
-        final int sctpPort = criterion.sctpPort();
+        final int sctpPort = criterion.sctpPort().toInt();
         final int jsonSctpPort = jsonCriterion.get("sctpPort").intValue();
         if (sctpPort != jsonSctpPort) {
             description.appendText("sctp port was "
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 f2786b6..b18dc3e 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
@@ -419,27 +419,27 @@
                 is((IpPrefix.valueOf("4.2.0.0/32"))));
 
         criterion = getCriterion(Criterion.Type.TCP_SRC);
-        assertThat(((TcpPortCriterion) criterion).tcpPort(),
+        assertThat(((TcpPortCriterion) criterion).tcpPort().toInt(),
                 is(80));
 
         criterion = getCriterion(Criterion.Type.TCP_DST);
-        assertThat(((TcpPortCriterion) criterion).tcpPort(),
+        assertThat(((TcpPortCriterion) criterion).tcpPort().toInt(),
                 is(443));
 
         criterion = getCriterion(Criterion.Type.UDP_SRC);
-        assertThat(((UdpPortCriterion) criterion).udpPort(),
+        assertThat(((UdpPortCriterion) criterion).udpPort().toInt(),
                 is(180));
 
         criterion = getCriterion(Criterion.Type.UDP_DST);
-        assertThat(((UdpPortCriterion) criterion).udpPort(),
+        assertThat(((UdpPortCriterion) criterion).udpPort().toInt(),
                 is(1443));
 
         criterion = getCriterion(Criterion.Type.SCTP_SRC);
-        assertThat(((SctpPortCriterion) criterion).sctpPort(),
+        assertThat(((SctpPortCriterion) criterion).sctpPort().toInt(),
                 is(280));
 
         criterion = getCriterion(Criterion.Type.SCTP_DST);
-        assertThat(((SctpPortCriterion) criterion).sctpPort(),
+        assertThat(((SctpPortCriterion) criterion).sctpPort().toInt(),
                 is(2443));
 
         criterion = getCriterion(Criterion.Type.ICMPV4_TYPE);
diff --git a/core/store/serializers/src/main/java/org/onosproject/store/serializers/KryoNamespaces.java b/core/store/serializers/src/main/java/org/onosproject/store/serializers/KryoNamespaces.java
index 556038a..66ee7be 100644
--- a/core/store/serializers/src/main/java/org/onosproject/store/serializers/KryoNamespaces.java
+++ b/core/store/serializers/src/main/java/org/onosproject/store/serializers/KryoNamespaces.java
@@ -29,6 +29,7 @@
 import org.onlab.packet.IpAddress;
 import org.onlab.packet.IpPrefix;
 import org.onlab.packet.MacAddress;
+import org.onlab.packet.TpPort;
 import org.onlab.packet.VlanId;
 import org.onlab.util.Bandwidth;
 import org.onlab.util.Frequency;
@@ -320,6 +321,7 @@
                     IPEcnCriterion.class,
                     IPProtocolCriterion.class,
                     IPCriterion.class,
+                    TpPort.class,
                     TcpPortCriterion.class,
                     UdpPortCriterion.class,
                     SctpPortCriterion.class,
diff --git a/drivers/src/main/java/org/onosproject/driver/pipeline/CentecV350Pipeline.java b/drivers/src/main/java/org/onosproject/driver/pipeline/CentecV350Pipeline.java
index ae5b621..ed9794c 100644
--- a/drivers/src/main/java/org/onosproject/driver/pipeline/CentecV350Pipeline.java
+++ b/drivers/src/main/java/org/onosproject/driver/pipeline/CentecV350Pipeline.java
@@ -9,6 +9,7 @@
 import org.onlab.osgi.ServiceDirectory;
 import org.onlab.packet.Ethernet;
 import org.onlab.packet.IPv4;
+import org.onlab.packet.TpPort;
 import org.onlab.packet.VlanId;
 import org.onlab.util.KryoNamespace;
 import org.onosproject.core.ApplicationId;
@@ -515,7 +516,7 @@
         treatment = DefaultTrafficTreatment.builder();
         selector.matchEthType(Ethernet.TYPE_IPV4)
                 .matchIPProtocol(IPv4.PROTOCOL_TCP)
-                .matchTcpSrc(BGP_PORT);
+                .matchTcpSrc(TpPort.tpPort(BGP_PORT));
         treatment.punt();
         rule = DefaultFlowRule.builder()
                 .forDevice(deviceId)
@@ -531,7 +532,7 @@
         treatment = DefaultTrafficTreatment.builder();
         selector.matchEthType(Ethernet.TYPE_IPV4)
                 .matchIPProtocol(IPv4.PROTOCOL_TCP)
-                .matchTcpDst(BGP_PORT);
+                .matchTcpDst(TpPort.tpPort(BGP_PORT));
         treatment.punt();
         rule = DefaultFlowRule.builder()
                 .forDevice(deviceId)
diff --git a/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/FlowEntryBuilder.java b/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/FlowEntryBuilder.java
index dba123b..f238bdb 100644
--- a/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/FlowEntryBuilder.java
+++ b/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/FlowEntryBuilder.java
@@ -30,6 +30,7 @@
 import org.onlab.packet.Ip6Prefix;
 import org.onlab.packet.MacAddress;
 import org.onlab.packet.MplsLabel;
+import org.onlab.packet.TpPort;
 import org.onlab.packet.VlanId;
 import org.onosproject.core.DefaultGroupId;
 import org.onosproject.net.DeviceId;
@@ -417,22 +418,22 @@
         case TCP_DST:
             @SuppressWarnings("unchecked")
             OFOxm<TransportPort> tcpdst = (OFOxm<TransportPort>) oxm;
-            builder.setTcpDst((short) tcpdst.getValue().getPort());
+            builder.setTcpDst(TpPort.tpPort(tcpdst.getValue().getPort()));
             break;
         case TCP_SRC:
             @SuppressWarnings("unchecked")
             OFOxm<TransportPort> tcpsrc = (OFOxm<TransportPort>) oxm;
-            builder.setTcpSrc((short) tcpsrc.getValue().getPort());
+            builder.setTcpSrc(TpPort.tpPort(tcpsrc.getValue().getPort()));
             break;
         case UDP_DST:
             @SuppressWarnings("unchecked")
             OFOxm<TransportPort> udpdst = (OFOxm<TransportPort>) oxm;
-            builder.setUdpDst((short) udpdst.getValue().getPort());
+            builder.setUdpDst(TpPort.tpPort(udpdst.getValue().getPort()));
             break;
         case UDP_SRC:
             @SuppressWarnings("unchecked")
             OFOxm<TransportPort> udpsrc = (OFOxm<TransportPort>) oxm;
-            builder.setUdpSrc((short) udpsrc.getValue().getPort());
+            builder.setUdpSrc(TpPort.tpPort(udpsrc.getValue().getPort()));
             break;
         case ARP_OP:
         case ARP_SHA:
@@ -588,16 +589,16 @@
                 builder.matchIPDst(ip4Prefix);
                 break;
             case TCP_SRC:
-                builder.matchTcpSrc((short) match.get(MatchField.TCP_SRC).getPort());
+                builder.matchTcpSrc(TpPort.tpPort(match.get(MatchField.TCP_SRC).getPort()));
                 break;
             case TCP_DST:
-                builder.matchTcpDst((short) match.get(MatchField.TCP_DST).getPort());
+                builder.matchTcpDst(TpPort.tpPort(match.get(MatchField.TCP_DST).getPort()));
                 break;
             case UDP_SRC:
-                builder.matchUdpSrc((short) match.get(MatchField.UDP_SRC).getPort());
+                builder.matchUdpSrc(TpPort.tpPort(match.get(MatchField.UDP_SRC).getPort()));
                 break;
             case UDP_DST:
-                builder.matchUdpDst((short) match.get(MatchField.UDP_DST).getPort());
+                builder.matchUdpDst(TpPort.tpPort(match.get(MatchField.UDP_DST).getPort()));
                 break;
             case MPLS_LABEL:
                 builder.matchMplsLabel(MplsLabel.mplsLabel((int) match.get(MatchField.MPLS_LABEL)
@@ -607,10 +608,10 @@
                 builder.matchMplsBos(match.get(MatchField.MPLS_BOS).getValue());
                 break;
             case SCTP_SRC:
-                builder.matchSctpSrc((short) match.get(MatchField.SCTP_SRC).getPort());
+                builder.matchSctpSrc(TpPort.tpPort(match.get(MatchField.SCTP_SRC).getPort()));
                 break;
             case SCTP_DST:
-                builder.matchSctpDst((short) match.get(MatchField.SCTP_DST).getPort());
+                builder.matchSctpDst(TpPort.tpPort(match.get(MatchField.SCTP_DST).getPort()));
                 break;
             case ICMPV4_TYPE:
                 byte icmpType = (byte) match.get(MatchField.ICMPV4_TYPE).getType();
diff --git a/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/FlowModBuilder.java b/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/FlowModBuilder.java
index b2978d9..e050524 100644
--- a/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/FlowModBuilder.java
+++ b/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/FlowModBuilder.java
@@ -268,32 +268,32 @@
             case TCP_SRC:
                 tcpPortCriterion = (TcpPortCriterion) c;
                 mBuilder.setExact(MatchField.TCP_SRC,
-                                  TransportPort.of(tcpPortCriterion.tcpPort()));
+                                  TransportPort.of(tcpPortCriterion.tcpPort().toInt()));
                 break;
             case TCP_DST:
                 tcpPortCriterion = (TcpPortCriterion) c;
                 mBuilder.setExact(MatchField.TCP_DST,
-                                  TransportPort.of(tcpPortCriterion.tcpPort()));
+                                  TransportPort.of(tcpPortCriterion.tcpPort().toInt()));
                 break;
             case UDP_SRC:
                 udpPortCriterion = (UdpPortCriterion) c;
                 mBuilder.setExact(MatchField.UDP_SRC,
-                                  TransportPort.of(udpPortCriterion.udpPort()));
+                                  TransportPort.of(udpPortCriterion.udpPort().toInt()));
                 break;
             case UDP_DST:
                 udpPortCriterion = (UdpPortCriterion) c;
                 mBuilder.setExact(MatchField.UDP_DST,
-                                  TransportPort.of(udpPortCriterion.udpPort()));
+                                  TransportPort.of(udpPortCriterion.udpPort().toInt()));
                 break;
             case SCTP_SRC:
                 sctpPortCriterion = (SctpPortCriterion) c;
                 mBuilder.setExact(MatchField.SCTP_SRC,
-                                  TransportPort.of(sctpPortCriterion.sctpPort()));
+                                  TransportPort.of(sctpPortCriterion.sctpPort().toInt()));
                 break;
             case SCTP_DST:
                 sctpPortCriterion = (SctpPortCriterion) c;
                 mBuilder.setExact(MatchField.SCTP_DST,
-                                  TransportPort.of(sctpPortCriterion.sctpPort()));
+                                  TransportPort.of(sctpPortCriterion.sctpPort().toInt()));
                 break;
             case ICMPV4_TYPE:
                 IcmpTypeCriterion icmpType = (IcmpTypeCriterion) c;
diff --git a/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/FlowModBuilderVer13.java b/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/FlowModBuilderVer13.java
index ac93f7b..5650dff 100644
--- a/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/FlowModBuilderVer13.java
+++ b/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/FlowModBuilderVer13.java
@@ -431,19 +431,19 @@
         switch (l4m.subtype()) {
             case TCP_SRC:
                 tp = (ModTransportPortInstruction) l4m;
-                oxm = factory().oxms().tcpSrc(TransportPort.of(tp.port()));
+                oxm = factory().oxms().tcpSrc(TransportPort.of(tp.port().toInt()));
                 break;
             case TCP_DST:
                 tp = (ModTransportPortInstruction) l4m;
-                oxm = factory().oxms().tcpDst(TransportPort.of(tp.port()));
+                oxm = factory().oxms().tcpDst(TransportPort.of(tp.port().toInt()));
                 break;
             case UDP_SRC:
                 tp = (ModTransportPortInstruction) l4m;
-                oxm = factory().oxms().udpSrc(TransportPort.of(tp.port()));
+                oxm = factory().oxms().udpSrc(TransportPort.of(tp.port().toInt()));
                 break;
             case UDP_DST:
                 tp = (ModTransportPortInstruction) l4m;
-                oxm = factory().oxms().udpDst(TransportPort.of(tp.port()));
+                oxm = factory().oxms().udpDst(TransportPort.of(tp.port().toInt()));
                 break;
             default:
                 log.warn("Unimplemented action type {}.", l4m.subtype());
diff --git a/utils/misc/src/main/java/org/onlab/packet/TCP.java b/utils/misc/src/main/java/org/onlab/packet/TCP.java
index b13b53c..8d45079 100644
--- a/utils/misc/src/main/java/org/onlab/packet/TCP.java
+++ b/utils/misc/src/main/java/org/onlab/packet/TCP.java
@@ -30,8 +30,8 @@
 
     private static final short TCP_HEADER_LENGTH = 20;
 
-    protected short sourcePort;
-    protected short destinationPort;
+    protected int sourcePort;
+    protected int destinationPort;
     protected int sequence;
     protected int acknowledge;
     protected byte dataOffset;
@@ -46,17 +46,17 @@
      *
      * @return TCP source port
      */
-    public short getSourcePort() {
+    public int getSourcePort() {
         return this.sourcePort;
     }
 
     /**
      * Sets TCP source port.
      *
-     * @param sourcePort the sourcePort to set
+     * @param sourcePort the sourcePort to set (unsigned 16 bits integer)
      * @return this
      */
-    public TCP setSourcePort(final short sourcePort) {
+    public TCP setSourcePort(final int sourcePort) {
         this.sourcePort = sourcePort;
         return this;
     }
@@ -66,17 +66,17 @@
      *
      * @return the destinationPort
      */
-    public short getDestinationPort() {
+    public int getDestinationPort() {
         return this.destinationPort;
     }
 
     /**
      * Sets TCP destination port.
      *
-     * @param destinationPort the destinationPort to set
+     * @param destinationPort the destinationPort to set (unsigned 16 bits integer)
      * @return this
      */
-    public TCP setDestinationPort(final short destinationPort) {
+    public TCP setDestinationPort(final int destinationPort) {
         this.destinationPort = destinationPort;
         return this;
     }
@@ -270,8 +270,8 @@
         final byte[] data = new byte[length];
         final ByteBuffer bb = ByteBuffer.wrap(data);
 
-        bb.putShort(this.sourcePort);
-        bb.putShort(this.destinationPort);
+        bb.putShort((short) (this.sourcePort & 0xffff));
+        bb.putShort((short) (this.destinationPort & 0xffff));
         bb.putInt(this.sequence);
         bb.putInt(this.acknowledge);
         bb.putShort((short) (this.flags | this.dataOffset << 12));
@@ -348,8 +348,8 @@
     public IPacket deserialize(final byte[] data, final int offset,
                                final int length) {
         final ByteBuffer bb = ByteBuffer.wrap(data, offset, length);
-        this.sourcePort = bb.getShort();
-        this.destinationPort = bb.getShort();
+        this.sourcePort = (bb.getShort() & 0xffff);
+        this.destinationPort = (bb.getShort() & 0xffff);
         this.sequence = bb.getInt();
         this.acknowledge = bb.getInt();
         this.flags = bb.getShort();
@@ -435,8 +435,8 @@
             TCP tcp = new TCP();
 
             final ByteBuffer bb = ByteBuffer.wrap(data, offset, length);
-            tcp.sourcePort = bb.getShort();
-            tcp.destinationPort = bb.getShort();
+            tcp.sourcePort = (bb.getShort() & 0xffff);
+            tcp.destinationPort = (bb.getShort() & 0xffff);
             tcp.sequence = bb.getInt();
             tcp.acknowledge = bb.getInt();
             tcp.flags = bb.getShort();
diff --git a/utils/misc/src/main/java/org/onlab/packet/UDP.java b/utils/misc/src/main/java/org/onlab/packet/UDP.java
index 32432e6..66534eb 100644
--- a/utils/misc/src/main/java/org/onlab/packet/UDP.java
+++ b/utils/misc/src/main/java/org/onlab/packet/UDP.java
@@ -46,24 +46,24 @@
 
     }
 
-    protected short sourcePort;
-    protected short destinationPort;
+    protected int sourcePort;
+    protected int destinationPort;
     protected short length;
     protected short checksum;
 
     /**
      * @return the sourcePort
      */
-    public short getSourcePort() {
+    public int getSourcePort() {
         return this.sourcePort;
     }
 
     /**
      * @param sourcePort
-     *            the sourcePort to set
+     *            the sourcePort to set (16 bits unsigned integer)
      * @return this
      */
-    public UDP setSourcePort(final short sourcePort) {
+    public UDP setSourcePort(final int sourcePort) {
         this.sourcePort = sourcePort;
         return this;
     }
@@ -71,16 +71,16 @@
     /**
      * @return the destinationPort
      */
-    public short getDestinationPort() {
+    public int getDestinationPort() {
         return this.destinationPort;
     }
 
     /**
      * @param destinationPort
-     *            the destinationPort to set
+     *            the destinationPort to set (16 bits unsigned integer)
      * @return this
      */
-    public UDP setDestinationPort(final short destinationPort) {
+    public UDP setDestinationPort(final int destinationPort) {
         this.destinationPort = destinationPort;
         return this;
     }
@@ -134,8 +134,8 @@
         final byte[] data = new byte[this.length];
         final ByteBuffer bb = ByteBuffer.wrap(data);
 
-        bb.putShort(this.sourcePort);
-        bb.putShort(this.destinationPort);
+        bb.putShort((short) (this.sourcePort & 0xffff));
+        bb.putShort((short) (this.destinationPort & 0xffff));
         bb.putShort(this.length);
         bb.putShort(this.checksum);
         if (payloadData != null) {
@@ -200,8 +200,8 @@
     public IPacket deserialize(final byte[] data, final int offset,
                                final int length) {
         final ByteBuffer bb = ByteBuffer.wrap(data, offset, length);
-        this.sourcePort = bb.getShort();
-        this.destinationPort = bb.getShort();
+        this.sourcePort = (bb.getShort() & 0xffff);
+        this.destinationPort = (bb.getShort() & 0xffff);
         this.length = bb.getShort();
         this.checksum = bb.getShort();
 
@@ -284,8 +284,8 @@
             UDP udp = new UDP();
 
             ByteBuffer bb = ByteBuffer.wrap(data, offset, length);
-            udp.sourcePort = bb.getShort();
-            udp.destinationPort = bb.getShort();
+            udp.sourcePort = (bb.getShort() & 0xffff);
+            udp.destinationPort = (bb.getShort() & 0xffff);
             udp.length = bb.getShort();
             udp.checksum = bb.getShort();
 
diff --git a/utils/misc/src/test/java/org/onlab/packet/TCPTest.java b/utils/misc/src/test/java/org/onlab/packet/TCPTest.java
index 18f532e..faab5c2 100644
--- a/utils/misc/src/test/java/org/onlab/packet/TCPTest.java
+++ b/utils/misc/src/test/java/org/onlab/packet/TCPTest.java
@@ -88,8 +88,8 @@
     @Test
     public void testSerialize() {
         TCP tcp = new TCP();
-        tcp.setSourcePort((short) 0x50);
-        tcp.setDestinationPort((short) 0x60);
+        tcp.setSourcePort(0x50);
+        tcp.setDestinationPort(0x60);
         tcp.setSequence(0x10);
         tcp.setAcknowledge(0x20);
         tcp.setDataOffset((byte) 0x5);
@@ -121,8 +121,8 @@
     public void testDeserialize() throws Exception {
         TCP tcp = deserializer.deserialize(bytePacketTCP4, 0, bytePacketTCP4.length);
 
-        assertThat(tcp.getSourcePort(), is((short) 0x50));
-        assertThat(tcp.getDestinationPort(), is((short) 0x60));
+        assertThat(tcp.getSourcePort(), is(0x50));
+        assertThat(tcp.getDestinationPort(), is(0x60));
         assertThat(tcp.getSequence(), is(0x10));
         assertThat(tcp.getAcknowledge(), is(0x20));
         assertThat(tcp.getDataOffset(), is((byte) 0x5));
@@ -138,8 +138,8 @@
     @Test
     public void testEqual() {
         TCP tcp1 = new TCP();
-        tcp1.setSourcePort((short) 0x50);
-        tcp1.setDestinationPort((short) 0x60);
+        tcp1.setSourcePort(0x50);
+        tcp1.setDestinationPort(0x60);
         tcp1.setSequence(0x10);
         tcp1.setAcknowledge(0x20);
         tcp1.setDataOffset((byte) 0x5);
@@ -148,8 +148,8 @@
         tcp1.setUrgentPointer((short) 0x1);
 
         TCP tcp2 = new TCP();
-        tcp2.setSourcePort((short) 0x70);
-        tcp2.setDestinationPort((short) 0x60);
+        tcp2.setSourcePort(0x70);
+        tcp2.setDestinationPort(0x60);
         tcp2.setSequence(0x10);
         tcp2.setAcknowledge(0x20);
         tcp2.setDataOffset((byte) 0x5);
diff --git a/utils/misc/src/test/java/org/onlab/packet/UDPTest.java b/utils/misc/src/test/java/org/onlab/packet/UDPTest.java
index 86363fa..ba453f6 100644
--- a/utils/misc/src/test/java/org/onlab/packet/UDPTest.java
+++ b/utils/misc/src/test/java/org/onlab/packet/UDPTest.java
@@ -82,8 +82,8 @@
     @Test
     public void testSerialize() {
         UDP udp = new UDP();
-        udp.setSourcePort((short) 0x50);
-        udp.setDestinationPort((short) 0x60);
+        udp.setSourcePort(0x50);
+        udp.setDestinationPort(0x60);
 
         udp.setParent(ipv4);
         assertArrayEquals(bytePacketUDP4, udp.serialize());
@@ -109,8 +109,8 @@
     public void testDeserialize() throws Exception {
         UDP udp = deserializer.deserialize(bytePacketUDP4, 0, bytePacketUDP4.length);
 
-        assertThat(udp.getSourcePort(), is((short) 0x50));
-        assertThat(udp.getDestinationPort(), is((short) 0x60));
+        assertThat(udp.getSourcePort(), is(0x50));
+        assertThat(udp.getDestinationPort(), is(0x60));
         assertThat(udp.getLength(), is((short) 8));
         assertThat(udp.getChecksum(), is((short) 0x7bda));
     }
@@ -121,12 +121,12 @@
     @Test
     public void testEqual() {
         UDP udp1 = new UDP();
-        udp1.setSourcePort((short) 0x50);
-        udp1.setDestinationPort((short) 0x60);
+        udp1.setSourcePort(0x50);
+        udp1.setDestinationPort(0x60);
 
         UDP udp2 = new UDP();
-        udp2.setSourcePort((short) 0x70);
-        udp2.setDestinationPort((short) 0x60);
+        udp2.setSourcePort(0x70);
+        udp2.setDestinationPort(0x60);
 
         assertTrue(udp1.equals(udp1));
         assertFalse(udp1.equals(udp2));