[ONOS-4014] Refactor *Id classes to extend from Identifier class

- Refactor all of *Id classes in protocols package
- Refactor all of *Id classes in utils package

Change-Id: Ie53f078174d0bd0cb5ab4ef6786f1025a7d70846
diff --git a/protocols/pcep/api/src/main/java/org/onosproject/pcep/controller/PccId.java b/protocols/pcep/api/src/main/java/org/onosproject/pcep/controller/PccId.java
index 3ff622b..0981c02 100755
--- a/protocols/pcep/api/src/main/java/org/onosproject/pcep/controller/PccId.java
+++ b/protocols/pcep/api/src/main/java/org/onosproject/pcep/controller/PccId.java
@@ -15,28 +15,28 @@
  */
 package org.onosproject.pcep.controller;
 
-import static com.google.common.base.Preconditions.checkArgument;
+import org.onlab.packet.IpAddress;
+import org.onlab.util.Identifier;
+
 import java.net.URI;
 import java.net.URISyntaxException;
-import java.util.Objects;
 
-import org.onlab.packet.IpAddress;
+import static com.google.common.base.Preconditions.checkArgument;
 
 /**
  * The class representing a network client pc ip.
  * This class is immutable.
  */
-public final class PccId {
+public final class PccId extends Identifier<IpAddress> {
 
     private static final String SCHEME = "pcep";
     private static final long UNKNOWN = 0;
-    private final IpAddress ipAddress;
 
     /**
      * Private constructor.
      */
     private PccId(IpAddress ipAddress) {
-        this.ipAddress = ipAddress;
+        super(ipAddress);
     }
 
     /**
@@ -55,32 +55,7 @@
      * @return ipAddress
      */
     public IpAddress ipAddress() {
-        return ipAddress;
-    }
-
-    /**
-     * Convert the PccId value to a ':' separated hexadecimal string.
-     *
-     * @return the PccId value as a ':' separated hexadecimal string.
-     */
-    @Override
-    public String toString() {
-        return ipAddress.toString();
-    }
-
-    @Override
-    public boolean equals(Object other) {
-        if (!(other instanceof PccId)) {
-            return false;
-        }
-
-        PccId otherPccid = (PccId) other;
-        return Objects.equals(ipAddress, otherPccid.ipAddress);
-    }
-
-    @Override
-    public int hashCode() {
-        return Objects.hash(ipAddress);
+        return identifier;
     }
 
     /**
diff --git a/protocols/pcep/pcepio/src/main/java/org/onosproject/pcepio/types/PcepNaiIpv4NodeId.java b/protocols/pcep/pcepio/src/main/java/org/onosproject/pcepio/types/PcepNaiIpv4NodeId.java
index 1d4ce5d..ff69561 100644
--- a/protocols/pcep/pcepio/src/main/java/org/onosproject/pcepio/types/PcepNaiIpv4NodeId.java
+++ b/protocols/pcep/pcepio/src/main/java/org/onosproject/pcepio/types/PcepNaiIpv4NodeId.java
@@ -16,29 +16,24 @@
 
 package org.onosproject.pcepio.types;
 
-import java.util.Objects;
-
 import org.jboss.netty.buffer.ChannelBuffer;
+import org.onlab.util.Identifier;
 import org.onosproject.pcepio.protocol.PcepNai;
 
-import com.google.common.base.MoreObjects;
-
 /**
  * Provides Pcep Nai Ipv4 Node Id.
  */
-public class PcepNaiIpv4NodeId implements PcepNai {
+public class PcepNaiIpv4NodeId extends Identifier<Integer> implements PcepNai {
 
     public static final byte ST_TYPE = 0x01;
 
-    private final int ipv4NodeId;
-
     /**
      * Constructor to initialize ipv4NodeId.
      *
      * @param value ipv4 node id
      */
     public PcepNaiIpv4NodeId(int value) {
-        this.ipv4NodeId = value;
+        super(value);
     }
 
     /**
@@ -59,7 +54,7 @@
     @Override
     public int write(ChannelBuffer bb) {
         int iLenStartIndex = bb.writerIndex();
-        bb.writeInt(ipv4NodeId);
+        bb.writeInt(identifier);
         return bb.writerIndex() - iLenStartIndex;
     }
 
@@ -72,28 +67,4 @@
     public static PcepNaiIpv4NodeId read(ChannelBuffer bb) {
         return new PcepNaiIpv4NodeId(bb.readInt());
     }
-
-    @Override
-    public int hashCode() {
-        return Objects.hash(ipv4NodeId);
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj instanceof PcepNaiIpv4NodeId) {
-            PcepNaiIpv4NodeId other = (PcepNaiIpv4NodeId) obj;
-            return Objects.equals(this.ipv4NodeId, other.ipv4NodeId);
-        }
-        return false;
-    }
-
-    @Override
-    public String toString() {
-        return MoreObjects.toStringHelper(getClass())
-                .add("IPv4NodeId", ipv4NodeId)
-                .toString();
-    }
 }