[ONOS-4164] PCE Store

Change-Id: I2caa918fae0bf635f98976b11ee8a717aba42aac
diff --git a/apps/pce/app/src/main/java/org/onosproject/pce/pcestore/DefaultLspLocalLabelInfo.java b/apps/pce/app/src/main/java/org/onosproject/pce/pcestore/DefaultLspLocalLabelInfo.java
new file mode 100644
index 0000000..717044f
--- /dev/null
+++ b/apps/pce/app/src/main/java/org/onosproject/pce/pcestore/DefaultLspLocalLabelInfo.java
@@ -0,0 +1,218 @@
+/*
+ * 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.pce.pcestore;
+
+import com.google.common.base.MoreObjects;
+
+import java.util.Objects;
+
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.PortNumber;
+import org.onosproject.incubator.net.resource.label.LabelResourceId;
+import org.onosproject.pce.pcestore.api.LspLocalLabelInfo;
+
+/**
+ * Local node details including IN and OUT labels as well as IN and OUT port details.
+ */
+public final class DefaultLspLocalLabelInfo implements LspLocalLabelInfo {
+
+    private final DeviceId deviceId;
+
+    private final LabelResourceId inLabelId;
+
+    private final LabelResourceId outLabelId;
+
+    private final PortNumber inPort;
+
+    private final PortNumber outPort;
+
+    /**
+     * Initialization of member variables.
+     *
+     * @param deviceId device id
+     * @param inLabelId in label id of a node
+     * @param outLabelId out label id of a node
+     * @param inPort input port
+     * @param outPort remote port
+     */
+    private DefaultLspLocalLabelInfo(DeviceId deviceId,
+                                     LabelResourceId inLabelId,
+                                     LabelResourceId outLabelId,
+                                     PortNumber inPort,
+                                     PortNumber outPort) {
+       this.deviceId = deviceId;
+       this.inLabelId = inLabelId;
+       this.outLabelId = outLabelId;
+       this.inPort = inPort;
+       this.outPort = outPort;
+    }
+
+    /**
+     * Initialization of member variables for serialization.
+     */
+    private DefaultLspLocalLabelInfo() {
+       this.deviceId = null;
+       this.inLabelId = null;
+       this.outLabelId = null;
+       this.inPort = null;
+       this.outPort = null;
+    }
+
+    @Override
+    public DeviceId deviceId() {
+       return deviceId;
+    }
+
+    @Override
+    public LabelResourceId inLabelId() {
+       return inLabelId;
+    }
+
+    @Override
+    public LabelResourceId outLabelId() {
+       return outLabelId;
+    }
+
+    @Override
+    public PortNumber inPort() {
+       return inPort;
+    }
+
+    @Override
+    public PortNumber outPort() {
+       return outPort;
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(deviceId, inLabelId, outLabelId, inPort, outPort);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof LspLocalLabelInfo) {
+            final DefaultLspLocalLabelInfo other = (DefaultLspLocalLabelInfo) obj;
+            return Objects.equals(this.deviceId, other.deviceId) &&
+                    Objects.equals(this.inLabelId, other.inLabelId) &&
+                    Objects.equals(this.outLabelId, other.outLabelId) &&
+                    Objects.equals(this.inPort, other.inPort) &&
+                    Objects.equals(this.outPort, other.outPort);
+        }
+        return false;
+    }
+
+    @Override
+    public String toString() {
+        return MoreObjects.toStringHelper(getClass())
+                .omitNullValues()
+                .add("DeviceId", deviceId.toString())
+                .add("InLabelId", inLabelId.toString())
+                .add("OutLabelId", outLabelId.toString())
+                .add("InPort", inPort.toString())
+                .add("OutPort", outPort.toString())
+                .toString();
+    }
+
+    /**
+     * Creates and returns a new builder instance that clones an existing object.
+     *
+     * @param deviceLabelInfo device label information
+     * @return new builder
+     */
+    public static Builder builder(LspLocalLabelInfo deviceLabelInfo) {
+        return new Builder(deviceLabelInfo);
+    }
+
+    /**
+     * Creates and returns a new builder instance.
+     *
+     * @return new builder
+     */
+    public static Builder builder() {
+        return new Builder();
+    }
+
+    /**
+     * Builder.
+     */
+    public static final class Builder implements LspLocalLabelInfo.Builder {
+
+        private DeviceId deviceId;
+
+        private LabelResourceId inLabelId;
+
+        private LabelResourceId outLabelId;
+
+        private PortNumber inPort;
+
+        private PortNumber outPort;
+
+        /**
+         * Constructs default builder.
+         */
+        private Builder() {
+        }
+
+        /**
+         * Initializes member variables with existing object.
+         */
+        private Builder(LspLocalLabelInfo deviceLabelInfo) {
+            this.deviceId = deviceLabelInfo.deviceId();
+            this.inLabelId = deviceLabelInfo.inLabelId();
+            this.outLabelId = deviceLabelInfo.outLabelId();
+            this.inPort = deviceLabelInfo.inPort();
+            this.outPort = deviceLabelInfo.outPort();
+        }
+
+        @Override
+        public Builder deviceId(DeviceId id) {
+            this.deviceId = id;
+            return this;
+        }
+
+        @Override
+        public Builder inLabelId(LabelResourceId id) {
+            this.inLabelId = id;
+            return this;
+        }
+
+        @Override
+        public Builder outLabelId(LabelResourceId id) {
+            this.outLabelId = id;
+            return this;
+        }
+
+        @Override
+        public Builder inPort(PortNumber port) {
+            this.inPort = port;
+            return this;
+        }
+
+        @Override
+        public Builder outPort(PortNumber port) {
+            this.outPort = port;
+            return this;
+        }
+
+        @Override
+        public LspLocalLabelInfo build() {
+            return new DefaultLspLocalLabelInfo(deviceId, inLabelId, outLabelId, inPort, outPort);
+        }
+    }
+}
diff --git a/apps/pce/app/src/main/java/org/onosproject/pce/pcestore/DistributedPceStore.java b/apps/pce/app/src/main/java/org/onosproject/pce/pcestore/DistributedPceStore.java
new file mode 100644
index 0000000..8276f3d
--- /dev/null
+++ b/apps/pce/app/src/main/java/org/onosproject/pce/pcestore/DistributedPceStore.java
@@ -0,0 +1,278 @@
+/*
+ * 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.pce.pcestore;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Deactivate;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.ReferenceCardinality;
+import org.apache.felix.scr.annotations.Service;
+
+import org.onlab.util.KryoNamespace;
+import org.onosproject.incubator.net.tunnel.TunnelId;
+import org.onosproject.incubator.net.resource.label.LabelResourceId;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.Link;
+import org.onosproject.net.resource.ResourceConsumer;
+import org.onosproject.pce.pceservice.TunnelConsumerId;
+import org.onosproject.pce.pcestore.api.LspLocalLabelInfo;
+import org.onosproject.pce.pcestore.api.PceStore;
+import org.onosproject.store.serializers.KryoNamespaces;
+import org.onosproject.store.service.ConsistentMap;
+import org.onosproject.store.service.Serializer;
+import org.onosproject.store.service.StorageService;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Manages the pool of available labels to devices, links and tunnels.
+ */
+@Component(immediate = true)
+@Service
+public class DistributedPceStore implements PceStore {
+
+    private static final String DEVICE_ID_NULL = "Device ID cannot be null";
+    private static final String LINK_NULL = "LINK cannot be null";
+    private static final String TUNNEL_ID_NULL = "Tunnel ID cannot be null";
+    private static final String LABEL_RESOURCE_ID_NULL = "Label Resource ID cannot be null";
+    private static final String PCECC_TUNNEL_INFO_NULL = "PCECC Tunnel Info cannot be null";
+    private static final String LSP_LOCAL_LABEL_INFO_NULL = "LSP Local Label info cannot be null";
+    private static final String TUNNEL_CONSUMER_ID_NULL = "Tunnel consumer Id cannot be null";
+
+    private final Logger log = LoggerFactory.getLogger(getClass());
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected StorageService storageService;
+
+    // Mapping device with global node label
+    private ConsistentMap<DeviceId, LabelResourceId> globalNodeLabelMap;
+
+    // Mapping link with adjacency label
+    private ConsistentMap<Link, LabelResourceId> adjLabelMap;
+
+    // Mapping tunnel with device local info with tunnel consumer id
+    private ConsistentMap<TunnelId, PceccTunnelInfo> tunnelInfoMap;
+
+    @Activate
+    protected void activate() {
+        globalNodeLabelMap = storageService.<DeviceId, LabelResourceId>consistentMapBuilder()
+                .withName("onos-pce-globalnodelabelmap")
+                .withSerializer(Serializer.using(
+                        new KryoNamespace.Builder()
+                                .register(KryoNamespaces.API)
+                                .register(LabelResourceId.class)
+                                .build()))
+                .build();
+
+        adjLabelMap = storageService.<Link, LabelResourceId>consistentMapBuilder()
+                .withName("onos-pce-adjlabelmap")
+                .withSerializer(Serializer.using(
+                        new KryoNamespace.Builder()
+                                .register(KryoNamespaces.API)
+                                .register(Link.class,
+                                          LabelResourceId.class)
+                                .build()))
+                .build();
+
+        tunnelInfoMap = storageService.<TunnelId, PceccTunnelInfo>consistentMapBuilder()
+                .withName("onos-pce-tunnelinfomap")
+                .withSerializer(Serializer.using(
+                        new KryoNamespace.Builder()
+                                .register(KryoNamespaces.API)
+                                .register(TunnelId.class,
+                                          PceccTunnelInfo.class,
+                                          DefaultLspLocalLabelInfo.class,
+                                          TunnelConsumerId.class,
+                                          LabelResourceId.class)
+                                .build()))
+                .build();
+
+        log.info("Started");
+    }
+
+    @Deactivate
+    protected void deactivate() {
+        log.info("Stopped");
+    }
+
+    @Override
+    public boolean existsGlobalNodeLabel(DeviceId id) {
+        checkNotNull(id, DEVICE_ID_NULL);
+        return globalNodeLabelMap.containsKey(id);
+    }
+
+    @Override
+    public boolean existsAdjLabel(Link link) {
+        checkNotNull(link, LINK_NULL);
+        return adjLabelMap.containsKey(link);
+    }
+
+    @Override
+    public boolean existsTunnelInfo(TunnelId tunnelId) {
+        checkNotNull(tunnelId, TUNNEL_ID_NULL);
+        return tunnelInfoMap.containsKey(tunnelId);
+    }
+
+    @Override
+    public int getGlobalNodeLabelCount() {
+        return globalNodeLabelMap.size();
+    }
+
+    @Override
+    public int getAdjLabelCount() {
+        return adjLabelMap.size();
+    }
+
+    @Override
+    public int getTunnelInfoCount() {
+        return tunnelInfoMap.size();
+    }
+
+    @Override
+    public Map<DeviceId, LabelResourceId> getGlobalNodeLabels() {
+       return globalNodeLabelMap.entrySet().stream()
+                 .collect(Collectors.toMap(Map.Entry::getKey, e -> (LabelResourceId) e.getValue().value()));
+    }
+
+    @Override
+    public Map<Link, LabelResourceId> getAdjLabels() {
+       return adjLabelMap.entrySet().stream()
+                 .collect(Collectors.toMap(Map.Entry::getKey, e -> (LabelResourceId) e.getValue().value()));
+    }
+
+    @Override
+    public Map<TunnelId, PceccTunnelInfo> getTunnelInfos() {
+       return tunnelInfoMap.entrySet().stream()
+                 .collect(Collectors.toMap(Map.Entry::getKey, e -> (PceccTunnelInfo) e.getValue().value()));
+    }
+
+    @Override
+    public LabelResourceId getGlobalNodeLabel(DeviceId id) {
+        checkNotNull(id, DEVICE_ID_NULL);
+        return globalNodeLabelMap.get(id).value();
+    }
+
+    @Override
+    public LabelResourceId getAdjLabel(Link link) {
+        checkNotNull(link, LINK_NULL);
+        return adjLabelMap.get(link).value();
+    }
+
+    @Override
+    public PceccTunnelInfo getTunnelInfo(TunnelId tunnelId) {
+        checkNotNull(tunnelId, TUNNEL_ID_NULL);
+        return tunnelInfoMap.get(tunnelId).value();
+    }
+
+    @Override
+    public void addGlobalNodeLabel(DeviceId deviceId, LabelResourceId labelId) {
+        checkNotNull(deviceId, DEVICE_ID_NULL);
+        checkNotNull(labelId, LABEL_RESOURCE_ID_NULL);
+
+        globalNodeLabelMap.put(deviceId, labelId);
+    }
+
+    @Override
+    public void addAdjLabel(Link link, LabelResourceId labelId) {
+        checkNotNull(link, LINK_NULL);
+        checkNotNull(labelId, LABEL_RESOURCE_ID_NULL);
+
+        adjLabelMap.put(link, labelId);
+    }
+
+    @Override
+    public void addTunnelInfo(TunnelId tunnelId, PceccTunnelInfo pceccTunnelInfo) {
+        checkNotNull(tunnelId, TUNNEL_ID_NULL);
+        checkNotNull(pceccTunnelInfo, PCECC_TUNNEL_INFO_NULL);
+
+        tunnelInfoMap.put(tunnelId, pceccTunnelInfo);
+    }
+
+    @Override
+    public boolean updateTunnelInfo(TunnelId tunnelId, List<LspLocalLabelInfo> lspLocalLabelInfoList) {
+        checkNotNull(tunnelId, TUNNEL_ID_NULL);
+        checkNotNull(lspLocalLabelInfoList, LSP_LOCAL_LABEL_INFO_NULL);
+
+        if (!tunnelInfoMap.containsKey((tunnelId))) {
+            log.debug("Tunnel info does not exist whose tunnel id is {}.", tunnelId.toString());
+            return false;
+        }
+
+        PceccTunnelInfo tunnelInfo = tunnelInfoMap.get(tunnelId).value();
+        tunnelInfo.lspLocalLabelInfoList(lspLocalLabelInfoList);
+        tunnelInfoMap.put(tunnelId, tunnelInfo);
+
+        return true;
+    }
+
+    @Override
+    public boolean updateTunnelInfo(TunnelId tunnelId, ResourceConsumer tunnelConsumerId) {
+        checkNotNull(tunnelId, TUNNEL_ID_NULL);
+        checkNotNull(tunnelConsumerId, TUNNEL_CONSUMER_ID_NULL);
+
+        if (!tunnelInfoMap.containsKey((tunnelId))) {
+            log.debug("Tunnel info does not exist whose tunnel id is {}.", tunnelId.toString());
+            return false;
+        }
+
+        PceccTunnelInfo tunnelInfo = tunnelInfoMap.get(tunnelId).value();
+        tunnelInfo.tunnelConsumerId(tunnelConsumerId);
+        tunnelInfoMap.put(tunnelId, tunnelInfo);
+
+        return true;
+    }
+
+    @Override
+    public boolean removeGlobalNodeLabel(DeviceId id) {
+        checkNotNull(id, DEVICE_ID_NULL);
+
+        if (globalNodeLabelMap.remove(id) == null) {
+            log.error("SR-TE node label deletion for device {} has failed.", id.toString());
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public boolean removeAdjLabel(Link link) {
+        checkNotNull(link, LINK_NULL);
+
+        if (adjLabelMap.remove(link) == null) {
+            log.error("Adjacency label deletion for link {} hash failed.", link.toString());
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public boolean removeTunnelInfo(TunnelId tunnelId) {
+        checkNotNull(tunnelId, TUNNEL_ID_NULL);
+
+        if (tunnelInfoMap.remove(tunnelId) == null) {
+            log.error("Tunnel info deletion for tunnel id {} has failed.", tunnelId.toString());
+            return false;
+        }
+        return true;
+    }
+}
diff --git a/apps/pce/app/src/main/java/org/onosproject/pce/pcestore/PceccTunnelInfo.java b/apps/pce/app/src/main/java/org/onosproject/pce/pcestore/PceccTunnelInfo.java
new file mode 100644
index 0000000..48f49cd
--- /dev/null
+++ b/apps/pce/app/src/main/java/org/onosproject/pce/pcestore/PceccTunnelInfo.java
@@ -0,0 +1,122 @@
+/*
+ * 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.pce.pcestore;
+
+import java.util.List;
+import com.google.common.base.MoreObjects;
+
+import java.util.Objects;
+
+import org.onosproject.net.resource.ResourceConsumer;
+import org.onosproject.pce.pcestore.api.LspLocalLabelInfo;
+
+/**
+ * PCECC tunnel information is used to store
+ * list of links label information of a path containing IN, OUT label and destination port of a link
+ * to release label allocation in devices.
+ * Also storing resource consumer id to release bandwdith of a tunnel.
+ * The first entry is created with TunnelId and resource consumer id,
+ * later this entry may be updated to store label information on basic PCECC case.
+ */
+public final class PceccTunnelInfo {
+
+    private List<LspLocalLabelInfo> lspLocalLabelInfoList;
+
+    private ResourceConsumer tunnelConsumerId;
+
+    /**
+     * Initialization of member variables.
+     *
+     * @param lspLocalLabelInfoList list of devices local label info
+     * @param tunnelConsumerId tunnel consumer id
+     */
+    public PceccTunnelInfo(List<LspLocalLabelInfo> lspLocalLabelInfoList,
+                                           ResourceConsumer tunnelConsumerId) {
+        this.lspLocalLabelInfoList = lspLocalLabelInfoList;
+        this.tunnelConsumerId = tunnelConsumerId;
+    }
+
+    /**
+     * Initialization for serialization.
+     */
+    public PceccTunnelInfo() {
+        this.lspLocalLabelInfoList = null;
+        this.tunnelConsumerId = null;
+    }
+
+    /**
+     * Retrieves list of devices local label info.
+     *
+     * @return list of devices local label info
+     */
+    public List<LspLocalLabelInfo> lspLocalLabelInfoList() {
+        return this.lspLocalLabelInfoList;
+    }
+
+    /**
+     * Retrieves tunnel consumer id.
+     *
+     * @return tunnel consumer id
+     */
+    public ResourceConsumer tunnelConsumerId() {
+       return this.tunnelConsumerId;
+    }
+
+    /**
+     * Sets list of local label info of a path.
+     *
+     * @param lspLocalLabelInfoList list of devices local label info
+     */
+    public void lspLocalLabelInfoList(List<LspLocalLabelInfo> lspLocalLabelInfoList) {
+       this.lspLocalLabelInfoList = lspLocalLabelInfoList;
+    }
+
+    /**
+     * Sets tunnel consumer id.
+     *
+     * @param id tunnel consumer id
+     */
+    public void tunnelConsumerId(ResourceConsumer id) {
+       this.tunnelConsumerId = id;
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(lspLocalLabelInfoList, tunnelConsumerId);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof PceccTunnelInfo) {
+            final PceccTunnelInfo other = (PceccTunnelInfo) obj;
+            return Objects.equals(this.lspLocalLabelInfoList, other.lspLocalLabelInfoList) &&
+                   Objects.equals(this.tunnelConsumerId, other.tunnelConsumerId);
+        }
+        return false;
+    }
+
+    @Override
+    public String toString() {
+        return MoreObjects.toStringHelper(getClass())
+                .omitNullValues()
+                .add("DeviceLabelInfoList", lspLocalLabelInfoList.toString())
+                .add("TunnelConsumerId", tunnelConsumerId.toString())
+                .toString();
+    }
+}
diff --git a/apps/pce/app/src/main/java/org/onosproject/pce/pcestore/api/LspLocalLabelInfo.java b/apps/pce/app/src/main/java/org/onosproject/pce/pcestore/api/LspLocalLabelInfo.java
new file mode 100644
index 0000000..07b61be
--- /dev/null
+++ b/apps/pce/app/src/main/java/org/onosproject/pce/pcestore/api/LspLocalLabelInfo.java
@@ -0,0 +1,114 @@
+/*
+ * 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.pce.pcestore.api;
+
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.PortNumber;
+import org.onosproject.incubator.net.resource.label.LabelResourceId;
+
+/**
+ * Abstraction of an entity providing LSP local label information.
+ */
+public interface LspLocalLabelInfo {
+
+    /**
+     * Returns device id.
+     *
+     * @return device id
+     */
+    DeviceId deviceId();
+
+    /**
+     * Returns in label id of a device.
+     *
+     * @return in label resource id
+     */
+    LabelResourceId inLabelId();
+
+    /**
+     * Returns out label id of a device.
+     *
+     * @return node out label resource id
+     */
+    LabelResourceId outLabelId();
+
+    /**
+     * Returns in port of an incoming label.
+     *
+     * @return in port
+     */
+    PortNumber inPort();
+
+    /**
+     * Returns next hop of an outgoing label.
+     *
+     * @return out port
+     */
+    PortNumber outPort();
+
+    /**
+     * LspLocalLabelInfo Builder.
+     */
+    interface Builder {
+
+        /**
+         * Returns builder object of a device id.
+         *
+         * @param id device id
+         * @return builder object of device id
+         */
+        Builder deviceId(DeviceId id);
+
+        /**
+         * Returns builder object of in label.
+         *
+         * @param id in label id
+         * @return builder object of in label id
+         */
+        Builder inLabelId(LabelResourceId id);
+
+        /**
+         * Returns builder object of out label.
+         *
+         * @param id out label id
+         * @return builder object of out label id
+         */
+        Builder outLabelId(LabelResourceId id);
+
+        /**
+         * Returns builder object of in port of an incoming label.
+         *
+         * @param port in port
+         * @return builder object of in port
+         */
+        Builder inPort(PortNumber port);
+
+        /**
+         * Returns builder object of next hop of an outgoing label.
+         *
+         * @param port out port
+         * @return builder object of out port
+         */
+        Builder outPort(PortNumber port);
+
+        /**
+         * Builds object of device local label info.
+         *
+         * @return object of device local label info.
+         */
+        LspLocalLabelInfo build();
+    }
+}
diff --git a/apps/pce/app/src/main/java/org/onosproject/pce/pcestore/api/PceStore.java b/apps/pce/app/src/main/java/org/onosproject/pce/pcestore/api/PceStore.java
new file mode 100644
index 0000000..912330c
--- /dev/null
+++ b/apps/pce/app/src/main/java/org/onosproject/pce/pcestore/api/PceStore.java
@@ -0,0 +1,189 @@
+/*
+ * 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.pce.pcestore.api;
+
+import java.util.List;
+
+import org.onosproject.incubator.net.resource.label.LabelResourceId;
+import org.onosproject.incubator.net.tunnel.TunnelId;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.Link;
+import org.onosproject.net.resource.ResourceConsumer;
+import org.onosproject.pce.pcestore.PceccTunnelInfo;
+
+import java.util.Map;
+
+/**
+ * Abstraction of an entity providing pool of available labels to devices, links and tunnels.
+ */
+public interface PceStore {
+    /**
+     * Checks whether device id is present in global node label store.
+     *
+     * @param id device id
+     * @return success of failure
+     */
+    boolean existsGlobalNodeLabel(DeviceId id);
+
+    /**
+     * Checks whether link is present in adjacency label store.
+     *
+     * @param link link between devices
+     * @return success of failure
+     */
+    boolean existsAdjLabel(Link link);
+
+    /**
+     * Checks whether tunnel id is present in tunnel info store.
+     *
+     * @param tunnelId tunnel id
+     * @return success of failure
+     */
+    boolean existsTunnelInfo(TunnelId tunnelId);
+
+    /**
+     * Retrieves the node label count.
+     *
+     * @return node label count
+     */
+    int getGlobalNodeLabelCount();
+
+    /**
+     * Retrieves the adjacency label count.
+     *
+     * @return adjacency label count
+     */
+    int getAdjLabelCount();
+
+    /**
+     * Retrieves the tunnel info count.
+     *
+     * @return tunnel info count
+     */
+    int getTunnelInfoCount();
+
+    /**
+     * Retrieves device id and label pairs collection from global node label store.
+     *
+     * @return collection of device id and label pairs
+     */
+    Map<DeviceId, LabelResourceId> getGlobalNodeLabels();
+
+    /**
+     * Retrieves link and label pairs collection from adjacency label store.
+     *
+     * @return collection of link and label pairs
+     */
+    Map<Link, LabelResourceId> getAdjLabels();
+
+    /**
+     * Retrieves tunnel id and pcecc tunnel info pairs collection from tunnel info store.
+     *
+     * @return collection of tunnel id and pcecc tunnel info pairs
+     */
+    Map<TunnelId, PceccTunnelInfo> getTunnelInfos();
+
+    /**
+     * Retrieves node label for specified device id.
+     *
+     * @param id device id
+     * @return node label
+     */
+    LabelResourceId getGlobalNodeLabel(DeviceId id);
+
+    /**
+     * Retrieves adjacency label for specified link.
+     *
+     * @param link between devices
+     * @return adjacency label
+     */
+    LabelResourceId getAdjLabel(Link link);
+
+    /**
+     * Retrieves local label info with tunnel consumer id from tunnel info store.
+     *
+     * @param tunnelId tunnel id
+     * @return pcecc tunnel info
+     */
+    PceccTunnelInfo getTunnelInfo(TunnelId tunnelId);
+
+    /**
+     * Stores node label into global node label store.
+     *
+     * @param deviceId device id
+     * @param labelId node label id
+     */
+    void addGlobalNodeLabel(DeviceId deviceId, LabelResourceId labelId);
+
+    /**
+     * Stores adjacency label into adjacency label store.
+     *
+     * @param link link between nodes
+     * @param labelId link label id
+     */
+    void addAdjLabel(Link link, LabelResourceId labelId);
+
+    /**
+     * Stores local label info with tunnel consumer id into tunnel info store for specified tunnel id.
+     *
+     * @param tunnelId tunnel id
+     * @param pceccTunnelInfo local label info
+     */
+    void addTunnelInfo(TunnelId tunnelId, PceccTunnelInfo pceccTunnelInfo);
+
+    /**
+     * Updates local label info. The first entry is created with TunnelId and TunnelConsumerId.
+     * Later this entry may be updated to store label information if it is basic PCECC case.
+     *
+     * @param tunnelId tunnel id
+     * @param lspLocalLabelInfoList list of local labels
+     * @return success or failure
+     */
+    boolean updateTunnelInfo(TunnelId tunnelId, List<LspLocalLabelInfo> lspLocalLabelInfoList);
+
+    /**
+     * Updates tunnel info map with tunnel consumer id.
+     *
+     * @param tunnelId tunnel id
+     * @param tunnelConsumerId tunnel consumer id
+     * @return success or failure
+     */
+    boolean updateTunnelInfo(TunnelId tunnelId, ResourceConsumer tunnelConsumerId);
+
+    /**
+     * Removes device label from global node label store for specified device id.
+     *
+     * @param id device id
+     * @return success or failure
+     */
+    boolean removeGlobalNodeLabel(DeviceId id);
+
+    /**
+     * Removes adjacency label from adjacency label store for specified link information.
+     *
+     * @param link between nodes
+     * @return success or failure
+     */
+    boolean removeAdjLabel(Link link);
+
+    /**
+     * Removes local label info with tunnel consumer id from tunnel info store for specified tunnel id.
+     *
+     * @param tunnelId tunnel id
+     * @return success or failure
+     */
+    boolean removeTunnelInfo(TunnelId tunnelId);
+}
diff --git a/apps/pce/app/src/main/java/org/onosproject/pce/pcestore/api/package-info.java b/apps/pce/app/src/main/java/org/onosproject/pce/pcestore/api/package-info.java
new file mode 100644
index 0000000..0803071
--- /dev/null
+++ b/apps/pce/app/src/main/java/org/onosproject/pce/pcestore/api/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.
+ */
+
+/**
+ * PCE store service API.
+ */
+package org.onosproject.pce.pcestore.api;
diff --git a/apps/pce/app/src/main/java/org/onosproject/pce/pcestore/package-info.java b/apps/pce/app/src/main/java/org/onosproject/pce/pcestore/package-info.java
new file mode 100644
index 0000000..c1d9bb5
--- /dev/null
+++ b/apps/pce/app/src/main/java/org/onosproject/pce/pcestore/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.
+ */
+
+/**
+ * PCE store application.
+ */
+package org.onosproject.pce.pcestore;
diff --git a/apps/pce/app/src/test/java/org/onosproject/pce/pcestore/DefaultLspLocalLabelInfoTest.java b/apps/pce/app/src/test/java/org/onosproject/pce/pcestore/DefaultLspLocalLabelInfoTest.java
new file mode 100644
index 0000000..b4012ac
--- /dev/null
+++ b/apps/pce/app/src/test/java/org/onosproject/pce/pcestore/DefaultLspLocalLabelInfoTest.java
@@ -0,0 +1,108 @@
+/*
+ * 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.pce.pcestore;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+
+import com.google.common.testing.EqualsTester;
+
+import org.junit.Test;
+import org.onosproject.incubator.net.resource.label.LabelResourceId;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.PortNumber;
+import org.onosproject.pce.pcestore.api.LspLocalLabelInfo;
+
+/**
+ * Unit tests for DefaultLspLocalLabelInfo class.
+ */
+public class DefaultLspLocalLabelInfoTest {
+
+    /**
+     * Checks the operation of equals() methods.
+     */
+    @Test
+    public void testEquals() {
+        // create same two objects.
+        DeviceId deviceId1 = DeviceId.deviceId("foo");
+        LabelResourceId inLabelId1 = LabelResourceId.labelResourceId(1);
+        LabelResourceId outLabelId1 = LabelResourceId.labelResourceId(2);
+        PortNumber inPort1 = PortNumber.portNumber(5122);
+        PortNumber outPort1 = PortNumber.portNumber(5123);
+
+        LspLocalLabelInfo lspLocalLabel1 = DefaultLspLocalLabelInfo.builder()
+                .deviceId(deviceId1)
+                .inLabelId(inLabelId1)
+                .outLabelId(outLabelId1)
+                .inPort(inPort1)
+                .outPort(outPort1)
+                .build();
+
+        // create same object as above object
+        LspLocalLabelInfo sameLocalLabel1 = DefaultLspLocalLabelInfo.builder()
+                .deviceId(deviceId1)
+                .inLabelId(inLabelId1)
+                .outLabelId(outLabelId1)
+                .inPort(inPort1)
+                .outPort(outPort1)
+                .build();
+
+        // Create different object.
+        DeviceId deviceId2 = DeviceId.deviceId("goo");
+        LabelResourceId inLabelId2 = LabelResourceId.labelResourceId(3);
+        LabelResourceId outLabelId2 = LabelResourceId.labelResourceId(4);
+        PortNumber inPort2 = PortNumber.portNumber(5124);
+        PortNumber outPort2 = PortNumber.portNumber(5125);
+
+        LspLocalLabelInfo lspLocalLabel2 = DefaultLspLocalLabelInfo.builder()
+                .deviceId(deviceId2)
+                .inLabelId(inLabelId2)
+                .outLabelId(outLabelId2)
+                .inPort(inPort2)
+                .outPort(outPort2)
+                .build();
+
+        new EqualsTester().addEqualityGroup(lspLocalLabel1, sameLocalLabel1)
+                          .addEqualityGroup(lspLocalLabel2)
+                          .testEquals();
+    }
+
+    /**
+     * Checks the construction of a DefaultLspLocalLabelInfo object.
+     */
+    @Test
+    public void testConstruction() {
+        DeviceId deviceId = DeviceId.deviceId("foo");
+        LabelResourceId inLabelId = LabelResourceId.labelResourceId(1);
+        LabelResourceId outLabelId = LabelResourceId.labelResourceId(2);
+        PortNumber inPort = PortNumber.portNumber(5122);
+        PortNumber outPort = PortNumber.portNumber(5123);
+
+        LspLocalLabelInfo lspLocalLabel = DefaultLspLocalLabelInfo.builder()
+                .deviceId(deviceId)
+                .inLabelId(inLabelId)
+                .outLabelId(outLabelId)
+                .inPort(inPort)
+                .outPort(outPort)
+                .build();
+
+        assertThat(deviceId, is(lspLocalLabel.deviceId()));
+        assertThat(inLabelId, is(lspLocalLabel.inLabelId()));
+        assertThat(outLabelId, is(lspLocalLabel.outLabelId()));
+        assertThat(inPort, is(lspLocalLabel.inPort()));
+        assertThat(outPort, is(lspLocalLabel.outPort()));
+    }
+}
diff --git a/apps/pce/app/src/test/java/org/onosproject/pce/pcestore/DistributedPceStoreTest.java b/apps/pce/app/src/test/java/org/onosproject/pce/pcestore/DistributedPceStoreTest.java
new file mode 100644
index 0000000..a64db83
--- /dev/null
+++ b/apps/pce/app/src/test/java/org/onosproject/pce/pcestore/DistributedPceStoreTest.java
@@ -0,0 +1,454 @@
+/*
+ * 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.pce.pcestore;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.notNullValue;
+
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import org.onosproject.incubator.net.resource.label.DefaultLabelResource;
+import org.onosproject.incubator.net.resource.label.LabelResource;
+import org.onosproject.incubator.net.resource.label.LabelResourceId;
+import org.onosproject.incubator.net.tunnel.TunnelId;
+import org.onosproject.net.ConnectPoint;
+import org.onosproject.net.DefaultAnnotations;
+import org.onosproject.net.DefaultLink;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.ElementId;
+import org.onosproject.net.Link;
+import org.onosproject.net.PortNumber;
+import org.onosproject.net.resource.ResourceConsumer;
+import org.onosproject.pce.pceservice.TunnelConsumerId;
+import org.onosproject.pce.pcestore.api.LspLocalLabelInfo;
+import org.onosproject.net.provider.ProviderId;
+import org.onosproject.store.service.TestStorageService;
+
+/**
+ * Unit tests for DistributedPceStore class.
+ */
+public class DistributedPceStoreTest {
+
+    private DistributedPceStore distrPceStore;
+    private DeviceId deviceId1 = DeviceId.deviceId("foo");
+    private DeviceId deviceId2 = DeviceId.deviceId("goo");
+    private DeviceId deviceId3 = DeviceId.deviceId("yaa");
+    private DeviceId deviceId4 = DeviceId.deviceId("zoo");
+    private LabelResourceId labelId1 = LabelResourceId.labelResourceId(1);
+    private LabelResourceId labelId2 = LabelResourceId.labelResourceId(2);
+    private LabelResourceId labelId3 = LabelResourceId.labelResourceId(3);
+    private LabelResourceId labelId4 = LabelResourceId.labelResourceId(4);
+    private PortNumber portNumber1 = PortNumber.portNumber(1);
+    private PortNumber portNumber2 = PortNumber.portNumber(2);
+    private PortNumber portNumber3 = PortNumber.portNumber(3);
+    private PortNumber portNumber4 = PortNumber.portNumber(4);
+    private ConnectPoint srcConnectionPoint1 = new ConnectPoint((ElementId) deviceId1, portNumber1);
+    private ConnectPoint dstConnectionPoint2 = new ConnectPoint((ElementId) deviceId2, portNumber2);
+    private ConnectPoint srcConnectionPoint3 = new ConnectPoint((ElementId) deviceId3, portNumber3);
+    private ConnectPoint dstConnectionPoint4 = new ConnectPoint((ElementId) deviceId4, portNumber4);
+    private LabelResource labelResource1 = new DefaultLabelResource(deviceId1, labelId1);
+    private LabelResource labelResource2 = new DefaultLabelResource(deviceId2, labelId2);
+    private LabelResource labelResource3 = new DefaultLabelResource(deviceId3, labelId3);
+    private LabelResource labelResource4 = new DefaultLabelResource(deviceId4, labelId4);
+    private Link link1;
+    private Link link2;
+    private List<LabelResource> labelList1 = new LinkedList<>();
+    private List<LabelResource> labelList2 = new LinkedList<>();
+    private TunnelId tunnelId1 = TunnelId.valueOf("1");
+    private TunnelId tunnelId2 = TunnelId.valueOf("2");
+    private TunnelId tunnelId3 = TunnelId.valueOf("3");
+    private TunnelId tunnelId4 = TunnelId.valueOf("4");
+    private PceccTunnelInfo pceccTunnelInfo1;
+    private PceccTunnelInfo pceccTunnelInfo2;
+
+    @BeforeClass
+    public static void setUpBeforeClass() throws Exception {
+    }
+
+    @AfterClass
+    public static void tearDownAfterClass() throws Exception {
+    }
+
+    @Before
+    public void setUp() throws Exception {
+       distrPceStore = new DistributedPceStore();
+
+       // Initialization of member variables
+       link1 = DefaultLink.builder()
+                          .providerId(new ProviderId("eth", "1"))
+                          .annotations(DefaultAnnotations.builder().set("key1", "yahoo").build())
+                          .src(srcConnectionPoint1)
+                          .dst(dstConnectionPoint2)
+                          .type(Link.Type.DIRECT)
+                          .state(Link.State.ACTIVE)
+                          .build();
+       link2 = DefaultLink.builder()
+                          .providerId(new ProviderId("mac", "2"))
+                          .annotations(DefaultAnnotations.builder().set("key2", "google").build())
+                          .src(srcConnectionPoint3)
+                          .dst(dstConnectionPoint4)
+                          .type(Link.Type.DIRECT)
+                          .state(Link.State.ACTIVE)
+                          .build();
+       labelList1.add(labelResource1);
+       labelList1.add(labelResource2);
+       labelList2.add(labelResource3);
+       labelList2.add(labelResource4);
+
+       // Create pceccTunnelInfo1
+       List<LspLocalLabelInfo> lspLocalLabelInfoList1 = new LinkedList<>();
+       ResourceConsumer tunnelConsumerId1 = TunnelConsumerId.valueOf(10);
+
+       DeviceId deviceId1 = DeviceId.deviceId("foo");
+       LabelResourceId inLabelId1 = LabelResourceId.labelResourceId(1);
+       LabelResourceId outLabelId1 = LabelResourceId.labelResourceId(2);
+
+       LspLocalLabelInfo lspLocalLabel1 = DefaultLspLocalLabelInfo.builder()
+               .deviceId(deviceId1)
+               .inLabelId(inLabelId1)
+               .outLabelId(outLabelId1)
+               .build();
+       lspLocalLabelInfoList1.add(lspLocalLabel1);
+
+       pceccTunnelInfo1 = new PceccTunnelInfo(lspLocalLabelInfoList1, tunnelConsumerId1);
+
+       // Create pceccTunnelInfo2
+       List<LspLocalLabelInfo> lspLocalLabelInfoList2 = new LinkedList<>();
+       ResourceConsumer tunnelConsumerId2 = TunnelConsumerId.valueOf(20);
+
+       DeviceId deviceId2 = DeviceId.deviceId("foo");
+       LabelResourceId inLabelId2 = LabelResourceId.labelResourceId(3);
+       LabelResourceId outLabelId2 = LabelResourceId.labelResourceId(4);
+
+       LspLocalLabelInfo lspLocalLabel2 = DefaultLspLocalLabelInfo.builder()
+               .deviceId(deviceId2)
+               .inLabelId(inLabelId2)
+               .outLabelId(outLabelId2)
+               .build();
+       lspLocalLabelInfoList2.add(lspLocalLabel2);
+
+       pceccTunnelInfo2 = new PceccTunnelInfo(lspLocalLabelInfoList2, tunnelConsumerId2);
+    }
+
+    @After
+    public void tearDown() throws Exception {
+    }
+
+    /**
+     * Checks the operation of addGlobalNodeLabel() method.
+     */
+    @Test
+    public void testAddGlobalNodeLabel() {
+        // initialization
+        distrPceStore.storageService = new TestStorageService();
+        distrPceStore.activate();
+
+        // add device with label
+        distrPceStore.addGlobalNodeLabel(deviceId1, labelId1);
+        assertThat(distrPceStore.existsGlobalNodeLabel(deviceId1), is(true));
+        assertThat(distrPceStore.getGlobalNodeLabel(deviceId1), is(labelId1));
+        distrPceStore.addGlobalNodeLabel(deviceId2, labelId2);
+        assertThat(distrPceStore.existsGlobalNodeLabel(deviceId2), is(true));
+        assertThat(distrPceStore.getGlobalNodeLabel(deviceId2), is(labelId2));
+    }
+
+    /**
+     * Checks the operation of addAdjLabel() method.
+     */
+    @Test
+    public void testAddAdjLabel() {
+        // initialization
+        distrPceStore.storageService = new TestStorageService();
+        distrPceStore.activate();
+
+        // link with list of labels
+        distrPceStore.addAdjLabel(link1, labelId1);
+        assertThat(distrPceStore.existsAdjLabel(link1), is(true));
+        assertThat(distrPceStore.getAdjLabel(link1), is(labelId1));
+        distrPceStore.addAdjLabel(link2, labelId2);
+        assertThat(distrPceStore.existsAdjLabel(link2), is(true));
+        assertThat(distrPceStore.getAdjLabel(link2), is(labelId2));
+    }
+
+    /**
+     * Checks the operation of addTunnelInfo() method.
+     */
+    @Test
+    public void testAddTunnelInfo() {
+        // initialization
+        distrPceStore.storageService = new TestStorageService();
+        distrPceStore.activate();
+
+        // TunnelId with device label store information
+        distrPceStore.addTunnelInfo(tunnelId1, pceccTunnelInfo1);
+        assertThat(distrPceStore.existsTunnelInfo(tunnelId1), is(true));
+        assertThat(distrPceStore.getTunnelInfo(tunnelId1), is(pceccTunnelInfo1));
+        distrPceStore.addTunnelInfo(tunnelId2, pceccTunnelInfo2);
+        assertThat(distrPceStore.existsTunnelInfo(tunnelId2), is(true));
+        assertThat(distrPceStore.getTunnelInfo(tunnelId2), is(pceccTunnelInfo2));
+    }
+
+    /**
+     * Checks the operation of existsGlobalNodeLabel() method.
+     */
+    @Test
+    public void testExistsGlobalNodeLabel() {
+        testAddGlobalNodeLabel();
+
+        assertThat(distrPceStore.existsGlobalNodeLabel(deviceId1), is(true));
+        assertThat(distrPceStore.existsGlobalNodeLabel(deviceId2), is(true));
+        assertThat(distrPceStore.existsGlobalNodeLabel(deviceId3), is(false));
+        assertThat(distrPceStore.existsGlobalNodeLabel(deviceId4), is(false));
+    }
+
+    /**
+     * Checks the operation of existsAdjLabel() method.
+     */
+    @Test
+    public void testExistsAdjLabel() {
+        testAddAdjLabel();
+
+        assertThat(distrPceStore.existsAdjLabel(link1), is(true));
+        assertThat(distrPceStore.existsAdjLabel(link2), is(true));
+    }
+
+    /**
+     * Checks the operation of existsTunnelInfo() method.
+     */
+    @Test
+    public void testExistsTunnelInfo() {
+        testAddTunnelInfo();
+
+        assertThat(distrPceStore.existsTunnelInfo(tunnelId1), is(true));
+        assertThat(distrPceStore.existsTunnelInfo(tunnelId2), is(true));
+        assertThat(distrPceStore.existsTunnelInfo(tunnelId3), is(false));
+        assertThat(distrPceStore.existsTunnelInfo(tunnelId4), is(false));
+    }
+
+    /**
+     * Checks the operation of getGlobalNodeLabelCount() method.
+     */
+    @Test
+    public void testGetGlobalNodeLabelCount() {
+        testAddGlobalNodeLabel();
+
+        assertThat(distrPceStore.getGlobalNodeLabelCount(), is(2));
+    }
+
+    /**
+     * Checks the operation of getAdjLabelCount() method.
+     */
+    @Test
+    public void testGetAdjLabelCount() {
+        testAddAdjLabel();
+
+        assertThat(distrPceStore.getAdjLabelCount(), is(2));
+    }
+
+    /**
+     * Checks the operation of getTunnelInfoCount() method.
+     */
+    @Test
+    public void testGetTunnelInfoCount() {
+        testAddTunnelInfo();
+
+        assertThat(distrPceStore.getTunnelInfoCount(), is(2));
+    }
+
+    /**
+     * Checks the operation of getGlobalNodeLabels() method.
+     */
+    @Test
+    public void testGetGlobalNodeLabels() {
+        testAddGlobalNodeLabel();
+
+        Map<DeviceId, LabelResourceId> nodeLabelMap = distrPceStore.getGlobalNodeLabels();
+        assertThat(nodeLabelMap, is(notNullValue()));
+        assertThat(nodeLabelMap.isEmpty(), is(false));
+        assertThat(nodeLabelMap.size(), is(2));
+    }
+
+    /**
+     * Checks the operation of getAdjLabels() method.
+     */
+    @Test
+    public void testGetAdjLabels() {
+        testAddAdjLabel();
+
+        Map<Link, LabelResourceId> adjLabelMap = distrPceStore.getAdjLabels();
+        assertThat(adjLabelMap, is(notNullValue()));
+        assertThat(adjLabelMap.isEmpty(), is(false));
+        assertThat(adjLabelMap.size(), is(2));
+    }
+
+    /**
+     * Checks the operation of getTunnelInfos() method.
+     */
+    @Test
+    public void testGetTunnelInfos() {
+        testAddTunnelInfo();
+
+        Map<TunnelId, PceccTunnelInfo> tunnelInfoMap = distrPceStore.getTunnelInfos();
+        assertThat(tunnelInfoMap, is(notNullValue()));
+        assertThat(tunnelInfoMap.isEmpty(), is(false));
+        assertThat(tunnelInfoMap.size(), is(2));
+    }
+
+    /**
+     * Checks the operation of getGlobalNodeLabel() method.
+     */
+    @Test
+    public void testGetGlobalNodeLabel() {
+        testAddGlobalNodeLabel();
+
+        // deviceId1 with labelId1
+        assertThat(deviceId1, is(notNullValue()));
+        assertThat(distrPceStore.getGlobalNodeLabel(deviceId1), is(labelId1));
+
+        // deviceId2 with labelId2
+        assertThat(deviceId2, is(notNullValue()));
+        assertThat(distrPceStore.getGlobalNodeLabel(deviceId2), is(labelId2));
+    }
+
+    /**
+     * Checks the operation of getAdjLabel() method.
+     */
+    @Test
+    public void testGetAdjLabel() {
+        testAddAdjLabel();
+
+        // link1 with labels
+        assertThat(link1, is(notNullValue()));
+        assertThat(distrPceStore.getAdjLabel(link1), is(labelId1));
+
+        // link2 with labels
+        assertThat(link2, is(notNullValue()));
+        assertThat(distrPceStore.getAdjLabel(link2), is(labelId2));
+    }
+
+    /**
+     * Checks the operation of getTunnelInfo() method.
+     */
+    @Test
+    public void testGetTunnelInfo() {
+        testAddTunnelInfo();
+
+        // tunnelId1 with device label store info
+        assertThat(tunnelId1, is(notNullValue()));
+        assertThat(distrPceStore.getTunnelInfo(tunnelId1), is(pceccTunnelInfo1));
+
+        // tunnelId2 with device label store info
+        assertThat(tunnelId2, is(notNullValue()));
+        assertThat(distrPceStore.getTunnelInfo(tunnelId2), is(pceccTunnelInfo2));
+    }
+
+    /**
+     * Checks the operation of updateTunnelInfo() method.
+     */
+    @Test
+    public void testUpdateTunnelInfo() {
+        // add tunnel info
+        testAddTunnelInfo();
+
+        // new updates
+        // Create pceccTunnelInfo3
+        List<LspLocalLabelInfo> lspLocalLabelInfoList3 = new LinkedList<>();
+        ResourceConsumer tunnelConsumerId3 = TunnelConsumerId.valueOf(30);
+
+        DeviceId deviceId3 = DeviceId.deviceId("goo");
+        LabelResourceId inLabelId3 = LabelResourceId.labelResourceId(3);
+        LabelResourceId outLabelId3 = LabelResourceId.labelResourceId(4);
+
+        LspLocalLabelInfo lspLocalLabel3 = DefaultLspLocalLabelInfo.builder()
+               .deviceId(deviceId3)
+               .inLabelId(inLabelId3)
+               .outLabelId(outLabelId3)
+               .build();
+        lspLocalLabelInfoList3.add(lspLocalLabel3);
+
+        PceccTunnelInfo pceccTunnelInfo3 = new PceccTunnelInfo(lspLocalLabelInfoList3, tunnelConsumerId3);
+
+        // Create pceccTunnelInfo4
+        List<LspLocalLabelInfo> lspLocalLabelInfoList4 = new LinkedList<>();
+        ResourceConsumer tunnelConsumerId4 = TunnelConsumerId.valueOf(40);
+
+        DeviceId deviceId4 = DeviceId.deviceId("goo");
+        LabelResourceId inLabelId4 = LabelResourceId.labelResourceId(4);
+        LabelResourceId outLabelId4 = LabelResourceId.labelResourceId(5);
+
+        LspLocalLabelInfo lspLocalLabel4 = DefaultLspLocalLabelInfo.builder()
+               .deviceId(deviceId4)
+               .inLabelId(inLabelId4)
+               .outLabelId(outLabelId4)
+               .build();
+        lspLocalLabelInfoList4.add(lspLocalLabel4);
+
+        PceccTunnelInfo pceccTunnelInfo4 = new PceccTunnelInfo(lspLocalLabelInfoList4, tunnelConsumerId4);
+
+        // update only lspLocalLabelInfoList
+        assertThat(distrPceStore.updateTunnelInfo(tunnelId1, lspLocalLabelInfoList3), is(true));
+        assertThat(distrPceStore.updateTunnelInfo(tunnelId2, lspLocalLabelInfoList4), is(true));
+
+        // update only tunnelConsumerId
+        assertThat(distrPceStore.updateTunnelInfo(tunnelId1, tunnelConsumerId3), is(true));
+        assertThat(distrPceStore.updateTunnelInfo(tunnelId2, tunnelConsumerId4), is(true));
+
+        assertThat(distrPceStore.getTunnelInfo(tunnelId1), is(pceccTunnelInfo3));
+        assertThat(distrPceStore.getTunnelInfo(tunnelId2), is(pceccTunnelInfo4));
+    }
+
+    /**
+     * Checks the operation of removeGlobalNodeLabel() method.
+     */
+    @Test
+    public void testRemoveGlobalNodeLabel() {
+        testAddGlobalNodeLabel();
+
+        assertThat(distrPceStore.removeGlobalNodeLabel(deviceId1), is(true));
+        assertThat(distrPceStore.removeGlobalNodeLabel(deviceId2), is(true));
+    }
+
+    /**
+     * Checks the operation of removeAdjLabel() method.
+     */
+    @Test
+    public void testRemoveAdjLabel() {
+        testAddAdjLabel();
+
+        assertThat(distrPceStore.removeAdjLabel(link1), is(true));
+        assertThat(distrPceStore.removeAdjLabel(link2), is(true));
+    }
+
+    /**
+     * Checks the operation of removeTunnelInfo() method.
+     */
+    @Test
+    public void testRemoveTunnelInfo() {
+        testAddTunnelInfo();
+
+        assertThat(distrPceStore.removeTunnelInfo(tunnelId1), is(true));
+        assertThat(distrPceStore.removeTunnelInfo(tunnelId2), is(true));
+    }
+}
diff --git a/apps/pce/app/src/test/java/org/onosproject/pce/pcestore/PceccTunnelInfoTest.java b/apps/pce/app/src/test/java/org/onosproject/pce/pcestore/PceccTunnelInfoTest.java
new file mode 100644
index 0000000..6d9bcd3
--- /dev/null
+++ b/apps/pce/app/src/test/java/org/onosproject/pce/pcestore/PceccTunnelInfoTest.java
@@ -0,0 +1,124 @@
+/*
+ * 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.pce.pcestore;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+
+import com.google.common.testing.EqualsTester;
+
+import org.junit.Test;
+import org.onosproject.incubator.net.resource.label.LabelResourceId;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.PortNumber;
+import org.onosproject.net.resource.ResourceConsumer;
+import org.onosproject.pce.pceservice.TunnelConsumerId;
+import org.onosproject.pce.pcestore.api.LspLocalLabelInfo;
+
+/**
+ * Unit tests for PceccTunnelInfo class.
+ */
+public class PceccTunnelInfoTest {
+
+   /**
+     * Checks the operation of equals() methods.
+     */
+    @Test
+    public void testEquals() {
+        // create same two objects.
+        List<LspLocalLabelInfo> lspLocalLabelList1 = new LinkedList<>();
+        ResourceConsumer tunnelConsumerId1 = TunnelConsumerId.valueOf(10);
+
+        // create object of DefaultLspLocalLabelInfo
+        DeviceId deviceId1 = DeviceId.deviceId("foo");
+        LabelResourceId inLabelId1 = LabelResourceId.labelResourceId(1);
+        LabelResourceId outLabelId1 = LabelResourceId.labelResourceId(2);
+        PortNumber inPort1 = PortNumber.portNumber(5122);
+        PortNumber outPort1 = PortNumber.portNumber(5123);
+
+        LspLocalLabelInfo lspLocalLabel1 = DefaultLspLocalLabelInfo.builder()
+                .deviceId(deviceId1)
+                .inLabelId(inLabelId1)
+                .outLabelId(outLabelId1)
+                .inPort(inPort1)
+                .outPort(outPort1)
+                .build();
+        lspLocalLabelList1.add(lspLocalLabel1);
+
+        PceccTunnelInfo pceccTunnelInfo1 = new PceccTunnelInfo(lspLocalLabelList1, tunnelConsumerId1);
+
+        // create same as above object
+        PceccTunnelInfo samePceccTunnelInfo1 = new PceccTunnelInfo(lspLocalLabelList1, tunnelConsumerId1);
+
+        // Create different object.
+        List<LspLocalLabelInfo> lspLocalLabelInfoList2 = new LinkedList<>();
+        ResourceConsumer tunnelConsumerId2 = TunnelConsumerId.valueOf(20);
+
+        // create object of DefaultLspLocalLabelInfo
+        DeviceId deviceId2 = DeviceId.deviceId("goo");
+        LabelResourceId inLabelId2 = LabelResourceId.labelResourceId(3);
+        LabelResourceId outLabelId2 = LabelResourceId.labelResourceId(4);
+        PortNumber inPort2 = PortNumber.portNumber(5124);
+        PortNumber outPort2 = PortNumber.portNumber(5125);
+
+        LspLocalLabelInfo lspLocalLabel2 = DefaultLspLocalLabelInfo.builder()
+                .deviceId(deviceId2)
+                .inLabelId(inLabelId2)
+                .outLabelId(outLabelId2)
+                .inPort(inPort2)
+                .outPort(outPort2)
+                .build();
+        lspLocalLabelInfoList2.add(lspLocalLabel2);
+
+        PceccTunnelInfo pceccTunnelInfo2 = new PceccTunnelInfo(lspLocalLabelInfoList2, tunnelConsumerId2);
+
+        new EqualsTester().addEqualityGroup(pceccTunnelInfo1, samePceccTunnelInfo1)
+                          .addEqualityGroup(pceccTunnelInfo2)
+                          .testEquals();
+    }
+
+    /**
+     * Checks the construction of a PceccTunnelInfo object.
+     */
+    @Test
+    public void testConstruction() {
+        List<LspLocalLabelInfo> lspLocalLabelInfoList = new LinkedList<>();
+        ResourceConsumer tunnelConsumerId = TunnelConsumerId.valueOf(10);
+
+        // create object of DefaultLspLocalLabelInfo
+        DeviceId deviceId = DeviceId.deviceId("foo");
+        LabelResourceId inLabelId = LabelResourceId.labelResourceId(1);
+        LabelResourceId outLabelId = LabelResourceId.labelResourceId(2);
+        PortNumber inPort = PortNumber.portNumber(5122);
+        PortNumber outPort = PortNumber.portNumber(5123);
+
+        LspLocalLabelInfo lspLocalLabelInfo = DefaultLspLocalLabelInfo.builder()
+                .deviceId(deviceId)
+                .inLabelId(inLabelId)
+                .outLabelId(outLabelId)
+                .inPort(inPort)
+                .outPort(outPort)
+                .build();
+        lspLocalLabelInfoList.add(lspLocalLabelInfo);
+
+        PceccTunnelInfo pceccTunnelInfo = new PceccTunnelInfo(lspLocalLabelInfoList, tunnelConsumerId);
+
+        assertThat(lspLocalLabelInfoList, is(pceccTunnelInfo.lspLocalLabelInfoList()));
+    }
+}