Move PCE label handling from APP to protocol.

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