Refactor UPF entities to have consistent naming and string representations

Also, add slice ID into applications and interfaces entities

Change-Id: I159bcf04af1504b4e5c7210aa1402218fae3eb8f
(cherry picked from commit de1f1f7806716ac6e368e55eaf0b887ab89530d4)
diff --git a/core/api/src/main/java/org/onosproject/net/behaviour/upf/UpfApplication.java b/core/api/src/main/java/org/onosproject/net/behaviour/upf/UpfApplication.java
index 83bb820..017de89 100644
--- a/core/api/src/main/java/org/onosproject/net/behaviour/upf/UpfApplication.java
+++ b/core/api/src/main/java/org/onosproject/net/behaviour/upf/UpfApplication.java
@@ -35,16 +35,19 @@
     private final Ip4Prefix ipPrefix;
     private final Range<Short> l4PortRange;
     private final Byte ipProto;
+    // TODO: move to SliceId object when slice APIs will be promoted to ONOS core.
+    private final int sliceId;
     // Action parameter
     private final byte appId;
 
     private final int priority;
 
     private UpfApplication(Ip4Prefix ipPrefix, Range<Short> l4PortRange,
-                           Byte ipProto, byte appId, int priority) {
+                           Byte ipProto, int sliceId, byte appId, int priority) {
         this.ipPrefix = ipPrefix;
         this.l4PortRange = l4PortRange;
         this.ipProto = ipProto;
+        this.sliceId = sliceId;
         this.appId = appId;
         this.priority = priority;
     }
@@ -70,18 +73,19 @@
         return Objects.equals(this.ipPrefix, that.ipPrefix) &&
                 Objects.equals(this.l4PortRange, that.l4PortRange) &&
                 Objects.equals(this.ipProto, that.ipProto) &&
+                this.sliceId == that.sliceId &&
                 this.appId == that.appId &&
                 this.priority == that.priority;
     }
 
     @Override
     public int hashCode() {
-        return Objects.hash(ipPrefix, l4PortRange, ipProto, appId, priority);
+        return Objects.hash(ipPrefix, l4PortRange, ipProto, sliceId, appId, priority);
     }
 
     @Override
     public String toString() {
-        return "UpfApplication{priority=" + this.priority + ", " + matchString() + " -> " + actionString() + "}";
+        return "UpfApplication(priority=" + this.priority + ", " + matchString() + " -> " + actionString() + ")";
     }
 
     private String matchString() {
@@ -101,12 +105,14 @@
                     .append(this.ipProto)
                     .append(", ");
         }
-        matchStrBuilder.delete(matchStrBuilder.length() - 2, matchStrBuilder.length());
-        return matchStrBuilder.append(")").toString();
+        matchStrBuilder.append("slice_id=")
+                .append(this.sliceId)
+                .append(")");
+        return matchStrBuilder.toString();
     }
 
     private String actionString() {
-        return "(app_id=" + this.appId + ")";
+        return "Action(app_id=" + this.appId + ")";
     }
 
     /**
@@ -137,6 +143,15 @@
     }
 
     /**
+     * Gets the slice ID of this UPF application rule.
+     *
+     * @return Slice ID
+     */
+    public int sliceId() {
+        return this.sliceId;
+    }
+
+    /**
      * Get the application ID of this UPF application rule.
      *
      * @return Application ID
@@ -167,6 +182,7 @@
         private Ip4Prefix ipPrefix = null;
         private Range<Short> l4PortRange = null;
         private Byte ipProto = null;
+        private Integer sliceId = null;
         // Action parameters
         private Byte appId = null;
 
@@ -212,6 +228,17 @@
         }
 
         /**
+         * Set the slice ID of the UPF application rule.
+         *
+         * @param sliceId the slice ID
+         * @return This builder object
+         */
+        public Builder withSliceId(int sliceId) {
+            this.sliceId = sliceId;
+            return this;
+        }
+
+        /**
          * Set the application ID of the UPF application rule.
          *
          * @param appId Application ID
@@ -237,9 +264,10 @@
             checkArgument(ipPrefix != null || l4PortRange != null ||
                                   ipProto != null,
                           "At least one match field is required");
+            checkNotNull(sliceId, "Slice ID must be provided");
             checkNotNull(appId, "Application ID must be provided");
             checkNotNull(priority, "Priority must be provided");
-            return new UpfApplication(ipPrefix, l4PortRange, ipProto, appId, priority);
+            return new UpfApplication(ipPrefix, l4PortRange, ipProto, sliceId, appId, priority);
         }
     }
 }
diff --git a/core/api/src/main/java/org/onosproject/net/behaviour/upf/UpfCounter.java b/core/api/src/main/java/org/onosproject/net/behaviour/upf/UpfCounter.java
index 4eee3fe..eb41a04 100644
--- a/core/api/src/main/java/org/onosproject/net/behaviour/upf/UpfCounter.java
+++ b/core/api/src/main/java/org/onosproject/net/behaviour/upf/UpfCounter.java
@@ -19,6 +19,8 @@
 
 import com.google.common.annotations.Beta;
 
+import java.util.Objects;
+
 import static com.google.common.base.Preconditions.checkNotNull;
 
 /**
@@ -50,10 +52,46 @@
 
     @Override
     public String toString() {
-        return String.format("Stats:{ CellID: %d, Ingress:(%dpkts,%dbytes), Egress:(%dpkts,%dbytes) }",
+        return String.format("UpfStats(cell_id=%d, ingress=(%dpkts,%dbytes), egress=(%dpkts,%dbytes))",
                 cellId, ingressPkts, ingressBytes, egressPkts, egressBytes);
     }
 
+    @Override
+    public boolean equals(Object object) {
+        if (object == this) {
+            return true;
+        }
+        if (object == null) {
+            return false;
+        }
+        if (getClass() != object.getClass()) {
+            return false;
+        }
+        UpfCounter that = (UpfCounter) object;
+        return this.cellId == that.cellId;
+    }
+
+    /**
+     * Returns whether this UpfCounter is exactly equal to the given UpfCounter,
+     * including their packets and bytes values.
+     *
+     * @param that other {@link UpfCounter} instance to compare
+     * @return true if exactly equals, false otherwise
+     */
+    public boolean exactlyEquals(UpfCounter that) {
+        return this.equals(that) &&
+                this.ingressPkts == that.ingressPkts &&
+                this.ingressBytes == that.ingressBytes &&
+                this.egressPkts == that.egressPkts &&
+                this.egressBytes == that.egressBytes;
+    }
+
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(cellId);
+    }
+
     /**
      * Get the cell ID (index) of the dataplane counter that produced this set of stats.
      *
diff --git a/core/api/src/main/java/org/onosproject/net/behaviour/upf/UpfEntityType.java b/core/api/src/main/java/org/onosproject/net/behaviour/upf/UpfEntityType.java
index e61abf1..2e9a26a 100644
--- a/core/api/src/main/java/org/onosproject/net/behaviour/upf/UpfEntityType.java
+++ b/core/api/src/main/java/org/onosproject/net/behaviour/upf/UpfEntityType.java
@@ -39,7 +39,7 @@
     }
 
     /**
-     * Returns a human readable representation of this UPF entity type (useful
+     * Returns a human-readable representation of this UPF entity type (useful
      * for logging).
      *
      * @return string
diff --git a/core/api/src/main/java/org/onosproject/net/behaviour/upf/GtpTunnelPeer.java b/core/api/src/main/java/org/onosproject/net/behaviour/upf/UpfGtpTunnelPeer.java
similarity index 73%
rename from core/api/src/main/java/org/onosproject/net/behaviour/upf/GtpTunnelPeer.java
rename to core/api/src/main/java/org/onosproject/net/behaviour/upf/UpfGtpTunnelPeer.java
index a3cf662..04b216b 100644
--- a/core/api/src/main/java/org/onosproject/net/behaviour/upf/GtpTunnelPeer.java
+++ b/core/api/src/main/java/org/onosproject/net/behaviour/upf/UpfGtpTunnelPeer.java
@@ -24,13 +24,13 @@
 import static com.google.common.base.Preconditions.checkArgument;
 
 /**
- * A structure representing a GTP tunnel peer.
+ * A structure representing a UPF GTP tunnel peer.
  * The GTP Tunnel Peer is used by UPF to identify a second end of a GTP tunnel.
  * The source and destination tunnel IPv4 addresses, and source UDP port are set
  * based on the information from this structure.
  */
 @Beta
-public final class GtpTunnelPeer implements UpfEntity {
+public final class UpfGtpTunnelPeer implements UpfEntity {
     // Match keys
     private final byte tunPeerId;
     // Action parameters
@@ -38,20 +38,20 @@
     private final Ip4Address dst;  // The destination address of the unidirectional tunnel
     private final short srcPort;   // Tunnel source port, default 2152
 
-    private GtpTunnelPeer(byte tunPeerId, Ip4Address src, Ip4Address dst, short srcPort) {
+    private UpfGtpTunnelPeer(byte tunPeerId, Ip4Address src, Ip4Address dst, short srcPort) {
         this.tunPeerId = tunPeerId;
         this.src = src;
         this.dst = dst;
         this.srcPort = srcPort;
     }
 
-    public static GtpTunnelPeer.Builder builder() {
-        return new GtpTunnelPeer.Builder();
+    public static UpfGtpTunnelPeer.Builder builder() {
+        return new UpfGtpTunnelPeer.Builder();
     }
 
     @Override
     public String toString() {
-        return String.format("GTP-Tunnel-Peer(%s -> src:%s, dst:%s srcPort:%s)",
+        return String.format("UpfGtpTunnelPeer(tunn_peer_id=%s -> src=%s, dst=%s src_port=%s)",
                              tunPeerId, src.toString(), dst.toString(), srcPort);
     }
 
@@ -68,20 +68,20 @@
             return false;
         }
 
-        GtpTunnelPeer that = (GtpTunnelPeer) object;
-        return (this.tunPeerId == that.tunPeerId &&
+        UpfGtpTunnelPeer that = (UpfGtpTunnelPeer) object;
+        return this.tunPeerId == that.tunPeerId &&
                 this.src.equals(that.src) &&
                 this.dst.equals(that.dst) &&
-                (this.srcPort == that.srcPort));
+                this.srcPort == that.srcPort;
     }
 
     @Override
     public int hashCode() {
-        return Objects.hash(src, dst, srcPort);
+        return Objects.hash(tunPeerId, src, dst, srcPort);
     }
 
     /**
-     * Get the ID of the GTP tunnel peer.
+     * Get the ID of the UPF GTP tunnel peer.
      *
      * @return GTP tunnel peer ID
      */
@@ -90,7 +90,7 @@
     }
 
     /**
-     * Get the source IP address of this unidirectional GTP tunnel.
+     * Get the source IP address of this unidirectional UPF GTP tunnel.
      *
      * @return tunnel source IP
      */
@@ -99,7 +99,7 @@
     }
 
     /**
-     * Get the destination address of this unidirectional GTP tunnel.
+     * Get the destination address of this unidirectional UPF GTP tunnel.
      *
      * @return tunnel destination IP
      */
@@ -108,7 +108,7 @@
     }
 
     /**
-     * Get the source L4 port of this unidirectional GTP tunnel.
+     * Get the source L4 port of this unidirectional UPF GTP tunnel.
      *
      * @return tunnel source port
      */
@@ -132,54 +132,54 @@
         }
 
         /**
-         * Set the ID of the GTP Tunnel peer.
+         * Set the ID of the UPF GTP Tunnel peer.
          *
          * @param tunPeerId GTP tunnel peer ID
          * @return This builder object
          */
-        public GtpTunnelPeer.Builder withTunnelPeerId(byte tunPeerId) {
+        public UpfGtpTunnelPeer.Builder withTunnelPeerId(byte tunPeerId) {
             this.tunPeerId = tunPeerId;
             return this;
         }
 
         /**
-         * Set the source IP address of the unidirectional GTP tunnel.
+         * Set the source IP address of the unidirectional UPF GTP tunnel.
          *
          * @param src GTP tunnel source IP
          * @return This builder object
          */
-        public GtpTunnelPeer.Builder withSrcAddr(Ip4Address src) {
+        public UpfGtpTunnelPeer.Builder withSrcAddr(Ip4Address src) {
             this.src = src;
             return this;
         }
 
         /**
-         * Set the destination IP address of the unidirectional GTP tunnel.
+         * Set the destination IP address of the unidirectional UPF GTP tunnel.
          *
          * @param dst GTP tunnel destination IP
          * @return This builder object
          */
-        public GtpTunnelPeer.Builder withDstAddr(Ip4Address dst) {
+        public UpfGtpTunnelPeer.Builder withDstAddr(Ip4Address dst) {
             this.dst = dst;
             return this;
         }
 
         /**
-         * Set the source port of this unidirectional GTP tunnel.
+         * Set the source port of this unidirectional UPF GTP tunnel.
          *
          * @param srcPort tunnel source port
          * @return this builder object
          */
-        public GtpTunnelPeer.Builder withSrcPort(short srcPort) {
+        public UpfGtpTunnelPeer.Builder withSrcPort(short srcPort) {
             this.srcPort = srcPort;
             return this;
         }
 
-        public GtpTunnelPeer build() {
+        public UpfGtpTunnelPeer build() {
             checkArgument(tunPeerId != null, "Tunnel Peer ID must be provided");
             checkArgument(src != null, "Tunnel source address cannot be null");
             checkArgument(dst != null, "Tunnel destination address cannot be null");
-            return new GtpTunnelPeer(this.tunPeerId, this.src, this.dst, srcPort);
+            return new UpfGtpTunnelPeer(this.tunPeerId, this.src, this.dst, srcPort);
         }
 
     }
diff --git a/core/api/src/main/java/org/onosproject/net/behaviour/upf/UpfInterface.java b/core/api/src/main/java/org/onosproject/net/behaviour/upf/UpfInterface.java
index f697d15..cf10ae1 100644
--- a/core/api/src/main/java/org/onosproject/net/behaviour/upf/UpfInterface.java
+++ b/core/api/src/main/java/org/onosproject/net/behaviour/upf/UpfInterface.java
@@ -31,10 +31,13 @@
 public final class UpfInterface implements UpfEntity {
     private final Ip4Prefix prefix;
     private final Type type;
+    // TODO: move to SliceId object when slice APIs will be promoted to ONOS core.
+    private final int sliceId;
 
-    private UpfInterface(Ip4Prefix prefix, Type type) {
+    private UpfInterface(Ip4Prefix prefix, Type type, int sliceId) {
         this.prefix = prefix;
         this.type = type;
+        this.sliceId = sliceId;
     }
 
     public static Builder builder() {
@@ -43,17 +46,7 @@
 
     @Override
     public String toString() {
-        String typeStr;
-        if (type.equals(Type.ACCESS)) {
-            typeStr = "Access";
-        } else if (type.equals(Type.CORE)) {
-            typeStr = "Core";
-        } else if (type.equals(Type.DBUF)) {
-            typeStr = "Dbuf-Receiver";
-        } else {
-            typeStr = "UNKNOWN";
-        }
-        return String.format("Interface{%s, %s}", typeStr, prefix);
+        return String.format("UpfInterface(type=%s, prefix=%s, slice_id=%s)", type.toString(), prefix, sliceId);
     }
 
     @Override
@@ -68,43 +61,58 @@
             return false;
         }
         UpfInterface that = (UpfInterface) obj;
-        return (this.type.equals(that.type) &&
-                this.prefix.equals(that.prefix));
+        return this.type.equals(that.type) &&
+                this.prefix.equals(that.prefix) &&
+                this.sliceId == that.sliceId;
     }
 
     @Override
     public int hashCode() {
-        return Objects.hash(prefix, type);
+        return Objects.hash(prefix, type, sliceId);
     }
 
     /**
      * Create a core-facing UPF Interface from the given address, which will be treated as a /32 prefix.
-     *
      * @param address the address of the new core-facing interface
+     * @param sliceId the slice if of the new interface
      * @return a new UPF interface
      */
-    public static UpfInterface createS1uFrom(Ip4Address address) {
-        return builder().setAccess().setPrefix(Ip4Prefix.valueOf(address, 32)).build();
+    public static UpfInterface createS1uFrom(Ip4Address address, int sliceId) {
+        return builder()
+                .setAccess()
+                .setPrefix(Ip4Prefix.valueOf(address, 32))
+                .setSliceId(sliceId)
+                .build();
     }
 
     /**
      * Create a core-facing UPF Interface from the given IP prefix.
      *
      * @param prefix the prefix of the new core-facing interface
+     * @param sliceId the slice if of the new interface
      * @return a new UPF interface
      */
-    public static UpfInterface createUePoolFrom(Ip4Prefix prefix) {
-        return builder().setCore().setPrefix(prefix).build();
+    public static UpfInterface createUePoolFrom(Ip4Prefix prefix, int sliceId) {
+        return builder()
+                .setCore()
+                .setPrefix(prefix)
+                .setSliceId(sliceId)
+                .build();
     }
 
     /**
      * Create a dbuf-receiving UPF interface from the given IP address.
      *
      * @param address the address of the dbuf-receiving interface
+     * @param sliceId the slice if of the new interface
      * @return a new UPF interface
      */
-    public static UpfInterface createDbufReceiverFrom(Ip4Address address) {
-        return UpfInterface.builder().setDbufReceiver().setAddress(address).build();
+    public static UpfInterface createDbufReceiverFrom(Ip4Address address, int sliceId) {
+        return builder()
+                .setDbufReceiver()
+                .setAddress(address)
+                .setSliceId(sliceId)
+                .build();
     }
 
     /**
@@ -117,6 +125,15 @@
     }
 
     /**
+     * Get the slice ID of this interface.
+     *
+     * @return the slice ID
+     */
+    public int sliceId() {
+        return sliceId;
+    }
+
+    /**
      * Check if this UPF interface is for packets traveling from UEs.
      * This will be true for S1U interface table entries.
      *
@@ -187,6 +204,7 @@
     public static class Builder {
         private Ip4Prefix prefix;
         private Type type;
+        private Integer sliceId;
 
         public Builder() {
             type = Type.UNKNOWN;
@@ -204,6 +222,17 @@
         }
 
         /**
+         * Set the slice ID of this interface.
+         *
+         * @param sliceId the slice ID
+         * @return this builder object
+         */
+        public Builder setSliceId(int sliceId) {
+            this.sliceId = sliceId;
+            return this;
+        }
+
+        /**
          * Set the IPv4 prefix of this interface, by turning the given address into a /32 prefix.
          *
          * @param address the interface address that will become a /32 prefix
@@ -245,8 +274,9 @@
         }
 
         public UpfInterface build() {
-            checkNotNull(prefix);
-            return new UpfInterface(prefix, type);
+            checkNotNull(prefix, "The IPv4 prefix must be provided");
+            checkNotNull(sliceId, "Slice ID must be provided");
+            return new UpfInterface(prefix, type, sliceId);
         }
     }
 }
diff --git a/core/api/src/main/java/org/onosproject/net/behaviour/upf/SessionDownlink.java b/core/api/src/main/java/org/onosproject/net/behaviour/upf/UpfSessionDownlink.java
similarity index 76%
rename from core/api/src/main/java/org/onosproject/net/behaviour/upf/SessionDownlink.java
rename to core/api/src/main/java/org/onosproject/net/behaviour/upf/UpfSessionDownlink.java
index 8146d2b..413c7ed 100644
--- a/core/api/src/main/java/org/onosproject/net/behaviour/upf/SessionDownlink.java
+++ b/core/api/src/main/java/org/onosproject/net/behaviour/upf/UpfSessionDownlink.java
@@ -25,10 +25,10 @@
 
 /**
  * A structure representing the UE Session on the UPF-programmable device.
- * Provides means to set up the UE Session in the downlink direction.
+ * Provide means to set up the UPF UE Session in the downlink direction.
  */
 @Beta
-public final class SessionDownlink implements UpfEntity {
+public final class UpfSessionDownlink implements UpfEntity {
     // Match Keys
     private final Ip4Address ueAddress;
     // Action parameters
@@ -36,10 +36,10 @@
     private final boolean buffering;
     private final boolean dropping;
 
-    private SessionDownlink(Ip4Address ipv4Address,
-                            Byte tunPeerId,
-                            boolean buffering,
-                            boolean drop) {
+    private UpfSessionDownlink(Ip4Address ipv4Address,
+                               Byte tunPeerId,
+                               boolean buffering,
+                               boolean drop) {
         this.ueAddress = ipv4Address;
         this.tunPeerId = tunPeerId;
         this.buffering = buffering;
@@ -50,6 +50,7 @@
         return new Builder();
     }
 
+    @Override
     public boolean equals(Object object) {
         if (object == this) {
             return true;
@@ -61,7 +62,7 @@
             return false;
         }
 
-        SessionDownlink that = (SessionDownlink) object;
+        UpfSessionDownlink that = (UpfSessionDownlink) object;
 
         return this.buffering == that.buffering &&
                 this.dropping == that.dropping &&
@@ -69,13 +70,14 @@
                 Objects.equals(tunPeerId, that.tunPeerId);
     }
 
+    @Override
     public int hashCode() {
         return java.util.Objects.hash(ueAddress, tunPeerId, buffering, dropping);
     }
 
     @Override
     public String toString() {
-        return "UESessionDL{" + matchString() + " -> " + actionString() + "}";
+        return "UpfSessionDL(" + matchString() + " -> " + actionString() + ")";
     }
 
     private String matchString() {
@@ -83,7 +85,7 @@
     }
 
     private String actionString() {
-        StringBuilder actionStrBuilder = new StringBuilder("(");
+        StringBuilder actionStrBuilder = new StringBuilder("Action(");
         if (this.needsBuffering() && this.needsDropping()) {
             actionStrBuilder.append("BUFF+DROP, ");
         } else if (this.needsBuffering()) {
@@ -98,25 +100,25 @@
     }
 
     /**
-     * True if this UE Session needs buffering of the downlink traffic.
+     * True if this UPF UE Session needs buffering of the downlink traffic.
      *
-     * @return true if the UE Session needs buffering.
+     * @return true if the UPF UE Session needs buffering.
      */
     public boolean needsBuffering() {
         return buffering;
     }
 
     /**
-     * True if this UE Session needs dropping of the downlink traffic.
+     * True if this UPF UE Session needs dropping of the downlink traffic.
      *
-     * @return true if the UE Session needs dropping.
+     * @return true if the UPF UE Session needs dropping.
      */
     public boolean needsDropping() {
         return dropping;
     }
 
     /**
-     * Get the UE IP address of this downlink UE session.
+     * Get the UE IP address of this downlink UPF UE session.
      *
      * @return UE IP address
      */
@@ -125,7 +127,7 @@
     }
 
     /**
-     * Get the GTP tunnel peer ID that is set by this UE Session rule.
+     * Get the GTP tunnel peer ID that is set by this UPF UE Session rule.
      *
      * @return GTP tunnel peer ID
      */
@@ -149,7 +151,7 @@
         }
 
         /**
-         * Set the UE IP address that this downlink UE session rule matches on.
+         * Set the UE IP address that this downlink UPF UE session rule matches on.
          *
          * @param ueAddress UE IP address
          * @return This builder object
@@ -160,7 +162,7 @@
         }
 
         /**
-         * Set the GTP tunnel peer ID that is set by this UE Session rule.
+         * Set the GTP tunnel peer ID that is set by this UPF UE Session rule.
          *
          * @param tunnelPeerId GTP tunnel peer ID
          * @return This builder object
@@ -171,7 +173,7 @@
         }
 
         /**
-         * Sets whether to buffer downlink UE session traffic or not.
+         * Set whether to buffer downlink UPF UE session traffic or not.
          *
          * @param buffer True if request to buffer, false otherwise
          * @return This builder object
@@ -182,7 +184,7 @@
         }
 
         /**
-         * Sets whether to drop downlink UE session traffic or not.
+         * Set whether to drop downlink UPF UE session traffic or not.
          *
          * @param drop True if request to buffer, false otherwise
          * @return This builder object
@@ -192,10 +194,10 @@
             return this;
         }
 
-        public SessionDownlink build() {
+        public UpfSessionDownlink build() {
             // Match fields are required
             checkNotNull(ueAddress, "UE address must be provided");
-            return new SessionDownlink(ueAddress, tunPeerId, buffer, drop);
+            return new UpfSessionDownlink(ueAddress, tunPeerId, buffer, drop);
         }
     }
 }
diff --git a/core/api/src/main/java/org/onosproject/net/behaviour/upf/SessionUplink.java b/core/api/src/main/java/org/onosproject/net/behaviour/upf/UpfSessionUplink.java
similarity index 77%
rename from core/api/src/main/java/org/onosproject/net/behaviour/upf/SessionUplink.java
rename to core/api/src/main/java/org/onosproject/net/behaviour/upf/UpfSessionUplink.java
index a2f0460..0a6bfa4 100644
--- a/core/api/src/main/java/org/onosproject/net/behaviour/upf/SessionUplink.java
+++ b/core/api/src/main/java/org/onosproject/net/behaviour/upf/UpfSessionUplink.java
@@ -25,10 +25,10 @@
 
 /**
  * A structure representing the UE Session on the UPF-programmable device.
- * Provides means to set up the UE Session in the uplink direction.
+ * Provide means to set up the UPF UE Session in the uplink direction.
  */
 @Beta
-public final class SessionUplink implements UpfEntity {
+public final class UpfSessionUplink implements UpfEntity {
     // Match Keys
     private final Ip4Address tunDestAddr; // The tunnel destination address (N3/S1U IPv4 address)
     private final Integer teid;  // The Tunnel Endpoint ID that this UeSession matches on
@@ -36,9 +36,9 @@
     // Action parameters
     private final boolean dropping; // Used to convey dropping information
 
-    private SessionUplink(Ip4Address tunDestAddr,
-                          Integer teid,
-                          boolean drop) {
+    private UpfSessionUplink(Ip4Address tunDestAddr,
+                             Integer teid,
+                             boolean drop) {
         this.tunDestAddr = tunDestAddr;
         this.teid = teid;
         this.dropping = drop;
@@ -48,6 +48,7 @@
         return new Builder();
     }
 
+    @Override
     public boolean equals(Object object) {
         if (object == this) {
             return true;
@@ -59,28 +60,29 @@
             return false;
         }
 
-        SessionUplink that = (SessionUplink) object;
+        UpfSessionUplink that = (UpfSessionUplink) object;
 
         return this.dropping == that.dropping &&
                 Objects.equals(tunDestAddr, that.tunDestAddr) &&
                 Objects.equals(teid, that.teid);
     }
 
+    @Override
     public int hashCode() {
         return Objects.hash(tunDestAddr, teid, dropping);
     }
 
     @Override
     public String toString() {
-        return "UESessionUL{" + matchString() + " -> " + actionString() + "}";
+        return "UpfSessionUL(" + matchString() + " -> " + actionString() + ")";
     }
 
     private String matchString() {
-        return "Match(tun_dst_addr=" + this.tunDstAddr() + ", TEID=" + this.teid() + ")";
+        return "Match(tun_dst_addr=" + this.tunDstAddr() + ", teid=" + this.teid() + ")";
     }
 
     private String actionString() {
-        StringBuilder actionStrBuilder = new StringBuilder("(");
+        StringBuilder actionStrBuilder = new StringBuilder("Action(");
         if (this.needsDropping()) {
             actionStrBuilder.append("DROP");
 
@@ -91,7 +93,7 @@
     }
 
     /**
-     * True if this UE Session needs dropping of the uplink traffic.
+     * True if this UPF UE Session needs dropping of the uplink traffic.
      *
      * @return true if the UE Session needs dropping.
      */
@@ -100,7 +102,7 @@
     }
 
     /**
-     * Get the tunnel destination IP address in the uplink UE session (N3/S1U IP address).
+     * Get the tunnel destination IP address in the uplink UPF UE session (N3/S1U IP address).
      *
      * @return UE IP address
      */
@@ -109,7 +111,7 @@
     }
 
     /**
-     * Get the identifier of the GTP tunnel that this UE Session rule matches on.
+     * Get the identifier of the GTP tunnel that this UPF UE Session rule matches on.
      *
      * @return GTP tunnel ID
      */
@@ -132,7 +134,7 @@
         }
 
         /**
-         * Set the tunnel destination IP address (N3/S1U address) that this UE Session rule matches on.
+         * Set the tunnel destination IP address (N3/S1U address) that this UPF UE Session rule matches on.
          *
          * @param tunDstAddr The tunnel destination IP address
          * @return This builder object
@@ -143,7 +145,7 @@
         }
 
         /**
-         * Set the identifier of the GTP tunnel that this UE Session rule matches on.
+         * Set the identifier of the GTP tunnel that this UPF UE Session rule matches on.
          *
          * @param teid GTP tunnel ID
          * @return This builder object
@@ -155,7 +157,7 @@
 
 
         /**
-         * Sets whether to drop uplink UE session traffic or not.
+         * Sets whether to drop uplink UPF UE session traffic or not.
          *
          * @param drop True if request to buffer, false otherwise
          * @return This builder object
@@ -165,11 +167,11 @@
             return this;
         }
 
-        public SessionUplink build() {
+        public UpfSessionUplink build() {
             // Match keys are required.
             checkNotNull(tunDstAddr, "Tunnel destination must be provided");
             checkNotNull(teid, "TEID must be provided");
-            return new SessionUplink(tunDstAddr, teid, drop);
+            return new UpfSessionUplink(tunDstAddr, teid, drop);
         }
     }
 }
diff --git a/core/api/src/main/java/org/onosproject/net/behaviour/upf/UpfTerminationDownlink.java b/core/api/src/main/java/org/onosproject/net/behaviour/upf/UpfTerminationDownlink.java
index cbb601b..edab0ac 100644
--- a/core/api/src/main/java/org/onosproject/net/behaviour/upf/UpfTerminationDownlink.java
+++ b/core/api/src/main/java/org/onosproject/net/behaviour/upf/UpfTerminationDownlink.java
@@ -153,7 +153,7 @@
 
     @Override
     public String toString() {
-        return "TerminationDL{" + matchString() + " -> " + actionString() + "}";
+        return "UpfTerminationDL(" + matchString() + " -> " + actionString() + ")";
     }
 
     private String matchString() {
@@ -165,11 +165,11 @@
         if (this.needsDropping()) {
             fwd = "DROP";
         }
-        return "(" + fwd +
-                ", TEID=" + this.teid() +
-                ", CTR_ID=" + this.counterId() +
-                ", QFI=" + this.qfi() +
-                ", TC=" + this.trafficClass() +
+        return "Action(" + fwd +
+                ", teid=" + this.teid() +
+                ", ctr_id=" + this.counterId() +
+                ", qfi=" + this.qfi() +
+                ", tc=" + this.trafficClass() +
                 ")";
     }
 
diff --git a/core/api/src/main/java/org/onosproject/net/behaviour/upf/UpfTerminationUplink.java b/core/api/src/main/java/org/onosproject/net/behaviour/upf/UpfTerminationUplink.java
index 1c6dd56..93ac0b7 100644
--- a/core/api/src/main/java/org/onosproject/net/behaviour/upf/UpfTerminationUplink.java
+++ b/core/api/src/main/java/org/onosproject/net/behaviour/upf/UpfTerminationUplink.java
@@ -129,7 +129,7 @@
 
     @Override
     public String toString() {
-        return "TerminationUL{" + matchString() + " -> " + actionString() + "}";
+        return "UpfTerminationUL(" + matchString() + " -> " + actionString() + ")";
     }
 
     private String matchString() {
@@ -141,9 +141,9 @@
         if (this.needsDropping()) {
             fwd = "DROP";
         }
-        return "(" + fwd +
-                ", CTR_ID=" + this.counterId() +
-                ", TC=" + this.trafficClass() +
+        return "Action(" + fwd +
+                ", ctr_id=" + this.counterId() +
+                ", tc=" + this.trafficClass() +
                 ")";
     }