ISIS protocol manual merge from 1.6 due to cherry pick merge conflict

Change-Id: I6c3abf6a83ddaeba76293dc7864fcec88e9b4e7e
diff --git a/protocols/isis/api/src/main/java/org/onosproject/isis/controller/topology/IsisRouterId.java b/protocols/isis/api/src/main/java/org/onosproject/isis/controller/topology/IsisRouterId.java
new file mode 100644
index 0000000..a40d68b
--- /dev/null
+++ b/protocols/isis/api/src/main/java/org/onosproject/isis/controller/topology/IsisRouterId.java
@@ -0,0 +1,116 @@
+/*
+ * Copyright 2016 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.isis.controller.topology;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.Objects;
+
+import static com.google.common.base.Preconditions.checkArgument;
+
+/**
+ * Represents an ISIS router id.
+ */
+public class IsisRouterId {
+
+    private static final String SCHEME = "l3";
+    private static final long UNKNOWN = 0;
+    private final String ipAddress;
+
+    /**
+     * Creates an instance of ISIS router id.
+     *
+     * @param ipAddress IP address of the router
+     */
+    public IsisRouterId(String ipAddress) {
+        this.ipAddress = ipAddress;
+    }
+
+    /**
+     * Creates an instance from ip address.
+     *
+     * @param ipAddress IP address
+     * @return ISIS router id instance
+     */
+    public static IsisRouterId isisRouterId(String ipAddress) {
+        return new IsisRouterId(ipAddress);
+    }
+
+    /**
+     * Creates ISIS router id instance from the URI.
+     *
+     * @param uri device URI
+     * @return ISIS router id instance
+     */
+    public static IsisRouterId isisRouterId(URI uri) {
+        checkArgument(uri.getScheme().equals(SCHEME), "Unsupported URI scheme");
+        return new IsisRouterId(uri.getSchemeSpecificPart());
+    }
+
+    /**
+     * Returns device URI from the given router id.
+     *
+     * @param isisRouterId router id instance
+     * @return device URI
+     */
+    public static URI uri(IsisRouterId isisRouterId) {
+        return uri(isisRouterId.ipAddress());
+    }
+
+    /**
+     * Returns device URI from the given IP address.
+     *
+     * @param ipAddress device IP address
+     * @return device URI
+     */
+    public static URI uri(String ipAddress) {
+        try {
+            return new URI(SCHEME, ipAddress, null);
+        } catch (URISyntaxException e) {
+            return null;
+        }
+    }
+
+    /**
+     * Returns the IP address.
+     *
+     * @return IP address
+     */
+    public String ipAddress() {
+        return ipAddress;
+    }
+
+    @Override
+    public String toString() {
+        return ipAddress;
+    }
+
+    @Override
+    public boolean equals(Object other) {
+        if (!(other instanceof IsisRouterId)) {
+            return false;
+        }
+
+        IsisRouterId otherIsisRouterId = (IsisRouterId) other;
+        return Objects.equals(ipAddress, otherIsisRouterId.ipAddress);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(ipAddress);
+    }
+}
\ No newline at end of file