Move PCE label handling from APP to protocol.

Change-Id: I26ae21b27ac2dc9ae3302030f6860e0e371c342c
diff --git a/protocols/pcep/api/src/main/java/org/onosproject/pcep/controller/PcepClientController.java b/protocols/pcep/api/src/main/java/org/onosproject/pcep/controller/PcepClientController.java
index 0f14778..7b29a72 100644
--- a/protocols/pcep/api/src/main/java/org/onosproject/pcep/controller/PcepClientController.java
+++ b/protocols/pcep/api/src/main/java/org/onosproject/pcep/controller/PcepClientController.java
@@ -16,8 +16,14 @@
 package org.onosproject.pcep.controller;
 
 import java.util.Collection;
+import java.util.LinkedList;
 
+import org.onosproject.incubator.net.tunnel.DefaultLabelStack;
+import org.onosproject.incubator.net.tunnel.LabelStack;
+import org.onosproject.incubator.net.tunnel.Tunnel;
+import org.onosproject.net.Path;
 import org.onosproject.pcepio.protocol.PcepMessage;
+import org.onosproject.pcepio.types.PcepValueType;
 
 /**
  * Abstraction of an Pcep client controller. Serves as a one stop
@@ -85,20 +91,6 @@
     void removeNodeListener(PcepNodeListener listener);
 
     /**
-     * Register a listener for packet events.
-     *
-     * @param listener the listener to notify
-     */
-    void addPacketListener(PcepPacketListener listener);
-
-    /**
-     * Unregister a packet listener.
-     *
-     * @param listener the listener to unregister
-     */
-    void removePacketListener(PcepPacketListener listener);
-
-    /**
      * Send a message to a particular pcc client.
      *
      * @param pccId the id of the client to send message.
@@ -118,4 +110,29 @@
      * Close all connected PCC clients.
      */
     void closeConnectedClients();
+
+    /**
+     * Create label stack from the given path.
+     *
+     * @param path from which label stack is to be computed
+     * @return the label stack
+     */
+    public LabelStack computeLabelStack(Path path);
+
+    /**
+     * Allocates and downloads local labels for the given LSP.
+     *
+     * @param tunnel for which local labels have to be assigned and downloaded
+     * @return success or failure
+     */
+    public boolean allocateLocalLabel(Tunnel tunnel);
+
+    /**
+     * Creates label stack for ERO object from network resource.
+     *
+     * @param labelStack
+     * @param path (hop list)
+     * @return list of ERO sub-objects
+     */
+    public LinkedList<PcepValueType> createPcepLabelStack(DefaultLabelStack labelStack, Path path);
 }
diff --git a/protocols/pcep/ctl/BUCK b/protocols/pcep/ctl/BUCK
index d28df76..e72e49b 100644
--- a/protocols/pcep/ctl/BUCK
+++ b/protocols/pcep/ctl/BUCK
@@ -1,8 +1,9 @@
 COMPILE_DEPS = [
     '//lib:CORE_DEPS',
+    '//incubator/api:onos-incubator-api',
     '//protocols/pcep/pcepio:onos-protocols-pcep-pcepio',
     '//protocols/pcep/api:onos-protocols-pcep-api',
-    '//incubator/api:onos-incubator-api',
+    '//core/store/serializers:onos-core-serializers',
     '//apps/pcep-api:onos-apps-pcep-api',
 ]
 
diff --git a/protocols/pcep/ctl/pom.xml b/protocols/pcep/ctl/pom.xml
index 3a492a6..861fe14 100644
--- a/protocols/pcep/ctl/pom.xml
+++ b/protocols/pcep/ctl/pom.xml
@@ -50,6 +50,11 @@
             <groupId>org.onosproject</groupId>
             <artifactId>onlab-misc</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-core-serializers</artifactId>
+            <version>${project.version}</version>
+        </dependency>
     </dependencies>
 
     <build>
diff --git a/protocols/pcep/ctl/src/main/java/org/onosproject/pcelabelstore/DefaultLspLocalLabelInfo.java b/protocols/pcep/ctl/src/main/java/org/onosproject/pcelabelstore/DefaultLspLocalLabelInfo.java
new file mode 100644
index 0000000..636d605
--- /dev/null
+++ b/protocols/pcep/ctl/src/main/java/org/onosproject/pcelabelstore/DefaultLspLocalLabelInfo.java
@@ -0,0 +1,209 @@
+/*
+ * 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.pcelabelstore;
+
+import com.google.common.base.MoreObjects;
+
+import java.util.Objects;
+
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.PortNumber;
+import org.onosproject.pcelabelstore.api.LspLocalLabelInfo;
+import org.onosproject.incubator.net.resource.label.LabelResourceId;
+
+/**
+ * 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)
+                .add("InLabelId", inLabelId)
+                .add("OutLabelId", outLabelId)
+                .add("InPort", inPort)
+                .add("OutPort", outPort)
+                .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/protocols/pcep/ctl/src/main/java/org/onosproject/pcelabelstore/DistributedPceLabelStore.java b/protocols/pcep/ctl/src/main/java/org/onosproject/pcelabelstore/DistributedPceLabelStore.java
new file mode 100644
index 0000000..9121058
--- /dev/null
+++ b/protocols/pcep/ctl/src/main/java/org/onosproject/pcelabelstore/DistributedPceLabelStore.java
@@ -0,0 +1,296 @@
+/*
+ * 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.pcelabelstore;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.HashMap;
+import java.util.HashSet;
+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.LabelResource;
+import org.onosproject.incubator.net.resource.label.LabelResourceId;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.Link;
+import org.onosproject.pcelabelstore.api.LspLocalLabelInfo;
+import org.onosproject.pcelabelstore.api.PceLabelStore;
+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 DistributedPceLabelStore implements PceLabelStore {
+
+    private static final String DEVICE_ID_NULL = "Device ID cannot be null";
+    private static final String LABEL_RESOURCE_ID_NULL = "Label Resource Id cannot be null";
+    private static final String LINK_NULL = "LINK cannot be null";
+    private static final String PCECC_TUNNEL_INFO_NULL = "PCECC Tunnel Info cannot be null";
+    private static final String TUNNEL_ID_NULL = "Tunnel 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 id with local labels.
+    private ConsistentMap<TunnelId, List<LspLocalLabelInfo>> tunnelLabelInfoMap;
+
+    // Locally maintain LSRID to device id mapping for better performance.
+    private Map<String, DeviceId> lsrIdDeviceIdMap = new HashMap<>();
+
+    // List of PCC LSR ids whose BGP device information was not available to perform
+    // label db sync.
+    private HashSet<DeviceId> pendinglabelDbSyncPccMap = new HashSet<>();
+
+    @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,
+                                          LabelResource.class,
+                                          LabelResourceId.class)
+                                .build()))
+                .build();
+
+        tunnelLabelInfoMap = storageService.<TunnelId, List<LspLocalLabelInfo>>consistentMapBuilder()
+                .withName("onos-pce-tunnellabelinfomap")
+                .withSerializer(Serializer.using(
+                        new KryoNamespace.Builder()
+                                .register(KryoNamespaces.API)
+                                .register(TunnelId.class,
+                                          DefaultLspLocalLabelInfo.class,
+                                          LabelResourceId.class,
+                                          DeviceId.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 tunnelLabelInfoMap.containsKey(tunnelId);
+    }
+
+    @Override
+    public int getGlobalNodeLabelCount() {
+        return globalNodeLabelMap.size();
+    }
+
+    @Override
+    public int getAdjLabelCount() {
+        return adjLabelMap.size();
+    }
+
+    @Override
+    public int getTunnelInfoCount() {
+        return tunnelLabelInfoMap.size();
+    }
+
+    @Override
+    public Map<DeviceId, LabelResourceId> getGlobalNodeLabels() {
+       return globalNodeLabelMap.entrySet().stream()
+                 .collect(Collectors.toMap(Map.Entry::getKey, e -> e.getValue().value()));
+    }
+
+    @Override
+    public Map<Link, LabelResourceId> getAdjLabels() {
+       return adjLabelMap.entrySet().stream()
+                 .collect(Collectors.toMap(Map.Entry::getKey, e -> e.getValue().value()));
+    }
+
+    @Override
+    public Map<TunnelId, List<LspLocalLabelInfo>> getTunnelInfos() {
+       return tunnelLabelInfoMap.entrySet().stream()
+                 .collect(Collectors.toMap(Map.Entry::getKey, e -> e.getValue().value()));
+    }
+
+    @Override
+    public LabelResourceId getGlobalNodeLabel(DeviceId id) {
+        checkNotNull(id, DEVICE_ID_NULL);
+        return globalNodeLabelMap.get(id) == null ? null : globalNodeLabelMap.get(id).value();
+    }
+
+    @Override
+    public LabelResourceId getAdjLabel(Link link) {
+        checkNotNull(link, LINK_NULL);
+        return adjLabelMap.get(link) == null ? null : adjLabelMap.get(link).value();
+    }
+
+    @Override
+    public List<LspLocalLabelInfo> getTunnelInfo(TunnelId tunnelId) {
+        checkNotNull(tunnelId, TUNNEL_ID_NULL);
+        return tunnelLabelInfoMap.get(tunnelId) == null ? null : tunnelLabelInfoMap.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, List<LspLocalLabelInfo> lspLocalLabelInfoList) {
+        checkNotNull(tunnelId, TUNNEL_ID_NULL);
+        checkNotNull(lspLocalLabelInfoList, PCECC_TUNNEL_INFO_NULL);
+
+        tunnelLabelInfoMap.put(tunnelId, lspLocalLabelInfoList);
+    }
+
+    @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 (tunnelLabelInfoMap.remove(tunnelId) == null) {
+            log.error("Tunnel info deletion for tunnel id {} has failed.", tunnelId.toString());
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public boolean addLsrIdDevice(String lsrId, DeviceId deviceId) {
+        checkNotNull(lsrId);
+        checkNotNull(deviceId);
+
+        lsrIdDeviceIdMap.put(lsrId, deviceId);
+        return true;
+    }
+
+    @Override
+    public boolean removeLsrIdDevice(String lsrId) {
+        checkNotNull(lsrId);
+
+        lsrIdDeviceIdMap.remove(lsrId);
+        return true;
+    }
+
+    @Override
+    public DeviceId getLsrIdDevice(String lsrId) {
+        checkNotNull(lsrId);
+
+        return lsrIdDeviceIdMap.get(lsrId);
+
+    }
+
+    @Override
+    public boolean addPccLsr(DeviceId lsrId) {
+        checkNotNull(lsrId);
+        pendinglabelDbSyncPccMap.add(lsrId);
+        return true;
+    }
+
+    @Override
+    public boolean removePccLsr(DeviceId lsrId) {
+        checkNotNull(lsrId);
+        pendinglabelDbSyncPccMap.remove(lsrId);
+        return true;
+    }
+
+    @Override
+    public boolean hasPccLsr(DeviceId lsrId) {
+        checkNotNull(lsrId);
+        return pendinglabelDbSyncPccMap.contains(lsrId);
+
+    }
+}
diff --git a/protocols/pcep/ctl/src/main/java/org/onosproject/pcelabelstore/PcepLabelOp.java b/protocols/pcep/ctl/src/main/java/org/onosproject/pcelabelstore/PcepLabelOp.java
new file mode 100644
index 0000000..4e7ef83
--- /dev/null
+++ b/protocols/pcep/ctl/src/main/java/org/onosproject/pcelabelstore/PcepLabelOp.java
@@ -0,0 +1,21 @@
+package org.onosproject.pcelabelstore;
+
+/**
+ * Representation of label operation over PCEP.
+ */
+public enum PcepLabelOp {
+    /**
+     * Signifies that the label operation is addition.
+     */
+    ADD,
+
+    /**
+     * Signifies that the label operation is modification. This is reserved for future.
+     */
+    MODIFY,
+
+    /**
+     * Signifies that the label operation is deletion.
+     */
+    REMOVE
+}
diff --git a/protocols/pcep/ctl/src/main/java/org/onosproject/pcelabelstore/api/LspLocalLabelInfo.java b/protocols/pcep/ctl/src/main/java/org/onosproject/pcelabelstore/api/LspLocalLabelInfo.java
new file mode 100644
index 0000000..8ab861e
--- /dev/null
+++ b/protocols/pcep/ctl/src/main/java/org/onosproject/pcelabelstore/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.pcelabelstore.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/protocols/pcep/ctl/src/main/java/org/onosproject/pcelabelstore/api/PceLabelStore.java b/protocols/pcep/ctl/src/main/java/org/onosproject/pcelabelstore/api/PceLabelStore.java
new file mode 100644
index 0000000..8037478
--- /dev/null
+++ b/protocols/pcep/ctl/src/main/java/org/onosproject/pcelabelstore/api/PceLabelStore.java
@@ -0,0 +1,217 @@
+/*
+ * 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.pcelabelstore.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 java.util.Map;
+
+/**
+ * Abstraction of an entity providing pool of available labels to devices, links and tunnels.
+ */
+public interface PceLabelStore {
+    /**
+     * 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, List<LspLocalLabelInfo>> 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
+     */
+    List<LspLocalLabelInfo> 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 lspLocalLabelInfoList local label info
+     */
+    void addTunnelInfo(TunnelId tunnelId, List<LspLocalLabelInfo> lspLocalLabelInfoList);
+
+    /**
+     * 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);
+
+    /**
+     * Adds lsrid to device id mapping.
+     *
+     * @param lsrId lsrId of the device
+     * @param deviceId device id
+     * @return success or failure
+     */
+    boolean addLsrIdDevice(String lsrId, DeviceId deviceId);
+
+    /**
+     * Removes lsrid to device id mapping.
+     *
+     * @param lsrId lsrId of the device
+     * @return success or failure
+     */
+    boolean removeLsrIdDevice(String lsrId);
+
+    /**
+     * Gets lsrid to device id mapping.
+     *
+     * @param lsrId lsrId of the device
+     * @return device id of the lsrId
+     */
+    DeviceId getLsrIdDevice(String lsrId);
+
+    /**
+     * Adds lsrId of the PCC in form of device id for the PCC for which sync is pending due to non-availability of BGP.
+     * device.
+     *
+     * @param lsrId LSR id of the PCC in form of device id
+     * @return success or failure
+     */
+    public boolean addPccLsr(DeviceId lsrId);
+
+    /**
+     * Removes lsrId of the PCC in form of device id for the PCC for which pending sync is done.
+     *
+     * @param lsrId LSR id of the PCC in form of device id
+     * @return success or failure
+     */
+    public boolean removePccLsr(DeviceId lsrId);
+
+    /**
+     * Gets lsrId of the PCC in form of device id.
+     *
+     * @param lsrId LSR id of the PCC in form of device id
+     * @return success or failure
+     */
+    public boolean hasPccLsr(DeviceId lsrId);
+}
diff --git a/protocols/pcep/api/src/main/java/org/onosproject/pcep/controller/PcepPacketListener.java b/protocols/pcep/ctl/src/main/java/org/onosproject/pcelabelstore/api/package-info.java
similarity index 83%
copy from protocols/pcep/api/src/main/java/org/onosproject/pcep/controller/PcepPacketListener.java
copy to protocols/pcep/ctl/src/main/java/org/onosproject/pcelabelstore/api/package-info.java
index c2017ae..ca084d6 100644
--- a/protocols/pcep/api/src/main/java/org/onosproject/pcep/controller/PcepPacketListener.java
+++ b/protocols/pcep/ctl/src/main/java/org/onosproject/pcelabelstore/api/package-info.java
@@ -13,10 +13,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.onosproject.pcep.controller;
 
-public interface PcepPacketListener {
-
-    void sendPacketIn(PccId pccId);
-
-}
+/**
+ * PCE store service API.
+ */
+package org.onosproject.pcelabelstore.api;
diff --git a/protocols/pcep/api/src/main/java/org/onosproject/pcep/controller/PcepPacketListener.java b/protocols/pcep/ctl/src/main/java/org/onosproject/pcelabelstore/package-info.java
similarity index 83%
rename from protocols/pcep/api/src/main/java/org/onosproject/pcep/controller/PcepPacketListener.java
rename to protocols/pcep/ctl/src/main/java/org/onosproject/pcelabelstore/package-info.java
index c2017ae..c32c094 100644
--- a/protocols/pcep/api/src/main/java/org/onosproject/pcep/controller/PcepPacketListener.java
+++ b/protocols/pcep/ctl/src/main/java/org/onosproject/pcelabelstore/package-info.java
@@ -13,10 +13,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.onosproject.pcep.controller;
 
-public interface PcepPacketListener {
-
-    void sendPacketIn(PccId pccId);
-
-}
+/**
+ * PCE store application.
+ */
+package org.onosproject.pcelabelstore;
diff --git a/protocols/pcep/ctl/src/main/java/org/onosproject/pcep/controller/impl/BasicPceccHandler.java b/protocols/pcep/ctl/src/main/java/org/onosproject/pcep/controller/impl/BasicPceccHandler.java
new file mode 100644
index 0000000..192b909
--- /dev/null
+++ b/protocols/pcep/ctl/src/main/java/org/onosproject/pcep/controller/impl/BasicPceccHandler.java
@@ -0,0 +1,577 @@
+/*
+ * 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.pcep.controller.impl;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.LinkedList;
+
+import org.onlab.packet.Ip4Address;
+import org.onlab.packet.IpAddress;
+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.resource.label.LabelResourceService;
+import org.onosproject.incubator.net.tunnel.IpTunnelEndPoint;
+import org.onosproject.incubator.net.tunnel.Tunnel;
+import org.onosproject.net.ConnectPoint;
+import org.onosproject.net.Device;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.PortNumber;
+import org.onosproject.net.device.DeviceService;
+import org.onosproject.pcelabelstore.DefaultLspLocalLabelInfo;
+import org.onosproject.pcelabelstore.PcepLabelOp;
+import org.onosproject.pcelabelstore.api.LspLocalLabelInfo;
+import org.onosproject.pcelabelstore.api.PceLabelStore;
+import org.onosproject.pcep.controller.LspType;
+import org.onosproject.pcep.controller.PccId;
+import org.onosproject.pcep.controller.PcepAnnotationKeys;
+import org.onosproject.pcep.controller.PcepClient;
+import org.onosproject.pcep.controller.PcepClientController;
+import org.onosproject.pcep.controller.SrpIdGenerators;
+import org.onosproject.pcepio.exceptions.PcepParseException;
+import org.onosproject.pcepio.protocol.PcepAttribute;
+import org.onosproject.pcepio.protocol.PcepBandwidthObject;
+import org.onosproject.pcepio.protocol.PcepEroObject;
+import org.onosproject.pcepio.protocol.PcepLabelObject;
+import org.onosproject.pcepio.protocol.PcepLabelUpdate;
+import org.onosproject.pcepio.protocol.PcepLabelUpdateMsg;
+import org.onosproject.pcepio.protocol.PcepLspObject;
+import org.onosproject.pcepio.protocol.PcepMsgPath;
+import org.onosproject.pcepio.protocol.PcepSrpObject;
+import org.onosproject.pcepio.protocol.PcepUpdateMsg;
+import org.onosproject.pcepio.protocol.PcepUpdateRequest;
+import org.onosproject.pcepio.types.IPv4SubObject;
+import org.onosproject.pcepio.types.NexthopIPv4addressTlv;
+import org.onosproject.pcepio.types.PathSetupTypeTlv;
+import org.onosproject.pcepio.types.PcepLabelDownload;
+import org.onosproject.pcepio.types.PcepValueType;
+import org.onosproject.pcepio.types.StatefulIPv4LspIdentifiersTlv;
+import org.onosproject.pcepio.types.SymbolicPathNameTlv;
+import org.onosproject.net.Link;
+import org.onosproject.net.Path;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.collect.ArrayListMultimap;
+import com.google.common.collect.Multimap;
+
+import static org.onosproject.pcep.controller.PcepAnnotationKeys.BANDWIDTH;
+import static org.onosproject.pcep.controller.PcepAnnotationKeys.LSP_SIG_TYPE;
+import static org.onosproject.pcep.controller.PcepAnnotationKeys.PCE_INIT;
+import static org.onosproject.pcep.controller.PcepAnnotationKeys.DELEGATE;
+
+/**
+ * Basic PCECC handler.
+ * In Basic PCECC, after path computation will configure IN and OUT label to nodes.
+ * [X]OUT---link----IN[Y]OUT---link-----IN[Z] where X, Y and Z are nodes.
+ * For generating labels, will go thorough links in the path from Egress to Ingress.
+ * In each link, will take label from destination node local pool as IN label,
+ * and assign this label as OUT label to source node.
+ */
+public final class BasicPceccHandler {
+    private static final Logger log = LoggerFactory.getLogger(BasicPceccHandler.class);
+    public static final int OUT_LABEL_TYPE = 0;
+    public static final int IN_LABEL_TYPE = 1;
+    public static final long IDENTIFIER_SET = 0x100000000L;
+    public static final long SET = 0xFFFFFFFFL;
+    private static final String LSRID = "lsrId";
+    private static final String LABEL_RESOURCE_SERVICE_NULL = "Label Resource Service cannot be null";
+    private static final String PCE_STORE_NULL = "PCE Store cannot be null";
+    private static BasicPceccHandler crHandlerInstance = null;
+    private LabelResourceService labelRsrcService;
+    private DeviceService deviceService;
+    private PceLabelStore pceStore;
+    private PcepClientController clientController;
+    private PcepLabelObject labelObj;
+
+    /**
+     * Initializes default values.
+     */
+    private BasicPceccHandler() {
+    }
+
+    /**
+     * Returns single instance of this class.
+     *
+     * @return this class single instance
+     */
+    public static BasicPceccHandler getInstance() {
+        if (crHandlerInstance == null) {
+            crHandlerInstance = new BasicPceccHandler();
+        }
+        return crHandlerInstance;
+    }
+
+    /**
+     * Initialization of label manager and pce store.
+     *
+     * @param labelRsrcService label resource service
+     * @param pceStore pce label store
+     */
+    public void initialize(LabelResourceService labelRsrcService,
+                           DeviceService deviceService,
+                           PceLabelStore pceStore,
+                           PcepClientController clientController) {
+        this.labelRsrcService = labelRsrcService;
+        this.deviceService = deviceService;
+        this.pceStore = pceStore;
+        this.clientController = clientController;
+    }
+
+    /**
+     * Allocates labels from local resource pool and configure these (IN and OUT) labels into devices.
+     *
+     * @param tunnel tunnel between ingress to egress
+     * @return success or failure
+     */
+    public boolean allocateLabel(Tunnel tunnel) {
+        long applyNum = 1;
+        boolean isLastLabelToPush = false;
+        Collection<LabelResource> labelRscList;
+
+        checkNotNull(labelRsrcService, LABEL_RESOURCE_SERVICE_NULL);
+        checkNotNull(pceStore, PCE_STORE_NULL);
+
+        List<Link> linkList = tunnel.path().links();
+        if ((linkList != null) && (linkList.size() > 0)) {
+            // Sequence through reverse order to push local labels into devices
+            // Generation of labels from egress to ingress
+            for (ListIterator<Link> iterator = linkList.listIterator(linkList.size()); iterator.hasPrevious();) {
+                Link link = iterator.previous();
+                DeviceId dstDeviceId = link.dst().deviceId();
+                DeviceId srcDeviceId = link.src().deviceId();
+                labelRscList = labelRsrcService.applyFromDevicePool(dstDeviceId, applyNum);
+                if ((labelRscList != null) && (labelRscList.size() > 0)) {
+                    // Link label value is taken from destination device local pool.
+                    // [X]OUT---link----IN[Y]OUT---link-----IN[Z] where X, Y and Z are nodes.
+                    // Link label value is used as OUT and IN for both ends
+                    // (source and destination devices) of the link.
+                    // Currently only one label is allocated to a device (destination device).
+                    // So, no need to iterate through list
+                    Iterator<LabelResource> labelIterator = labelRscList.iterator();
+                    DefaultLabelResource defaultLabelResource = (DefaultLabelResource) labelIterator.next();
+                    LabelResourceId labelId = defaultLabelResource.labelResourceId();
+                    log.debug("Allocated local label: " + labelId.toString()
+                              + "to device: " + defaultLabelResource.deviceId().toString());
+                    PortNumber dstPort = link.dst().port();
+
+                    // Check whether this is last link label to push
+                    if (!iterator.hasPrevious()) {
+                       isLastLabelToPush = true;
+                    }
+
+                    try {
+                        // Push into destination device
+                        // Destination device IN port is link.dst().port()
+                        pushLocalLabels(dstDeviceId, labelId, dstPort, tunnel, false,
+                                            Long.valueOf(LabelType.IN_LABEL.value), PcepLabelOp.ADD);
+
+                        // Push into source device
+                        // Source device OUT port will be link.dst().port(). Means its remote port used to send packet.
+                        pushLocalLabels(srcDeviceId, labelId, dstPort, tunnel, isLastLabelToPush,
+                                            Long.valueOf(LabelType.OUT_LABEL.value), PcepLabelOp.ADD);
+                    } catch (PcepParseException e) {
+                        log.error("Failed to push local label for device {} or {} for tunnel {}.",
+                                  dstDeviceId.toString(), srcDeviceId.toString(), tunnel.tunnelName().toString());
+                    }
+
+                    // Add or update pcecc tunnel info in pce store.
+                    updatePceccTunnelInfoInStore(srcDeviceId, dstDeviceId, labelId, dstPort,
+                                                 tunnel);
+                } else {
+                    log.error("Unable to allocate label to device id {}.", dstDeviceId.toString());
+                    releaseLabel(tunnel);
+                    return false;
+                }
+            }
+        } else {
+           log.error("Tunnel {} is having empty links.", tunnel.toString());
+           return false;
+        }
+        return true;
+    }
+
+    /**
+     * Updates list of local labels of PCECC tunnel info in pce store.
+     *
+     * @param srcDeviceId source device in a link
+     * @param dstDeviceId destination device in a link
+     * @param labelId label id of a link
+     * @param dstPort destination device port number of a link
+     * @param tunnel tunnel
+     */
+    public void updatePceccTunnelInfoInStore(DeviceId srcDeviceId, DeviceId dstDeviceId, LabelResourceId labelId,
+                                                PortNumber dstPort, Tunnel tunnel) {
+       // First try to retrieve device from store and update its label id if it is exists,
+       // otherwise add it
+       boolean dstDeviceUpdated = false;
+       boolean srcDeviceUpdated = false;
+
+       List<LspLocalLabelInfo> lspLabelInfoList = pceStore.getTunnelInfo(tunnel.tunnelId());
+       if ((lspLabelInfoList != null) && (lspLabelInfoList.size() > 0)) {
+           for (int i = 0; i < lspLabelInfoList.size(); ++i) {
+               LspLocalLabelInfo lspLocalLabelInfo =
+                       lspLabelInfoList.get(i);
+               LspLocalLabelInfo.Builder lspLocalLabelInfoBuilder = null;
+               if (dstDeviceId.equals(lspLocalLabelInfo.deviceId())) {
+                   lspLocalLabelInfoBuilder = DefaultLspLocalLabelInfo.builder(lspLocalLabelInfo);
+                   lspLocalLabelInfoBuilder.inLabelId(labelId);
+                   // Destination device IN port will be link destination port
+                   lspLocalLabelInfoBuilder.inPort(dstPort);
+                   dstDeviceUpdated = true;
+               } else if (srcDeviceId.equals(lspLocalLabelInfo.deviceId())) {
+                   lspLocalLabelInfoBuilder = DefaultLspLocalLabelInfo.builder(lspLocalLabelInfo);
+                   lspLocalLabelInfoBuilder.outLabelId(labelId);
+                   // Source device OUT port will be link destination (remote) port
+                   lspLocalLabelInfoBuilder.outPort(dstPort);
+                   srcDeviceUpdated = true;
+               }
+
+               // Update
+               if ((lspLocalLabelInfoBuilder != null) && (dstDeviceUpdated || srcDeviceUpdated)) {
+                   lspLabelInfoList.set(i, lspLocalLabelInfoBuilder.build());
+               }
+           }
+       }
+
+       // If it is not found in store then add it to store
+       if (!dstDeviceUpdated || !srcDeviceUpdated) {
+           // If tunnel info itself not available then create new one, otherwise add node to list.
+           if (lspLabelInfoList == null) {
+              lspLabelInfoList = new LinkedList<>();
+           }
+
+           if (!dstDeviceUpdated) {
+               LspLocalLabelInfo lspLocalLabelInfo = DefaultLspLocalLabelInfo.builder()
+                   .deviceId(dstDeviceId)
+                   .inLabelId(labelId)
+                   .outLabelId(null)
+                   .inPort(dstPort) // Destination device IN port will be link destination port
+                   .outPort(null)
+                   .build();
+               lspLabelInfoList.add(lspLocalLabelInfo);
+           }
+
+           if (!srcDeviceUpdated) {
+               LspLocalLabelInfo lspLocalLabelInfo = DefaultLspLocalLabelInfo.builder()
+                   .deviceId(srcDeviceId)
+                   .inLabelId(null)
+                   .outLabelId(labelId)
+                   .inPort(null)
+                   .outPort(dstPort) // Source device OUT port will be link destination (remote) port
+                   .build();
+               lspLabelInfoList.add(lspLocalLabelInfo);
+           }
+
+           pceStore.addTunnelInfo(tunnel.tunnelId(), lspLabelInfoList);
+       }
+    }
+
+    /**
+     * Deallocates unused labels to device pools.
+     *
+     * @param tunnel tunnel between ingress to egress
+     */
+    public void releaseLabel(Tunnel tunnel) {
+
+       checkNotNull(labelRsrcService, LABEL_RESOURCE_SERVICE_NULL);
+       checkNotNull(pceStore, PCE_STORE_NULL);
+
+       Multimap<DeviceId, LabelResource> release = ArrayListMultimap.create();
+       List<LspLocalLabelInfo> lspLocalLabelInfoList = pceStore.getTunnelInfo(tunnel.tunnelId());
+       if ((lspLocalLabelInfoList != null) && (lspLocalLabelInfoList.size() > 0)) {
+           for (Iterator<LspLocalLabelInfo> iterator = lspLocalLabelInfoList.iterator(); iterator.hasNext();) {
+               LspLocalLabelInfo lspLocalLabelInfo = iterator.next();
+               DeviceId deviceId = lspLocalLabelInfo.deviceId();
+               LabelResourceId inLabelId = lspLocalLabelInfo.inLabelId();
+               LabelResourceId outLabelId = lspLocalLabelInfo.outLabelId();
+               PortNumber inPort = lspLocalLabelInfo.inPort();
+               PortNumber outPort = lspLocalLabelInfo.outPort();
+
+               try {
+                   // Push into device
+                   if ((outLabelId != null) && (outPort != null)) {
+                       pushLocalLabels(deviceId, outLabelId, outPort, tunnel, false,
+                                       Long.valueOf(LabelType.OUT_LABEL.value), PcepLabelOp.REMOVE);
+                   }
+
+                   if ((inLabelId != null) && (inPort != null)) {
+                       pushLocalLabels(deviceId, inLabelId, inPort, tunnel, false,
+                                       Long.valueOf(LabelType.IN_LABEL.value), PcepLabelOp.REMOVE);
+                   }
+               } catch (PcepParseException e) {
+                   log.error("Failed to push local label for device {}for tunnel {}.", deviceId.toString(),
+                             tunnel.tunnelName().toString());
+               }
+
+               // List is stored from egress to ingress. So, using IN label id to release.
+               // Only one local label is assigned to device (destination node)
+               // and that is used as OUT label for source node.
+               // No need to release label for last node in the list from pool because label was not allocated to
+               // ingress node (source node).
+               if ((iterator.hasNext()) && (inLabelId != null)) {
+                   LabelResource labelRsc = new DefaultLabelResource(deviceId, inLabelId);
+                   release.put(deviceId, labelRsc);
+               }
+           }
+       }
+
+       // Release from label pool
+       if (!release.isEmpty()) {
+          labelRsrcService.releaseToDevicePool(release);
+       }
+
+       pceStore.removeTunnelInfo(tunnel.tunnelId());
+   }
+
+   //Pushes local labels to the device which is specific to path [CR-case].
+   private void pushLocalLabels(DeviceId deviceId, LabelResourceId labelId,
+            PortNumber portNum, Tunnel tunnel,
+            Boolean isBos, Long labelType, PcepLabelOp type) throws PcepParseException {
+
+        checkNotNull(deviceId);
+        checkNotNull(labelId);
+        checkNotNull(portNum);
+        checkNotNull(tunnel);
+        checkNotNull(labelType);
+        checkNotNull(type);
+
+        PcepClient pc = getPcepClient(deviceId);
+        if (pc == null) {
+            log.error("PCEP client not found");
+            return;
+        }
+
+        PcepLspObject lspObj;
+        LinkedList<PcepLabelUpdate> labelUpdateList = new LinkedList<>();
+        LinkedList<PcepLabelObject> labelObjects = new LinkedList<>();
+        PcepSrpObject srpObj;
+        PcepLabelDownload labelDownload = new PcepLabelDownload();
+        LinkedList<PcepValueType> optionalTlv = new LinkedList<>();
+
+        long portNo = portNum.toLong();
+        portNo = ((portNo & IDENTIFIER_SET) == IDENTIFIER_SET) ? portNo & SET : portNo;
+
+        optionalTlv.add(NexthopIPv4addressTlv.of((int) portNo));
+
+        PcepLabelObject labelObj = pc.factory().buildLabelObject()
+                                   .setOFlag(labelType == OUT_LABEL_TYPE ? true : false)
+                                   .setOptionalTlv(optionalTlv)
+                                   .setLabel((int) labelId.labelId())
+                                   .build();
+
+        /**
+         * Check whether transit node or not. For transit node, label update message should include IN and OUT labels.
+         * Hence store IN label object and next when out label comes add IN and OUT label objects and encode label
+         * update message and send to specified client.
+         */
+        if (!deviceId.equals(tunnel.path().src().deviceId()) && !deviceId.equals(tunnel.path().dst().deviceId())) {
+            //Device is transit node
+            if (labelType == OUT_LABEL_TYPE) {
+                //Store label object having IN label value
+                this.labelObj = labelObj;
+                return;
+            }
+            //Add IN label object
+            labelObjects.add(this.labelObj);
+        }
+
+        //Add OUT label object in case of transit node
+        labelObjects.add(labelObj);
+
+        srpObj = getSrpObject(pc, type, false);
+
+        String lspId = tunnel.annotations().value(PcepAnnotationKeys.LOCAL_LSP_ID);
+        String plspId = tunnel.annotations().value(PcepAnnotationKeys.PLSP_ID);
+        String tunnelIdentifier = tunnel.annotations().value(PcepAnnotationKeys.PCC_TUNNEL_ID);
+
+        LinkedList<PcepValueType> tlvs = new LinkedList<>();
+        StatefulIPv4LspIdentifiersTlv lspIdTlv = new StatefulIPv4LspIdentifiersTlv(((IpTunnelEndPoint) tunnel.src())
+                .ip().getIp4Address().toInt(), Short.valueOf(lspId), Short.valueOf(tunnelIdentifier),
+                ((IpTunnelEndPoint) tunnel.src()).ip().getIp4Address().toInt(),
+                ((IpTunnelEndPoint) tunnel.dst()).ip().getIp4Address().toInt());
+        tlvs.add(lspIdTlv);
+
+        if (tunnel.tunnelName().value() != null) {
+            SymbolicPathNameTlv pathNameTlv = new SymbolicPathNameTlv(tunnel.tunnelName().value().getBytes());
+            tlvs.add(pathNameTlv);
+        }
+
+        boolean delegated = (tunnel.annotations().value(DELEGATE) == null) ? false
+                                                                           : Boolean.valueOf(tunnel.annotations()
+                                                                                   .value(DELEGATE));
+        boolean initiated = (tunnel.annotations().value(PCE_INIT) == null) ? false
+                                                                           : Boolean.valueOf(tunnel.annotations()
+                                                                                   .value(PCE_INIT));
+
+        lspObj = pc.factory().buildLspObject()
+                .setRFlag(false)
+                .setAFlag(true)
+                .setDFlag(delegated)
+                .setCFlag(initiated)
+                .setPlspId(Integer.valueOf(plspId))
+                .setOptionalTlv(tlvs)
+                .build();
+
+        labelDownload.setLabelList(labelObjects);
+        labelDownload.setLspObject(lspObj);
+        labelDownload.setSrpObject(srpObj);
+
+        labelUpdateList.add(pc.factory().buildPcepLabelUpdateObject()
+                            .setLabelDownload(labelDownload)
+                            .build());
+
+        PcepLabelUpdateMsg labelMsg = pc.factory().buildPcepLabelUpdateMsg()
+                                      .setPcLabelUpdateList(labelUpdateList)
+                                      .build();
+
+        pc.sendMessage(labelMsg);
+
+        //If isBos is true, label download is done along the LSP, send PCEP update message.
+        if (isBos) {
+            sendPcepUpdateMsg(pc, lspObj, tunnel);
+        }
+    }
+
+   //Sends PCEP update message.
+   private void sendPcepUpdateMsg(PcepClient pc, PcepLspObject lspObj, Tunnel tunnel) throws PcepParseException {
+       LinkedList<PcepUpdateRequest> updateRequestList = new LinkedList<>();
+       LinkedList<PcepValueType> subObjects = createEroSubObj(tunnel.path());
+
+       if (subObjects == null) {
+           log.error("ERO subjects not present");
+           return;
+       }
+
+       // set PathSetupTypeTlv of SRP object
+       LinkedList<PcepValueType> llOptionalTlv = new LinkedList<PcepValueType>();
+       LspType lspSigType = LspType.valueOf(tunnel.annotations().value(LSP_SIG_TYPE));
+       llOptionalTlv.add(new PathSetupTypeTlv(lspSigType.type()));
+
+       PcepSrpObject srpObj = pc.factory().buildSrpObject()
+                              .setRFlag(false)
+                              .setSrpID(SrpIdGenerators.create())
+                              .setOptionalTlv(llOptionalTlv)
+                              .build();
+
+       PcepEroObject eroObj = pc.factory().buildEroObject()
+                             .setSubObjects(subObjects)
+                             .build();
+
+       float  iBandwidth = 0;
+       if (tunnel.annotations().value(BANDWIDTH) != null) {
+           //iBandwidth = Float.floatToIntBits(Float.parseFloat(tunnel.annotations().value(BANDWIDTH)));
+           iBandwidth = Float.parseFloat(tunnel.annotations().value(BANDWIDTH));
+       }
+       // build bandwidth object
+       PcepBandwidthObject bandwidthObject = pc.factory().buildBandwidthObject()
+                                             .setBandwidth(iBandwidth)
+                                             .build();
+       // build pcep attribute
+       PcepAttribute pcepAttribute = pc.factory().buildPcepAttribute()
+                                     .setBandwidthObject(bandwidthObject)
+                                     .build();
+
+       PcepMsgPath msgPath = pc.factory().buildPcepMsgPath()
+                             .setEroObject(eroObj)
+                             .setPcepAttribute(pcepAttribute)
+                             .build();
+
+       PcepUpdateRequest updateReq = pc.factory().buildPcepUpdateRequest()
+                                    .setSrpObject(srpObj)
+                                    .setMsgPath(msgPath)
+                                    .setLspObject(lspObj)
+                                    .build();
+
+       updateRequestList.add(updateReq);
+
+       //TODO: P = 1 is it P flag in PCEP obj header
+       PcepUpdateMsg updateMsg = pc.factory().buildUpdateMsg()
+                                 .setUpdateRequestList(updateRequestList)
+                                 .build();
+
+       pc.sendMessage(updateMsg);
+   }
+
+   private LinkedList<PcepValueType> createEroSubObj(Path path) {
+       LinkedList<PcepValueType> subObjects = new LinkedList<>();
+       List<Link> links = path.links();
+       ConnectPoint source = null;
+       ConnectPoint destination = null;
+       IpAddress ipDstAddress = null;
+       IpAddress ipSrcAddress = null;
+       PcepValueType subObj = null;
+       long portNo;
+
+       for (Link link : links) {
+           source = link.src();
+           if (!(source.equals(destination))) {
+               //set IPv4SubObject for ERO object
+               portNo = source.port().toLong();
+               portNo = ((portNo & IDENTIFIER_SET) == IDENTIFIER_SET) ? portNo & SET : portNo;
+               ipSrcAddress = Ip4Address.valueOf((int) portNo);
+               subObj = new IPv4SubObject(ipSrcAddress.getIp4Address().toInt());
+               subObjects.add(subObj);
+           }
+
+           destination = link.dst();
+           portNo = destination.port().toLong();
+           portNo = ((portNo & IDENTIFIER_SET) == IDENTIFIER_SET) ? portNo & SET : portNo;
+           ipDstAddress = Ip4Address.valueOf((int) portNo);
+           subObj = new IPv4SubObject(ipDstAddress.getIp4Address().toInt());
+           subObjects.add(subObj);
+       }
+       return subObjects;
+   }
+
+   private PcepSrpObject getSrpObject(PcepClient pc, PcepLabelOp type, boolean bSFlag)
+           throws PcepParseException {
+       PcepSrpObject srpObj;
+       boolean bRFlag = false;
+
+       if (!type.equals(PcepLabelOp.ADD)) {
+           // To cleanup labels, R bit is set
+           bRFlag = true;
+       }
+
+       srpObj = pc.factory().buildSrpObject()
+               .setRFlag(bRFlag)
+               .setSFlag(bSFlag)
+               .setSrpID(SrpIdGenerators.create())
+               .build();
+
+       return srpObj;
+   }
+
+   /**
+    * Returns PCEP client.
+    *
+    * @return PCEP client
+    */
+   private PcepClient getPcepClient(DeviceId deviceId) {
+       Device device = deviceService.getDevice(deviceId);
+
+       // In future projections instead of annotations will be used to fetch LSR ID.
+       String lsrId = device.annotations().value(LSRID);
+       PcepClient pcc = clientController.getClient(PccId.pccId(IpAddress.valueOf(lsrId)));
+       return pcc;
+   }
+}
diff --git a/protocols/pcep/ctl/src/main/java/org/onosproject/pcep/controller/impl/LabelType.java b/protocols/pcep/ctl/src/main/java/org/onosproject/pcep/controller/impl/LabelType.java
new file mode 100644
index 0000000..133011d
--- /dev/null
+++ b/protocols/pcep/ctl/src/main/java/org/onosproject/pcep/controller/impl/LabelType.java
@@ -0,0 +1,52 @@
+/*
+ * 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.pcep.controller.impl;
+
+/**
+ * Describes about Label type.
+ */
+public enum LabelType {
+    /**
+     * Signifies in label id of a device.
+     */
+    OUT_LABEL(0),
+
+    /**
+     * Signifies out label id of a device.
+     */
+    IN_LABEL(1);
+
+    int value;
+
+    /**
+     * Assign val with the value as the Label type.
+     *
+     * @param val Label type
+     */
+    LabelType(int val) {
+        value = val;
+    }
+
+    /**
+     * Returns value of Label type.
+     *
+     * @return label type
+     */
+    public byte type() {
+        return (byte) value;
+    }
+}
diff --git a/protocols/pcep/ctl/src/main/java/org/onosproject/pcep/controller/impl/PceccSrTeBeHandler.java b/protocols/pcep/ctl/src/main/java/org/onosproject/pcep/controller/impl/PceccSrTeBeHandler.java
new file mode 100644
index 0000000..f6fe132
--- /dev/null
+++ b/protocols/pcep/ctl/src/main/java/org/onosproject/pcep/controller/impl/PceccSrTeBeHandler.java
@@ -0,0 +1,584 @@
+/*
+ * 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.pcep.controller.impl;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static org.onosproject.pcep.controller.PcepSyncStatus.IN_SYNC;
+import static org.onosproject.pcep.controller.PcepSyncStatus.SYNCED;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.HashSet;
+import java.util.List;
+import java.util.LinkedList;
+import java.util.Map;
+import java.util.Set;
+
+import org.onlab.packet.IpAddress;
+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.resource.label.LabelResourceAdminService;
+import org.onosproject.incubator.net.resource.label.LabelResourceService;
+import org.onosproject.incubator.net.tunnel.DefaultLabelStack;
+import org.onosproject.incubator.net.tunnel.LabelStack;
+import org.onosproject.net.device.DeviceService;
+import org.onosproject.pcelabelstore.PcepLabelOp;
+import org.onosproject.pcelabelstore.api.PceLabelStore;
+import org.onosproject.net.Device;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.Link;
+import org.onosproject.net.Path;
+import org.onosproject.pcep.controller.PccId;
+import org.onosproject.pcep.controller.PcepClient;
+import org.onosproject.pcep.controller.PcepClientController;
+import org.onosproject.pcep.controller.SrpIdGenerators;
+import org.onosproject.pcepio.exceptions.PcepParseException;
+import org.onosproject.pcepio.protocol.PcepFecObjectIPv4;
+import org.onosproject.pcepio.protocol.PcepFecObjectIPv4Adjacency;
+import org.onosproject.pcepio.protocol.PcepLabelObject;
+import org.onosproject.pcepio.protocol.PcepLabelUpdate;
+import org.onosproject.pcepio.protocol.PcepLabelUpdateMsg;
+import org.onosproject.pcepio.protocol.PcepSrpObject;
+import org.onosproject.pcepio.types.PcepLabelMap;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.collect.ArrayListMultimap;
+import com.google.common.collect.Multimap;
+
+/**
+ * PCE SR-BE and SR-TE functionality.
+ * SR-BE: Each node (PCC) is allocated a node-SID (label) by the PCECC. The PCECC sends PCLabelUpd to
+ * update the label map of each node to all the nodes in the domain.
+ * SR-TE: apart from node-SID, Adj-SID is used where each adjacency is allocated an Adj-SID (label) by the PCECC.
+ * The PCECC sends PCLabelUpd to update the label map of each Adj to the corresponding nodes in the domain.
+ */
+public final class PceccSrTeBeHandler {
+    private static final Logger log = LoggerFactory.getLogger(PceccSrTeBeHandler.class);
+
+    private static final String LABEL_RESOURCE_ADMIN_SERVICE_NULL = "Label Resource Admin Service cannot be null";
+    private static final String LABEL_RESOURCE_SERVICE_NULL = "Label Resource Service cannot be null";
+    private static final String PCE_STORE_NULL = "PCE Store cannot be null";
+    private static final String DEVICE_ID_NULL = "Device-Id cannot be null";
+    private static final String LSR_ID_NULL = "LSR-Id cannot be null";
+    private static final String LINK_NULL = "Link cannot be null";
+    private static final String PATH_NULL = "Path cannot be null";
+    private static final String LSR_ID = "lsrId";
+    private static PceccSrTeBeHandler srTeHandlerInstance = null;
+    private LabelResourceAdminService labelRsrcAdminService;
+    private LabelResourceService labelRsrcService;
+    private DeviceService deviceService;
+    private PcepClientController clientController;
+    private PceLabelStore pceStore;
+
+    /**
+     * Initializes default values.
+     */
+    private PceccSrTeBeHandler() {
+    }
+
+    /**
+     * Returns single instance of this class.
+     *
+     * @return this class single instance
+     */
+    public static PceccSrTeBeHandler getInstance() {
+        if (srTeHandlerInstance == null) {
+            srTeHandlerInstance = new PceccSrTeBeHandler();
+        }
+        return srTeHandlerInstance;
+    }
+
+    /**
+     * Initialization of label manager interfaces and pce store.
+     *
+     * @param labelRsrcAdminService label resource admin service
+     * @param labelRsrcService label resource service
+     * @param pceStore PCE label store
+     * @param deviceService device service
+     */
+    public void initialize(LabelResourceAdminService labelRsrcAdminService,
+                           LabelResourceService labelRsrcService,
+                           PcepClientController clientController,
+                           PceLabelStore pceStore,
+                           DeviceService deviceService) {
+        this.labelRsrcAdminService = labelRsrcAdminService;
+        this.labelRsrcService = labelRsrcService;
+        this.clientController = clientController;
+        this.pceStore = pceStore;
+        this.deviceService = deviceService;
+    }
+
+    /**
+     * Reserves the global label pool.
+     *
+     * @param beginLabel minimum value of global label space
+     * @param endLabel maximum value of global label space
+     * @return success or failure
+     */
+    public boolean reserveGlobalPool(long beginLabel, long endLabel) {
+        checkNotNull(labelRsrcAdminService, LABEL_RESOURCE_ADMIN_SERVICE_NULL);
+        return labelRsrcAdminService.createGlobalPool(LabelResourceId.labelResourceId(beginLabel),
+                                                      LabelResourceId.labelResourceId(endLabel));
+    }
+
+    /**
+     * Retrieve lsr-id from device annotation.
+     *
+     * @param deviceId specific device id from which lsr-id needs to be retrieved
+     * @return lsr-id of a device
+     */
+    public String getLsrId(DeviceId deviceId) {
+        checkNotNull(deviceId, DEVICE_ID_NULL);
+        Device device = deviceService.getDevice(deviceId);
+        if (device == null) {
+            log.debug("Device is not available for device id {} in device service.", deviceId.toString());
+            return null;
+        }
+
+        // Retrieve lsr-id from device
+        if (device.annotations() == null) {
+            log.debug("Device {} does not have annotation.", device.toString());
+            return null;
+        }
+
+        String lsrId = device.annotations().value(LSR_ID);
+        if (lsrId == null) {
+            log.debug("The lsr-id of device {} is null.", device.toString());
+            return null;
+        }
+        return lsrId;
+    }
+
+    /**
+     * Allocates node label from global node label pool to specific device.
+     * Configure this device with labels and lsrid mapping of all other devices and vice versa.
+     *
+     * @param specificDeviceId node label needs to be allocated to specific device
+     * @param specificLsrId lsrid of specific device
+     * @return success or failure
+     */
+    public boolean allocateNodeLabel(DeviceId specificDeviceId, String specificLsrId) {
+        long applyNum = 1; // For each node only one node label
+        LabelResourceId specificLabelId = null;
+
+        checkNotNull(specificDeviceId, DEVICE_ID_NULL);
+        checkNotNull(specificLsrId, LSR_ID_NULL);
+        checkNotNull(labelRsrcService, LABEL_RESOURCE_SERVICE_NULL);
+        checkNotNull(pceStore, PCE_STORE_NULL);
+
+        // Check whether node-label was already configured for this specific device.
+        if (pceStore.getGlobalNodeLabel(specificDeviceId) != null) {
+            log.debug("Node label was already configured for device {}.", specificDeviceId.toString());
+            return false;
+        }
+
+        // The specificDeviceId is the new device and is not there in the pce store.
+        // So, first generate its label and configure label and its lsr-id to it.
+        Collection<LabelResource> result = labelRsrcService.applyFromGlobalPool(applyNum);
+        if (result.size() > 0) {
+            // Only one element (label-id) to retrieve
+            Iterator<LabelResource> iterator = result.iterator();
+            DefaultLabelResource defaultLabelResource = (DefaultLabelResource) iterator.next();
+            specificLabelId = defaultLabelResource.labelResourceId();
+            if (specificLabelId == null) {
+                log.error("Unable to retrieve global node label for a device id {}.", specificDeviceId.toString());
+                return false;
+            }
+        } else {
+            log.error("Unable to allocate global node label for a device id {}.", specificDeviceId.toString());
+            return false;
+        }
+
+        // store it
+        pceStore.addGlobalNodeLabel(specificDeviceId, specificLabelId);
+
+        // Push its label information into specificDeviceId
+        PcepClient pcc = getPcepClient(specificDeviceId);
+        try {
+            pushGlobalNodeLabel(pcc,
+                                specificLabelId,
+                                IpAddress.valueOf(specificLsrId).getIp4Address().toInt(),
+                                PcepLabelOp.ADD,
+                                false);
+        } catch (PcepParseException e) {
+            log.error("Failed to push global node label for LSR {}.", specificLsrId.toString());
+        }
+
+        // Configure (node-label, lsr-id) mapping of each devices into specific device and vice versa.
+        for (Map.Entry<DeviceId, LabelResourceId> element : pceStore.getGlobalNodeLabels().entrySet()) {
+            DeviceId otherDevId = element.getKey();
+
+            // Get lsr-id of a device
+            String otherLsrId = getLsrId(otherDevId);
+            if (otherLsrId == null) {
+                log.error("The lsr-id of device id {} is null.", otherDevId.toString());
+                releaseNodeLabel(specificDeviceId, specificLsrId);
+                return false;
+            }
+
+            // Push to device
+            // Push label information of specificDeviceId to otherDevId in list and vice versa.
+            if (!otherDevId.equals(specificDeviceId)) {
+                try {
+                    pushGlobalNodeLabel(getPcepClient(otherDevId),
+                                        specificLabelId,
+                                        IpAddress.valueOf(specificLsrId).getIp4Address().toInt(),
+                                        PcepLabelOp.ADD,
+                                        false);
+
+                    pushGlobalNodeLabel(pcc, specificLabelId,
+                                        IpAddress.valueOf(otherLsrId).getIp4Address().toInt(),
+                                        PcepLabelOp.ADD,
+                                        false);
+                } catch (PcepParseException e) {
+                    log.error("Failed to push global node label for LSR {} or LSR {}.", specificLsrId.toString(),
+                              otherLsrId.toString());
+                }
+            }
+        }
+        return true;
+    }
+
+    /**
+     * Releases assigned node label of specific device from global node label pool and pce store.
+     * and remove configured this node label from all other devices.
+     *
+     * @param specificDeviceId node label needs to be released for specific device
+     * @param specificLsrId lsrid of specific device
+     * @return success or failure
+     */
+    public boolean releaseNodeLabel(DeviceId specificDeviceId, String specificLsrId) {
+        checkNotNull(specificDeviceId, DEVICE_ID_NULL);
+        checkNotNull(specificLsrId, LSR_ID_NULL);
+        checkNotNull(labelRsrcService, LABEL_RESOURCE_SERVICE_NULL);
+        checkNotNull(pceStore, PCE_STORE_NULL);
+        boolean retValue = true;
+
+        // Release node label entry of this specific device from all other devices
+        // Retrieve node label of this specific device from store
+        LabelResourceId labelId = pceStore.getGlobalNodeLabel(specificDeviceId);
+        if (labelId == null) {
+            log.error("Unable to retrieve label of a device id {} from store.", specificDeviceId.toString());
+            return false;
+        }
+
+        // Go through all devices in the pce store and remove label entry from device
+        for (Map.Entry<DeviceId, LabelResourceId> element : pceStore.getGlobalNodeLabels().entrySet()) {
+            DeviceId otherDevId = element.getKey();
+
+            // Remove this specific device label information from all other nodes except
+            // this specific node where connection already lost.
+            if (!specificDeviceId.equals(otherDevId)) {
+                try {
+                    pushGlobalNodeLabel(getPcepClient(otherDevId),
+                                        labelId,
+                                        IpAddress.valueOf(specificLsrId).getIp4Address().toInt(),
+                                        PcepLabelOp.REMOVE,
+                                        false);
+                } catch (PcepParseException e) {
+                    log.error("Failed to push global node label for LSR {}.", specificLsrId.toString());
+                }
+            }
+        }
+
+        // Release from label manager
+        Set<LabelResourceId> release = new HashSet<>();
+        release.add(labelId);
+        if (!labelRsrcService.releaseToGlobalPool(release)) {
+            log.error("Unable to release label id {} from label manager.", labelId.toString());
+            retValue = false;
+        }
+
+        // Remove from store
+        if (!pceStore.removeGlobalNodeLabel(specificDeviceId)) {
+            log.error("Unable to remove global node label id {} from store.", labelId.toString());
+            retValue = false;
+        }
+        return retValue;
+    }
+
+    /**
+     * Allocates adjacency label to a link from local resource pool by a specific device id.
+     *
+     * @param link between devices
+     * @return success or failure
+     */
+    public boolean allocateAdjacencyLabel(Link link) {
+        long applyNum = 1; // Single label to each link.
+        DeviceId srcDeviceId = link.src().deviceId();
+        Collection<LabelResource> labelList;
+
+        checkNotNull(link, LINK_NULL);
+        checkNotNull(labelRsrcService, LABEL_RESOURCE_SERVICE_NULL);
+        checkNotNull(pceStore, PCE_STORE_NULL);
+
+        // Checks whether adjacency label was already allocated
+        LabelResourceId labelId = pceStore.getAdjLabel(link);
+        if (labelId != null) {
+            log.debug("Adjacency label {} was already allocated for a link {}.", labelId.toString(), link.toString());
+            return false;
+        }
+
+        // Allocate adjacency label to a link from label manager.
+        // Take label from source device pool to allocate.
+        labelList = labelRsrcService.applyFromDevicePool(srcDeviceId, applyNum);
+        if (labelList.size() <= 0) {
+            log.error("Unable to allocate label to a device id {}.", srcDeviceId.toString());
+            return false;
+        }
+
+        // Currently only one label to a device. So, no need to iterate through list
+        Iterator<LabelResource> iterator = labelList.iterator();
+        DefaultLabelResource defaultLabelResource = (DefaultLabelResource) iterator.next();
+        labelId = defaultLabelResource.labelResourceId();
+        if (labelId == null) {
+            log.error("Unable to allocate label to a device id {}.", srcDeviceId.toString());
+            return false;
+        }
+        log.debug("Allocated adjacency label {} to a link {}.", labelId.toString(), link.toString());
+
+        // Push adjacency label to device
+        try {
+            pushAdjacencyLabel(getPcepClient(srcDeviceId), labelId, (int) link.src().port().toLong(),
+                               (int) link.dst().port().toLong(), PcepLabelOp.ADD);
+        } catch (PcepParseException e) {
+            log.error("Failed to push adjacency label for link {}-{}.", (int) link.src().port().toLong(),
+                      (int) link.dst().port().toLong());
+        }
+
+        // Save in store
+        pceStore.addAdjLabel(link, labelId);
+        return true;
+    }
+
+    /**
+      * Releases unused adjacency labels from device pools.
+      *
+      * @param link between devices
+      * @return success or failure
+      */
+    public boolean releaseAdjacencyLabel(Link link) {
+        checkNotNull(link, LINK_NULL);
+        checkNotNull(labelRsrcService, LABEL_RESOURCE_SERVICE_NULL);
+        checkNotNull(pceStore, PCE_STORE_NULL);
+        boolean retValue = true;
+
+        // Retrieve link label from store
+        LabelResourceId labelId = pceStore.getAdjLabel(link);
+        if (labelId == null) {
+            log.error("Unabel to retrieve label for a link {} from store.", link.toString());
+            return false;
+        }
+
+        // Device
+        DeviceId srcDeviceId = link.src().deviceId();
+
+        // Release adjacency label from device
+        try {
+            pushAdjacencyLabel(getPcepClient(srcDeviceId), labelId, (int) link.src().port().toLong(),
+                               (int) link.dst().port().toLong(), PcepLabelOp.REMOVE);
+        } catch (PcepParseException e) {
+            log.error("Failed to push adjacency label for link {}-{}.", (int) link.src().port().toLong(),
+                      (int) link.dst().port().toLong());
+        }
+
+
+        // Release link label from label manager
+        Multimap<DeviceId, LabelResource> release = ArrayListMultimap.create();
+        DefaultLabelResource defaultLabelResource = new DefaultLabelResource(srcDeviceId, labelId);
+        release.put(srcDeviceId, defaultLabelResource);
+        if (!labelRsrcService.releaseToDevicePool(release)) {
+            log.error("Unable to release label id {} from label manager.", labelId.toString());
+            retValue = false;
+        }
+
+        // Remove adjacency label from store
+        if (!pceStore.removeAdjLabel(link)) {
+            log.error("Unable to remove adjacency label id {} from store.", labelId.toString());
+            retValue = false;
+        }
+        return retValue;
+    }
+
+    /**
+     * Computes label stack for a path.
+     *
+     * @param path lsp path
+     * @return label stack
+     */
+    public LabelStack computeLabelStack(Path path) {
+        checkNotNull(path, PATH_NULL);
+        // Label stack is linked list to make labels in order.
+        List<LabelResourceId> labelStack = new LinkedList<>();
+        List<Link> linkList = path.links();
+        if ((linkList != null) && (linkList.size() > 0)) {
+            // Path: [x] ---- [y] ---- [z]
+            // For other than last link, add only source[x] device label.
+            // For the last link, add both source[y] and destination[z] device labels.
+            // For all links add adjacency label
+            Link link = null;
+            LabelResourceId nodeLabelId = null;
+            LabelResourceId adjLabelId = null;
+            DeviceId deviceId = null;
+            for (Iterator<Link> iterator = linkList.iterator(); iterator.hasNext();) {
+                link = iterator.next();
+                // Add adjacency label for this link
+                adjLabelId = pceStore.getAdjLabel(link);
+                if (adjLabelId == null) {
+                    log.error("Adjacency label id is null for a link {}.", link.toString());
+                    return null;
+                }
+                labelStack.add(adjLabelId);
+
+                deviceId = link.dst().deviceId();
+                nodeLabelId = pceStore.getGlobalNodeLabel(deviceId);
+                if (nodeLabelId == null) {
+                    log.error("Unable to find node label for a device id {} in store.", deviceId.toString());
+                    return null;
+                }
+                labelStack.add(nodeLabelId);
+            }
+        } else {
+            log.debug("Empty link in path.");
+            return null;
+        }
+        return new DefaultLabelStack(labelStack);
+    }
+
+    //Pushes node labels to the specified device.
+    void pushGlobalNodeLabel(PcepClient pc, LabelResourceId labelId,
+            int labelForNode, PcepLabelOp type, boolean isBos) throws PcepParseException {
+
+        checkNotNull(pc);
+        checkNotNull(labelId);
+        checkNotNull(type);
+
+        LinkedList<PcepLabelUpdate> labelUpdateList = new LinkedList<>();
+        PcepFecObjectIPv4 fecObject = pc.factory().buildFecObjectIpv4()
+                                      .setNodeID(labelForNode)
+                                      .build();
+
+        boolean bSFlag = false;
+        if (pc.labelDbSyncStatus() == IN_SYNC && !isBos) {
+            // Need to set sync flag in all messages till sync completes.
+            bSFlag = true;
+        }
+
+        PcepSrpObject srpObj = getSrpObject(pc, type, bSFlag);
+
+        //Global NODE-SID as label object
+        PcepLabelObject labelObject = pc.factory().buildLabelObject()
+                                      .setLabel((int) labelId.labelId())
+                                      .build();
+
+        PcepLabelMap labelMap = new PcepLabelMap();
+        labelMap.setFecObject(fecObject);
+        labelMap.setLabelObject(labelObject);
+        labelMap.setSrpObject(srpObj);
+
+        labelUpdateList.add(pc.factory().buildPcepLabelUpdateObject()
+                            .setLabelMap(labelMap)
+                            .build());
+
+        PcepLabelUpdateMsg labelMsg = pc.factory().buildPcepLabelUpdateMsg()
+                                      .setPcLabelUpdateList(labelUpdateList)
+                                      .build();
+        pc.sendMessage(labelMsg);
+
+        if (isBos) {
+            // Sync is completed.
+            pc.setLabelDbSyncStatus(SYNCED);
+        }
+    }
+
+    //Pushes adjacency labels to the specified device.
+    void pushAdjacencyLabel(PcepClient pc, LabelResourceId labelId, int srcPortNo,
+                                    int dstPortNo, PcepLabelOp type)
+            throws PcepParseException {
+
+        checkNotNull(pc);
+        checkNotNull(labelId);
+        checkNotNull(type);
+
+        LinkedList<PcepLabelUpdate> labelUpdateList = new LinkedList<>();
+        PcepFecObjectIPv4Adjacency fecAdjObject = pc.factory().buildFecIpv4Adjacency()
+                                                  .seRemoteIPv4Address(dstPortNo)
+                                                  .seLocalIPv4Address(srcPortNo)
+                                                  .build();
+
+        boolean bSFlag = false;
+        if (pc.labelDbSyncStatus() == IN_SYNC) {
+            // Need to set sync flag in all messages till sync completes.
+            bSFlag = true;
+        }
+
+        PcepSrpObject srpObj = getSrpObject(pc, type, bSFlag);
+
+        //Adjacency label object
+        PcepLabelObject labelObject = pc.factory().buildLabelObject()
+                                      .setLabel((int) labelId.labelId())
+                                      .build();
+
+        PcepLabelMap labelMap = new PcepLabelMap();
+        labelMap.setFecObject(fecAdjObject);
+        labelMap.setLabelObject(labelObject);
+        labelMap.setSrpObject(srpObj);
+
+        labelUpdateList.add(pc.factory().buildPcepLabelUpdateObject()
+                            .setLabelMap(labelMap)
+                            .build());
+
+        PcepLabelUpdateMsg labelMsg = pc.factory().buildPcepLabelUpdateMsg()
+                                      .setPcLabelUpdateList(labelUpdateList)
+                                      .build();
+        pc.sendMessage(labelMsg);
+    }
+
+    private PcepSrpObject getSrpObject(PcepClient pc, PcepLabelOp type, boolean bSFlag)
+            throws PcepParseException {
+        PcepSrpObject srpObj;
+        boolean bRFlag = false;
+
+        if (!type.equals(PcepLabelOp.ADD)) {
+            // To cleanup labels, R bit is set
+            bRFlag = true;
+        }
+
+        srpObj = pc.factory().buildSrpObject()
+                .setRFlag(bRFlag)
+                .setSFlag(bSFlag)
+                .setSrpID(SrpIdGenerators.create())
+                .build();
+
+        return srpObj;
+    }
+
+    /**
+     * Returns PCEP client.
+     *
+     * @return PCEP client
+     */
+    private PcepClient getPcepClient(DeviceId deviceId) {
+        Device device = deviceService.getDevice(deviceId);
+
+        // In future projections instead of annotations will be used to fetch LSR ID.
+        String lsrId = device.annotations().value(LSR_ID);
+        PcepClient pcc = clientController.getClient(PccId.pccId(IpAddress.valueOf(lsrId)));
+        return pcc;
+    }
+}
diff --git a/protocols/pcep/ctl/src/main/java/org/onosproject/pcep/controller/impl/PcepClientControllerImpl.java b/protocols/pcep/ctl/src/main/java/org/onosproject/pcep/controller/impl/PcepClientControllerImpl.java
index f1458ab..3a1c74c 100644
--- a/protocols/pcep/ctl/src/main/java/org/onosproject/pcep/controller/impl/PcepClientControllerImpl.java
+++ b/protocols/pcep/ctl/src/main/java/org/onosproject/pcep/controller/impl/PcepClientControllerImpl.java
@@ -26,6 +26,7 @@
 import java.util.ListIterator;
 import java.util.Map;
 import java.util.Set;
+import java.util.Map.Entry;
 import java.util.concurrent.ConcurrentHashMap;
 
 import org.apache.felix.scr.annotations.Activate;
@@ -34,12 +35,40 @@
 import org.apache.felix.scr.annotations.Reference;
 import org.apache.felix.scr.annotations.ReferenceCardinality;
 import org.apache.felix.scr.annotations.Service;
+import org.onlab.packet.Ip4Address;
+import org.onlab.packet.IpAddress;
+import org.onosproject.incubator.net.resource.label.LabelResourceAdminService;
+import org.onosproject.incubator.net.resource.label.LabelResourceId;
+import org.onosproject.incubator.net.resource.label.LabelResourceService;
+import org.onosproject.incubator.net.tunnel.DefaultLabelStack;
+import org.onosproject.incubator.net.tunnel.DefaultTunnel;
 import org.onosproject.incubator.net.tunnel.IpTunnelEndPoint;
+import org.onosproject.incubator.net.tunnel.LabelStack;
 import org.onosproject.incubator.net.tunnel.Tunnel;
 import org.onosproject.incubator.net.tunnel.TunnelService;
 import org.onosproject.incubator.net.tunnel.Tunnel.State;
+import org.onosproject.mastership.MastershipService;
+import org.onosproject.net.DefaultAnnotations;
+import org.onosproject.net.DefaultAnnotations.Builder;
+import org.onosproject.net.Device;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.Link;
+import org.onosproject.net.MastershipRole;
+import org.onosproject.net.Path;
+import org.onosproject.net.config.NetworkConfigEvent;
+import org.onosproject.net.config.NetworkConfigListener;
+import org.onosproject.net.config.NetworkConfigService;
+import org.onosproject.net.device.DeviceEvent;
+import org.onosproject.net.device.DeviceListener;
 import org.onosproject.net.device.DeviceService;
+import org.onosproject.net.link.LinkEvent;
+import org.onosproject.net.link.LinkListener;
+import org.onosproject.net.link.LinkService;
+import org.onosproject.pcelabelstore.PcepLabelOp;
+import org.onosproject.pcelabelstore.api.PceLabelStore;
+import org.onosproject.pcep.api.DeviceCapability;
 import org.onosproject.pcep.controller.LspKey;
+import org.onosproject.pcep.controller.LspType;
 import org.onosproject.pcep.controller.PccId;
 import org.onosproject.pcep.controller.PcepClient;
 import org.onosproject.pcep.controller.PcepClientController;
@@ -47,8 +76,6 @@
 import org.onosproject.pcep.controller.PcepEventListener;
 import org.onosproject.pcep.controller.PcepLspStatus;
 import org.onosproject.pcep.controller.PcepNodeListener;
-import org.onosproject.pcep.controller.PcepPacketListener;
-import org.onosproject.pcep.controller.PcepSyncStatus;
 import org.onosproject.pcep.controller.SrpIdGenerators;
 import org.onosproject.pcep.controller.driver.PcepAgent;
 import org.onosproject.pcepio.exceptions.PcepParseException;
@@ -61,10 +88,15 @@
 import org.onosproject.pcepio.protocol.PcepInitiateMsg;
 import org.onosproject.pcepio.protocol.PcepLspObject;
 import org.onosproject.pcepio.protocol.PcepMessage;
+import org.onosproject.pcepio.protocol.PcepNai;
 import org.onosproject.pcepio.protocol.PcepReportMsg;
 import org.onosproject.pcepio.protocol.PcepSrpObject;
 import org.onosproject.pcepio.protocol.PcepStateReport;
+import org.onosproject.pcepio.types.PathSetupTypeTlv;
+import org.onosproject.pcepio.types.PcepNaiIpv4Adjacency;
+import org.onosproject.pcepio.types.PcepNaiIpv4NodeId;
 import org.onosproject.pcepio.types.PcepValueType;
+import org.onosproject.pcepio.types.SrEroSubObject;
 import org.onosproject.pcepio.types.StatefulIPv4LspIdentifiersTlv;
 import org.onosproject.pcepio.types.SymbolicPathNameTlv;
 import org.slf4j.Logger;
@@ -74,11 +106,23 @@
 import static com.google.common.base.Preconditions.checkNotNull;
 
 import static org.onosproject.pcep.controller.PcepSyncStatus.IN_SYNC;
+import static org.onosproject.pcep.controller.LspType.WITHOUT_SIGNALLING_AND_WITHOUT_SR;
+import static org.onosproject.pcep.controller.LspType.WITH_SIGNALLING;
 import static org.onosproject.pcep.controller.PcepLspSyncAction.REMOVE;
 import static org.onosproject.pcep.controller.PcepLspSyncAction.SEND_UPDATE;
 import static org.onosproject.pcep.controller.PcepLspSyncAction.UNSTABLE;
 import static org.onosproject.pcepio.types.PcepErrorDetailInfo.ERROR_TYPE_19;
 import static org.onosproject.pcepio.types.PcepErrorDetailInfo.ERROR_VALUE_5;
+import static org.onosproject.pcep.controller.PcepAnnotationKeys.BANDWIDTH;
+import static org.onosproject.pcep.controller.PcepAnnotationKeys.LOCAL_LSP_ID;
+import static org.onosproject.pcep.controller.PcepAnnotationKeys.LSP_SIG_TYPE;
+import static org.onosproject.pcep.controller.PcepAnnotationKeys.PCC_TUNNEL_ID;
+import static org.onosproject.pcep.controller.PcepAnnotationKeys.PCE_INIT;
+import static org.onosproject.pcep.controller.PcepAnnotationKeys.PLSP_ID;
+import static org.onosproject.pcep.controller.PcepAnnotationKeys.DELEGATE;
+import static org.onosproject.pcep.controller.PcepAnnotationKeys.COST_TYPE;
+import static org.onosproject.pcep.controller.PcepSyncStatus.SYNCED;
+import static org.onosproject.pcep.controller.PcepSyncStatus.NOT_SYNCED;
 
 /**
  * Implementation of PCEP client controller.
@@ -88,10 +132,33 @@
 public class PcepClientControllerImpl implements PcepClientController {
 
     private static final Logger log = LoggerFactory.getLogger(PcepClientControllerImpl.class);
+    private static final long IDENTIFIER_SET = 0x100000000L;
+    private static final long SET = 0xFFFFFFFFL;
 
     @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
     protected DeviceService deviceService;
 
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected LinkService linkService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected TunnelService tunnelService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected NetworkConfigService netCfgService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected MastershipService mastershipService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected LabelResourceAdminService labelRsrcAdminService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected LabelResourceService labelRsrcService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected PceLabelStore pceStore;
+
     protected ConcurrentHashMap<PccId, PcepClient> connectedClients =
             new ConcurrentHashMap<>();
 
@@ -100,25 +167,44 @@
 
     protected Set<PcepEventListener> pcepEventListener = Sets.newHashSet();
     protected Set<PcepNodeListener> pcepNodeListener = Sets.newHashSet();
-    protected Set<PcepPacketListener> pcepPacketListener = Sets.newHashSet();
+
+    // LSR-id and device-id mapping for checking capability if L3 device is not
+    // having its capability
+    private Map<String, DeviceId> lsrIdDeviceIdMap = new HashMap<>();
 
     private final Controller ctrl = new Controller();
+    public static final long GLOBAL_LABEL_SPACE_MIN = 4097;
+    public static final long GLOBAL_LABEL_SPACE_MAX = 5121;
+    private static final String LSRID = "lsrId";
+    private static final String DEVICE_NULL = "Device-cannot be null";
+    private static final String LINK_NULL = "Link-cannot be null";
 
-    public static final String BANDWIDTH = "bandwidth";
-    public static final String LSP_SIG_TYPE = "lspSigType";
-    public static final String PCC_TUNNEL_ID = "PccTunnelId";
-    public static final String PLSP_ID = "PLspId";
-    public static final String LOCAL_LSP_ID = "localLspId";
-    public static final String PCE_INIT = "pceInit";
-    public static final String COST_TYPE = "costType";
-    public static final String DELEGATE = "delegation";
+    private BasicPceccHandler crHandler;
+    private PceccSrTeBeHandler srTeHandler;
 
-    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
-    protected TunnelService tunnelService;
+    private DeviceListener deviceListener = new InternalDeviceListener();
+    private LinkListener linkListener = new InternalLinkListener();
+    private InternalConfigListener cfgListener = new InternalConfigListener();
 
     @Activate
     public void activate() {
         ctrl.start(agent);
+        crHandler = BasicPceccHandler.getInstance();
+        crHandler.initialize(labelRsrcService, deviceService, pceStore, this);
+
+        srTeHandler = PceccSrTeBeHandler.getInstance();
+        srTeHandler.initialize(labelRsrcAdminService, labelRsrcService, this, pceStore,
+                               deviceService);
+
+        deviceService.addListener(deviceListener);
+        linkService.addListener(linkListener);
+        netCfgService.addListener(cfgListener);
+
+        // Reserve global node pool
+        if (!srTeHandler.reserveGlobalPool(GLOBAL_LABEL_SPACE_MIN, GLOBAL_LABEL_SPACE_MAX)) {
+            log.debug("Global node pool was already reserved.");
+        }
+
         log.info("Started");
     }
 
@@ -126,6 +212,9 @@
     public void deactivate() {
         // Close all connected clients
         closeConnectedClients();
+        deviceService.removeListener(deviceListener);
+        linkService.removeListener(linkListener);
+        netCfgService.removeListener(cfgListener);
         ctrl.stop();
         log.info("Stopped");
     }
@@ -163,16 +252,6 @@
     }
 
     @Override
-    public void addPacketListener(PcepPacketListener listener) {
-        pcepPacketListener.add(listener);
-    }
-
-    @Override
-    public void removePacketListener(PcepPacketListener listener) {
-        pcepPacketListener.remove(listener);
-    }
-
-    @Override
     public void writeMessage(PccId pccId, PcepMessage msg) {
         this.getClient(pccId).sendMessage(msg);
     }
@@ -239,10 +318,10 @@
                     PcepStateReport stateRpt = listIterator.next();
                     PcepLspObject lspObj = stateRpt.getLspObject();
                     if (lspObj.getSFlag()) {
-                        if (pc.lspDbSyncStatus() != PcepSyncStatus.IN_SYNC) {
+                        if (pc.lspDbSyncStatus() != IN_SYNC) {
                             log.debug("LSP DB sync started for PCC {}", pc.getPccId().id().toString());
                             // Initialize LSP DB sync and temporary cache.
-                            pc.setLspDbSyncStatus(PcepSyncStatus.IN_SYNC);
+                            pc.setLspDbSyncStatus(IN_SYNC);
                             pc.initializeSyncMsgList(pccId);
                         }
                         // Store stateRpt in temporary cache.
@@ -251,18 +330,24 @@
                         // Don't send to provider as of now.
                         continue;
                     } else if (lspObj.getPlspId() == 0) {
-                        if (pc.lspDbSyncStatus() == PcepSyncStatus.IN_SYNC
-                                || pc.lspDbSyncStatus() == PcepSyncStatus.NOT_SYNCED) {
+                        if (pc.lspDbSyncStatus() == IN_SYNC
+                                || pc.lspDbSyncStatus() == NOT_SYNCED) {
                             // Set end of LSPDB sync.
                             log.debug("LSP DB sync completed for PCC {}", pc.getPccId().id().toString());
-                            pc.setLspDbSyncStatus(PcepSyncStatus.SYNCED);
+                            pc.setLspDbSyncStatus(SYNCED);
 
                             // Call packet provider to initiate label DB sync (only if PCECC capable).
                             if (pc.capability().pceccCapability()) {
                                 log.debug("Trigger label DB sync for PCC {}", pc.getPccId().id().toString());
                                 pc.setLabelDbSyncStatus(IN_SYNC);
-                                for (PcepPacketListener l : pcepPacketListener) {
-                                    l.sendPacketIn(pccId);
+                                // Get lsrId of the PCEP client from the PCC ID. Session info is based on lsrID.
+                                String lsrId = String.valueOf(pccId.ipAddress());
+                                DeviceId pccDeviceId = DeviceId.deviceId(lsrId);
+                                try {
+                                    syncLabelDb(pccDeviceId);
+                                    pc.setLabelDbSyncStatus(SYNCED);
+                                } catch (PcepParseException e) {
+                                    log.error("Exception caught in sending label masg to PCC while in sync.");
                                 }
                             } else {
                                 // If label db sync is not to be done, handle end of LSPDB sync actions.
@@ -272,6 +357,27 @@
                         }
                     }
 
+                    PcepLspStatus pcepLspStatus = PcepLspStatus.values()[lspObj.getOFlag()];
+                    LspType lspType = getLspType(stateRpt.getSrpObject());
+
+                    // Download (or remove) labels for basic PCECC LSPs.
+                    if (lspType.equals(WITHOUT_SIGNALLING_AND_WITHOUT_SR)) {
+                        boolean isRemove = lspObj.getRFlag();
+                        Tunnel tunnel = null;
+
+                        if (isRemove || pcepLspStatus.equals(PcepLspStatus.GOING_UP)) {
+                            tunnel = getTunnel(lspObj);
+                        }
+
+                        if (tunnel != null) {
+                            if (isRemove) {
+                                crHandler.releaseLabel(tunnel);
+                            } else {
+                                crHandler.allocateLabel(tunnel);
+                            }
+                        }
+                    }
+
                     // It's a usual report message while sync is not undergoing. So process it immediately.
                     LinkedList<PcepStateReport> llPcRptList = new LinkedList<>();
                     llPcRptList.add(stateRpt);
@@ -300,6 +406,113 @@
         }
     }
 
+    private LspType getLspType(PcepSrpObject srpObj) {
+        LspType lspType = WITH_SIGNALLING;
+
+        if (null != srpObj) {
+            LinkedList<PcepValueType> llOptionalTlv = srpObj.getOptionalTlv();
+            ListIterator<PcepValueType> listIterator = llOptionalTlv.listIterator();
+
+            while (listIterator.hasNext()) {
+                PcepValueType tlv = listIterator.next();
+                switch (tlv.getType()) {
+                case PathSetupTypeTlv.TYPE:
+                    lspType = LspType.values()[Integer.valueOf(((PathSetupTypeTlv) tlv).getPst())];
+                    break;
+                default:
+                    break;
+                }
+            }
+        }
+        return lspType;
+    }
+
+    private Tunnel getTunnel(PcepLspObject lspObj) {
+        ListIterator<PcepValueType> listTlvIterator = lspObj.getOptionalTlv().listIterator();
+        StatefulIPv4LspIdentifiersTlv ipv4LspIdenTlv = null;
+        SymbolicPathNameTlv pathNameTlv = null;
+        Tunnel tunnel = null;
+        while (listTlvIterator.hasNext()) {
+            PcepValueType tlv = listTlvIterator.next();
+            switch (tlv.getType()) {
+            case StatefulIPv4LspIdentifiersTlv.TYPE:
+                ipv4LspIdenTlv = (StatefulIPv4LspIdentifiersTlv) tlv;
+                break;
+            case SymbolicPathNameTlv.TYPE:
+                pathNameTlv = (SymbolicPathNameTlv) tlv;
+                break;
+            default:
+                break;
+            }
+        }
+        /*
+         * Draft says: The LSP-IDENTIFIERS TLV MUST be included in the LSP object in PCRpt messages for
+         * RSVP-signaled LSPs. For ONOS PCECC implementation, it is mandatory.
+         */
+        if (ipv4LspIdenTlv == null) {
+            log.error("Stateful IPv4 identifier TLV is null in PCRpt msg.");
+            return null;
+        }
+        IpTunnelEndPoint tunnelEndPointSrc = IpTunnelEndPoint
+                .ipTunnelPoint(IpAddress.valueOf(ipv4LspIdenTlv.getIpv4IngressAddress()));
+        IpTunnelEndPoint tunnelEndPointDst = IpTunnelEndPoint
+                .ipTunnelPoint(IpAddress.valueOf(ipv4LspIdenTlv.getIpv4EgressAddress()));
+        Collection<Tunnel> tunnelQueryResult = tunnelService.queryTunnel(tunnelEndPointSrc, tunnelEndPointDst);
+
+        for (Tunnel tunnelObj : tunnelQueryResult) {
+            if (tunnelObj.annotations().value(PLSP_ID) == null) {
+                /*
+                 * PLSP_ID is null while Tunnel is created at PCE and PCInit msg carries it as 0. It is allocated by
+                 * PCC and in that case it becomes the first PCRpt msg from PCC for this LSP, and hence symbolic
+                 * path name must be carried in the PCRpt msg. Draft says: The SYMBOLIC-PATH-NAME TLV "MUST" be
+                 * included in the LSP object in the LSP State Report (PCRpt) message when during a given PCEP
+                 * session an LSP is "first" reported to a PCE.
+                 */
+                if ((pathNameTlv != null)
+                        && Arrays.equals(tunnelObj.tunnelName().value().getBytes(), pathNameTlv.getValue())) {
+                    tunnel = tunnelObj;
+                    break;
+                }
+                continue;
+            }
+            if ((Integer.valueOf(tunnelObj.annotations().value(PLSP_ID)) == lspObj.getPlspId())) {
+                if ((Integer
+                        .valueOf(tunnelObj.annotations().value(LOCAL_LSP_ID)) == ipv4LspIdenTlv.getLspId())) {
+                    tunnel = tunnelObj;
+                    break;
+                }
+            }
+        }
+
+        if (tunnel == null || tunnel.annotations().value(PLSP_ID) != null) {
+            return tunnel;
+        }
+
+        // The returned tunnel is used just for filling values in Label message. So manipulate locally
+        // and return so that to allocate label, we don't need to wait for the tunnel in the "core"
+        // to be updated, as that depends on listener mechanism and there may be timing/multi-threading issues.
+        Builder annotationBuilder = DefaultAnnotations.builder();
+        annotationBuilder.set(BANDWIDTH, tunnel.annotations().value(BANDWIDTH));
+        annotationBuilder.set(COST_TYPE, tunnel.annotations().value(COST_TYPE));
+        annotationBuilder.set(LSP_SIG_TYPE, tunnel.annotations().value(LSP_SIG_TYPE));
+        annotationBuilder.set(PCE_INIT, tunnel.annotations().value(PCE_INIT));
+        annotationBuilder.set(DELEGATE, tunnel.annotations().value(DELEGATE));
+        annotationBuilder.set(PLSP_ID, String.valueOf(lspObj.getPlspId()));
+        annotationBuilder.set(PCC_TUNNEL_ID, String.valueOf(ipv4LspIdenTlv.getTunnelId()));
+        annotationBuilder.set(LOCAL_LSP_ID, tunnel.annotations().value(LOCAL_LSP_ID));
+
+        Tunnel updatedTunnel = new DefaultTunnel(tunnel.providerId(), tunnel.src(),
+                            tunnel.dst(), tunnel.type(),
+                            tunnel.state(), tunnel.groupId(),
+                            tunnel.tunnelId(),
+                            tunnel.tunnelName(),
+                            tunnel.path(),
+                            tunnel.resource(),
+                            annotationBuilder.build());
+
+        return updatedTunnel;
+    }
+
     @Override
     public void closeConnectedClients() {
         PcepClient pc;
@@ -337,6 +550,294 @@
         return errMsg;
     }
 
+    private boolean syncLabelDb(DeviceId deviceId) throws PcepParseException {
+        checkNotNull(deviceId);
+
+        DeviceId actualDevcieId = pceStore.getLsrIdDevice(deviceId.toString());
+        if (actualDevcieId == null) {
+            log.error("Device not available {}.", deviceId.toString());
+            pceStore.addPccLsr(deviceId);
+            return false;
+        }
+        PcepClient pc = connectedClients.get(PccId.pccId(IpAddress.valueOf(deviceId.toString())));
+
+        Device specificDevice = deviceService.getDevice(actualDevcieId);
+        if (specificDevice == null) {
+            log.error("Unable to find device for specific device id {}.", actualDevcieId.toString());
+            return false;
+        }
+
+        if (pceStore.getGlobalNodeLabel(actualDevcieId) != null) {
+            Map<DeviceId, LabelResourceId> globalNodeLabelMap = pceStore.getGlobalNodeLabels();
+
+            for (Entry<DeviceId, LabelResourceId> entry : globalNodeLabelMap.entrySet()) {
+
+                // Convert from DeviceId to TunnelEndPoint
+                Device srcDevice = deviceService.getDevice(entry.getKey());
+
+                /*
+                 * If there is a slight difference in timing such that if device subsystem has removed the device but
+                 * PCE store still has it, just ignore such devices.
+                 */
+                if (srcDevice == null) {
+                    continue;
+                }
+
+                String srcLsrId = srcDevice.annotations().value(LSRID);
+                if (srcLsrId == null) {
+                    continue;
+                }
+
+                srTeHandler.pushGlobalNodeLabel(pc, entry.getValue(),
+                                    IpAddress.valueOf(srcLsrId).getIp4Address().toInt(),
+                                    PcepLabelOp.ADD, false);
+            }
+
+            Map<Link, LabelResourceId> adjLabelMap = pceStore.getAdjLabels();
+            for (Entry<Link, LabelResourceId> entry : adjLabelMap.entrySet()) {
+                if (entry.getKey().src().deviceId().equals(actualDevcieId)) {
+                    srTeHandler.pushAdjacencyLabel(pc,
+                                       entry.getValue(),
+                                       (int) entry.getKey().src().port().toLong(),
+                                       (int) entry.getKey().dst().port().toLong(),
+                                       PcepLabelOp.ADD
+                                       );
+                }
+            }
+        }
+
+        srTeHandler.pushGlobalNodeLabel(pc, LabelResourceId.labelResourceId(0),
+                            0, PcepLabelOp.ADD, true);
+
+        log.debug("End of label DB sync for device {}", actualDevcieId);
+
+        if (mastershipService.getLocalRole(specificDevice.id()) == MastershipRole.MASTER) {
+            // Allocate node-label to this specific device.
+            allocateNodeLabel(specificDevice);
+
+            // Allocate adjacency label
+            Set<Link> links = linkService.getDeviceEgressLinks(specificDevice.id());
+            if (links != null) {
+                for (Link link : links) {
+                    allocateAdjacencyLabel(link);
+                }
+            }
+        }
+        return true;
+    }
+
+    /**
+     * Allocates node label to specific device.
+     *
+     * @param specificDevice device to which node label needs to be allocated
+     */
+    public void allocateNodeLabel(Device specificDevice) {
+        checkNotNull(specificDevice, DEVICE_NULL);
+
+        DeviceId deviceId = specificDevice.id();
+
+        // Retrieve lsrId of a specific device
+        if (specificDevice.annotations() == null) {
+            log.debug("Device {} does not have annotations.", specificDevice.toString());
+            return;
+        }
+
+        String lsrId = specificDevice.annotations().value(LSRID);
+        if (lsrId == null) {
+            log.debug("Unable to retrieve lsr-id of a device {}.", specificDevice.toString());
+            return;
+        }
+
+        // Get capability config from netconfig
+        DeviceCapability cfg = netCfgService.getConfig(DeviceId.deviceId(lsrId), DeviceCapability.class);
+        if (cfg == null) {
+            log.error("Unable to find corresponding capability for a lsrd {} from NetConfig.", lsrId);
+            // Save info. When PCEP session is comes up then allocate node-label
+            lsrIdDeviceIdMap.put(lsrId, specificDevice.id());
+            return;
+        }
+
+        // Check whether device has SR-TE Capability
+        if (cfg.labelStackCap()) {
+            srTeHandler.allocateNodeLabel(deviceId, lsrId);
+        }
+    }
+
+    /**
+     * Releases node label of a specific device.
+     *
+     * @param specificDevice this device label and lsr-id information will be
+     *            released in other existing devices
+     */
+    public void releaseNodeLabel(Device specificDevice) {
+        checkNotNull(specificDevice, DEVICE_NULL);
+
+        DeviceId deviceId = specificDevice.id();
+
+        // Retrieve lsrId of a specific device
+        if (specificDevice.annotations() == null) {
+            log.debug("Device {} does not have annotations.", specificDevice.toString());
+            return;
+        }
+
+        String lsrId = specificDevice.annotations().value(LSRID);
+        if (lsrId == null) {
+            log.debug("Unable to retrieve lsr-id of a device {}.", specificDevice.toString());
+            return;
+        }
+
+        // Get capability config from netconfig
+        DeviceCapability cfg = netCfgService.getConfig(DeviceId.deviceId(lsrId), DeviceCapability.class);
+        if (cfg == null) {
+            log.error("Unable to find corresponding capabilty for a lsrd {} from NetConfig.", lsrId);
+            return;
+        }
+
+        // Check whether device has SR-TE Capability
+        if (cfg.labelStackCap()) {
+            if (!srTeHandler.releaseNodeLabel(deviceId, lsrId)) {
+                log.error("Unable to release node label for a device id {}.", deviceId.toString());
+            }
+        }
+    }
+
+    /**
+     * Allocates adjacency label for a link.
+     *
+     * @param link link
+     */
+    public void allocateAdjacencyLabel(Link link) {
+        checkNotNull(link, LINK_NULL);
+
+        Device specificDevice = deviceService.getDevice(link.src().deviceId());
+
+        // Retrieve lsrId of a specific device
+        if (specificDevice.annotations() == null) {
+            log.debug("Device {} does not have annotations.", specificDevice.toString());
+            return;
+        }
+
+        String lsrId = specificDevice.annotations().value(LSRID);
+        if (lsrId == null) {
+            log.debug("Unable to retrieve lsr-id of a device {}.", specificDevice.toString());
+            return;
+        }
+
+        // Get capability config from netconfig
+        DeviceCapability cfg = netCfgService.getConfig(DeviceId.deviceId(lsrId), DeviceCapability.class);
+        if (cfg == null) {
+            log.error("Unable to find corresponding capabilty for a lsrd {} from NetConfig.", lsrId);
+            // Save info. When PCEP session comes up then allocate adjacency
+            // label
+            if (lsrIdDeviceIdMap.get(lsrId) != null) {
+                lsrIdDeviceIdMap.put(lsrId, specificDevice.id());
+            }
+            return;
+        }
+
+        // Check whether device has SR-TE Capability
+        if (cfg.labelStackCap()) {
+            srTeHandler.allocateAdjacencyLabel(link);
+        }
+    }
+
+    /**
+     * Releases allocated adjacency label of a link.
+     *
+     * @param link link
+     */
+    public void releaseAdjacencyLabel(Link link) {
+        checkNotNull(link, LINK_NULL);
+
+        Device specificDevice = deviceService.getDevice(link.src().deviceId());
+
+        // Retrieve lsrId of a specific device
+        if (specificDevice.annotations() == null) {
+            log.debug("Device {} does not have annotations.", specificDevice.toString());
+            return;
+        }
+
+        String lsrId = specificDevice.annotations().value(LSRID);
+        if (lsrId == null) {
+            log.debug("Unable to retrieve lsr-id of a device {}.", specificDevice.toString());
+            return;
+        }
+
+        // Get capability config from netconfig
+        DeviceCapability cfg = netCfgService.getConfig(DeviceId.deviceId(lsrId), DeviceCapability.class);
+        if (cfg == null) {
+            log.error("Unable to find corresponding capabilty for a lsrd {} from NetConfig.", lsrId);
+            return;
+        }
+
+        // Check whether device has SR-TE Capability
+        if (cfg.labelStackCap()) {
+            if (!srTeHandler.releaseAdjacencyLabel(link)) {
+                log.error("Unable to release adjacency labels for a link {}.", link.toString());
+            }
+        }
+    }
+
+    @Override
+    public LabelStack computeLabelStack(Path path) {
+        return srTeHandler.computeLabelStack(path);
+    }
+
+    @Override
+    public boolean allocateLocalLabel(Tunnel tunnel) {
+        return crHandler.allocateLabel(tunnel);
+    }
+
+    /**
+     * Creates label stack for ERO object from network resource.
+     *
+     * @param labelStack
+     * @param path (hop list)
+     * @return list of ERO subobjects
+     */
+    @Override
+    public LinkedList<PcepValueType> createPcepLabelStack(DefaultLabelStack labelStack, Path path) {
+        checkNotNull(labelStack);
+
+        LinkedList<PcepValueType> llSubObjects = new LinkedList<PcepValueType>();
+        Iterator<Link> links = path.links().iterator();
+        LabelResourceId label = null;
+        Link link = null;
+        PcepValueType subObj = null;
+        PcepNai nai = null;
+        Device dstNode = null;
+        long srcPortNo, dstPortNo;
+
+        ListIterator<LabelResourceId> labelListIterator = labelStack.labelResources().listIterator();
+        while (labelListIterator.hasNext()) {
+            label = labelListIterator.next();
+            link = links.next();
+
+            srcPortNo = link.src().port().toLong();
+            srcPortNo = ((srcPortNo & IDENTIFIER_SET) == IDENTIFIER_SET) ? srcPortNo & SET : srcPortNo;
+
+            dstPortNo = link.dst().port().toLong();
+            dstPortNo = ((dstPortNo & IDENTIFIER_SET) == IDENTIFIER_SET) ? dstPortNo & SET : dstPortNo;
+
+            nai = new PcepNaiIpv4Adjacency((int) srcPortNo, (int) dstPortNo);
+            subObj = new SrEroSubObject(PcepNaiIpv4Adjacency.ST_TYPE, false, false, false, true, (int) label.labelId(),
+                                        nai);
+            llSubObjects.add(subObj);
+
+            dstNode = deviceService.getDevice(link.dst().deviceId());
+            nai = new PcepNaiIpv4NodeId(Ip4Address.valueOf(dstNode.annotations().value(LSRID)).toInt());
+
+            if (!labelListIterator.hasNext()) {
+                log.error("Malformed label stack.");
+            }
+            label = labelListIterator.next();
+            subObj = new SrEroSubObject(PcepNaiIpv4NodeId.ST_TYPE, false, false, false, true, (int) label.labelId(),
+                                        nai);
+            llSubObjects.add(subObj);
+        }
+        return llSubObjects;
+    }
+
     /**
      * Implementation of an Pcep Agent which is responsible for
      * keeping track of connected clients and the state in which
@@ -370,7 +871,6 @@
                         + "connected client: pccIp {}. Aborting ..", pccId.toString());
                 return false;
             }
-
             return true;
         }
 
@@ -479,7 +979,7 @@
                 } else if (pathNameTlv != null) {
                     tunnel = preSyncLspDbByName.get(Arrays.toString(pathNameTlv.getValue()));
                     if (tunnel != null) {
-                        preSyncLspDbByName.remove(tunnel.tunnelName());
+                        preSyncLspDbByName.remove(tunnel.tunnelName().value());
                     }
                 }
 
@@ -566,4 +1066,130 @@
             }
         }
     }
+
+    /*
+     * Handle device events.
+     */
+    private class InternalDeviceListener implements DeviceListener {
+        @Override
+        public void event(DeviceEvent event) {
+            Device specificDevice = event.subject();
+            if (specificDevice == null) {
+                log.error("Unable to find device from device event.");
+                return;
+            }
+
+            switch (event.type()) {
+
+            case DEVICE_ADDED:
+                // Node-label allocation is being done during Label DB Sync.
+                // So, when device is detected, no need to do node-label
+                // allocation.
+                String lsrId = specificDevice.annotations().value(LSRID);
+                if (lsrId != null) {
+                    pceStore.addLsrIdDevice(lsrId, specificDevice.id());
+
+                    // Search in failed DB sync store. If found, trigger label DB sync.
+                    DeviceId pccDeviceId = DeviceId.deviceId(lsrId);
+                    if (pceStore.hasPccLsr(pccDeviceId)) {
+                        log.debug("Continue to perform label DB sync for device {}.", pccDeviceId.toString());
+                        try {
+                            syncLabelDb(pccDeviceId);
+                        } catch (PcepParseException e) {
+                            log.error("Exception caught in sending label masg to PCC while in sync.");
+                        }
+                        pceStore.removePccLsr(pccDeviceId);
+                    }
+                }
+                break;
+
+            case DEVICE_REMOVED:
+                // Release node-label
+                if (mastershipService.getLocalRole(specificDevice.id()) == MastershipRole.MASTER) {
+                    releaseNodeLabel(specificDevice);
+                }
+
+                if (specificDevice.annotations().value(LSRID) != null) {
+                    pceStore.removeLsrIdDevice(specificDevice.annotations().value(LSRID));
+                }
+                break;
+
+            default:
+                break;
+            }
+        }
+    }
+
+    /*
+     * Handle link events.
+     */
+    private class InternalLinkListener implements LinkListener {
+        @Override
+        public void event(LinkEvent event) {
+            Link link = event.subject();
+
+            switch (event.type()) {
+
+            case LINK_ADDED:
+                // Allocate adjacency label
+                if (mastershipService.getLocalRole(link.src().deviceId()) == MastershipRole.MASTER) {
+                    allocateAdjacencyLabel(link);
+                }
+                break;
+
+            case LINK_REMOVED:
+                // Release adjacency label
+                if (mastershipService.getLocalRole(link.src().deviceId()) == MastershipRole.MASTER) {
+                    releaseAdjacencyLabel(link);
+                }
+                break;
+
+            default:
+                break;
+            }
+        }
+    }
+
+    private class InternalConfigListener implements NetworkConfigListener {
+
+        @Override
+        public void event(NetworkConfigEvent event) {
+
+            if ((event.type() == NetworkConfigEvent.Type.CONFIG_ADDED)
+                    && event.configClass().equals(DeviceCapability.class)) {
+
+                DeviceId deviceIdLsrId = (DeviceId) event.subject();
+                String lsrId = deviceIdLsrId.toString();
+                DeviceId deviceId = lsrIdDeviceIdMap.get(lsrId);
+                if (deviceId == null) {
+                    log.debug("Unable to find device id for a lsr-id {} from lsr-id and device-id map.", lsrId);
+                    return;
+                }
+
+                DeviceCapability cfg = netCfgService.getConfig(DeviceId.deviceId(lsrId), DeviceCapability.class);
+                if (cfg == null) {
+                    log.error("Unable to find corresponding capabilty for a lsrd {}.", lsrId);
+                    return;
+                }
+
+                if (cfg.labelStackCap()) {
+                    if (mastershipService.getLocalRole(deviceId) == MastershipRole.MASTER) {
+                        // Allocate node-label
+                        srTeHandler.allocateNodeLabel(deviceId, lsrId);
+
+                        // Allocate adjacency label to links which are
+                        // originated from this specific device id
+                        Set<Link> links = linkService.getDeviceEgressLinks(deviceId);
+                        for (Link link : links) {
+                            if (!srTeHandler.allocateAdjacencyLabel(link)) {
+                                return;
+                            }
+                        }
+                    }
+                }
+                // Remove lsrId info from map
+                lsrIdDeviceIdMap.remove(lsrId);
+            }
+        }
+    }
 }
diff --git a/protocols/pcep/ctl/src/main/java/org/onosproject/pcep/controller/impl/PcepControllerImpl.java b/protocols/pcep/ctl/src/main/java/org/onosproject/pcep/controller/impl/PcepControllerImpl.java
index 24193bd..64230c5 100644
--- a/protocols/pcep/ctl/src/main/java/org/onosproject/pcep/controller/impl/PcepControllerImpl.java
+++ b/protocols/pcep/ctl/src/main/java/org/onosproject/pcep/controller/impl/PcepControllerImpl.java
@@ -111,13 +111,13 @@
     @Override
     public Boolean deleteTunnel(String id) {
         // TODO Auto-generated method stub
-        return null;
+        return false;
     }
 
     @Override
     public Boolean updateTunnelBandwidth(String id, long bandwidth) {
         // TODO Auto-generated method stub
-        return null;
+        return false;
     }
 
     @Override
diff --git a/protocols/pcep/ctl/src/test/java/org/onosproject/pcelabelstore/DefaultLspLocalLabelInfoTest.java b/protocols/pcep/ctl/src/test/java/org/onosproject/pcelabelstore/DefaultLspLocalLabelInfoTest.java
new file mode 100644
index 0000000..8dc5f8a
--- /dev/null
+++ b/protocols/pcep/ctl/src/test/java/org/onosproject/pcelabelstore/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.pcelabelstore;
+
+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.pcelabelstore.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/protocols/pcep/ctl/src/test/java/org/onosproject/pcelabelstore/DistributedPceLabelStoreTest.java b/protocols/pcep/ctl/src/test/java/org/onosproject/pcelabelstore/DistributedPceLabelStoreTest.java
new file mode 100644
index 0000000..b8aa2e2
--- /dev/null
+++ b/protocols/pcep/ctl/src/test/java/org/onosproject/pcelabelstore/DistributedPceLabelStoreTest.java
@@ -0,0 +1,380 @@
+/*
+ * 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.pcelabelstore;
+
+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.Link;
+import org.onosproject.net.PortNumber;
+import org.onosproject.net.provider.ProviderId;
+import org.onosproject.pcelabelstore.api.LspLocalLabelInfo;
+import org.onosproject.pcelabelstore.util.TestStorageService;
+
+/**
+ * Unit tests for DistributedPceStore class.
+ */
+public class DistributedPceLabelStoreTest {
+
+    private DistributedPceLabelStore 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(deviceId1, portNumber1);
+    private ConnectPoint dstConnectionPoint2 = new ConnectPoint(deviceId2, portNumber2);
+    private ConnectPoint srcConnectionPoint3 = new ConnectPoint(deviceId3, portNumber3);
+    private ConnectPoint dstConnectionPoint4 = new ConnectPoint(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");
+
+    List<LspLocalLabelInfo> lspLocalLabelInfoList1 = new LinkedList<>();
+    List<LspLocalLabelInfo> lspLocalLabelInfoList2 = new LinkedList<>();
+
+    @BeforeClass
+    public static void setUpBeforeClass() throws Exception {
+    }
+
+    @AfterClass
+    public static void tearDownAfterClass() throws Exception {
+    }
+
+    @Before
+    public void setUp() throws Exception {
+       distrPceStore = new DistributedPceLabelStore();
+       // initialization
+       distrPceStore.storageService = new TestStorageService();
+       distrPceStore.activate();
+
+       // 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
+       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);
+       distrPceStore.addTunnelInfo(tunnelId1, lspLocalLabelInfoList1);
+
+       // Create pceccTunnelInfo2
+       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);
+       distrPceStore.addTunnelInfo(tunnelId2, lspLocalLabelInfoList2);
+    }
+
+    @After
+    public void tearDown() throws Exception {
+    }
+
+    /**
+     * Checks the operation of addGlobalNodeLabel() method.
+     */
+    @Test
+    public void testAddGlobalNodeLabel() {
+        // 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() {
+        // 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() {
+        // TunnelId with device label store information
+        distrPceStore.addTunnelInfo(tunnelId1, lspLocalLabelInfoList1);
+        assertThat(distrPceStore.existsTunnelInfo(tunnelId1), is(true));
+        assertThat(distrPceStore.getTunnelInfo(tunnelId1), is(lspLocalLabelInfoList1));
+        distrPceStore.addTunnelInfo(tunnelId2, lspLocalLabelInfoList2);
+        assertThat(distrPceStore.existsTunnelInfo(tunnelId2), is(true));
+        assertThat(distrPceStore.getTunnelInfo(tunnelId2), is(lspLocalLabelInfoList2));
+    }
+
+    /**
+     * 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, List<LspLocalLabelInfo>> 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(lspLocalLabelInfoList1));
+
+        // tunnelId2 with device label store info
+        assertThat(tunnelId2, is(notNullValue()));
+        assertThat(distrPceStore.getTunnelInfo(tunnelId2), is(lspLocalLabelInfoList2));
+    }
+
+    /**
+     * 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/protocols/pcep/ctl/src/test/java/org/onosproject/pcelabelstore/label/BasicPceccHandlerTest.java b/protocols/pcep/ctl/src/test/java/org/onosproject/pcelabelstore/label/BasicPceccHandlerTest.java
new file mode 100644
index 0000000..aa8481e
--- /dev/null
+++ b/protocols/pcep/ctl/src/test/java/org/onosproject/pcelabelstore/label/BasicPceccHandlerTest.java
@@ -0,0 +1,329 @@
+/*
+ * 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.pcelabelstore.label;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.notNullValue;
+import static org.hamcrest.Matchers.nullValue;
+import static org.onosproject.net.Link.Type.DIRECT;
+import java.util.Iterator;
+import java.util.List;
+import java.util.LinkedList;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.onlab.packet.IpAddress;
+import org.onosproject.core.DefaultGroupId;
+import org.onosproject.incubator.net.tunnel.Tunnel;
+import org.onosproject.incubator.net.tunnel.TunnelEndPoint;
+import org.onosproject.incubator.net.tunnel.IpTunnelEndPoint;
+import org.onosproject.incubator.net.tunnel.TunnelName;
+import org.onosproject.incubator.net.tunnel.TunnelId;
+import org.onosproject.incubator.net.tunnel.DefaultTunnel;
+import org.onosproject.incubator.net.resource.label.LabelResourceId;
+import org.onosproject.incubator.net.resource.label.LabelResourceService;
+import org.onosproject.net.AnnotationKeys;
+import org.onosproject.net.Annotations;
+import org.onosproject.net.ConnectPoint;
+import org.onosproject.net.DefaultAnnotations;
+import org.onosproject.net.DefaultDevice;
+import org.onosproject.net.DefaultPath;
+import org.onosproject.net.Device;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.PortNumber;
+import org.onosproject.net.Path;
+import org.onosproject.net.provider.ProviderId;
+import org.onosproject.pcelabelstore.api.LspLocalLabelInfo;
+import org.onosproject.pcelabelstore.api.PceLabelStore;
+import org.onosproject.pcelabelstore.util.LabelResourceAdapter;
+import org.onosproject.pcelabelstore.util.MockDeviceService;
+import org.onosproject.pcelabelstore.util.PceLabelStoreAdapter;
+import org.onosproject.pcep.controller.impl.BasicPceccHandler;
+import org.onosproject.pcep.controller.impl.PcepClientControllerImpl;
+import org.onosproject.net.DefaultLink;
+import org.onosproject.net.Link;
+
+/**
+ * Unit tests for BasicPceccHandler class.
+ */
+public class BasicPceccHandlerTest {
+
+    public static final long LOCAL_LABEL_SPACE_MIN = 5122;
+    public static final long LOCAL_LABEL_SPACE_MAX = 9217;
+    private static final String L3 = "L3";
+    private static final String LSRID = "lsrId";
+
+    private BasicPceccHandler pceccHandler;
+    protected LabelResourceService labelRsrcService;
+    protected MockDeviceService deviceService;
+    protected PceLabelStore pceStore;
+    private TunnelEndPoint src = IpTunnelEndPoint.ipTunnelPoint(IpAddress.valueOf(23423));
+    private TunnelEndPoint dst = IpTunnelEndPoint.ipTunnelPoint(IpAddress.valueOf(32421));
+    private DefaultGroupId groupId = new DefaultGroupId(92034);
+    private TunnelName tunnelName = TunnelName.tunnelName("TunnelName");
+    private TunnelId tunnelId = TunnelId.valueOf("41654654");
+    private ProviderId producerName = new ProviderId("producer1", "13");
+    private Path path;
+    private Tunnel tunnel;
+    List<LspLocalLabelInfo> lspLocalLabelInfoList;
+    private Device deviceD1, deviceD2, deviceD3, deviceD4, deviceD5;
+    private DeviceId deviceId1;
+    private DeviceId deviceId2;
+    private DeviceId deviceId3;
+    private DeviceId deviceId4;
+    private DeviceId deviceId5;
+    private PortNumber port1;
+    private PortNumber port2;
+    private PortNumber port3;
+    private PortNumber port4;
+    private PortNumber port5;
+
+    @Before
+    public void setUp() throws Exception {
+       pceccHandler = BasicPceccHandler.getInstance();
+       labelRsrcService = new LabelResourceAdapter();
+       pceStore = new PceLabelStoreAdapter();
+       deviceService = new MockDeviceService();
+       pceccHandler.initialize(labelRsrcService,
+                              deviceService,
+                              pceStore,
+                              new PcepClientControllerImpl());
+
+       // Create tunnel test
+       // Link
+       ProviderId providerId = new ProviderId("of", "foo");
+       deviceId1 = DeviceId.deviceId("of:A");
+       deviceId2 = DeviceId.deviceId("of:B");
+       deviceId3 = DeviceId.deviceId("of:C");
+       deviceId4 = DeviceId.deviceId("of:D");
+       deviceId5 = DeviceId.deviceId("of:E");
+       port1 = PortNumber.portNumber(1);
+       port2 = PortNumber.portNumber(2);
+       port3 = PortNumber.portNumber(3);
+       port4 = PortNumber.portNumber(4);
+       port5 = PortNumber.portNumber(5);
+       List<Link> linkList = new LinkedList<>();
+
+       // Making L3 devices
+       DefaultAnnotations.Builder builderDev1 = DefaultAnnotations.builder();
+       builderDev1.set(AnnotationKeys.TYPE, L3);
+       builderDev1.set(LSRID, "1.1.1.1");
+       deviceD1 = new MockDevice(deviceId1, builderDev1.build());
+       deviceService.addDevice(deviceD1);
+
+       // Making L3 devices
+       DefaultAnnotations.Builder builderDev2 = DefaultAnnotations.builder();
+       builderDev2.set(AnnotationKeys.TYPE, L3);
+       builderDev2.set(LSRID, "2.2.2.2");
+       deviceD2 = new MockDevice(deviceId2, builderDev2.build());
+       deviceService.addDevice(deviceD2);
+
+       // Making L3 devices
+       DefaultAnnotations.Builder builderDev3 = DefaultAnnotations.builder();
+       builderDev3.set(AnnotationKeys.TYPE, L3);
+       builderDev3.set(LSRID, "3.3.3.3");
+       deviceD3 = new MockDevice(deviceId3, builderDev3.build());
+       deviceService.addDevice(deviceD3);
+
+       // Making L3 devices
+       DefaultAnnotations.Builder builderDev4 = DefaultAnnotations.builder();
+       builderDev4.set(AnnotationKeys.TYPE, L3);
+       builderDev4.set(LSRID, "4.4.4.4");
+       deviceD4 = new MockDevice(deviceId4, builderDev4.build());
+       deviceService.addDevice(deviceD4);
+
+       // Making L3 devices
+       DefaultAnnotations.Builder builderDev5 = DefaultAnnotations.builder();
+       builderDev5.set(AnnotationKeys.TYPE, L3);
+       builderDev5.set(LSRID, "5.5.5.5");
+       deviceD5 = new MockDevice(deviceId5, builderDev5.build());
+       deviceService.addDevice(deviceD5);
+
+       Link l1 = DefaultLink.builder()
+                            .providerId(providerId)
+                            .annotations(DefaultAnnotations.builder().set("key1", "yahoo").build())
+                            .src(new ConnectPoint(deviceId1, port1))
+                            .dst(new ConnectPoint(deviceId2, port2))
+                            .type(DIRECT)
+                            .state(Link.State.ACTIVE)
+                            .build();
+       linkList.add(l1);
+       Link l2 = DefaultLink.builder()
+                            .providerId(providerId)
+                            .annotations(DefaultAnnotations.builder().set("key2", "yahoo").build())
+                            .src(new ConnectPoint(deviceId2, port2))
+                            .dst(new ConnectPoint(deviceId3, port3))
+                            .type(DIRECT)
+                            .state(Link.State.ACTIVE)
+                            .build();
+       linkList.add(l2);
+       Link l3 = DefaultLink.builder()
+                            .providerId(providerId)
+                            .annotations(DefaultAnnotations.builder().set("key3", "yahoo").build())
+                            .src(new ConnectPoint(deviceId3, port3))
+                            .dst(new ConnectPoint(deviceId4, port4))
+                            .type(DIRECT)
+                            .state(Link.State.ACTIVE)
+                            .build();
+       linkList.add(l3);
+       Link l4 = DefaultLink.builder()
+                            .providerId(providerId)
+                            .annotations(DefaultAnnotations.builder().set("key4", "yahoo").build())
+                            .src(new ConnectPoint(deviceId4, port4))
+                            .dst(new ConnectPoint(deviceId5, port5))
+                            .type(DIRECT)
+                            .state(Link.State.ACTIVE)
+                            .build();
+       linkList.add(l4);
+
+       // Path
+       path = new DefaultPath(providerId, linkList, 10);
+
+       // Tunnel
+       tunnel = new DefaultTunnel(producerName, src, dst, Tunnel.Type.VXLAN,
+                                  Tunnel.State.ACTIVE, groupId, tunnelId,
+                                  tunnelName, path);
+    }
+
+    @After
+    public void tearDown() throws Exception {
+    }
+
+    /**
+     * Checks the operation of getInstance() method.
+     */
+    @Test
+    public void testGetInstance() {
+        assertThat(pceccHandler, is(notNullValue()));
+    }
+
+    /**
+     * Checks the operation of allocateLabel() method.
+     */
+    @Test
+    public void testAllocateLabel() {
+       Iterator<LspLocalLabelInfo> iterator;
+       LspLocalLabelInfo lspLocalLabelInfo;
+       DeviceId deviceId;
+       LabelResourceId inLabelId;
+       LabelResourceId outLabelId;
+       PortNumber inPort;
+       PortNumber outPort;
+
+       // check allocation result
+       assertThat(pceccHandler.allocateLabel(tunnel), is(true));
+
+       // Check list of devices with IN and OUT labels whether stored properly in store
+       lspLocalLabelInfoList = pceStore.getTunnelInfo(tunnel.tunnelId());
+       iterator = lspLocalLabelInfoList.iterator();
+
+       // Retrieve values and check device5
+       lspLocalLabelInfo = iterator.next();
+       deviceId = lspLocalLabelInfo.deviceId();
+       inLabelId = lspLocalLabelInfo.inLabelId();
+       outLabelId = lspLocalLabelInfo.outLabelId();
+       inPort = lspLocalLabelInfo.inPort();
+       outPort = lspLocalLabelInfo.outPort();
+
+       assertThat(deviceId, is(deviceId5));
+       assertThat(inLabelId, is(notNullValue()));
+       assertThat(outLabelId, is(nullValue()));
+       assertThat(inPort, is(port5));
+       assertThat(outPort, is(nullValue()));
+
+       // Next element check
+       // Retrieve values and check device4
+       lspLocalLabelInfo = iterator.next();
+       deviceId = lspLocalLabelInfo.deviceId();
+       inLabelId = lspLocalLabelInfo.inLabelId();
+       outLabelId = lspLocalLabelInfo.outLabelId();
+       inPort = lspLocalLabelInfo.inPort();
+       outPort = lspLocalLabelInfo.outPort();
+
+       assertThat(deviceId, is(deviceId4));
+       assertThat(inLabelId, is(notNullValue()));
+       assertThat(outLabelId, is(notNullValue()));
+       assertThat(inPort, is(port4));
+       assertThat(outPort, is(port5));
+
+       // Next element check
+       // Retrieve values and check device3
+       lspLocalLabelInfo = iterator.next();
+       deviceId = lspLocalLabelInfo.deviceId();
+       inLabelId = lspLocalLabelInfo.inLabelId();
+       outLabelId = lspLocalLabelInfo.outLabelId();
+       inPort = lspLocalLabelInfo.inPort();
+       outPort = lspLocalLabelInfo.outPort();
+
+       assertThat(deviceId, is(deviceId3));
+       assertThat(inLabelId, is(notNullValue()));
+       assertThat(outLabelId, is(notNullValue()));
+       assertThat(inPort, is(port3));
+       assertThat(outPort, is(port4));
+
+       // Next element check
+       // Retrieve values and check device2
+       lspLocalLabelInfo = iterator.next();
+       deviceId = lspLocalLabelInfo.deviceId();
+       inLabelId = lspLocalLabelInfo.inLabelId();
+       outLabelId = lspLocalLabelInfo.outLabelId();
+       inPort = lspLocalLabelInfo.inPort();
+       outPort = lspLocalLabelInfo.outPort();
+
+       assertThat(deviceId, is(deviceId2));
+       assertThat(inLabelId, is(notNullValue()));
+       assertThat(outLabelId, is(notNullValue()));
+       assertThat(inPort, is(port2));
+       assertThat(outPort, is(port3));
+
+       // Next element check
+       // Retrieve values and check device1
+       lspLocalLabelInfo = iterator.next();
+       deviceId = lspLocalLabelInfo.deviceId();
+       inLabelId = lspLocalLabelInfo.inLabelId();
+       outLabelId = lspLocalLabelInfo.outLabelId();
+       inPort = lspLocalLabelInfo.inPort();
+       outPort = lspLocalLabelInfo.outPort();
+
+       assertThat(deviceId, is(deviceId1));
+       assertThat(inLabelId, is(nullValue()));
+       assertThat(outLabelId, is(notNullValue()));
+       assertThat(inPort, is(nullValue()));
+       assertThat(outPort, is(port2));
+    }
+
+    /**
+     * Checks the operation of releaseLabel() method.
+     */
+    @Test
+    public void testReleaseLabel() {
+       // Release tunnels
+       assertThat(pceccHandler.allocateLabel(tunnel), is(true));
+       pceccHandler.releaseLabel(tunnel);
+
+       // Retrieve from store. Store should not contain this tunnel info.
+       lspLocalLabelInfoList = pceStore.getTunnelInfo(tunnel.tunnelId());
+       assertThat(lspLocalLabelInfoList, is(nullValue()));
+    }
+
+    private class MockDevice extends DefaultDevice {
+        MockDevice(DeviceId id, Annotations annotations) {
+            super(null, id, null, null, null, null, null, null, annotations);
+        }
+    }
+}
diff --git a/protocols/pcep/ctl/src/test/java/org/onosproject/pcelabelstore/label/PceccSrTeBeHandlerTest.java b/protocols/pcep/ctl/src/test/java/org/onosproject/pcelabelstore/label/PceccSrTeBeHandlerTest.java
new file mode 100644
index 0000000..4ea3248
--- /dev/null
+++ b/protocols/pcep/ctl/src/test/java/org/onosproject/pcelabelstore/label/PceccSrTeBeHandlerTest.java
@@ -0,0 +1,490 @@
+/*
+ * 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.pcelabelstore.label;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.notNullValue;
+import static org.hamcrest.Matchers.nullValue;
+import static org.onosproject.net.Link.Type.DIRECT;
+import java.util.Iterator;
+import java.util.List;
+import java.util.LinkedList;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.onlab.packet.IpAddress;
+import org.onosproject.incubator.net.resource.label.LabelResourceId;
+import org.onosproject.incubator.net.resource.label.LabelResourceAdminService;
+import org.onosproject.incubator.net.resource.label.LabelResourceService;
+import org.onosproject.incubator.net.tunnel.LabelStack;
+import org.onosproject.net.AnnotationKeys;
+import org.onosproject.net.Annotations;
+import org.onosproject.net.ConnectPoint;
+import org.onosproject.net.DefaultAnnotations;
+import org.onosproject.net.DefaultDevice;
+import org.onosproject.net.DefaultPath;
+import org.onosproject.net.Device;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.PortNumber;
+import org.onosproject.net.Path;
+import org.onosproject.net.provider.ProviderId;
+import org.onosproject.pcelabelstore.api.PceLabelStore;
+import org.onosproject.pcelabelstore.util.LabelResourceAdapter;
+import org.onosproject.pcelabelstore.util.MockDeviceService;
+import org.onosproject.pcelabelstore.util.MockNetConfigRegistryAdapter;
+import org.onosproject.pcelabelstore.util.MockPcepClientController;
+import org.onosproject.pcelabelstore.util.PceLabelStoreAdapter;
+import org.onosproject.pcelabelstore.util.PcepClientAdapter;
+import org.onosproject.pcep.api.DeviceCapability;
+import org.onosproject.pcep.controller.PccId;
+import org.onosproject.pcep.controller.impl.PceccSrTeBeHandler;
+import org.onosproject.pcepio.protocol.PcepVersion;
+import org.onosproject.net.DefaultLink;
+import org.onosproject.net.Link;
+
+/**
+ * Unit tests for PceccSrTeBeHandler class.
+ */
+public class PceccSrTeBeHandlerTest {
+
+    public static final long GLOBAL_LABEL_SPACE_MIN = 4097;
+    public static final long GLOBAL_LABEL_SPACE_MAX = 5121;
+    private static final String L3 = "L3";
+    private static final String LSRID = "lsrId";
+
+    private PceccSrTeBeHandler srTeHandler;
+    private LabelResourceAdminService labelRsrcAdminService;
+    private LabelResourceService labelRsrcService;
+    private PceLabelStore pceStore;
+    private MockDeviceService deviceService;
+    private MockNetConfigRegistryAdapter netCfgService = new MockNetConfigRegistryAdapter();
+    private MockPcepClientController clientController = new MockPcepClientController();
+    private ProviderId providerId;
+    private DeviceId deviceId1, deviceId2, deviceId3, deviceId4, deviceId5;
+    private Device deviceD1;
+    private Device deviceD2;
+    private Device deviceD3;
+    private Device deviceD4;
+    private Device deviceD5;
+    private PortNumber port1;
+    private PortNumber port2;
+    private PortNumber port3;
+    private PortNumber port4;
+    private PortNumber port5;
+    private Link link1;
+    private Link link2;
+    private Link link3;
+    private Link link4;
+    private Path path1;
+    LabelResourceId labelId;
+
+    @Before
+    public void setUp() throws Exception {
+        // Initialization of member variables
+        srTeHandler = PceccSrTeBeHandler.getInstance();
+        labelRsrcService = new LabelResourceAdapter();
+        labelRsrcAdminService = new LabelResourceAdapter();
+        pceStore = new PceLabelStoreAdapter();
+        deviceService = new MockDeviceService();
+
+        srTeHandler.initialize(labelRsrcAdminService,
+                               labelRsrcService,
+                               clientController,
+                               pceStore,
+                               deviceService);
+
+        // Creates path
+        // Creates list of links
+        providerId = new ProviderId("of", "foo");
+
+        PccId pccId1 = PccId.pccId(IpAddress.valueOf("11.1.1.1"));
+        PccId pccId2 = PccId.pccId(IpAddress.valueOf("12.1.1.1"));
+        PccId pccId3 = PccId.pccId(IpAddress.valueOf("13.1.1.1"));
+        PccId pccId4 = PccId.pccId(IpAddress.valueOf("14.1.1.1"));
+        PccId pccId5 = PccId.pccId(IpAddress.valueOf("15.1.1.1"));
+
+        PcepClientAdapter pc1 = new PcepClientAdapter();
+        pc1.init(pccId1, PcepVersion.PCEP_1);
+
+        PcepClientAdapter pc2 = new PcepClientAdapter();
+        pc2.init(pccId2, PcepVersion.PCEP_1);
+
+        PcepClientAdapter pc3 = new PcepClientAdapter();
+        pc3.init(pccId3, PcepVersion.PCEP_1);
+
+        PcepClientAdapter pc4 = new PcepClientAdapter();
+        pc4.init(pccId4, PcepVersion.PCEP_1);
+
+        PcepClientAdapter pc5 = new PcepClientAdapter();
+        pc5.init(pccId5, PcepVersion.PCEP_1);
+
+        clientController.addClient(pccId1, pc1);
+        clientController.addClient(pccId2, pc2);
+        clientController.addClient(pccId3, pc3);
+        clientController.addClient(pccId4, pc4);
+        clientController.addClient(pccId5, pc5);
+
+        deviceId1 = DeviceId.deviceId("11.1.1.1");
+        deviceId2 = DeviceId.deviceId("12.1.1.1");
+        deviceId3 = DeviceId.deviceId("13.1.1.1");
+        deviceId4 = DeviceId.deviceId("14.1.1.1");
+        deviceId5 = DeviceId.deviceId("15.1.1.1");
+
+        // Devices
+        DefaultAnnotations.Builder builderDev1 = DefaultAnnotations.builder();
+        DefaultAnnotations.Builder builderDev2 = DefaultAnnotations.builder();
+        DefaultAnnotations.Builder builderDev3 = DefaultAnnotations.builder();
+        DefaultAnnotations.Builder builderDev4 = DefaultAnnotations.builder();
+        DefaultAnnotations.Builder builderDev5 = DefaultAnnotations.builder();
+
+        builderDev1.set(AnnotationKeys.TYPE, L3);
+        builderDev1.set(LSRID, "11.1.1.1");
+
+        builderDev2.set(AnnotationKeys.TYPE, L3);
+        builderDev2.set(LSRID, "12.1.1.1");
+
+        builderDev3.set(AnnotationKeys.TYPE, L3);
+        builderDev3.set(LSRID, "13.1.1.1");
+
+        builderDev4.set(AnnotationKeys.TYPE, L3);
+        builderDev4.set(LSRID, "14.1.1.1");
+
+        builderDev5.set(AnnotationKeys.TYPE, L3);
+        builderDev5.set(LSRID, "15.1.1.1");
+
+        deviceD1 = new MockDevice(deviceId1, builderDev1.build());
+        deviceD2 = new MockDevice(deviceId2, builderDev2.build());
+        deviceD3 = new MockDevice(deviceId3, builderDev3.build());
+        deviceD4 = new MockDevice(deviceId4, builderDev4.build());
+        deviceD5 = new MockDevice(deviceId5, builderDev5.build());
+
+        deviceService.addDevice(deviceD1);
+        deviceService.addDevice(deviceD2);
+        deviceService.addDevice(deviceD3);
+        deviceService.addDevice(deviceD4);
+        deviceService.addDevice(deviceD5);
+
+        DeviceCapability device1Cap = netCfgService.addConfig(deviceId1, DeviceCapability.class);
+        device1Cap.setLabelStackCap(true).setLocalLabelCap(false).setSrCap(true).apply();
+
+        DeviceCapability device2Cap = netCfgService.addConfig(deviceId2, DeviceCapability.class);
+        device2Cap.setLabelStackCap(true).setLocalLabelCap(false).setSrCap(true).apply();
+
+        DeviceCapability device3Cap = netCfgService.addConfig(deviceId3, DeviceCapability.class);
+        device3Cap.setLabelStackCap(true).setLocalLabelCap(false).setSrCap(true).apply();
+
+        DeviceCapability device4Cap = netCfgService.addConfig(deviceId4, DeviceCapability.class);
+        device4Cap.setLabelStackCap(true).setLocalLabelCap(false).setSrCap(true).apply();
+
+        DeviceCapability device5Cap = netCfgService.addConfig(deviceId5, DeviceCapability.class);
+        device5Cap.setLabelStackCap(true).setLocalLabelCap(false).setSrCap(true).apply();
+
+        // Port Numbers
+        port1 = PortNumber.portNumber(1);
+        port2 = PortNumber.portNumber(2);
+        port3 = PortNumber.portNumber(3);
+        port4 = PortNumber.portNumber(4);
+        port5 = PortNumber.portNumber(5);
+        List<Link> linkList = new LinkedList<>();
+
+        link1 = DefaultLink.builder().providerId(providerId)
+                .annotations(DefaultAnnotations.builder().set("key1", "yahoo").build())
+                .src(new ConnectPoint(deviceD1.id(), port1)).dst(new ConnectPoint(deviceD2.id(), port2)).type(DIRECT)
+                .state(Link.State.ACTIVE).build();
+        linkList.add(link1);
+        link2 = DefaultLink.builder().providerId(providerId)
+                .annotations(DefaultAnnotations.builder().set("key2", "yahoo").build())
+                .src(new ConnectPoint(deviceD2.id(), port2)).dst(new ConnectPoint(deviceD3.id(), port3)).type(DIRECT)
+                .state(Link.State.ACTIVE).build();
+        linkList.add(link2);
+        link3 = DefaultLink.builder().providerId(providerId)
+                .annotations(DefaultAnnotations.builder().set("key3", "yahoo").build())
+                .src(new ConnectPoint(deviceD3.id(), port3)).dst(new ConnectPoint(deviceD4.id(), port4)).type(DIRECT)
+                .state(Link.State.ACTIVE).build();
+        linkList.add(link3);
+        link4 = DefaultLink.builder().providerId(providerId)
+                .annotations(DefaultAnnotations.builder().set("key4", "yahoo").build())
+                .src(new ConnectPoint(deviceD4.id(), port4)).dst(new ConnectPoint(deviceD5.id(), port5)).type(DIRECT)
+                .state(Link.State.ACTIVE).build();
+        linkList.add(link4);
+
+        // Path
+        path1 = new DefaultPath(providerId, linkList, 10);
+    }
+
+    @After
+    public void tearDown() throws Exception {
+    }
+
+    /**
+     * Checks the operation of getInstance() method.
+     */
+    @Test
+    public void testGetInstance() {
+        assertThat(srTeHandler, is(notNullValue()));
+    }
+
+    /**
+     * Checks the operation of reserveGlobalPool() method.
+     */
+    @Test
+    public void testReserveGlobalPool() {
+        assertThat(srTeHandler.reserveGlobalPool(GLOBAL_LABEL_SPACE_MIN, GLOBAL_LABEL_SPACE_MAX), is(true));
+    }
+
+    /**
+     * Checks the operation of allocateNodeLabel() method on node label.
+     */
+    @Test
+    public void testAllocateNodeLabel() {
+        // Specific device D1.deviceId
+
+        //device 1
+        String lsrId1 = "11.1.1.1";
+        // Allocate node label for specific device D1deviceId
+        assertThat(srTeHandler.allocateNodeLabel(deviceId1, lsrId1), is(true));
+        // Retrieve label from store
+        LabelResourceId labelId = pceStore.getGlobalNodeLabel(deviceId1);
+        // Check whether label is generated for this device D1.deviceId()
+        assertThat(labelId, is(notNullValue()));
+
+        // device 2
+        String lsrId2 = "12.1.1.1";
+        // Allocate node label for specific device D2.deviceId()
+        assertThat(srTeHandler.allocateNodeLabel(deviceId2, lsrId2), is(true));
+        // Retrieve label from store
+        labelId = pceStore.getGlobalNodeLabel(deviceId2);
+        // Check whether label is generated for this device D2.deviceId()
+        assertThat(labelId, is(notNullValue()));
+
+        // device 3
+        String lsrId3 = "13.1.1.1";
+        // Allocate node label for specific device D3.deviceId()
+        assertThat(srTeHandler.allocateNodeLabel(deviceId3, lsrId3), is(true));
+        // Retrieve label from store
+        labelId = pceStore.getGlobalNodeLabel(deviceId3);
+        // Check whether label is generated for this device D3.deviceId()
+        assertThat(labelId, is(notNullValue()));
+
+        // device 4
+        String lsrId4 = "14.1.1.1";
+        // Allocate node label for specific device D4.deviceId()
+        assertThat(srTeHandler.allocateNodeLabel(deviceId4, lsrId4), is(true));
+        // Retrieve label from store
+        labelId = pceStore.getGlobalNodeLabel(deviceId4);
+        // Check whether label is generated for this device D4.deviceId()
+        assertThat(labelId, is(notNullValue()));
+
+        // device 5
+        String lsrId5 = "15.1.1.1";
+        // Allocate node label for specific device D5.deviceId()
+        assertThat(srTeHandler.allocateNodeLabel(deviceId5, lsrId5), is(true));
+        // Retrieve label from store
+        labelId = pceStore.getGlobalNodeLabel(deviceId5);
+        // Check whether label is generated for this device D5.deviceId()
+        assertThat(labelId, is(notNullValue()));
+    }
+
+    /**
+     * Checks the operation of releaseNodeLabel() method on node label.
+     */
+    @Test
+    public void testReleaseNodeLabelSuccess() {
+        testAllocateNodeLabel();
+        // Specific device D1.deviceId()
+
+        //device 1
+        String lsrId1 = "11.1.1.1";
+        // Check whether successfully released node label
+        assertThat(srTeHandler.releaseNodeLabel(deviceId1, lsrId1), is(true));
+        // Check whether successfully removed label from store
+        LabelResourceId labelId = pceStore.getGlobalNodeLabel(deviceId1);
+        assertThat(labelId, is(nullValue()));
+
+        //device 2
+        String lsrId2 = "12.1.1.1";
+        // Check whether successfully released node label
+        assertThat(srTeHandler.releaseNodeLabel(deviceId2, lsrId2), is(true));
+        // Check whether successfully removed label from store
+        labelId = pceStore.getGlobalNodeLabel(deviceId2);
+        assertThat(labelId, is(nullValue()));
+
+        //device 3
+        String lsrId3 = "13.1.1.1";
+        // Check whether successfully released node label
+        assertThat(srTeHandler.releaseNodeLabel(deviceId3, lsrId3), is(true));
+        // Check whether successfully removed label from store
+        labelId = pceStore.getGlobalNodeLabel(deviceId3);
+        assertThat(labelId, is(nullValue()));
+
+        //device 4
+        String lsrId4 = "14.1.1.1";
+        // Check whether successfully released node label
+        assertThat(srTeHandler.releaseNodeLabel(deviceId4, lsrId4), is(true));
+        // Check whether successfully removed label from store
+        labelId = pceStore.getGlobalNodeLabel(deviceId4);
+        assertThat(labelId, is(nullValue()));
+
+        //device 5
+        String lsrId5 = "15.1.1.1";
+        // Check whether successfully released node label
+        assertThat(srTeHandler.releaseNodeLabel(deviceId5, lsrId5), is(true));
+        // Check whether successfully removed label from store
+        labelId = pceStore.getGlobalNodeLabel(deviceId5);
+        assertThat(labelId, is(nullValue()));
+    }
+
+    @Test
+    public void testReleaseNodeLabelFailure() {
+        testAllocateNodeLabel();
+
+        //device 6
+        String lsrId6 = "16.1.1.1";
+        // Check whether successfully released node label
+        DeviceId deviceId6 = DeviceId.deviceId("foo6");
+        assertThat(srTeHandler.releaseNodeLabel(deviceId6, lsrId6), is(false));
+    }
+
+    /**
+     * Checks the operation of allocateAdjacencyLabel() method on adjacency label.
+     */
+    @Test
+    public void testAllocateAdjacencyLabel() {
+        // test link1
+        // Check whether adjacency label is allocated successfully.
+        assertThat(srTeHandler.allocateAdjacencyLabel(link1), is(true));
+        // Retrieve from store and check whether adjacency label is generated successfully for this device.
+        LabelResourceId labelId = pceStore.getAdjLabel(link1);
+        assertThat(labelId, is(notNullValue()));
+
+        // test link2
+        // Check whether adjacency label is allocated successfully.
+        assertThat(srTeHandler.allocateAdjacencyLabel(link2), is(true));
+        // Retrieve from store and check whether adjacency label is generated successfully for this device.
+        labelId = pceStore.getAdjLabel(link2);
+        assertThat(labelId, is(notNullValue()));
+
+        // test link3
+        // Check whether adjacency label is allocated successfully.
+        assertThat(srTeHandler.allocateAdjacencyLabel(link3), is(true));
+        // Retrieve from store and check whether adjacency label is generated successfully for this device.
+        labelId = pceStore.getAdjLabel(link3);
+        assertThat(labelId, is(notNullValue()));
+
+        // test link4
+        // Check whether adjacency label is allocated successfully.
+        assertThat(srTeHandler.allocateAdjacencyLabel(link4), is(true));
+        // Retrieve from store and check whether adjacency label is generated successfully for this device.
+        labelId = pceStore.getAdjLabel(link4);
+        assertThat(labelId, is(notNullValue()));
+    }
+
+    /**
+     * Checks the operation of releaseAdjacencyLabel() method on adjacency label.
+     */
+    @Test
+    public void testReleaseAdjacencyLabel() {
+        // Test link1
+        // Check whether adjacency label is released successfully.
+        assertThat(srTeHandler.allocateAdjacencyLabel(link1), is(true));
+        assertThat(srTeHandler.releaseAdjacencyLabel(link1), is(true));
+        // Retrieve from store and check whether adjacency label is removed successfully for this device.
+        LabelResourceId labelId = pceStore.getAdjLabel(link1);
+        assertThat(labelId, is(nullValue()));
+
+        // Test link2
+        // Check whether adjacency label is released successfully.
+        assertThat(srTeHandler.allocateAdjacencyLabel(link2), is(true));
+        assertThat(srTeHandler.releaseAdjacencyLabel(link2), is(true));
+        // Retrieve from store and check whether adjacency label is removed successfully for this device.
+        labelId = pceStore.getAdjLabel(link2);
+        assertThat(labelId, is(nullValue()));
+    }
+
+    /**
+     * Checks the operation of computeLabelStack() method.
+     */
+    @Test
+    public void testComputeLabelStack() {
+        // Allocate node labels to each devices
+        labelId = LabelResourceId.labelResourceId(4097);
+        pceStore.addGlobalNodeLabel(deviceId1, labelId);
+        labelId = LabelResourceId.labelResourceId(4098);
+        pceStore.addGlobalNodeLabel(deviceId2, labelId);
+        labelId = LabelResourceId.labelResourceId(4099);
+        pceStore.addGlobalNodeLabel(deviceId3, labelId);
+        labelId = LabelResourceId.labelResourceId(4100);
+        pceStore.addGlobalNodeLabel(deviceId4, labelId);
+        labelId = LabelResourceId.labelResourceId(4101);
+        pceStore.addGlobalNodeLabel(deviceId5, labelId);
+
+        // Allocate adjacency labels to each devices
+        labelId = LabelResourceId.labelResourceId(5122);
+        pceStore.addAdjLabel(link1, labelId);
+        labelId = LabelResourceId.labelResourceId(5123);
+        pceStore.addAdjLabel(link2, labelId);
+        labelId = LabelResourceId.labelResourceId(5124);
+        pceStore.addAdjLabel(link3, labelId);
+        labelId = LabelResourceId.labelResourceId(5125);
+        pceStore.addAdjLabel(link4, labelId);
+
+        // Compute label stack
+        LabelStack labelStack = srTeHandler.computeLabelStack(path1);
+
+        List<LabelResourceId> labelList = labelStack.labelResources();
+        Iterator<LabelResourceId> iterator = labelList.iterator();
+
+        // check adjacency label of D1.deviceId()
+        labelId = iterator.next();
+        assertThat(labelId, is(LabelResourceId.labelResourceId(5122)));
+
+        // check node-label of D2.deviceId()
+        labelId = iterator.next();
+        assertThat(labelId, is(LabelResourceId.labelResourceId(4098)));
+
+        // check adjacency label of D2.deviceId()
+        labelId = iterator.next();
+        assertThat(labelId, is(LabelResourceId.labelResourceId(5123)));
+
+        // check node-label of D3.deviceId()
+        labelId = iterator.next();
+        assertThat(labelId, is(LabelResourceId.labelResourceId(4099)));
+
+        // check adjacency label of D3.deviceId()
+        labelId = iterator.next();
+        assertThat(labelId, is(LabelResourceId.labelResourceId(5124)));
+
+        // check node-label of D4.deviceId()
+        labelId = iterator.next();
+        assertThat(labelId, is(LabelResourceId.labelResourceId(4100)));
+
+        // check adjacency label of D4.deviceId()
+        labelId = iterator.next();
+        assertThat(labelId, is(LabelResourceId.labelResourceId(5125)));
+
+        // check node-label of D5.deviceId()
+        labelId = iterator.next();
+        assertThat(labelId, is(LabelResourceId.labelResourceId(4101)));
+    }
+
+    private class MockDevice extends DefaultDevice {
+        MockDevice(DeviceId id, Annotations annotations) {
+            super(null, id, null, null, null, null, null, null, annotations);
+        }
+    }
+}
diff --git a/protocols/pcep/ctl/src/test/java/org/onosproject/pcelabelstore/util/ConsistentMapAdapter.java b/protocols/pcep/ctl/src/test/java/org/onosproject/pcelabelstore/util/ConsistentMapAdapter.java
new file mode 100644
index 0000000..f7a5b5a
--- /dev/null
+++ b/protocols/pcep/ctl/src/test/java/org/onosproject/pcelabelstore/util/ConsistentMapAdapter.java
@@ -0,0 +1,171 @@
+/*
+ * Copyright 2015-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.pcelabelstore.util;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.Executor;
+import java.util.function.BiFunction;
+import java.util.function.Function;
+import java.util.function.Predicate;
+
+import org.onosproject.store.service.ConsistentMap;
+import org.onosproject.store.service.DistributedPrimitive;
+import org.onosproject.store.service.MapEventListener;
+import org.onosproject.store.service.Versioned;
+
+/**
+ * Testing adapter for the consistent map.
+ */
+public class ConsistentMapAdapter<K, V> implements ConsistentMap<K, V> {
+
+    @Override
+    public String name() {
+        return null;
+    }
+
+    @Override
+    public DistributedPrimitive.Type primitiveType() {
+        return DistributedPrimitive.Type.CONSISTENT_MAP;
+    }
+
+    @Override
+    public int size() {
+        return 0;
+    }
+
+    @Override
+    public boolean isEmpty() {
+        return false;
+    }
+
+    @Override
+    public boolean containsKey(K key) {
+        return false;
+    }
+
+    @Override
+    public boolean containsValue(V value) {
+        return false;
+    }
+
+    @Override
+    public Versioned<V> get(K key) {
+        return null;
+    }
+
+    @Override
+    public Versioned<V> computeIfAbsent(K key, Function<? super K, ? extends V> mappingFunction) {
+        return null;
+    }
+
+    @Override
+    public Versioned<V> compute(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) {
+        return null;
+    }
+
+    @Override
+    public Versioned<V> computeIfPresent(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) {
+        return null;
+    }
+
+    @Override
+    public Versioned<V> computeIf(K key, Predicate<? super V> condition,
+                                  BiFunction<? super K, ? super V, ? extends V> remappingFunction) {
+        return null;
+    }
+
+    @Override
+    public Versioned<V> put(K key, V value) {
+        return null;
+    }
+
+    @Override
+    public Versioned<V> putAndGet(K key, V value) {
+        return null;
+    }
+
+    @Override
+    public Versioned<V> remove(K key) {
+        return null;
+    }
+
+    @Override
+    public void clear() {
+
+    }
+
+    @Override
+    public Set<K> keySet() {
+        return null;
+    }
+
+    @Override
+    public Collection<Versioned<V>> values() {
+        return null;
+    }
+
+    @Override
+    public Set<Map.Entry<K, Versioned<V>>> entrySet() {
+        return null;
+    }
+
+    @Override
+    public Versioned<V> putIfAbsent(K key, V value) {
+        return null;
+    }
+
+    @Override
+    public boolean remove(K key, V value) {
+        return false;
+    }
+
+    @Override
+    public boolean remove(K key, long version) {
+        return false;
+    }
+
+    @Override
+    public Versioned replace(K key, V value) {
+        return null;
+    }
+
+    @Override
+    public boolean replace(K key, V oldValue, V newValue) {
+        return false;
+    }
+
+    @Override
+    public boolean replace(K key, long oldVersion, V newValue) {
+        return false;
+    }
+
+    @Override
+    public void addListener(MapEventListener<K, V> listener, Executor executor) {
+
+    }
+
+    @Override
+    public void removeListener(MapEventListener<K, V> listener) {
+
+    }
+
+    @Override
+    public Map<K, V> asJavaMap() {
+        return null;
+    }
+}
diff --git a/protocols/pcep/ctl/src/test/java/org/onosproject/pcelabelstore/util/DistributedSetAdapter.java b/protocols/pcep/ctl/src/test/java/org/onosproject/pcelabelstore/util/DistributedSetAdapter.java
new file mode 100644
index 0000000..f798a4f
--- /dev/null
+++ b/protocols/pcep/ctl/src/test/java/org/onosproject/pcelabelstore/util/DistributedSetAdapter.java
@@ -0,0 +1,99 @@
+/*
+ * 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.pcelabelstore.util;
+
+import java.util.Collection;
+import java.util.Set;
+import java.util.concurrent.CompletableFuture;
+
+import org.onosproject.store.service.AsyncDistributedSet;
+import org.onosproject.store.service.SetEventListener;
+
+/**
+ * Testing adapter for the distributed set.
+ */
+public class DistributedSetAdapter<E> implements AsyncDistributedSet<E> {
+    @Override
+    public CompletableFuture<Void> addListener(SetEventListener<E> listener) {
+        return null;
+    }
+
+    @Override
+    public CompletableFuture<Void> removeListener(SetEventListener<E> listener) {
+        return null;
+    }
+
+    @Override
+    public CompletableFuture<Boolean> add(E element) {
+        return null;
+    }
+
+    @Override
+    public CompletableFuture<Boolean> remove(E element) {
+        return null;
+    }
+
+    @Override
+    public CompletableFuture<Integer> size() {
+        return null;
+    }
+
+    @Override
+    public CompletableFuture<Boolean> isEmpty() {
+        return null;
+    }
+
+    @Override
+    public CompletableFuture<Void> clear() {
+        return null;
+    }
+
+    @Override
+    public CompletableFuture<Boolean> contains(E element) {
+        return null;
+    }
+
+    @Override
+    public CompletableFuture<Boolean> addAll(Collection<? extends E> c) {
+        return null;
+    }
+
+    @Override
+    public CompletableFuture<Boolean> containsAll(Collection<? extends E> c) {
+        return null;
+    }
+
+    @Override
+    public CompletableFuture<Boolean> retainAll(Collection<? extends E> c) {
+        return null;
+    }
+
+    @Override
+    public CompletableFuture<Boolean> removeAll(Collection<? extends E> c) {
+        return null;
+    }
+
+    @Override
+    public CompletableFuture<? extends Set<E>> getAsImmutableSet() {
+        return null;
+    }
+
+    @Override
+    public String name() {
+        return null;
+    }
+}
diff --git a/protocols/pcep/ctl/src/test/java/org/onosproject/pcelabelstore/util/EventuallyConsistentMapAdapter.java b/protocols/pcep/ctl/src/test/java/org/onosproject/pcelabelstore/util/EventuallyConsistentMapAdapter.java
new file mode 100644
index 0000000..4524207
--- /dev/null
+++ b/protocols/pcep/ctl/src/test/java/org/onosproject/pcelabelstore/util/EventuallyConsistentMapAdapter.java
@@ -0,0 +1,126 @@
+/*
+ * Copyright 2015-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.pcelabelstore.util;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.CompletableFuture;
+import java.util.function.BiFunction;
+
+import org.onosproject.store.service.EventuallyConsistentMap;
+import org.onosproject.store.service.EventuallyConsistentMapListener;
+
+/**
+ * Testing adapter for EventuallyConsistentMap.
+ */
+public class EventuallyConsistentMapAdapter<K, V> implements EventuallyConsistentMap<K, V> {
+
+    @Override
+    public String name() {
+        return null;
+    }
+
+    @Override
+    public Type primitiveType() {
+        return Type.EVENTUALLY_CONSISTENT_MAP;
+    }
+
+    @Override
+    public int size() {
+        return 0;
+    }
+
+    @Override
+    public boolean isEmpty() {
+        return false;
+    }
+
+    @Override
+    public boolean containsKey(K key) {
+        return false;
+    }
+
+    @Override
+    public boolean containsValue(V value) {
+        return false;
+    }
+
+    @Override
+    public V get(K key) {
+        return null;
+    }
+
+    @Override
+    public void put(K key, V value) {
+
+    }
+
+    @Override
+    public V remove(K key) {
+        return null;
+    }
+
+    @Override
+    public void remove(K key, V value) {
+
+    }
+
+    @Override
+    public V compute(K key, BiFunction<K, V, V> recomputeFunction) {
+        return null;
+    }
+
+    @Override
+    public void putAll(Map<? extends K, ? extends V> m) {
+
+    }
+
+    @Override
+    public void clear() {
+
+    }
+
+    @Override
+    public Set<K> keySet() {
+        return null;
+    }
+
+    @Override
+    public Collection<V> values() {
+        return null;
+    }
+
+    @Override
+    public Set<Map.Entry<K, V>> entrySet() {
+        return null;
+    }
+
+    @Override
+    public void addListener(EventuallyConsistentMapListener<K, V> listener) {
+
+    }
+
+    @Override
+    public void removeListener(EventuallyConsistentMapListener<K, V> listener) {
+
+    }
+
+    @Override
+    public CompletableFuture<Void> destroy() {
+        return CompletableFuture.completedFuture(null);
+    }
+}
diff --git a/protocols/pcep/ctl/src/test/java/org/onosproject/pcelabelstore/util/LabelResourceAdapter.java b/protocols/pcep/ctl/src/test/java/org/onosproject/pcelabelstore/util/LabelResourceAdapter.java
new file mode 100644
index 0000000..ec21c2c
--- /dev/null
+++ b/protocols/pcep/ctl/src/test/java/org/onosproject/pcelabelstore/util/LabelResourceAdapter.java
@@ -0,0 +1,197 @@
+/*
+ * 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.pcelabelstore.util;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.Random;
+import java.util.Set;
+
+import org.onosproject.incubator.net.resource.label.DefaultLabelResource;
+import org.onosproject.incubator.net.resource.label.LabelResource;
+import org.onosproject.incubator.net.resource.label.LabelResourceAdminService;
+import org.onosproject.incubator.net.resource.label.LabelResourceDelegate;
+import org.onosproject.incubator.net.resource.label.LabelResourceEvent;
+import org.onosproject.incubator.net.resource.label.LabelResourceId;
+import org.onosproject.incubator.net.resource.label.LabelResourceListener;
+import org.onosproject.incubator.net.resource.label.LabelResourcePool;
+import org.onosproject.incubator.net.resource.label.LabelResourceProvider;
+import org.onosproject.incubator.net.resource.label.LabelResourceProviderRegistry;
+import org.onosproject.incubator.net.resource.label.LabelResourceProviderService;
+import org.onosproject.incubator.net.resource.label.LabelResourceService;
+import org.onosproject.net.Device;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.device.DeviceEvent;
+import org.onosproject.net.device.DeviceEvent.Type;
+import org.onosproject.net.device.DeviceListener;
+import org.onosproject.net.provider.AbstractListenerProviderRegistry;
+import org.onosproject.net.provider.AbstractProviderService;
+
+import com.google.common.collect.Multimap;
+
+/**
+ * Provides test implementation of class LabelResourceService.
+ */
+public class LabelResourceAdapter
+        extends AbstractListenerProviderRegistry<LabelResourceEvent, LabelResourceListener,
+                                                 LabelResourceProvider, LabelResourceProviderService>
+        implements LabelResourceService, LabelResourceAdminService, LabelResourceProviderRegistry {
+    public static final long GLOBAL_LABEL_SPACE_MIN = 4097;
+    public static final long GLOBAL_LABEL_SPACE_MAX = 5121;
+    public static final long LOCAL_LABEL_SPACE_MIN = 5122;
+    public static final long LOCAL_LABEL_SPACE_MAX = 9217;
+
+    private Random random = new Random();
+
+    @Override
+    public boolean createDevicePool(DeviceId deviceId,
+                                    LabelResourceId beginLabel,
+                                    LabelResourceId endLabel) {
+       return true;
+    }
+
+    @Override
+    public boolean createGlobalPool(LabelResourceId beginLabel,
+                                    LabelResourceId endLabel) {
+       return true;
+    }
+
+    @Override
+    public boolean destroyDevicePool(DeviceId deviceId) {
+       return true;
+    }
+
+    @Override
+    public boolean destroyGlobalPool() {
+       return true;
+    }
+
+    public long getLabelId(long min, long max) {
+      return random.nextInt((int) max - (int) min + 1) + (int) min;
+    }
+
+    @Override
+    public Collection<LabelResource> applyFromDevicePool(DeviceId deviceId,
+                                                  long applyNum) {
+        Collection<LabelResource> labelList = new LinkedList<>();
+        LabelResource label = new DefaultLabelResource(deviceId,
+                                  LabelResourceId.labelResourceId(
+                                  getLabelId(LOCAL_LABEL_SPACE_MIN, LOCAL_LABEL_SPACE_MAX)));
+        labelList.add(label);
+        return labelList;
+    }
+
+    @Override
+    public Collection<LabelResource> applyFromGlobalPool(long applyNum) {
+        Collection<LabelResource> labelList = new LinkedList<>();
+        LabelResource label = new DefaultLabelResource(DeviceId.deviceId("foo"),
+                                  LabelResourceId.labelResourceId(
+                                  getLabelId(GLOBAL_LABEL_SPACE_MIN, GLOBAL_LABEL_SPACE_MAX)));
+        labelList.add(label);
+        return labelList;
+    }
+
+    @Override
+    public boolean releaseToDevicePool(Multimap<DeviceId, LabelResource> release) {
+       return true;
+    }
+
+    @Override
+    public boolean releaseToGlobalPool(Set<LabelResourceId> release) {
+       return true;
+    }
+
+    @Override
+    public boolean isDevicePoolFull(DeviceId deviceId) {
+       return false;
+    }
+
+    @Override
+    public boolean isGlobalPoolFull() {
+       return false;
+    }
+
+    @Override
+    public long getFreeNumOfDevicePool(DeviceId deviceId) {
+       return 4;
+    }
+
+    @Override
+    public long getFreeNumOfGlobalPool() {
+       return 4;
+    }
+
+    @Override
+    public LabelResourcePool getDeviceLabelResourcePool(DeviceId deviceId) {
+       return null;
+    }
+
+    @Override
+    public LabelResourcePool getGlobalLabelResourcePool() {
+       return null;
+    }
+
+    private class InternalLabelResourceDelegate implements LabelResourceDelegate {
+        @Override
+        public void notify(LabelResourceEvent event) {
+            post(event);
+        }
+
+    }
+
+    private class InternalDeviceListener implements DeviceListener {
+        @Override
+        public void event(DeviceEvent event) {
+            Device device = event.subject();
+            if (Type.DEVICE_REMOVED.equals(event.type())) {
+                destroyDevicePool(device.id());
+            }
+        }
+    }
+
+    private class InternalLabelResourceProviderService
+            extends AbstractProviderService<LabelResourceProvider>
+            implements LabelResourceProviderService {
+
+        protected InternalLabelResourceProviderService(LabelResourceProvider provider) {
+            super(provider);
+        }
+
+        @Override
+        public void deviceLabelResourcePoolDetected(DeviceId deviceId,
+                                                    LabelResourceId beginLabel,
+                                                    LabelResourceId endLabel) {
+            checkNotNull(deviceId, "deviceId is not null");
+            checkNotNull(beginLabel, "beginLabel is not null");
+            checkNotNull(endLabel, "endLabel is not null");
+            createDevicePool(deviceId, beginLabel, endLabel);
+        }
+
+        @Override
+        public void deviceLabelResourcePoolDestroyed(DeviceId deviceId) {
+            checkNotNull(deviceId, "deviceId is not null");
+            destroyDevicePool(deviceId);
+        }
+
+    }
+
+    @Override
+    protected LabelResourceProviderService createProviderService(LabelResourceProvider provider) {
+        return null;
+    }
+}
diff --git a/protocols/pcep/ctl/src/test/java/org/onosproject/pcelabelstore/util/MockDeviceService.java b/protocols/pcep/ctl/src/test/java/org/onosproject/pcelabelstore/util/MockDeviceService.java
new file mode 100644
index 0000000..b8c5017
--- /dev/null
+++ b/protocols/pcep/ctl/src/test/java/org/onosproject/pcelabelstore/util/MockDeviceService.java
@@ -0,0 +1,148 @@
+/*
+ * 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.pcelabelstore.util;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.onosproject.net.device.DeviceListener;
+import org.onosproject.net.device.PortStatistics;
+import org.onosproject.net.Device;
+import org.onosproject.net.Device.Type;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.MastershipRole;
+import org.onosproject.net.Port;
+import org.onosproject.net.PortNumber;
+import org.onosproject.net.device.DeviceService;
+
+/**
+ * Test fixture for the device service.
+ */
+public class MockDeviceService implements DeviceService {
+    private List<Device> devices = new LinkedList<>();
+    private DeviceListener listener;
+
+    /**
+     * Adds a new device.
+     *
+     * @param dev device to be added
+     */
+    public void addDevice(Device dev) {
+        devices.add(dev);
+    }
+
+    /**
+     * Removes the specified device.
+     *
+     * @param dev device to be removed
+     */
+    public void removeDevice(Device dev) {
+        devices.remove(dev);
+    }
+
+    @Override
+    public Device getDevice(DeviceId deviceId) {
+        for (Device dev : devices) {
+            if (dev.id().equals(deviceId)) {
+                return dev;
+            }
+        }
+        return null;
+    }
+
+    @Override
+    public Iterable<Device> getAvailableDevices() {
+        return devices;
+    }
+
+    @Override
+    public void addListener(DeviceListener listener) {
+        this.listener = listener;
+    }
+
+    /**
+     * Get the listener.
+     */
+    public DeviceListener getListener() {
+        return listener;
+    }
+
+    @Override
+    public void removeListener(DeviceListener listener) {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public int getDeviceCount() {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public Iterable<Device> getDevices() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Iterable<Device> getDevices(Type type) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Iterable<Device> getAvailableDevices(Type type) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public MastershipRole getRole(DeviceId deviceId) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public List<Port> getPorts(DeviceId deviceId) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public List<PortStatistics> getPortStatistics(DeviceId deviceId) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public List<PortStatistics> getPortDeltaStatistics(DeviceId deviceId) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Port getPort(DeviceId deviceId, PortNumber portNumber) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public boolean isAvailable(DeviceId deviceId) {
+        // TODO Auto-generated method stub
+        return false;
+    }
+}
diff --git a/protocols/pcep/ctl/src/test/java/org/onosproject/pcelabelstore/util/MockNetConfigRegistryAdapter.java b/protocols/pcep/ctl/src/test/java/org/onosproject/pcelabelstore/util/MockNetConfigRegistryAdapter.java
new file mode 100644
index 0000000..21dea6b
--- /dev/null
+++ b/protocols/pcep/ctl/src/test/java/org/onosproject/pcelabelstore/util/MockNetConfigRegistryAdapter.java
@@ -0,0 +1,179 @@
+package org.onosproject.pcelabelstore.util;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.config.Config;
+import org.onosproject.net.config.ConfigApplyDelegate;
+import org.onosproject.net.config.ConfigFactory;
+import org.onosproject.net.config.NetworkConfigListener;
+import org.onosproject.net.config.NetworkConfigRegistry;
+import org.onosproject.net.config.NetworkConfigService;
+import org.onosproject.net.config.SubjectFactory;
+import org.onosproject.pcep.api.DeviceCapability;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.JsonNodeFactory;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+
+/* Mock test for network config registry. */
+public class MockNetConfigRegistryAdapter implements NetworkConfigService, NetworkConfigRegistry {
+    private ConfigFactory cfgFactory;
+    private Map<DeviceId, DeviceCapability> classConfig = new HashMap<>();
+
+    @Override
+    public void registerConfigFactory(ConfigFactory configFactory) {
+        cfgFactory = configFactory;
+    }
+
+    @Override
+    public void unregisterConfigFactory(ConfigFactory configFactory) {
+        cfgFactory = null;
+    }
+
+    @Override
+    public <S, C extends Config<S>> C addConfig(S subject, Class<C> configClass) {
+        if (configClass == DeviceCapability.class) {
+            DeviceCapability devCap = new DeviceCapability();
+            classConfig.put((DeviceId) subject, devCap);
+
+            JsonNode node = new ObjectNode(new MockJsonNode());
+            ObjectMapper mapper = new ObjectMapper();
+            ConfigApplyDelegate delegate = new InternalApplyDelegate();
+            devCap.init((DeviceId) subject, null, node, mapper, delegate);
+            return (C) devCap;
+        }
+
+        return null;
+    }
+
+    @Override
+    public <S, C extends Config<S>> void removeConfig(S subject, Class<C> configClass) {
+        classConfig.remove(subject);
+    }
+
+    @Override
+    public <S, C extends Config<S>> C getConfig(S subject, Class<C> configClass) {
+        if (configClass == DeviceCapability.class) {
+            return (C) classConfig.get(subject);
+        }
+        return null;
+    }
+
+    private class MockJsonNode extends JsonNodeFactory {
+    }
+
+    // Auxiliary delegate to receive notifications about changes applied to
+    // the network configuration - by the apps.
+    private class InternalApplyDelegate implements ConfigApplyDelegate {
+        @Override
+        public void onApply(Config config) {
+            //configs.put(config.subject(), config.node());
+        }
+    }
+
+    @Override
+    public void addListener(NetworkConfigListener listener) {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void removeListener(NetworkConfigListener listener) {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public Set<ConfigFactory> getConfigFactories() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public <S, C extends Config<S>> Set<ConfigFactory<S, C>> getConfigFactories(Class<S> subjectClass) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public <S, C extends Config<S>> ConfigFactory<S, C> getConfigFactory(Class<C> configClass) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Set<Class> getSubjectClasses() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public SubjectFactory getSubjectFactory(String subjectClassKey) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public SubjectFactory getSubjectFactory(Class subjectClass) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Class<? extends Config> getConfigClass(String subjectClassKey, String configKey) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public <S> Set<S> getSubjects(Class<S> subjectClass) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public <S, C extends Config<S>> Set<S> getSubjects(Class<S> subjectClass, Class<C> configClass) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public <S> Set<? extends Config<S>> getConfigs(S subject) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public <S, C extends Config<S>> C applyConfig(S subject, Class<C> configClass, JsonNode json) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public <S, C extends Config<S>> C applyConfig(String subjectClassKey, S subject, String configKey, JsonNode json) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public <S> void removeConfig(String subjectClassKey, S subject, String configKey) {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public <S> void removeConfig(S subject) {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public <S> void removeConfig() {
+        // TODO Auto-generated method stub
+
+    }
+}
diff --git a/protocols/pcep/ctl/src/test/java/org/onosproject/pcelabelstore/util/MockPcepClientController.java b/protocols/pcep/ctl/src/test/java/org/onosproject/pcelabelstore/util/MockPcepClientController.java
new file mode 100644
index 0000000..d04235f
--- /dev/null
+++ b/protocols/pcep/ctl/src/test/java/org/onosproject/pcelabelstore/util/MockPcepClientController.java
@@ -0,0 +1,113 @@
+package org.onosproject.pcelabelstore.util;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.Map;
+
+import org.onosproject.incubator.net.tunnel.DefaultLabelStack;
+import org.onosproject.incubator.net.tunnel.LabelStack;
+import org.onosproject.incubator.net.tunnel.Tunnel;
+import org.onosproject.net.Path;
+import org.onosproject.pcep.controller.PccId;
+import org.onosproject.pcep.controller.PcepClient;
+import org.onosproject.pcep.controller.PcepClientController;
+import org.onosproject.pcep.controller.PcepClientListener;
+import org.onosproject.pcep.controller.PcepEventListener;
+import org.onosproject.pcep.controller.PcepNodeListener;
+import org.onosproject.pcepio.protocol.PcepMessage;
+import org.onosproject.pcepio.types.PcepValueType;
+
+public class MockPcepClientController implements PcepClientController {
+
+    Map<PccId, PcepClient> clientMap = new HashMap<>();
+
+    @Override
+    public Collection<PcepClient> getClients() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public void addClient(PccId pccId, PcepClient pc) {
+        clientMap.put(pccId, pc);
+        return;
+    }
+
+    @Override
+    public PcepClient getClient(PccId pccId) {
+        return clientMap.get(pccId);
+    }
+
+    @Override
+    public void addListener(PcepClientListener listener) {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void removeListener(PcepClientListener listener) {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void addEventListener(PcepEventListener listener) {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void removeEventListener(PcepEventListener listener) {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void addNodeListener(PcepNodeListener listener) {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void removeNodeListener(PcepNodeListener listener) {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void writeMessage(PccId pccId, PcepMessage msg) {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void processClientMessage(PccId pccId, PcepMessage msg) {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void closeConnectedClients() {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public LabelStack computeLabelStack(Path path) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public LinkedList<PcepValueType> createPcepLabelStack(DefaultLabelStack labelStack, Path path) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public boolean allocateLocalLabel(Tunnel tunnel) {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+}
diff --git a/protocols/pcep/ctl/src/test/java/org/onosproject/pcelabelstore/util/PceLabelStoreAdapter.java b/protocols/pcep/ctl/src/test/java/org/onosproject/pcelabelstore/util/PceLabelStoreAdapter.java
new file mode 100644
index 0000000..40f8e44
--- /dev/null
+++ b/protocols/pcep/ctl/src/test/java/org/onosproject/pcelabelstore/util/PceLabelStoreAdapter.java
@@ -0,0 +1,191 @@
+/*
+ * 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.pcelabelstore.util;
+
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+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.pcelabelstore.api.LspLocalLabelInfo;
+import org.onosproject.pcelabelstore.api.PceLabelStore;
+
+/**
+ * Provides test implementation of PceStore.
+ */
+public class PceLabelStoreAdapter implements PceLabelStore {
+
+    // Mapping device with global node label
+    private ConcurrentMap<DeviceId, LabelResourceId> globalNodeLabelMap = new ConcurrentHashMap<>();
+
+    // Mapping link with adjacency label
+    private ConcurrentMap<Link, LabelResourceId> adjLabelMap = new ConcurrentHashMap<>();
+
+    // Mapping tunnel with device local info with tunnel consumer id
+    private ConcurrentMap<TunnelId, List<LspLocalLabelInfo>> tunnelInfoMap = new ConcurrentHashMap<>();
+
+
+    // Locally maintain LSRID to device id mapping for better performance.
+    private Map<String, DeviceId> lsrIdDeviceIdMap = new HashMap<>();
+
+    @Override
+    public boolean existsGlobalNodeLabel(DeviceId id) {
+        return globalNodeLabelMap.containsKey(id);
+    }
+
+    @Override
+    public boolean existsAdjLabel(Link link) {
+        return adjLabelMap.containsKey(link);
+    }
+
+    @Override
+    public boolean existsTunnelInfo(TunnelId tunnelId) {
+        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 boolean removeTunnelInfo(TunnelId tunnelId) {
+        tunnelInfoMap.remove(tunnelId);
+        if (tunnelInfoMap.containsKey(tunnelId)) {
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public Map<DeviceId, LabelResourceId> getGlobalNodeLabels() {
+       return globalNodeLabelMap.entrySet().stream()
+                 .collect(Collectors.toMap(Map.Entry::getKey, e -> e.getValue()));
+    }
+
+    @Override
+    public Map<Link, LabelResourceId> getAdjLabels() {
+       return adjLabelMap.entrySet().stream()
+                 .collect(Collectors.toMap(Map.Entry::getKey, e -> e.getValue()));
+    }
+
+    @Override
+    public LabelResourceId getGlobalNodeLabel(DeviceId id) {
+        return globalNodeLabelMap.get(id);
+    }
+
+    @Override
+    public LabelResourceId getAdjLabel(Link link) {
+        return adjLabelMap.get(link);
+    }
+
+    @Override
+    public List<LspLocalLabelInfo> getTunnelInfo(TunnelId tunnelId) {
+        return tunnelInfoMap.get(tunnelId);
+    }
+
+    @Override
+    public void addGlobalNodeLabel(DeviceId deviceId, LabelResourceId labelId) {
+        globalNodeLabelMap.put(deviceId, labelId);
+    }
+
+    @Override
+    public void addAdjLabel(Link link, LabelResourceId labelId) {
+        adjLabelMap.put(link, labelId);
+    }
+
+    @Override
+    public void addTunnelInfo(TunnelId tunnelId, List<LspLocalLabelInfo> lspLocalLabelInfoList) {
+        tunnelInfoMap.put(tunnelId, lspLocalLabelInfoList);
+    }
+
+    @Override
+    public boolean removeGlobalNodeLabel(DeviceId id) {
+        globalNodeLabelMap.remove(id);
+        if (globalNodeLabelMap.containsKey(id)) {
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public boolean removeAdjLabel(Link link) {
+        adjLabelMap.remove(link);
+        if (adjLabelMap.containsKey(link)) {
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public boolean addLsrIdDevice(String lsrId, DeviceId deviceId) {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean removeLsrIdDevice(String lsrId) {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public DeviceId getLsrIdDevice(String lsrId) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public boolean addPccLsr(DeviceId lsrId) {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean removePccLsr(DeviceId lsrId) {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean hasPccLsr(DeviceId lsrId) {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public Map<TunnelId, List<LspLocalLabelInfo>> getTunnelInfos() {
+        return tunnelInfoMap.entrySet().stream()
+                .collect(Collectors.toMap(Map.Entry::getKey, e -> e.getValue()));
+    }
+}
diff --git a/protocols/pcep/ctl/src/test/java/org/onosproject/pcelabelstore/util/PcepClientAdapter.java b/protocols/pcep/ctl/src/test/java/org/onosproject/pcelabelstore/util/PcepClientAdapter.java
new file mode 100644
index 0000000..66e9647
--- /dev/null
+++ b/protocols/pcep/ctl/src/test/java/org/onosproject/pcelabelstore/util/PcepClientAdapter.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.pcelabelstore.util;
+
+import static org.junit.Assert.assertNotNull;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.RejectedExecutionException;
+
+import org.jboss.netty.channel.Channel;
+import org.onosproject.pcep.controller.ClientCapability;
+import org.onosproject.pcep.controller.PccId;
+import org.onosproject.pcep.controller.LspKey;
+import org.onosproject.pcep.controller.PcepClient;
+import org.onosproject.pcep.controller.PcepSyncStatus;
+import org.onosproject.pcepio.protocol.PcepFactories;
+import org.onosproject.pcepio.protocol.PcepFactory;
+import org.onosproject.pcepio.protocol.PcepMessage;
+import org.onosproject.pcepio.protocol.PcepStateReport;
+import org.onosproject.pcepio.protocol.PcepVersion;
+
+/**
+ * Representation of PCEP client adapter.
+ */
+public class PcepClientAdapter implements PcepClient {
+
+    private Channel channel;
+    protected String channelId;
+
+    private boolean connected;
+    private PccId pccId;
+    private ClientCapability capability;
+
+    private PcepVersion pcepVersion;
+    private PcepSyncStatus lspDbSyncStatus;
+    private PcepSyncStatus labelDbSyncStatus;
+    private Map<LspKey, Boolean> lspDelegationInfo = new HashMap<>();
+
+    /**
+     * Initialize instance with specified parameters.
+     *
+     * @param pccId PCC id
+     * @param pcepVersion PCEP message version
+     */
+    public void init(PccId pccId, PcepVersion pcepVersion) {
+        this.pccId = pccId;
+        this.pcepVersion = pcepVersion;
+    }
+
+    @Override
+    public final void disconnectClient() {
+        this.channel.close();
+    }
+
+    @Override
+    public final void sendMessage(PcepMessage m) {
+    }
+
+    @Override
+    public final void sendMessage(List<PcepMessage> msgs) {
+        try {
+            PcepMessage pcepMsg = msgs.get(0);
+            assertNotNull("PCEP MSG should be created.", pcepMsg);
+        } catch (RejectedExecutionException e) {
+            throw e;
+        }
+    }
+
+    @Override
+    public final boolean isConnected() {
+        return this.connected;
+    }
+
+    @Override
+    public String channelId() {
+        return channelId;
+    }
+
+    @Override
+    public final PccId getPccId() {
+        return this.pccId;
+    };
+
+    @Override
+    public final String getStringId() {
+        return this.pccId.toString();
+    }
+
+    @Override
+    public final void handleMessage(PcepMessage m) {
+    }
+
+    @Override
+    public boolean isOptical() {
+        return false;
+    }
+
+    @Override
+    public PcepFactory factory() {
+        return PcepFactories.getFactory(pcepVersion);
+    }
+
+    @Override
+    public void setLspDbSyncStatus(PcepSyncStatus syncStatus) {
+        this.lspDbSyncStatus = syncStatus;
+    }
+
+    @Override
+    public PcepSyncStatus lspDbSyncStatus() {
+        return lspDbSyncStatus;
+    }
+
+    @Override
+    public void setLabelDbSyncStatus(PcepSyncStatus syncStatus) {
+        this.labelDbSyncStatus = syncStatus;
+    }
+
+    @Override
+    public PcepSyncStatus labelDbSyncStatus() {
+        return labelDbSyncStatus;
+    }
+
+    @Override
+    public void setCapability(ClientCapability capability) {
+        this.capability = capability;
+    }
+
+    @Override
+    public ClientCapability capability() {
+        return capability;
+    }
+
+    @Override
+    public void addNode(PcepClient pc) {
+    }
+
+    @Override
+    public void deleteNode(PccId pccId) {
+    }
+
+    @Override
+    public void setLspAndDelegationInfo(LspKey lspKey, boolean dFlag) {
+        lspDelegationInfo.put(lspKey, dFlag);
+    }
+
+    @Override
+    public Boolean delegationInfo(LspKey lspKey) {
+        return lspDelegationInfo.get(lspKey);
+    }
+
+    @Override
+    public void initializeSyncMsgList(PccId pccId) {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public List<PcepStateReport> getSyncMsgList(PccId pccId) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public void removeSyncMsgList(PccId pccId) {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void addSyncMsgToList(PccId pccId, PcepStateReport rptMsg) {
+        // TODO Auto-generated method stub
+
+    }
+}
diff --git a/protocols/pcep/ctl/src/test/java/org/onosproject/pcelabelstore/util/StorageServiceAdapter.java b/protocols/pcep/ctl/src/test/java/org/onosproject/pcelabelstore/util/StorageServiceAdapter.java
new file mode 100644
index 0000000..3b864c4
--- /dev/null
+++ b/protocols/pcep/ctl/src/test/java/org/onosproject/pcelabelstore/util/StorageServiceAdapter.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2015-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.pcelabelstore.util;
+
+import org.onosproject.store.service.AtomicCounterBuilder;
+import org.onosproject.store.service.AtomicValueBuilder;
+import org.onosproject.store.service.ConsistentMapBuilder;
+import org.onosproject.store.service.ConsistentTreeMapBuilder;
+import org.onosproject.store.service.DistributedSetBuilder;
+import org.onosproject.store.service.EventuallyConsistentMapBuilder;
+import org.onosproject.store.service.LeaderElectorBuilder;
+import org.onosproject.store.service.Serializer;
+import org.onosproject.store.service.StorageService;
+import org.onosproject.store.service.Topic;
+import org.onosproject.store.service.TransactionContextBuilder;
+import org.onosproject.store.service.WorkQueue;
+
+/**
+ * Adapter for the storage service.
+ */
+public class StorageServiceAdapter implements StorageService {
+    @Override
+    public <K, V> EventuallyConsistentMapBuilder<K, V> eventuallyConsistentMapBuilder() {
+        return null;
+    }
+
+    @Override
+    public <K, V> ConsistentMapBuilder<K, V> consistentMapBuilder() {
+        return null;
+    }
+
+    @Override
+    public <E> DistributedSetBuilder<E> setBuilder() {
+        return null;
+    }
+
+    @Override
+    public AtomicCounterBuilder atomicCounterBuilder() {
+        return null;
+    }
+
+    @Override
+    public <V> AtomicValueBuilder<V> atomicValueBuilder() {
+        return null;
+    }
+
+    @Override
+    public TransactionContextBuilder transactionContextBuilder() {
+        return null;
+    }
+
+    @Override
+    public LeaderElectorBuilder leaderElectorBuilder() {
+        return null;
+    }
+
+    @Override
+    public <E> WorkQueue<E> getWorkQueue(String name, Serializer serializer) {
+        return null;
+    }
+
+    @Override
+    public <T> Topic<T> getTopic(String name, Serializer serializer) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public <V> ConsistentTreeMapBuilder<V> consistentTreeMapBuilder() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+}
diff --git a/protocols/pcep/ctl/src/test/java/org/onosproject/pcelabelstore/util/TestAtomicCounter.java b/protocols/pcep/ctl/src/test/java/org/onosproject/pcelabelstore/util/TestAtomicCounter.java
new file mode 100644
index 0000000..33a7682
--- /dev/null
+++ b/protocols/pcep/ctl/src/test/java/org/onosproject/pcelabelstore/util/TestAtomicCounter.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2015-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.pcelabelstore.util;
+
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.onosproject.store.service.AsyncAtomicCounter;
+import org.onosproject.store.service.AtomicCounterBuilder;
+
+/**
+ * Test implementation of atomic counter.
+ */
+public final class TestAtomicCounter implements AsyncAtomicCounter {
+    final AtomicLong value;
+
+    @Override
+    public String name() {
+        return null;
+    }
+
+    private TestAtomicCounter() {
+        value = new AtomicLong();
+    }
+
+    @Override
+    public CompletableFuture<Long> incrementAndGet() {
+        return CompletableFuture.completedFuture(value.incrementAndGet());
+    }
+
+    @Override
+    public CompletableFuture<Long> getAndIncrement() {
+        return CompletableFuture.completedFuture(value.getAndIncrement());
+    }
+
+    @Override
+    public CompletableFuture<Long> getAndAdd(long delta) {
+        return CompletableFuture.completedFuture(value.getAndAdd(delta));
+    }
+
+    @Override
+    public CompletableFuture<Long> addAndGet(long delta) {
+        return CompletableFuture.completedFuture(value.addAndGet(delta));
+    }
+
+    @Override
+    public CompletableFuture<Void> set(long value) {
+        this.value.set(value);
+        return CompletableFuture.completedFuture(null);
+    }
+
+    @Override
+    public CompletableFuture<Boolean> compareAndSet(long expectedValue, long updateValue) {
+        return CompletableFuture.completedFuture(value.compareAndSet(expectedValue, updateValue));
+    }
+
+    @Override
+    public CompletableFuture<Long> get() {
+        return CompletableFuture.completedFuture(value.get());
+    }
+
+    public static AtomicCounterBuilder builder() {
+        return new Builder();
+    }
+
+    public static class Builder extends AtomicCounterBuilder {
+        @Override
+        public AsyncAtomicCounter build() {
+            return new TestAtomicCounter();
+        }
+    }
+}
diff --git a/protocols/pcep/ctl/src/test/java/org/onosproject/pcelabelstore/util/TestConsistentMap.java b/protocols/pcep/ctl/src/test/java/org/onosproject/pcelabelstore/util/TestConsistentMap.java
new file mode 100644
index 0000000..d92138b
--- /dev/null
+++ b/protocols/pcep/ctl/src/test/java/org/onosproject/pcelabelstore/util/TestConsistentMap.java
@@ -0,0 +1,315 @@
+/*
+ * Copyright 2015-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.pcelabelstore.util;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.concurrent.atomic.AtomicReference;
+import java.util.function.BiFunction;
+import java.util.function.Function;
+import java.util.function.Predicate;
+import java.util.stream.Collectors;
+
+import org.onosproject.store.primitives.ConsistentMapBackedJavaMap;
+import org.onosproject.store.service.AsyncConsistentMap;
+import org.onosproject.store.service.ConsistentMap;
+import org.onosproject.store.service.ConsistentMapBuilder;
+import org.onosproject.store.service.MapEvent;
+import org.onosproject.store.service.MapEventListener;
+import org.onosproject.store.service.Versioned;
+
+import com.google.common.base.Objects;
+
+/**
+ * Test implementation of the consistent map.
+ */
+public final class TestConsistentMap<K, V> extends ConsistentMapAdapter<K, V> {
+
+    private final List<MapEventListener<K, V>> listeners;
+    private final Map<K, Versioned<V>> map;
+    private final String mapName;
+    private final AtomicLong counter = new AtomicLong(0);
+
+    private TestConsistentMap(String mapName) {
+        map = new HashMap<>();
+        listeners = new LinkedList<>();
+        this.mapName = mapName;
+    }
+
+    private Versioned<V> version(V v) {
+        return new Versioned<>(v, counter.incrementAndGet(), System.currentTimeMillis());
+    }
+
+    /**
+     * Notify all listeners of an event.
+     */
+    private void notifyListeners(String mapName,
+                                 K key, Versioned<V> newvalue, Versioned<V> oldValue) {
+        MapEvent<K, V> event = new MapEvent<>(mapName, key, newvalue, oldValue);
+        listeners.forEach(
+                listener -> listener.event(event)
+        );
+    }
+
+    @Override
+    public int size() {
+        return map.size();
+    }
+
+    @Override
+    public boolean isEmpty() {
+        return map.isEmpty();
+    }
+
+    @Override
+    public boolean containsKey(K key) {
+        return map.containsKey(key);
+    }
+
+    @Override
+    public boolean containsValue(V value) {
+        return map.containsValue(value);
+    }
+
+    @Override
+    public Versioned<V> get(K key) {
+        return map.get(key);
+    }
+
+    @Override
+    public Versioned<V> computeIfAbsent(K key, Function<? super K, ? extends V> mappingFunction) {
+        AtomicBoolean updated = new AtomicBoolean(false);
+        Versioned<V> result = map.compute(key, (k, v) -> {
+            if (v == null) {
+                updated.set(true);
+                return version(mappingFunction.apply(key));
+            }
+            return v;
+        });
+        if (updated.get()) {
+            notifyListeners(mapName, key, result, null);
+        }
+        return result;
+    }
+
+    @Override
+    public Versioned<V> compute(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) {
+            AtomicBoolean updated = new AtomicBoolean(false);
+            AtomicReference<Versioned<V>> previousValue = new AtomicReference<>();
+            Versioned<V> result = map.compute(key, (k, v) -> {
+                    updated.set(true);
+                    previousValue.set(v);
+                    return version(remappingFunction.apply(k, Versioned.valueOrNull(v)));
+                });
+            if (updated.get()) {
+                notifyListeners(mapName, key, result, previousValue.get());
+            }
+            return result;
+    }
+
+    @Override
+    public Versioned<V> computeIfPresent(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) {
+        AtomicBoolean updated = new AtomicBoolean(false);
+        AtomicReference<Versioned<V>> previousValue = new AtomicReference<>();
+        Versioned<V> result = map.compute(key, (k, v) -> {
+            if (v != null) {
+                updated.set(true);
+                previousValue.set(v);
+                return version(remappingFunction.apply(k, v.value()));
+            }
+            return v;
+        });
+        if (updated.get()) {
+            notifyListeners(mapName, key, result, previousValue.get());
+        }
+        return result;
+    }
+
+    @Override
+    public Versioned<V> computeIf(K key, Predicate<? super V> condition,
+                                  BiFunction<? super K, ? super V, ? extends V> remappingFunction) {
+        AtomicBoolean updated = new AtomicBoolean(false);
+        AtomicReference<Versioned<V>> previousValue = new AtomicReference<>();
+        Versioned<V> result = map.compute(key, (k, v) -> {
+            if (condition.test(Versioned.valueOrNull(v))) {
+                previousValue.set(v);
+                updated.set(true);
+                return version(remappingFunction.apply(k, Versioned.valueOrNull(v)));
+            }
+            return v;
+        });
+        if (updated.get()) {
+            notifyListeners(mapName, key, result, previousValue.get());
+        }
+        return result;
+    }
+
+    @Override
+    public Versioned<V> put(K key, V value) {
+        Versioned<V> newValue = version(value);
+        Versioned<V> previousValue = map.put(key, newValue);
+        notifyListeners(mapName, key, newValue, previousValue);
+        return previousValue;
+    }
+
+    @Override
+    public Versioned<V> putAndGet(K key, V value) {
+        Versioned<V> newValue = version(value);
+        Versioned<V> previousValue = map.put(key, newValue);
+        notifyListeners(mapName, key, newValue, previousValue);
+        return newValue;
+    }
+
+    @Override
+    public Versioned<V> remove(K key) {
+        Versioned<V> result = map.remove(key);
+        notifyListeners(mapName, key, null, result);
+        return result;
+    }
+
+    @Override
+    public void clear() {
+        map.keySet().forEach(this::remove);
+    }
+
+    @Override
+    public Set<K> keySet() {
+        return map.keySet();
+    }
+
+    @Override
+    public Collection<Versioned<V>> values() {
+        return map.values()
+                .stream()
+                .collect(Collectors.toList());
+    }
+
+    @Override
+    public Set<Map.Entry<K, Versioned<V>>> entrySet() {
+        return map.entrySet();
+    }
+
+    @Override
+    public Versioned<V> putIfAbsent(K key, V value) {
+        Versioned<V> newValue = version(value);
+        Versioned<V> result =  map.putIfAbsent(key, newValue);
+        if (result == null) {
+            notifyListeners(mapName, key, newValue, result);
+        }
+        return result;
+    }
+
+    @Override
+    public boolean remove(K key, V value) {
+        Versioned<V> existingValue = map.get(key);
+        if (Objects.equal(Versioned.valueOrNull(existingValue), value)) {
+            map.remove(key);
+            notifyListeners(mapName, key, null, existingValue);
+            return true;
+        }
+        return false;
+    }
+
+    @Override
+    public boolean remove(K key, long version) {
+        Versioned<V> existingValue = map.get(key);
+        if (existingValue == null) {
+            return false;
+        }
+        if (existingValue.version() == version) {
+            map.remove(key);
+            notifyListeners(mapName, key, null, existingValue);
+            return true;
+        }
+        return false;
+    }
+
+    @Override
+    public Versioned<V> replace(K key, V value) {
+        Versioned<V> existingValue = map.get(key);
+        if (existingValue == null) {
+            return null;
+        }
+        Versioned<V> newValue = version(value);
+        Versioned<V> result = map.put(key, newValue);
+        notifyListeners(mapName, key, newValue, result);
+        return result;
+    }
+
+    @Override
+    public boolean replace(K key, V oldValue, V newValue) {
+        Versioned<V> existingValue = map.get(key);
+        if (existingValue == null || !existingValue.value().equals(oldValue)) {
+            return false;
+        }
+        Versioned<V> value = version(newValue);
+        Versioned<V> result = map.put(key, value);
+        notifyListeners(mapName, key, value, result);
+        return true;
+    }
+
+    @Override
+    public boolean replace(K key, long oldVersion, V newValue) {
+        Versioned<V> existingValue = map.get(key);
+        if (existingValue == null || existingValue.version() != oldVersion) {
+            return false;
+        }
+        Versioned<V> value = version(newValue);
+        Versioned<V> result = map.put(key, value);
+        notifyListeners(mapName, key, value, result);
+        return true;
+    }
+
+    @Override
+    public void addListener(MapEventListener<K, V> listener) {
+        listeners.add(listener);
+    }
+
+    @Override
+    public void removeListener(MapEventListener<K, V> listener) {
+        listeners.remove(listener);
+    }
+
+    @Override
+    public Map<K, V> asJavaMap() {
+        return new ConsistentMapBackedJavaMap<>(this);
+    }
+
+    public static Builder builder() {
+        return new Builder();
+    }
+
+    public static class Builder<K, V> extends ConsistentMapBuilder<K, V> {
+
+        @Override
+        public ConsistentMap<K, V> build() {
+            return new TestConsistentMap<>(name());
+        }
+
+        @Override
+        public AsyncConsistentMap<K, V> buildAsyncMap() {
+            return null;
+        }
+
+    }
+
+}
diff --git a/protocols/pcep/ctl/src/test/java/org/onosproject/pcelabelstore/util/TestDistributedSet.java b/protocols/pcep/ctl/src/test/java/org/onosproject/pcelabelstore/util/TestDistributedSet.java
new file mode 100644
index 0000000..05ee3a5
--- /dev/null
+++ b/protocols/pcep/ctl/src/test/java/org/onosproject/pcelabelstore/util/TestDistributedSet.java
@@ -0,0 +1,178 @@
+/*
+ * 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.pcelabelstore.util;
+
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Sets;
+import org.onosproject.store.primitives.DefaultDistributedSet;
+import org.onosproject.store.service.AsyncDistributedSet;
+import org.onosproject.store.service.DistributedSet;
+import org.onosproject.store.service.DistributedSetBuilder;
+import org.onosproject.store.service.SetEvent;
+import org.onosproject.store.service.SetEventListener;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.CompletableFuture;
+
+/**
+ * Test implementation of the distributed set.
+ */
+public final class TestDistributedSet<E> extends DistributedSetAdapter<E> {
+    private final List<SetEventListener<E>> listeners;
+    private final Set<E> set;
+    private final String setName;
+
+    /**
+     * Public constructor.
+     *
+     * @param setName name to be assigned to this set
+     */
+    public TestDistributedSet(String setName) {
+        set = new HashSet<>();
+        listeners = new LinkedList<>();
+        this.setName = setName;
+    }
+
+    /**
+     * Notify all listeners of a set event.
+     *
+     * @param event the SetEvent
+     */
+    private void notifyListeners(SetEvent<E> event) {
+        listeners.forEach(
+                listener -> listener.event(event)
+        );
+    }
+
+    @Override
+    public CompletableFuture<Void> addListener(SetEventListener<E> listener) {
+        listeners.add(listener);
+        return CompletableFuture.completedFuture(null);
+    }
+
+    @Override
+    public CompletableFuture<Void> removeListener(SetEventListener<E> listener) {
+        listeners.remove(listener);
+        return CompletableFuture.completedFuture(null);
+    }
+
+    @Override
+    public CompletableFuture<Boolean> add(E element) {
+        SetEvent<E> event =
+                new SetEvent<>(setName, SetEvent.Type.ADD, element);
+        notifyListeners(event);
+        return CompletableFuture.completedFuture(set.add(element));
+    }
+
+    @Override
+    public CompletableFuture<Boolean> remove(E element) {
+        SetEvent<E> event =
+                new SetEvent<>(setName, SetEvent.Type.REMOVE, element);
+        notifyListeners(event);
+        return CompletableFuture.completedFuture(set.remove(element));
+    }
+
+    @Override
+    public CompletableFuture<Integer> size() {
+        return CompletableFuture.completedFuture(set.size());
+    }
+
+    @Override
+    public CompletableFuture<Boolean> isEmpty() {
+        return CompletableFuture.completedFuture(set.isEmpty());
+    }
+
+    @Override
+    public CompletableFuture<Void> clear() {
+        removeAll(ImmutableSet.copyOf(set));
+        return CompletableFuture.completedFuture(null);
+    }
+
+    @Override
+    public CompletableFuture<Boolean> contains(E element) {
+        return CompletableFuture.completedFuture(set.contains(element));
+    }
+
+    @Override
+    public CompletableFuture<Boolean> addAll(Collection<? extends E> c) {
+        c.forEach(this::add);
+        return CompletableFuture.completedFuture(true);
+    }
+
+    @Override
+    public CompletableFuture<Boolean> containsAll(Collection<? extends E> c) {
+        return CompletableFuture.completedFuture(set.containsAll(c));
+    }
+
+    @Override
+    public CompletableFuture<Boolean> retainAll(Collection<? extends E> c) {
+        Set notInSet2;
+        notInSet2 = Sets.difference(set, (Set<?>) c);
+        return removeAll(ImmutableSet.copyOf(notInSet2));
+    }
+
+    @Override
+    public CompletableFuture<Boolean> removeAll(Collection<? extends E> c) {
+        c.forEach(this::remove);
+        return CompletableFuture.completedFuture(true);
+    }
+
+    @Override
+    public CompletableFuture<? extends Set<E>> getAsImmutableSet() {
+        return CompletableFuture.completedFuture(ImmutableSet.copyOf(set));
+    }
+
+    @Override
+    public String name() {
+        return this.setName;
+    }
+
+    @Override
+    public DistributedSet<E> asDistributedSet() {
+        return new DefaultDistributedSet<>(this, 0);
+    }
+
+    @Override
+    public DistributedSet<E> asDistributedSet(long timeoutMillis) {
+        return new DefaultDistributedSet<>(this, timeoutMillis);
+    }
+
+    /**
+     * Returns a new Builder instance.
+     *
+     * @return Builder
+     **/
+    public static Builder builder() {
+        return new Builder();
+    }
+
+    /**
+     * Builder constructor that instantiates a TestDistributedSet.
+     *
+     * @param <E>
+     */
+    public static class Builder<E> extends DistributedSetBuilder<E> {
+        @Override
+        public AsyncDistributedSet<E> build() {
+            return new TestDistributedSet(name());
+        }
+    }
+}
diff --git a/protocols/pcep/ctl/src/test/java/org/onosproject/pcelabelstore/util/TestEventuallyConsistentMap.java b/protocols/pcep/ctl/src/test/java/org/onosproject/pcelabelstore/util/TestEventuallyConsistentMap.java
new file mode 100644
index 0000000..6c90592
--- /dev/null
+++ b/protocols/pcep/ctl/src/test/java/org/onosproject/pcelabelstore/util/TestEventuallyConsistentMap.java
@@ -0,0 +1,248 @@
+/*
+ * Copyright 2015-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.pcelabelstore.util;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+import java.util.function.BiFunction;
+
+import org.onlab.util.KryoNamespace;
+import org.onosproject.cluster.NodeId;
+import org.onosproject.store.Timestamp;
+import org.onosproject.store.service.EventuallyConsistentMap;
+import org.onosproject.store.service.EventuallyConsistentMapBuilder;
+import org.onosproject.store.service.EventuallyConsistentMapEvent;
+import org.onosproject.store.service.EventuallyConsistentMapListener;
+
+import static org.onosproject.store.service.EventuallyConsistentMapEvent.Type.PUT;
+import static org.onosproject.store.service.EventuallyConsistentMapEvent.Type.REMOVE;
+
+/**
+ * Testing version of an Eventually Consistent Map.
+ */
+
+public final class TestEventuallyConsistentMap<K, V> extends EventuallyConsistentMapAdapter<K, V> {
+
+    private final HashMap<K, V> map;
+    private final String mapName;
+    private final List<EventuallyConsistentMapListener<K, V>> listeners;
+    private final BiFunction<K, V, Collection<NodeId>> peerUpdateFunction;
+
+    private TestEventuallyConsistentMap(String mapName,
+                                        BiFunction<K, V, Collection<NodeId>> peerUpdateFunction) {
+        map = new HashMap<>();
+        listeners = new LinkedList<>();
+        this.mapName = mapName;
+        this.peerUpdateFunction = peerUpdateFunction;
+    }
+
+    /**
+     * Notify all listeners of an event.
+     */
+    private void notifyListeners(EventuallyConsistentMapEvent<K, V> event) {
+        listeners.forEach(
+                listener -> listener.event(event)
+        );
+    }
+
+    @Override
+    public int size() {
+        return map.size();
+    }
+
+    @Override
+    public boolean isEmpty() {
+        return map.isEmpty();
+    }
+
+    @Override
+    public boolean containsKey(K key) {
+        return map.containsKey(key);
+    }
+
+    @Override
+    public boolean containsValue(V value) {
+        return map.containsValue(value);
+    }
+
+    @Override
+    public V get(K key) {
+        return map.get(key);
+    }
+
+    @Override
+    public void put(K key, V value) {
+        map.put(key, value);
+        EventuallyConsistentMapEvent<K, V> addEvent =
+                new EventuallyConsistentMapEvent<>(mapName, PUT, key, value);
+        notifyListeners(addEvent);
+        if (peerUpdateFunction != null) {
+            peerUpdateFunction.apply(key, value);
+        }
+    }
+
+    @Override
+    public V remove(K key) {
+        V result = map.remove(key);
+        if (result != null) {
+            EventuallyConsistentMapEvent<K, V> removeEvent =
+                    new EventuallyConsistentMapEvent<>(mapName, REMOVE,
+                            key, map.get(key));
+            notifyListeners(removeEvent);
+        }
+        return result;
+    }
+
+    @Override
+    public void remove(K key, V value) {
+        boolean removed = map.remove(key, value);
+        if (removed) {
+            EventuallyConsistentMapEvent<K, V> removeEvent =
+                    new EventuallyConsistentMapEvent<>(mapName, REMOVE, key, value);
+            notifyListeners(removeEvent);
+        }
+    }
+
+    @Override
+    public V compute(K key, BiFunction<K, V, V> recomputeFunction) {
+        return map.compute(key, recomputeFunction);
+    }
+
+    @Override
+    public void putAll(Map<? extends K, ? extends V> m) {
+        map.putAll(m);
+    }
+
+    @Override
+    public void clear() {
+        map.clear();
+    }
+
+    @Override
+    public Set<K> keySet() {
+        return map.keySet();
+    }
+
+    @Override
+    public Collection<V> values() {
+        return map.values();
+    }
+
+    @Override
+    public Set<Map.Entry<K, V>> entrySet() {
+        return map.entrySet();
+    }
+
+    public static <K, V> Builder<K, V> builder() {
+        return new Builder<>();
+    }
+
+    @Override
+    public void addListener(EventuallyConsistentMapListener<K, V> listener) {
+        listeners.add(listener);
+    }
+
+    @Override
+    public void removeListener(EventuallyConsistentMapListener<K, V> listener) {
+        listeners.remove(listener);
+    }
+
+    public static class Builder<K, V> implements EventuallyConsistentMapBuilder<K, V> {
+        private String name;
+        private BiFunction<K, V, Collection<NodeId>> peerUpdateFunction;
+
+        @Override
+        public EventuallyConsistentMapBuilder<K, V> withName(String name) {
+            this.name = name;
+            return this;
+        }
+
+        @Override
+        public EventuallyConsistentMapBuilder<K, V> withSerializer(KryoNamespace.Builder serializerBuilder) {
+            return this;
+        }
+
+        @Override
+        public EventuallyConsistentMapBuilder<K, V> withSerializer(KryoNamespace serializer) {
+            return this;
+        }
+
+        @Override
+        public EventuallyConsistentMapBuilder<K, V>
+        withTimestampProvider(BiFunction<K, V, Timestamp> timestampProvider) {
+            return this;
+        }
+
+        @Override
+        public EventuallyConsistentMapBuilder<K, V> withEventExecutor(ExecutorService executor) {
+            return this;
+        }
+
+        @Override
+        public EventuallyConsistentMapBuilder<K, V> withCommunicationExecutor(ExecutorService executor) {
+            return this;
+        }
+
+        @Override
+        public EventuallyConsistentMapBuilder<K, V> withBackgroundExecutor(ScheduledExecutorService executor) {
+            return this;
+        }
+
+        @Override
+        public EventuallyConsistentMapBuilder<K, V>
+        withPeerUpdateFunction(BiFunction<K, V, Collection<NodeId>> peerUpdateFunction) {
+            this.peerUpdateFunction = peerUpdateFunction;
+            return this;
+        }
+
+        @Override
+        public EventuallyConsistentMapBuilder<K, V> withTombstonesDisabled() {
+            return this;
+        }
+
+        @Override
+        public EventuallyConsistentMapBuilder<K, V> withAntiEntropyPeriod(long period, TimeUnit unit) {
+            return this;
+        }
+
+        @Override
+        public EventuallyConsistentMapBuilder<K, V> withFasterConvergence() {
+            return this;
+        }
+
+        @Override
+        public EventuallyConsistentMapBuilder<K, V> withPersistence() {
+            return this;
+        }
+
+        @Override
+        public EventuallyConsistentMap<K, V> build() {
+            if (name == null) {
+                name = "test";
+            }
+            return new TestEventuallyConsistentMap<>(name, peerUpdateFunction);
+        }
+    }
+
+}
+
diff --git a/protocols/pcep/ctl/src/test/java/org/onosproject/pcelabelstore/util/TestStorageService.java b/protocols/pcep/ctl/src/test/java/org/onosproject/pcelabelstore/util/TestStorageService.java
new file mode 100644
index 0000000..097b34e
--- /dev/null
+++ b/protocols/pcep/ctl/src/test/java/org/onosproject/pcelabelstore/util/TestStorageService.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2015-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.pcelabelstore.util;
+
+import org.onosproject.store.service.AtomicCounterBuilder;
+import org.onosproject.store.service.AtomicValueBuilder;
+import org.onosproject.store.service.ConsistentMapBuilder;
+import org.onosproject.store.service.DistributedSetBuilder;
+import org.onosproject.store.service.EventuallyConsistentMapBuilder;
+import org.onosproject.store.service.TransactionContextBuilder;
+
+public class TestStorageService extends StorageServiceAdapter {
+
+
+    @Override
+    public <K, V> EventuallyConsistentMapBuilder<K, V> eventuallyConsistentMapBuilder() {
+        return TestEventuallyConsistentMap.builder();
+    }
+
+    @Override
+    public <K, V> ConsistentMapBuilder<K, V> consistentMapBuilder() {
+        return TestConsistentMap.builder();
+    }
+
+    @Override
+    public <E> DistributedSetBuilder<E> setBuilder() {
+        return TestDistributedSet.builder();
+    }
+
+    @Override
+    public AtomicCounterBuilder atomicCounterBuilder() {
+        return TestAtomicCounter.builder();
+    }
+
+    @Override
+    public <V> AtomicValueBuilder<V> atomicValueBuilder() {
+        throw new UnsupportedOperationException("atomicValueBuilder");
+    }
+
+    @Override
+    public TransactionContextBuilder transactionContextBuilder() {
+        throw new UnsupportedOperationException("transactionContextBuilder");
+    }
+}
diff --git a/protocols/pcep/pcepio/src/main/java/org/onosproject/pcepio/protocol/ver1/PcepLspObjectVer1.java b/protocols/pcep/pcepio/src/main/java/org/onosproject/pcepio/protocol/ver1/PcepLspObjectVer1.java
index 8de5125..b939ae5 100644
--- a/protocols/pcep/pcepio/src/main/java/org/onosproject/pcepio/protocol/ver1/PcepLspObjectVer1.java
+++ b/protocols/pcep/pcepio/src/main/java/org/onosproject/pcepio/protocol/ver1/PcepLspObjectVer1.java
@@ -366,7 +366,6 @@
             default:
                 // Skip the unknown TLV.
                 cb.skipBytes(hLength);
-                tlv = null;
                 log.info("Received unsupported TLV type :" + hType + " in LSP object.");
             }
             // Check for the padding