ONOS-4082:ISIS protocol API changes

Change-Id: I4cdd4a4811ec0ab0aba51d7d8085a3eac9b34b2c
diff --git a/protocols/isis/api/src/main/java/org/onosproject/isis/controller/IsisController.java b/protocols/isis/api/src/main/java/org/onosproject/isis/controller/IsisController.java
index 447e0f2..7d5b111 100644
--- a/protocols/isis/api/src/main/java/org/onosproject/isis/controller/IsisController.java
+++ b/protocols/isis/api/src/main/java/org/onosproject/isis/controller/IsisController.java
@@ -15,6 +15,8 @@
  */
 package org.onosproject.isis.controller;
 
+import org.onosproject.isis.controller.topology.IsisRouterListener;
+
 import java.util.List;
 
 /**
@@ -25,14 +27,14 @@
     /**
      * Registers a listener for router meta events.
      *
-     * @param isisRouterListener isis router listener instance
+     * @param isisRouterListener ISIS router listener instance
      */
     void addRouterListener(IsisRouterListener isisRouterListener);
 
     /**
      * Unregisters a router listener.
      *
-     * @param isisRouterListener isis router listener instance
+     * @param isisRouterListener ISIS router listener instance
      */
     void removeRouterListener(IsisRouterListener isisRouterListener);
 
@@ -47,7 +49,8 @@
      * Deletes configuration parameters.
      *
      * @param processes list of process instance
-     * @param attribute attribute to delete
+     * @param attribute string key which deletes the particular node or element
+     * from the controller
      */
     void deleteConfig(List<IsisProcess> processes, String attribute);
 
diff --git a/protocols/isis/api/src/main/java/org/onosproject/isis/controller/IsisInterface.java b/protocols/isis/api/src/main/java/org/onosproject/isis/controller/IsisInterface.java
index 2b9dab3..0b97c7d 100644
--- a/protocols/isis/api/src/main/java/org/onosproject/isis/controller/IsisInterface.java
+++ b/protocols/isis/api/src/main/java/org/onosproject/isis/controller/IsisInterface.java
@@ -15,12 +15,25 @@
  */
 package org.onosproject.isis.controller;
 
+import org.jboss.netty.channel.Channel;
+import org.onlab.packet.Ip4Address;
+import org.onlab.packet.MacAddress;
+
+import java.util.Set;
+
 /**
  * Representation of an ISIS interface.
  */
 public interface IsisInterface {
 
     /**
+     * Returns interface index.
+     *
+     * @return interface index
+     */
+    int interfaceIndex();
+
+    /**
      * Sets interface index.
      *
      * @param interfaceIndex interface index
@@ -28,6 +41,48 @@
     void setInterfaceIndex(int interfaceIndex);
 
     /**
+     * Returns the interface IP address.
+     *
+     * @return interface IP address
+     */
+    Ip4Address interfaceIpAddress();
+
+    /**
+     * Sets the interface IP address.
+     *
+     * @param interfaceIpAddress interface IP address interface IP address
+     */
+    void setInterfaceIpAddress(Ip4Address interfaceIpAddress);
+
+    /**
+     * Returns the network mask.
+     *
+     * @return network mask
+     */
+    byte[] networkMask();
+
+    /**
+     * Sets the network mask.
+     *
+     * @param networkMask network mask
+     */
+    void setNetworkMask(byte[] networkMask);
+
+    /**
+     * Sets the interface MAC address.
+     *
+     * @param interfaceMacAddress interface MAC address
+     */
+    void setInterfaceMacAddress(MacAddress interfaceMacAddress);
+
+    /**
+     * Returns the neighbors list.
+     *
+     * @return neighbors list
+     */
+    Set<MacAddress> neighbors();
+
+    /**
      * Sets intermediate system name.
      *
      * @param intermediateSystemName intermediate system name
@@ -35,6 +90,13 @@
     void setIntermediateSystemName(String intermediateSystemName);
 
     /**
+     * Returns system ID.
+     *
+     * @return systemID system ID
+     */
+    String systemId();
+
+    /**
      * Sets system ID.
      *
      * @param systemId system ID
@@ -42,11 +104,32 @@
     void setSystemId(String systemId);
 
     /**
+     * Returns LAN ID.
+     *
+     * @return LAN ID
+     */
+    String l1LanId();
+
+    /**
      * Sets LAN ID.
      *
      * @param lanId LAN ID
      */
-    void setLanId(String lanId);
+    void setL1LanId(String lanId);
+
+    /**
+     * Returns LAN ID.
+     *
+     * @return LAN ID
+     */
+    String l2LanId();
+
+    /**
+     * Sets LAN ID.
+     *
+     * @param lanId LAN ID
+     */
+    void setL2LanId(String lanId);
 
     /**
      * Sets ID length.
@@ -63,6 +146,13 @@
     void setMaxAreaAddresses(int maxAreaAddresses);
 
     /**
+     * Returns reserved packet circuit type.
+     *
+     * @return reserved packet circuit type
+     */
+    int reservedPacketCircuitType();
+
+    /**
      * Sets reserved packet circuit type.
      *
      * @param reservedPacketCircuitType reserved packet circuit type
@@ -70,11 +160,25 @@
     void setReservedPacketCircuitType(int reservedPacketCircuitType);
 
     /**
+     * Returns point to point or broadcast.
+     *
+     * @return 1 if point to point, 2 broadcast
+     */
+    IsisNetworkType networkType();
+
+    /**
      * Sets point to point.
      *
-     * @param p2p point to point
+     * @param networkType point to point
      */
-    void setP2p(int p2p);
+    void setNetworkType(IsisNetworkType networkType);
+
+    /**
+     * Returns area address.
+     *
+     * @return area address
+     */
+    String areaAddress();
 
     /**
      * Sets area address.
@@ -98,6 +202,13 @@
     void setLspId(String lspId);
 
     /**
+     * Returns holding time.
+     *
+     * @return holding time
+     */
+    int holdingTime();
+
+    /**
      * Sets holding time.
      *
      * @param holdingTime holding time
@@ -105,6 +216,13 @@
     void setHoldingTime(int holdingTime);
 
     /**
+     * Returns priority.
+     *
+     * @return priority
+     */
+    int priority();
+
+    /**
      * Sets priority.
      *
      * @param priority priority
@@ -117,4 +235,70 @@
      * @param helloInterval hello interval
      */
     void setHelloInterval(int helloInterval);
-}
\ No newline at end of file
+
+    /**
+     * Starts the hello timer which sends hello packet every configured seconds.
+     *
+     * @param channel netty channel instance
+     */
+    void startHelloSender(Channel channel);
+
+    /**
+     * Processes an ISIS message which is received on this interface.
+     *
+     * @param isisMessage ISIS message instance
+     * @param isisLsdb    ISIS LSDB instance
+     * @param channel     channel instance
+     */
+    void processIsisMessage(IsisMessage isisMessage, IsisLsdb isisLsdb, Channel channel);
+
+    /**
+     * Returns the interface state.
+     *
+     * @return interface state
+     */
+    IsisInterfaceState interfaceState();
+
+    /**
+     * Sets the interface state.
+     *
+     * @param interfaceState the interface state
+     */
+    void setInterfaceState(IsisInterfaceState interfaceState);
+
+    /**
+     * Returns the LSDB instance.
+     *
+     * @return LSDB instance
+     */
+    IsisLsdb isisLsdb();
+
+    /**
+     * Returns intermediate system name.
+     *
+     * @return intermediate system name
+     */
+    String intermediateSystemName();
+
+    /**
+     * Returns the ISIS neighbor instance if exists.
+     *
+     * @param isisNeighborMac mac address of the neighbor router
+     * @return ISIS neighbor instance if exists else null
+     */
+    IsisNeighbor lookup(MacAddress isisNeighborMac);
+
+    /**
+     * Returns circuit ID.
+     *
+     * @return circuit ID
+     */
+    String circuitId();
+
+    /**
+     * Sets circuit ID.
+     *
+     * @param circuitId circuit ID
+     */
+    void setCircuitId(String circuitId);
+}
diff --git a/protocols/isis/api/src/main/java/org/onosproject/isis/controller/IsisInterfaceState.java b/protocols/isis/api/src/main/java/org/onosproject/isis/controller/IsisInterfaceState.java
new file mode 100644
index 0000000..500ff7c
--- /dev/null
+++ b/protocols/isis/api/src/main/java/org/onosproject/isis/controller/IsisInterfaceState.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2016-present 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;
+
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Enum represents ISIS Interface state.
+ */
+public enum IsisInterfaceState {
+    /**
+     * Represents interface is in "up" state.
+     */
+    UP(0),
+    /**
+     * Represents interface is in "initial" state.
+     */
+    INITIAL(1),
+    /**
+     * Represents interface is in "down" state.
+     */
+    DOWN(2);
+
+    // Reverse lookup table
+    private static final Map<Integer, IsisInterfaceState> LOOKUP = new HashMap<>();
+
+    // Populate the lookup table on loading time
+    static {
+        for (IsisInterfaceState isisInterfaceState : EnumSet.allOf(IsisInterfaceState.class)) {
+            LOOKUP.put(isisInterfaceState.value(), isisInterfaceState);
+        }
+    }
+
+    private int value;
+
+    /**
+     * Creates an instance of ISIS interface type.
+     *
+     * @param value represents ISIS interface type
+     */
+    private IsisInterfaceState(int value) {
+        this.value = value;
+    }
+
+    /**
+     * Gets the enum instance from type value - reverse lookup purpose.
+     *
+     * @param interfaceStateTypeValue interface state type value
+     * @return ISIS interface state type instance
+     */
+    public static IsisInterfaceState get(int interfaceStateTypeValue) {
+        return LOOKUP.get(interfaceStateTypeValue);
+    }
+
+    /**
+     * Gets the value representing interface state type.
+     *
+     * @return value represents interface state type
+     */
+    public int value() {
+        return value;
+    }
+}
\ No newline at end of file
diff --git a/protocols/isis/api/src/main/java/org/onosproject/isis/controller/IsisLsdb.java b/protocols/isis/api/src/main/java/org/onosproject/isis/controller/IsisLsdb.java
index 851ed17..7ceb9f1 100644
--- a/protocols/isis/api/src/main/java/org/onosproject/isis/controller/IsisLsdb.java
+++ b/protocols/isis/api/src/main/java/org/onosproject/isis/controller/IsisLsdb.java
@@ -13,18 +13,84 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.onosproject.isis.controller;
 
+import java.util.List;
+
 /**
  * Representation of an ISIS link state database.
  */
 public interface IsisLsdb {
 
     /**
-     * Gets the ISIS LSDB.
+     * Returns the ISIS LSDB.
      *
      * @return ISIS LSDB
      */
     IsisLsdb isisLsdb();
-}
\ No newline at end of file
+
+    /**
+     * Initializes LSDB.
+     */
+    void initializeDb();
+
+    /**
+     * Returns the LSDB LSP key.
+     *
+     * @param systemId system ID
+     * @return LSP key
+     */
+    String lspKey(String systemId);
+
+    /**
+     * Returns the sequence number.
+     *
+     * @param lspType L1 or L2 LSP
+     * @return sequence number
+     */
+    int lsSequenceNumber(IsisPduType lspType);
+
+    /**
+     * Finds the LSP from LSDB.
+     *
+     * @param pduType L1 or L2 LSP
+     * @param lspId   LSP ID
+     * @return LSP wrapper object
+     */
+    LspWrapper findLsp(IsisPduType pduType, String lspId);
+
+    /**
+     * Installs a new self-originated LSA in LSDB.
+     * Return true if installing was successful else false.
+     *
+     * @param lsPdu            PDU instance
+     * @param isSelfOriginated true if self originated else false
+     * @param isisInterface    ISIS interface instance
+     * @return true if successfully added
+     */
+    boolean addLsp(IsisMessage lsPdu, boolean isSelfOriginated, IsisInterface isisInterface);
+
+    /**
+     * Checks received LSP is latest, same or old.
+     *
+     * @param receivedLsp received LSP
+     * @param lspFromDb   existing LSP
+     * @return "latest", "old" or "same"
+     */
+    String isNewerOrSameLsp(IsisMessage receivedLsp, IsisMessage lspFromDb);
+
+    /**
+     * Returns all LSPs (L1 and L2).
+     *
+     * @param excludeMaxAgeLsp exclude the max age LSPs
+     * @return List of LSPs
+     */
+    List<LspWrapper> allLspHeaders(boolean excludeMaxAgeLsp);
+
+    /**
+     * Deletes the given LSP.
+     *
+     * @param lsp LSP instance
+     */
+    void deleteLsp(IsisMessage lsp);
+}
diff --git a/protocols/isis/api/src/main/java/org/onosproject/isis/controller/IsisLsdbAge.java b/protocols/isis/api/src/main/java/org/onosproject/isis/controller/IsisLsdbAge.java
new file mode 100644
index 0000000..314f9f8
--- /dev/null
+++ b/protocols/isis/api/src/main/java/org/onosproject/isis/controller/IsisLsdbAge.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2016-present 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;
+
+/**
+ * Representation of an ISIS link state database aging.
+ */
+public interface IsisLsdbAge {
+
+    /**
+     * Starts the aging timer thread which gets invokes every second.
+     */
+    void startDbAging();
+
+    /**
+     * Returns the age counter.
+     *
+     * @return age counter
+     */
+    int ageCounter();
+
+    /**
+     * Returns the age counter rollover.
+     *
+     * @return age counter rollover
+     */
+    int ageCounterRollOver();
+
+    /**
+     * Returns the bin number.
+     *
+     * @param x can be either age or ageCounter
+     * @return bin number
+     */
+    int age2Bin(int x);
+
+    /**
+     * Returns the LSP bin instance.
+     *
+     * @param binKey key to search
+     * @return LSP bin instance
+     */
+    IsisLspBin getLspBin(int binKey);
+
+    /**
+     * Adds LSP to bin.
+     *
+     * @param binNumber key to store in bin
+     * @param lspBin    LSP bin instance
+     */
+    void addLspBin(int binNumber, IsisLspBin lspBin);
+
+    /**
+     * Removes LSP from bin.
+     *
+     * @param lspWrapper LSP wrapper instance
+     */
+    void removeLspFromBin(LspWrapper lspWrapper);
+}
diff --git a/protocols/isis/api/src/main/java/org/onosproject/isis/controller/IsisLspBin.java b/protocols/isis/api/src/main/java/org/onosproject/isis/controller/IsisLspBin.java
new file mode 100644
index 0000000..0964aae
--- /dev/null
+++ b/protocols/isis/api/src/main/java/org/onosproject/isis/controller/IsisLspBin.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2016-present 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;
+
+import java.util.Map;
+
+/**
+ * Representation of an ISIS LSP bin which is part of LSP aging process.
+ */
+public interface IsisLspBin {
+
+    /**
+     * Returns all the LSPs in the bin.
+     *
+     * @return all LSPs in the bin
+     */
+    Map<String, LspWrapper> listOfLsp();
+
+    /**
+     * Adds LSP to bin for aging.
+     *
+     * @param lspKey     key to add the LSP
+     * @param lspWrapper LSP wrapper instance
+     */
+    void addIsisLsp(String lspKey, LspWrapper lspWrapper);
+
+    /**
+     * Removes LSP from bin.
+     *
+     * @param lspKey     LSP key
+     * @param lspWrapper LSP wrapper instance
+     */
+    void removeIsisLsp(String lspKey, LspWrapper lspWrapper);
+}
diff --git a/protocols/isis/api/src/main/java/org/onosproject/isis/controller/IsisMessage.java b/protocols/isis/api/src/main/java/org/onosproject/isis/controller/IsisMessage.java
index 8772ec4..35c6f78 100644
--- a/protocols/isis/api/src/main/java/org/onosproject/isis/controller/IsisMessage.java
+++ b/protocols/isis/api/src/main/java/org/onosproject/isis/controller/IsisMessage.java
@@ -13,18 +13,76 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.onosproject.isis.controller;
 
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.onlab.packet.MacAddress;
+
 /**
  * Representation of an ISIS Message.
  */
 public interface IsisMessage {
 
     /**
-     * Gets the type of ISIS PDU.
+     * Returns the interface index on which the message received.
+     *
+     * @return interface index on which the message received
+     */
+    int interfaceIndex();
+
+    /**
+     * Sets the interface index on which the message received.
+     *
+     * @param interfaceIndex interface index on which the message received
+     */
+    void setInterfaceIndex(int interfaceIndex);
+
+    /**
+     * Returns the interface mac address on which the message received.
+     *
+     * @return interface mac address on which the message received
+     */
+    MacAddress interfaceMac();
+
+    /**
+     * Sets the interface mac address on which the message received.
+     *
+     * @param interfaceMac mac address on which the message received
+     */
+    void setInterfaceMac(MacAddress interfaceMac);
+
+    /**
+     * Returns the mac address of the message sender.
+     *
+     * @return mac address of the message sender
+     */
+    MacAddress sourceMac();
+
+    /**
+     * Sets the mac address of the message sender.
+     *
+     * @param sourceMac mac address of the message sender
+     */
+    void setSourceMac(MacAddress sourceMac);
+
+    /**
+     * Returns the type of ISIS PDU.
      *
      * @return ISIS PDU type instance
      */
     IsisPduType isisPduType();
-}
\ No newline at end of file
+
+    /**
+     * Reads from channel buffer and initializes the type of PDU.
+     *
+     * @param channelBuffer channel buffer instance
+     */
+    void readFrom(ChannelBuffer channelBuffer);
+
+    /**
+     * Returns IsisMessage as byte array.
+     *
+     * @return ISIS message as bytes
+     */
+    byte[] asBytes();
+}
diff --git a/protocols/isis/api/src/main/java/org/onosproject/isis/controller/IsisNeighbor.java b/protocols/isis/api/src/main/java/org/onosproject/isis/controller/IsisNeighbor.java
new file mode 100644
index 0000000..f6a462b
--- /dev/null
+++ b/protocols/isis/api/src/main/java/org/onosproject/isis/controller/IsisNeighbor.java
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2016-present 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;
+
+import org.onlab.packet.MacAddress;
+
+/**
+ * Representation of an ISIS neighbor.
+ */
+public interface IsisNeighbor {
+
+    /**
+     * Returns the MAC address of neighbor.
+     *
+     * @return MAC address of neighbor
+     */
+    MacAddress neighborMacAddress();
+
+    /**
+     * Returns the neighbor interface state.
+     *
+     * @return neighbor interface state
+     */
+    IsisInterfaceState interfaceState();
+
+    /**
+     * Sets the neighbor interface state.
+     *
+     * @param interfaceState the neighbor interface state
+     */
+    void setNeighborState(IsisInterfaceState interfaceState);
+
+    /**
+     * Sets the LAN ID.
+     *
+     * @param l1LanId LAN ID
+     */
+    void setL1LanId(String l1LanId);
+
+    /**
+     * Sets the LAN ID.
+     *
+     * @param l2LanId LAN ID
+     */
+    void setL2LanId(String l2LanId);
+
+    /**
+     * Returns neighbor system ID.
+     *
+     * @return neighbor system ID
+     */
+    String neighborSystemId();
+
+    /**
+     * Returns neighbor circuit ID.
+     *
+     * @return neighbor circuit ID
+     */
+    byte localCircuitId();
+
+    /**
+     * Returns neighbor extended circuit ID.
+     *
+     * @return neighbor extended circuit ID
+     */
+    int localExtendedCircuitId();
+
+    /**
+     * Sets neighbor extended circuit ID.
+     *
+     * @param localExtendedCircuitId neighbor extended circuit ID
+     */
+    void setLocalExtendedCircuitId(int localExtendedCircuitId);
+}
diff --git a/protocols/isis/api/src/main/java/org/onosproject/isis/controller/IsisNetworkType.java b/protocols/isis/api/src/main/java/org/onosproject/isis/controller/IsisNetworkType.java
new file mode 100644
index 0000000..083e6d9
--- /dev/null
+++ b/protocols/isis/api/src/main/java/org/onosproject/isis/controller/IsisNetworkType.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2016-present 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;
+
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Represents ISIS network types.
+ */
+public enum IsisNetworkType {
+    /**
+     * Represents point-to-point network.
+     */
+    P2P(1),
+    /**
+     * Represents broadcast network.
+     */
+    BROADCAST(2);
+    // Reverse lookup table
+    private static final Map<Integer, IsisNetworkType> LOOKUP = new HashMap<>();
+
+    // Populate the lookup table on loading time
+    static {
+        for (IsisNetworkType isisNetworkType : EnumSet.allOf(IsisNetworkType.class)) {
+            LOOKUP.put(isisNetworkType.value(), isisNetworkType);
+        }
+    }
+
+    private int value;
+
+
+    /**
+     * Creates an instance of ISIS network type.
+     *
+     * @param value represents ISIS network type
+     */
+    private IsisNetworkType(int value) {
+        this.value = value;
+    }
+
+    /**
+     * Gets the enum instance from type value - reverse lookup purpose.
+     *
+     * @param isisNetworkTypeValue interface network type value
+     * @return ISIS interface network type instance
+     */
+    public static IsisNetworkType get(int isisNetworkTypeValue) {
+        return LOOKUP.get(isisNetworkTypeValue);
+    }
+
+    /**
+     * Gets the value representing network type.
+     *
+     * @return value represents network type
+     */
+    public int value() {
+        return value;
+    }
+}
\ No newline at end of file
diff --git a/protocols/isis/api/src/main/java/org/onosproject/isis/controller/IsisPduType.java b/protocols/isis/api/src/main/java/org/onosproject/isis/controller/IsisPduType.java
index f919891..f3917a1 100644
--- a/protocols/isis/api/src/main/java/org/onosproject/isis/controller/IsisPduType.java
+++ b/protocols/isis/api/src/main/java/org/onosproject/isis/controller/IsisPduType.java
@@ -13,9 +13,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.onosproject.isis.controller;
 
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.Map;
+
 /**
  * Representation of ISIS PDU types.
  */
@@ -58,8 +61,17 @@
      */
     L2PSNP(27);
 
-    private int value;
+    // Reverse lookup table
+    private static final Map<Integer, IsisPduType> LOOKUP = new HashMap<>();
 
+    // Populate the lookup table on loading time
+    static {
+        for (IsisPduType isisPduType : EnumSet.allOf(IsisPduType.class)) {
+            LOOKUP.put(isisPduType.value(), isisPduType);
+        }
+    }
+
+    private int value;
 
     /**
      * Creates an instance of ISIS PDU type.
@@ -71,6 +83,16 @@
     }
 
     /**
+     * Gets the enum instance from type value - reverse lookup purpose.
+     *
+     * @param pduTypeValue PDU type value
+     * @return ISIS PDU type instance
+     */
+    public static IsisPduType get(int pduTypeValue) {
+        return LOOKUP.get(pduTypeValue);
+    }
+
+    /**
      * Gets the value representing PDU type.
      *
      * @return value represents PDU type
diff --git a/protocols/isis/api/src/main/java/org/onosproject/isis/controller/IsisProcess.java b/protocols/isis/api/src/main/java/org/onosproject/isis/controller/IsisProcess.java
index a64a26e..a5d1ae6 100644
--- a/protocols/isis/api/src/main/java/org/onosproject/isis/controller/IsisProcess.java
+++ b/protocols/isis/api/src/main/java/org/onosproject/isis/controller/IsisProcess.java
@@ -13,7 +13,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.onosproject.isis.controller;
 
 import java.util.List;
@@ -36,4 +35,11 @@
      * @param isisInterfaceList list of ISIS interface details
      */
     void setIsisInterfaceList(List<IsisInterface> isisInterfaceList);
-}
\ No newline at end of file
+
+    /**
+     * Returns list of ISIS interface details.
+     *
+     * @return list of ISIS interface details
+     */
+    List<IsisInterface> isisInterfaceList();
+}
diff --git a/protocols/isis/api/src/main/java/org/onosproject/isis/controller/IsisRouterType.java b/protocols/isis/api/src/main/java/org/onosproject/isis/controller/IsisRouterType.java
new file mode 100644
index 0000000..8972540
--- /dev/null
+++ b/protocols/isis/api/src/main/java/org/onosproject/isis/controller/IsisRouterType.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2016-present 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;
+
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Representation of ISIS router types.
+ */
+public enum IsisRouterType {
+    /**
+     * Represents ISIS L1 router.
+     */
+    L1(1),
+    /**
+     * Represents ISIS L2 router.
+     */
+    L2(2),
+    /**
+     * Represents ISIS L1/L2 router.
+     */
+    L1L2(3);
+    // Reverse lookup table
+    private static final Map<Integer, IsisRouterType> LOOKUP = new HashMap<>();
+
+    // Populate the lookup table on loading time
+    static {
+        for (IsisRouterType isisRouterType : EnumSet.allOf(IsisRouterType.class)) {
+            LOOKUP.put(isisRouterType.value(), isisRouterType);
+        }
+    }
+
+    private int value;
+
+    /**
+     * Creates an instance of ISIS router type.
+     *
+     * @param value represents ISIS router type
+     */
+    private IsisRouterType(int value) {
+        this.value = value;
+    }
+
+    /**
+     * Gets the enum instance from type value - reverse lookup purpose.
+     *
+     * @param routerTypeValue router type value
+     * @return ISIS router type instance
+     */
+    public static IsisRouterType get(int routerTypeValue) {
+        return LOOKUP.get(routerTypeValue);
+    }
+
+    /**
+     * Gets the value representing router type.
+     *
+     * @return value represents router type
+     */
+    public int value() {
+        return value;
+    }
+}
\ No newline at end of file
diff --git a/protocols/isis/api/src/main/java/org/onosproject/isis/controller/LspWrapper.java b/protocols/isis/api/src/main/java/org/onosproject/isis/controller/LspWrapper.java
new file mode 100644
index 0000000..a4615f7
--- /dev/null
+++ b/protocols/isis/api/src/main/java/org/onosproject/isis/controller/LspWrapper.java
@@ -0,0 +1,127 @@
+/*
+ * Copyright 2016-present 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;
+
+/**
+ * Representation of a LSP wrapper.
+ */
+public interface LspWrapper {
+
+    /**
+     * Returns bin number into which the LSP wrapper is put for aging process.
+     *
+     * @return bin number
+     */
+    int binNumber();
+
+    /**
+     * Sets bin number into which the LSP wrapper is put for aging process.
+     *
+     * @param binNumber bin number
+     */
+    void setBinNumber(int binNumber);
+
+    /**
+     * Checks the contained LSP is self originated or not.
+     *
+     * @return true if self originated else false
+     */
+    boolean isSelfOriginated();
+
+    /**
+     * Sets the contained LSP is self originated or not.
+     *
+     * @param selfOriginated true if self originated else false
+     */
+    void setSelfOriginated(boolean selfOriginated);
+
+    /**
+     * Returns the LSP type.
+     *
+     * @return LSP type
+     */
+    IsisPduType lspType();
+
+    /**
+     * Returns the LSPs remaining life time.
+     *
+     * @return LSPs remaining life time.
+     */
+    int remainingLifetime();
+
+    /**
+     * Returns the age counter value when LSP was received.
+     *
+     * @return age counter value when LSP was received
+     */
+    int ageCounterWhenReceived();
+
+    /**
+     * Returns the age counter roll over value when LSP was added to wrapper instance.
+     *
+     * @return age counter roll over value when LSP was added to wrapper instance
+     */
+    int ageCounterRollOverWhenAdded();
+
+    /**
+     * Returns the LSP instance stored in wrapper.
+     *
+     * @return LSP instance stored in wrapper
+     */
+    IsisMessage lsPdu();
+
+    /**
+     * Sets LSPs remaining life time.
+     *
+     * @param remainingLifetime LSPs remaining life time
+     */
+    void setRemainingLifetime(int remainingLifetime);
+
+    /**
+     * Returns the age of LSP when received.
+     *
+     * @return age of LSP when received
+     */
+    int lspAgeReceived();
+
+    /**
+     * Returns the LSP processing string.
+     *
+     * @return lsp processing value for switch case
+     */
+    String lspProcessing();
+
+    /**
+     * Returns ISIS interface instance.
+     *
+     * @return ISIS interface instance
+     */
+    IsisInterface isisInterface();
+
+    /**
+     * Returns the current LSP age.
+     *
+     * @return LSP age
+     */
+    int currentAge();
+
+    /**
+     * Sets the LSP processing string based on LSP to process.
+     *
+     * @param lspProcessing "refreshLsp" or "maxageLsp" based on LSP to process
+     */
+    void setLspProcessing(String lspProcessing);
+}
diff --git a/protocols/isis/api/src/main/java/org/onosproject/isis/controller/topology/IsisLink.java b/protocols/isis/api/src/main/java/org/onosproject/isis/controller/topology/IsisLink.java
new file mode 100644
index 0000000..1760106
--- /dev/null
+++ b/protocols/isis/api/src/main/java/org/onosproject/isis/controller/topology/IsisLink.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2016-present 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 org.onlab.packet.IpAddress;
+
+import java.util.List;
+
+/**
+ * Abstraction of an ISIS Link.
+ */
+public interface IsisLink {
+
+    /**
+     * Returns IP address of the Router.
+     *
+     * @return IP address of router
+     */
+    IpAddress remoteRouterId();
+
+    /**
+     * Returns the area ID for this device.
+     *
+     * @return the area ID
+     */
+    int areaIdOfInterface();
+
+    /**
+     * Returns IP address of the interface.
+     *
+     * @return IP address of the interface
+     */
+    IpAddress interfaceIp();
+
+    /**
+     * Returns the list of link TED details.
+     *
+     * @return linkTed list of link TED
+     */
+    List<IsisLinkTed> linkTed();
+
+    /**
+     * Sets IP address of the router.
+     *
+     * @param routerIp router's IP address
+     */
+    void setRouterIp(IpAddress routerIp);
+
+    /**
+     * Sets the area ID for this device.
+     *
+     * @param areaIdOfInterface area ID
+     */
+    void setAreaIdOfInterface(int areaIdOfInterface);
+
+    /**
+     * Sets IP address of the interface.
+     *
+     * @param interfaceIp IP address of the interface
+     */
+    void setInterfaceIp(IpAddress interfaceIp);
+
+    /**
+     * Sets the list of link TED.
+     *
+     * @param linkTed list of link TED
+     */
+    void setLinkTed(List<IsisLinkTed> linkTed);
+}
diff --git a/protocols/isis/api/src/main/java/org/onosproject/isis/controller/topology/IsisLinkListener.java b/protocols/isis/api/src/main/java/org/onosproject/isis/controller/topology/IsisLinkListener.java
new file mode 100644
index 0000000..b96d81c
--- /dev/null
+++ b/protocols/isis/api/src/main/java/org/onosproject/isis/controller/topology/IsisLinkListener.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2016-present 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;
+
+/**
+ * Abstraction of an ISIS link listener.
+ */
+public interface IsisLinkListener {
+
+    /**
+     * Notifies that we got a link from network.
+     *
+     * @param isisRouter  router instance
+     * @param isisLinkTed link TED information of router
+     */
+    void addLink(IsisRouter isisRouter, IsisLinkTed isisLinkTed);
+
+    /**
+     * Notifies that a link got removed from network.
+     *
+     * @param isisRouter router instance
+     * @param isisLinkTed isis link ted infromation
+     */
+    void deleteLink(IsisRouter isisRouter, IsisLinkTed isisLinkTed);
+}
\ No newline at end of file
diff --git a/protocols/isis/api/src/main/java/org/onosproject/isis/controller/topology/IsisLinkTed.java b/protocols/isis/api/src/main/java/org/onosproject/isis/controller/topology/IsisLinkTed.java
new file mode 100644
index 0000000..08014b8
--- /dev/null
+++ b/protocols/isis/api/src/main/java/org/onosproject/isis/controller/topology/IsisLinkTed.java
@@ -0,0 +1,140 @@
+/*
+ * Copyright 2016-present 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 org.onlab.packet.Ip4Address;
+import org.onlab.packet.Ip6Address;
+import org.onlab.util.Bandwidth;
+
+import java.util.List;
+
+/**
+ * Representation of ISIS link traffic engineering parameters.
+ */
+public interface IsisLinkTed {
+
+    /**
+     * Provides maximum bandwidth can be used on the link.
+     *
+     * @return maximum bandwidth
+     */
+    Bandwidth maximumLink();
+
+    /**
+     * Sets maximum band width.
+     *
+     * @param bandwidth maximum bandwidth
+     */
+    void setMaximumLink(Bandwidth bandwidth);
+
+    /**
+     * Amount of bandwidth reservable on the link.
+     *
+     * @return unreserved bandwidth
+     */
+    List<Bandwidth> maxUnResBandwidth();
+
+    /**
+     * Sets max bandwidth that is not reserved on the link.
+     *
+     * @param bandwidth max bandwidth that is not reserved on the link
+     */
+    void setMaxUnResBandwidth(Bandwidth bandwidth);
+
+    /**
+     * Provides max bandwidth that can be reserved on the link.
+     *
+     * @return max bandwidth reserved
+     */
+    Bandwidth maxReserved();
+
+    /**
+     * Sets max bandwidth that can be reserved on the link.
+     *
+     * @param bandwidth max bandwidth that can be reserved on the link
+     */
+    void setMaxReserved(Bandwidth bandwidth);
+
+    /**
+     * Provides Traffic Engineering metric for the link.
+     *
+     * @return Traffic Engineering metric
+     */
+    int teMetric();
+
+    /**
+     * Sets Traffic Engineering metric for the link.
+     *
+     * @param teMetric Traffic Engineering metric for the link
+     */
+    void setTeMetric(int teMetric);
+
+    /**
+     * Provides IPv4 router-Id of local node.
+     *
+     * @return IPv4 router-Id of local node
+     */
+    List<Ip4Address> ipv4LocRouterId();
+
+    /**
+     * Sets IPv4 router-Id of local node.
+     *
+     * @param routerIds IPv4 router-Id of local node
+     */
+    void setIpv4LocRouterId(List<Ip4Address> routerIds);
+
+    /**
+     * Provides IPv6 router-Id of local node.
+     *
+     * @return IPv6 router-Id of local node
+     */
+    List<Ip6Address> ipv6LocRouterId();
+
+    /**
+     * Sets IPv6 router-Id of local node.
+     *
+     * @param routerIds IPv6 router-Id of local node
+     */
+    void setIpv6LocRouterId(List<Ip6Address> routerIds);
+
+    /**
+     * Provides IPv4 router-Id of remote node.
+     *
+     * @return IPv4 router-Id of remote node
+     */
+    List<Ip4Address> ipv4RemRouterId();
+
+    /**
+     * Sets IPv4 router-Id of remote node.
+     *
+     * @param routerIds IPv4 router-Id of remote node
+     */
+    void setIpv4RemRouterId(List<Ip4Address> routerIds);
+
+    /**
+     * Provides IPv6 router-Id of remote node.
+     *
+     * @return IPv6 router-Id of remote node
+     */
+    List<Ip6Address> ipv6RemRouterId();
+
+    /**
+     * Sets IPv6 router-Id of remote node.
+     *
+     * @param routerIds IPv6 router-Id of remote node
+     */
+    void setIpv6RemRouterId(List<Ip6Address> routerIds);
+}
\ No newline at end of file
diff --git a/protocols/isis/api/src/main/java/org/onosproject/isis/controller/IsisRouter.java b/protocols/isis/api/src/main/java/org/onosproject/isis/controller/topology/IsisRouter.java
similarity index 88%
rename from protocols/isis/api/src/main/java/org/onosproject/isis/controller/IsisRouter.java
rename to protocols/isis/api/src/main/java/org/onosproject/isis/controller/topology/IsisRouter.java
index a7e41a2..56ad7da 100644
--- a/protocols/isis/api/src/main/java/org/onosproject/isis/controller/IsisRouter.java
+++ b/protocols/isis/api/src/main/java/org/onosproject/isis/controller/topology/IsisRouter.java
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.onosproject.isis.controller;
+package org.onosproject.isis.controller.topology;
 
 import org.onlab.packet.Ip4Address;
 
@@ -23,14 +23,14 @@
 public interface IsisRouter {
 
     /**
-     * Gets IP address of the router.
+     * Returns IP address of the router.
      *
      * @return IP address of the router
      */
     Ip4Address routerIp();
 
     /**
-     * Gets IP address of the interface.
+     * Returns IP address of the interface.
      *
      * @return IP address of the interface
      */
@@ -42,4 +42,4 @@
      * @param routerIp IP address of the router
      */
     void setRouterIp(Ip4Address routerIp);
-}
\ No newline at end of file
+}
diff --git a/protocols/isis/api/src/main/java/org/onosproject/isis/controller/IsisRouterListener.java b/protocols/isis/api/src/main/java/org/onosproject/isis/controller/topology/IsisRouterListener.java
similarity index 95%
rename from protocols/isis/api/src/main/java/org/onosproject/isis/controller/IsisRouterListener.java
rename to protocols/isis/api/src/main/java/org/onosproject/isis/controller/topology/IsisRouterListener.java
index 712a4fc..82d6c61 100644
--- a/protocols/isis/api/src/main/java/org/onosproject/isis/controller/IsisRouterListener.java
+++ b/protocols/isis/api/src/main/java/org/onosproject/isis/controller/topology/IsisRouterListener.java
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.onosproject.isis.controller;
+package org.onosproject.isis.controller.topology;
 
 /**
  * Abstraction of an ISIS Router Listener.
diff --git a/protocols/isis/api/src/main/java/org/onosproject/isis/controller/topology/package-info.java b/protocols/isis/api/src/main/java/org/onosproject/isis/controller/topology/package-info.java
new file mode 100644
index 0000000..27df3df
--- /dev/null
+++ b/protocols/isis/api/src/main/java/org/onosproject/isis/controller/topology/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2016-present 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.
+ */
+
+/**
+ * Implementation of the ISIS topology provider.
+ */
+package org.onosproject.isis.controller.topology;
\ No newline at end of file