Move PCE label handling from APP to protocol.

Change-Id: I26ae21b27ac2dc9ae3302030f6860e0e371c342c
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");
+    }
+}