PCE Changes to handle bandwidth changes from network

Change-Id: Ib4961ac4ea8ed803fb035ab93725ae6f0968a5c0
diff --git a/apps/pce/BUCK b/apps/pce/BUCK
new file mode 100644
index 0000000..cd306b8
--- /dev/null
+++ b/apps/pce/BUCK
@@ -0,0 +1,15 @@
+BUNDLES = [
+    '//apps/pce/bandwidthmgmt:onos-apps-pce-bandwidthmgmt',
+    '//apps/pce/app:onos-apps-pce-app',
+    '//apps/pce/pcerest:onos-apps-pce-pcerest',
+    '//apps/pce/pceweb:onos-apps-pce-pceweb',
+]
+
+onos_app (
+  app_name='org.onosproject.pce',
+    title = 'PCE APP',
+    category = 'PCE',
+    url = 'http://onosproject.org',
+    included_bundles = BUNDLES,
+    description = 'PCE Service App.',
+)
\ No newline at end of file
diff --git a/apps/pce/app/BUCK b/apps/pce/app/BUCK
index f25f607..dddfdbf 100644
--- a/apps/pce/app/BUCK
+++ b/apps/pce/app/BUCK
@@ -11,6 +11,7 @@
   '//core/api:onos-api',
   '//lib:org.apache.karaf.shell.console',
   '//lib:javax.ws.rs-api',
+  '//apps/pce/bandwidthmgmt:onos-apps-pce-bandwidthmgmt',
 ]
 
 TEST_DEPS = [
@@ -23,6 +24,7 @@
 )
 
 onos_app (
+    app_name='org.onosproject.pce.app',
     title = 'PCE App',
     category = 'default',
     url = 'http://onosproject.org',
diff --git a/apps/pce/app/pom.xml b/apps/pce/app/pom.xml
index 979d255..9c4f697 100644
--- a/apps/pce/app/pom.xml
+++ b/apps/pce/app/pom.xml
@@ -110,5 +110,10 @@
            <artifactId>easymock</artifactId>
            <scope>test</scope>
        </dependency>
-    </dependencies>
+       <dependency>
+           <groupId>org.onosproject</groupId>
+           <artifactId>onos-app-bandwidthmgmt</artifactId>
+           <version>${project.version}</version>
+       </dependency>
+   </dependencies>
 </project>
diff --git a/apps/pce/app/src/main/java/org/onosproject/pce/cli/PceSetupPathCommand.java b/apps/pce/app/src/main/java/org/onosproject/pce/cli/PceSetupPathCommand.java
index 6139004..18e2ce8 100644
--- a/apps/pce/app/src/main/java/org/onosproject/pce/cli/PceSetupPathCommand.java
+++ b/apps/pce/app/src/main/java/org/onosproject/pce/cli/PceSetupPathCommand.java
@@ -37,13 +37,13 @@
 import org.onosproject.net.DeviceId;
 import org.onosproject.net.NetworkResource;
 import org.onosproject.net.PortNumber;
-import org.onosproject.net.intent.constraint.BandwidthConstraint;
 import org.onosproject.net.intent.Constraint;
 import org.onosproject.net.provider.ProviderId;
 import org.onosproject.pce.pceservice.ExplicitPathInfo;
 import org.onosproject.pce.pceservice.constraint.CostConstraint;
 import org.onosproject.pce.pceservice.LspType;
 import org.onosproject.pce.pceservice.api.PceService;
+import org.onosproject.pce.pceservice.constraint.PceBandwidthConstraint;
 import org.slf4j.Logger;
 
 /**
@@ -132,7 +132,7 @@
         // Add bandwidth
         // bandwidth default data rate unit is in BPS
         if (bandwidth != 0.0) {
-            listConstrnt.add(BandwidthConstraint.of(bandwidth, DataRateUnit.valueOf("BPS")));
+            listConstrnt.add(PceBandwidthConstraint.of(bandwidth, DataRateUnit.valueOf("BPS")));
         }
 
         // Add cost
diff --git a/apps/pce/app/src/main/java/org/onosproject/pce/cli/PceUpdatePathCommand.java b/apps/pce/app/src/main/java/org/onosproject/pce/cli/PceUpdatePathCommand.java
index 4505e7e..7d51ee3 100644
--- a/apps/pce/app/src/main/java/org/onosproject/pce/cli/PceUpdatePathCommand.java
+++ b/apps/pce/app/src/main/java/org/onosproject/pce/cli/PceUpdatePathCommand.java
@@ -27,7 +27,7 @@
 import org.onlab.util.DataRateUnit;
 import org.onosproject.cli.AbstractShellCommand;
 import org.onosproject.incubator.net.tunnel.TunnelId;
-import org.onosproject.net.intent.constraint.BandwidthConstraint;
+import org.onosproject.pce.pceservice.constraint.PceBandwidthConstraint;
 import org.onosproject.net.intent.Constraint;
 import org.onosproject.pce.pceservice.constraint.CostConstraint;
 import org.onosproject.pce.pceservice.api.PceService;
@@ -62,7 +62,7 @@
         List<Constraint> constrntList = new LinkedList<>();
         // Assign bandwidth. Data rate unit is in Bps.
         if (bandwidth != null) {
-            constrntList.add(BandwidthConstraint.of(Double.valueOf(bandwidth), DataRateUnit.valueOf("BPS")));
+            constrntList.add(PceBandwidthConstraint.of(Double.valueOf(bandwidth), DataRateUnit.valueOf("BPS")));
         }
 
         // Cost validation
diff --git a/apps/pce/app/src/main/java/org/onosproject/pce/pceservice/DefaultPcePath.java b/apps/pce/app/src/main/java/org/onosproject/pce/pceservice/DefaultPcePath.java
index 4c85fd7..2efacec 100644
--- a/apps/pce/app/src/main/java/org/onosproject/pce/pceservice/DefaultPcePath.java
+++ b/apps/pce/app/src/main/java/org/onosproject/pce/pceservice/DefaultPcePath.java
@@ -26,9 +26,9 @@
 import org.onlab.util.DataRateUnit;
 import org.onosproject.incubator.net.tunnel.Tunnel;
 import org.onosproject.incubator.net.tunnel.TunnelId;
-import org.onosproject.net.intent.constraint.BandwidthConstraint;
 import org.onosproject.net.intent.Constraint;
 import org.onosproject.pce.pceservice.constraint.CostConstraint;
+import org.onosproject.pce.pceservice.constraint.PceBandwidthConstraint;
 
 /**
  * Implementation of an entity which provides functionalities of pce path.
@@ -249,7 +249,7 @@
 
         @Override
         public Builder bandwidthConstraint(String bandwidth) {
-            this.bandwidthConstraint = BandwidthConstraint.of(Double.valueOf(bandwidth), DataRateUnit
+            this.bandwidthConstraint = PceBandwidthConstraint.of(Double.valueOf(bandwidth), DataRateUnit
                     .valueOf("BPS"));
             return this;
         }
@@ -281,7 +281,7 @@
             // Bandwidth
             String bandwidth = tunnel.annotations().value(PcepAnnotationKeys.BANDWIDTH);
             if (bandwidth != null) {
-                this.bandwidthConstraint = BandwidthConstraint.of(Double.parseDouble(bandwidth),
+                this.bandwidthConstraint = PceBandwidthConstraint.of(Double.parseDouble(bandwidth),
                                                                   DataRateUnit.valueOf("BPS"));
             }
 
diff --git a/apps/pce/app/src/main/java/org/onosproject/pce/pceservice/PceManager.java b/apps/pce/app/src/main/java/org/onosproject/pce/pceservice/PceManager.java
index ecc1d72..bc80a7f 100644
--- a/apps/pce/app/src/main/java/org/onosproject/pce/pceservice/PceManager.java
+++ b/apps/pce/app/src/main/java/org/onosproject/pce/pceservice/PceManager.java
@@ -17,11 +17,14 @@
 
 import static com.google.common.base.Preconditions.checkNotNull;
 
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.HashMap;
 import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
+import java.util.Map;
 import java.util.Optional;
 import java.util.Set;
 import org.apache.felix.scr.annotations.Activate;
@@ -45,6 +48,9 @@
 import org.onosproject.incubator.net.tunnel.TunnelName;
 import org.onosproject.incubator.net.tunnel.TunnelService;
 import org.onosproject.mastership.MastershipService;
+import org.onosproject.net.LinkKey;
+import org.onosproject.net.config.ConfigFactory;
+import org.onosproject.net.config.NetworkConfigRegistry;
 import org.onosproject.net.config.NetworkConfigService;
 import org.onosproject.net.DefaultAnnotations;
 import org.onosproject.net.DefaultAnnotations.Builder;
@@ -54,21 +60,19 @@
 import org.onosproject.net.Link;
 import org.onosproject.net.NetworkResource;
 import org.onosproject.net.Path;
+import org.onosproject.net.config.basics.SubjectFactories;
 import org.onosproject.net.device.DeviceService;
 import org.onosproject.net.intent.Constraint;
-import org.onosproject.net.intent.constraint.BandwidthConstraint;
 import org.onosproject.net.link.LinkEvent;
 import org.onosproject.net.MastershipRole;
+import org.onosproject.bandwidthmgr.api.BandwidthMgmtService;
 import org.onosproject.pce.pceservice.constraint.CapabilityConstraint;
 import org.onosproject.pce.pceservice.constraint.CapabilityConstraint.CapabilityType;
 import org.onosproject.pce.pceservice.constraint.CostConstraint;
+import org.onosproject.pce.pceservice.constraint.PceBandwidthConstraint;
 import org.onosproject.pce.pceservice.constraint.SharedBandwidthConstraint;
 import org.onosproject.net.resource.Resource;
 import org.onosproject.net.resource.ResourceAllocation;
-import org.onosproject.net.resource.ResourceConsumer;
-import org.onosproject.net.resource.ResourceQueryService;
-import org.onosproject.net.resource.ResourceService;
-import org.onosproject.net.resource.Resources;
 import org.onosproject.net.topology.LinkWeight;
 import org.onosproject.net.topology.PathService;
 import org.onosproject.net.topology.TopologyEdge;
@@ -79,6 +83,7 @@
 import org.onosproject.pce.pcestore.PcePathInfo;
 import org.onosproject.pce.pcestore.api.PceStore;
 import org.onosproject.pcep.api.DeviceCapability;
+import org.onosproject.pcep.api.TeLinkConfig;
 import org.onosproject.store.serializers.KryoNamespaces;
 import org.onosproject.store.service.DistributedSet;
 import org.onosproject.store.service.Serializer;
@@ -118,9 +123,6 @@
     public static final String DEVICE_TYPE = "type";
     public static final String L3_DEVICE = "L3";
 
-    private static final String TUNNEL_CONSUMER_ID_GEN_TOPIC = "pcep-tunnel-consumer-id";
-    private IdGenerator tunnelConsumerIdGen;
-
     private static final String LSRID = "lsrId";
     private static final String TRUE = "true";
     private static final String FALSE = "false";
@@ -133,12 +135,6 @@
     protected CoreService coreService;
 
     @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
-    protected ResourceService resourceService;
-
-    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
-    protected ResourceQueryService resourceQueryService;
-
-    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
     protected PathService pathService;
 
     @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
@@ -162,13 +158,27 @@
     @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
     protected TopologyService topologyService;
 
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected BandwidthMgmtService bandwidthMgmtService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected NetworkConfigRegistry netConfigRegistry;
+
     private TunnelListener listener = new InnerTunnelListener();
     private ApplicationId appId;
 
     private final TopologyListener topologyListener = new InternalTopologyListener();
 
-    public static final int INITIAL_DELAY = 30;
-    public static final int PERIODIC_DELAY = 30;
+    private List<TunnelId> rsvpTunnelsWithLocalBw = new ArrayList<>();
+
+    private final ConfigFactory<LinkKey, TeLinkConfig> configFactory =
+            new ConfigFactory<LinkKey, TeLinkConfig>(SubjectFactories.LINK_SUBJECT_FACTORY,
+                    TeLinkConfig.class, "teLinkConfig") {
+                @Override
+                public TeLinkConfig createConfig() {
+                    return new TeLinkConfig();
+                }
+            };
 
     /**
      * Creates new instance of PceManager.
@@ -182,7 +192,6 @@
 
         tunnelService.addListener(listener);
 
-        tunnelConsumerIdGen = coreService.getIdGenerator(TUNNEL_CONSUMER_ID_GEN_TOPIC);
         localLspIdIdGen = coreService.getIdGenerator(LOCAL_LSP_ID_GEN_TOPIC);
         localLspIdIdGen.getNewId(); // To prevent 0, the 1st value generated from being used in protocol.
         localLspIdFreeList = storageService.<Short>setBuilder()
@@ -192,6 +201,7 @@
                 .asDistributedSet();
 
         topologyService.addListener(topologyListener);
+        netConfigRegistry.registerConfigFactory(configFactory);
 
         log.info("Started");
     }
@@ -200,6 +210,8 @@
     protected void deactivate() {
         tunnelService.removeListener(listener);
         topologyService.removeListener(topologyListener);
+        netConfigRegistry.unregisterConfigFactory(configFactory);
+
         log.info("Stopped");
     }
 
@@ -460,8 +472,8 @@
 
             while (iterator.hasNext()) {
                 Constraint constraint = iterator.next();
-                if (constraint instanceof BandwidthConstraint) {
-                    bwConstraintValue = ((BandwidthConstraint) constraint).bandwidth().bps();
+                if (constraint instanceof PceBandwidthConstraint) {
+                    bwConstraintValue = ((PceBandwidthConstraint) constraint).bandwidth().bps();
                 } else if (constraint instanceof CostConstraint) {
                     costConstraint = (CostConstraint) constraint;
                 }
@@ -534,11 +546,9 @@
                                           TunnelName.tunnelName(tunnelName), computedPath,
                                           annotationBuilder.build());
 
-        // Allocate bandwidth.
-        TunnelConsumerId consumerId = null;
+        // Allocate bandwidth for all tunnels.
         if (bwConstraintValue != 0) {
-            consumerId = reserveBandwidth(computedPath, bwConstraintValue, null);
-            if (consumerId == null) {
+            if (!reserveBandwidth(computedPath, bwConstraintValue, null)) {
                 pceStore.addFailedPathInfo(new PcePathInfo(src, dst, tunnelName, constraints,
                         lspType, explicitPathInfo));
                 return false;
@@ -548,16 +558,19 @@
         TunnelId tunnelId = tunnelService.setupTunnel(appId, src, tunnel, computedPath);
         if (tunnelId == null) {
             pceStore.addFailedPathInfo(new PcePathInfo(src, dst, tunnelName, constraints, lspType, explicitPathInfo));
-            if (consumerId != null) {
-                resourceService.release(consumerId);
+
+            if (bwConstraintValue != 0) {
+                computedPath.links().forEach(ln -> bandwidthMgmtService.releaseLocalReservedBw(LinkKey.linkKey(ln),
+                        Double.parseDouble(tunnel.annotations().value(BANDWIDTH))));
             }
+
             return false;
         }
 
-        if (consumerId != null) {
-            // Store tunnel consumer id in LSP store.
-            pceStore.addTunnelInfo(tunnelId, consumerId);
+        if (bwConstraintValue != 0 && lspType == WITH_SIGNALLING) {
+            rsvpTunnelsWithLocalBw.add(tunnelId);
         }
+
         return true;
     }
 
@@ -581,7 +594,7 @@
         double bwConstraintValue = 0;
         String costType = null;
         SharedBandwidthConstraint shBwConstraint = null;
-        BandwidthConstraint bwConstraint = null;
+        PceBandwidthConstraint bwConstraint = null;
         CostConstraint costConstraint = null;
 
         if (constraints != null) {
@@ -589,8 +602,8 @@
             Iterator<Constraint> iterator = constraints.iterator();
             while (iterator.hasNext()) {
                 Constraint constraint = iterator.next();
-                if (constraint instanceof BandwidthConstraint) {
-                    bwConstraint = (BandwidthConstraint) constraint;
+                if (constraint instanceof PceBandwidthConstraint) {
+                    bwConstraint = (PceBandwidthConstraint) constraint;
                     bwConstraintValue = bwConstraint.bandwidth().bps();
                 } else if (constraint instanceof CostConstraint) {
                     costConstraint = (CostConstraint) constraint;
@@ -684,7 +697,6 @@
         annotationBuilder.set(PCC_TUNNEL_ID, tunnel.annotations().value(PCC_TUNNEL_ID));
 
         Path computedPath = computedPathSet.iterator().next();
-        TunnelConsumerId consumerId = null;
         LspType lspType = LspType.valueOf(lspSigType);
         long localLspId = 0;
         if (lspType != WITH_SIGNALLING) {
@@ -700,10 +712,9 @@
                                                  tunnel.tunnelName(), computedPath,
                                                  annotationBuilder.build());
 
-        // Allocate shared bandwidth.
+        // Allocate shared bandwidth for all tunnels.
         if (bwConstraintValue != 0) {
-            consumerId = reserveBandwidth(computedPath, bwConstraintValue, shBwConstraint);
-            if (consumerId == null) {
+            if (!reserveBandwidth(computedPath, bwConstraintValue, shBwConstraint)) {
                 return false;
             }
         }
@@ -712,15 +723,14 @@
                                                              computedPath);
 
         if (updatedTunnelId == null) {
-            if (consumerId != null) {
-                resourceService.release(consumerId);
+            if (bwConstraintValue != 0) {
+                releaseSharedBwForNewTunnel(computedPath, bwConstraintValue, shBwConstraint);
             }
             return false;
         }
 
-        if (consumerId != null) {
-            // Store tunnel consumer id in LSP store.
-            pceStore.addTunnelInfo(updatedTunnelId, consumerId);
+        if (bwConstraintValue != 0 && lspType == WITH_SIGNALLING) {
+            rsvpTunnelsWithLocalBw.add(updatedTunnelId);
         }
 
         return true;
@@ -750,6 +760,35 @@
         return tunnelService.queryTunnel(tunnelId);
     }
 
+    private boolean releaseSharedBwForNewTunnel(Path computedPath, double bandwidthConstraint,
+                                                SharedBandwidthConstraint shBwConstraint) {
+        checkNotNull(computedPath);
+        checkNotNull(bandwidthConstraint);
+        double bwToAllocate;
+
+        Double additionalBwValue = null;
+        if (shBwConstraint != null) {
+            additionalBwValue = ((bandwidthConstraint - shBwConstraint.sharedBwValue().bps()) <= 0) ? null
+                    : (bandwidthConstraint - shBwConstraint.sharedBwValue().bps());
+        }
+
+        for (Link link : computedPath.links()) {
+            bwToAllocate = 0;
+            if ((shBwConstraint != null) && (shBwConstraint.links().contains(link))) {
+                if (additionalBwValue != null) {
+                    bwToAllocate = additionalBwValue;
+                }
+            } else {
+                bwToAllocate = bandwidthConstraint;
+            }
+
+            if (bwToAllocate != 0) {
+                bandwidthMgmtService.releaseLocalReservedBw(LinkKey.linkKey(link), bwToAllocate);
+            }
+        }
+        return true;
+    }
+
     /**
      * Returns the next local LSP identifier to be used either by getting from
      * freed list if available otherwise generating a new one.
@@ -801,8 +840,16 @@
                 if (constraint instanceof CapabilityConstraint) {
                     cost = ((CapabilityConstraint) constraint).isValidLink(edge.link(), deviceService,
                                                                            netCfgService) ? 1 : -1;
+                } else if (constraint instanceof PceBandwidthConstraint) {
+                    cost = ((PceBandwidthConstraint) constraint).isValidLink(edge.link(),
+                            bandwidthMgmtService) ? 1 : -1;
+                } else if (constraint instanceof SharedBandwidthConstraint) {
+                    cost = ((SharedBandwidthConstraint) constraint).isValidLink(edge.link(),
+                            bandwidthMgmtService) ? 1 : -1;
+                } else if (constraint instanceof CostConstraint) {
+                    cost = ((CostConstraint) constraint).isValidLink(edge.link(), netCfgService);
                 } else {
-                    cost = constraint.cost(edge.link(), resourceService::isAvailable);
+                    cost = constraint.cost(edge.link(), null);
                 }
             }
             return cost;
@@ -841,7 +888,7 @@
 
             if (tunnel.annotations().value(BANDWIDTH) != null) {
                 //Requested bandwidth will be same as previous allocated bandwidth for the tunnel
-                BandwidthConstraint localConst = new BandwidthConstraint(Bandwidth.bps(Double.parseDouble(tunnel
+                PceBandwidthConstraint localConst = new PceBandwidthConstraint(Bandwidth.bps(Double.parseDouble(tunnel
                         .annotations().value(BANDWIDTH))));
                 constraintList.add(localConst);
             }
@@ -870,14 +917,13 @@
     }
 
      // Allocates the bandwidth locally for PCECC tunnels.
-    private TunnelConsumerId reserveBandwidth(Path computedPath, double bandwidthConstraint,
+    private boolean reserveBandwidth(Path computedPath, double bandwidthConstraint,
                                   SharedBandwidthConstraint shBwConstraint) {
         checkNotNull(computedPath);
         checkNotNull(bandwidthConstraint);
         Resource resource = null;
         double bwToAllocate = 0;
-
-        TunnelConsumerId consumer = TunnelConsumerId.valueOf(tunnelConsumerIdGen.getNewId());
+        Map<Link, Double> linkMap = new HashMap<>();
 
         /**
          * Shared bandwidth sub-case : Lesser bandwidth required than original -
@@ -905,24 +951,20 @@
              *  is not required to allocate anything.
              */
             if (bwToAllocate != 0) {
-                resource = Resources.continuous(link.src().deviceId(), link.src().port(), Bandwidth.class)
-                        .resource(bwToAllocate);
-                resAlloc = resourceService.allocate(consumer, resource);
-
-                // If allocation for any link fails, then release the partially allocated bandwidth.
-                if (!resAlloc.isPresent()) {
-                    resourceService.release(consumer);
-                    return null;
+                if (!bandwidthMgmtService.allocLocalReservedBw(LinkKey.linkKey(link.src(), link.dst()),
+                        bwToAllocate)) {
+                    // If allocation for any link fails, then release the partially allocated bandwidth
+                    // for all links allocated
+                    linkMap.forEach((ln, aDouble) -> bandwidthMgmtService
+                                                     .releaseLocalReservedBw(LinkKey.linkKey(ln), aDouble));
+                    return false;
                 }
+
+                linkMap.put(link, bwToAllocate);
             }
         }
 
-        /*
-         * Note: Storing of tunnel consumer id is done by caller of bandwidth reservation function. So deleting tunnel
-         * consumer id should be done by caller of bandwidth releasing function. This will prevent ambiguities related
-         * to who is supposed to store/delete.
-         */
-        return consumer;
+        return true;
     }
 
     /*
@@ -950,24 +992,13 @@
             }
         }
 
-        ResourceConsumer tunnelConsumerId = pceStore.getTunnelInfo(tunnel.tunnelId());
-        if (tunnelConsumerId == null) {
-            //If bandwidth for old tunnel is not allocated i,e 0 then no need to release
-            log.debug("Bandwidth not allocated (0 bandwidth) for old LSP.");
-            return;
-        }
-
         if (isLinkShared) {
             releaseSharedBandwidth(newTunnel, tunnel);
             return;
         }
 
-        resourceService.release(tunnelConsumerId);
-        /*
-         * Note: Storing of tunnel consumer id is done by caller of bandwidth reservation function. So deleting tunnel
-         * consumer id should be done by caller of bandwidth releasing function. This will prevent ambiguities related
-         * to who is supposed to store/delete.
-         */
+        tunnel.path().links().forEach(tn -> bandwidthMgmtService.releaseLocalReservedBw(LinkKey.linkKey(tn),
+                Double.parseDouble(tunnel.annotations().value(BANDWIDTH))));
     }
 
     /**
@@ -975,27 +1006,24 @@
      *  allocated in shared mode initially.
      */
     private synchronized void releaseSharedBandwidth(Tunnel newTunnel, Tunnel oldTunnel) {
-        // 1. Release old tunnel's bandwidth.
-        resourceService.release(pceStore.getTunnelInfo(oldTunnel.tunnelId()));
 
-        // 2. Release new tunnel's bandwidth, if new tunnel bandwidth is allocated
-        ResourceConsumer consumer = pceStore.getTunnelInfo(newTunnel.tunnelId());
-        if (consumer == null) {
-            //If bandwidth for new tunnel is not allocated i,e 0 then no need to allocate
-            return;
+        boolean isAllocate = false;
+        Double oldTunnelBw = Double.parseDouble(oldTunnel.annotations().value(BANDWIDTH));
+        Double newTunnelBw = Double.parseDouble(newTunnel.annotations().value(BANDWIDTH));
+
+        if (newTunnelBw > oldTunnelBw) {
+            isAllocate = true;
         }
 
-        resourceService.release(consumer);
-
-        // 3. Allocate new tunnel's complete bandwidth.
-        double bandwidth = Double.parseDouble(newTunnel.annotations().value(BANDWIDTH));
-        Resource resource;
-
         for (Link link : newTunnel.path().links()) {
-            resource = Resources.continuous(link.src().deviceId(), link.src().port(), Bandwidth.class)
-                    .resource(bandwidth);
-            resourceService.allocate(consumer, resource); // Reusing new tunnel's TunnelConsumerId intentionally.
-
+            if (oldTunnel.path().links().contains(link)) {
+                if (!isAllocate) {
+                    bandwidthMgmtService.releaseLocalReservedBw(LinkKey.linkKey(link),
+                            oldTunnelBw - newTunnelBw);
+                }
+            } else {
+                bandwidthMgmtService.releaseLocalReservedBw(LinkKey.linkKey(link), oldTunnelBw);
+            }
         }
     }
 
@@ -1017,19 +1045,12 @@
             }
 
             switch (event.type()) {
-            case TUNNEL_ADDED:
-                // Allocate bandwidth for non-initiated, delegated LSPs with non-zero bandwidth (learned LSPs).
-                String pceInit = tunnel.annotations().value(PCE_INIT);
-                if (FALSE.equalsIgnoreCase(pceInit) && bwConstraintValue != 0) {
-                    TunnelConsumerId consumerId = reserveBandwidth(tunnel.path(), bwConstraintValue, null);
-                    if (consumerId != null) {
-                        // Store tunnel consumer id in LSP store.
-                        pceStore.addTunnelInfo(tunnel.tunnelId(), consumerId);
-                    }
-                }
-                break;
-
             case TUNNEL_UPDATED:
+                if (rsvpTunnelsWithLocalBw.contains(tunnel.tunnelId())) {
+                    releaseBandwidth(event.subject());
+                        rsvpTunnelsWithLocalBw.remove(tunnel.tunnelId());
+                }
+
                 if (tunnel.state() == UNSTABLE) {
                     /*
                      * During LSP DB sync if PCC doesn't report LSP which was PCE initiated, it's state is turned into
@@ -1040,7 +1061,7 @@
                     List<Constraint> constraints = new LinkedList<>();
                     String bandwidth = tunnel.annotations().value(BANDWIDTH);
                     if (bandwidth != null) {
-                        constraints.add(new BandwidthConstraint(Bandwidth
+                        constraints.add(new PceBandwidthConstraint(Bandwidth
                                 .bps(Double.parseDouble(bandwidth))));
                     }
 
@@ -1068,14 +1089,16 @@
                     localLspIdFreeList.add(Short.valueOf(tunnel.annotations().value(LOCAL_LSP_ID)));
                 }
                 // If not zero bandwidth, and delegated (initiated LSPs will also be delegated).
-                if (bwConstraintValue != 0
-                        && mastershipService.getLocalRole(tunnel.path().src().deviceId()) == MastershipRole.MASTER) {
-                    releaseBandwidth(tunnel);
+                if (bwConstraintValue != 0 && mastershipService.getLocalRole(tunnel.path().src()
+                        .deviceId()) == MastershipRole.MASTER) {
+                    if (lspType != WITH_SIGNALLING) {
+                        releaseBandwidth(tunnel);
+                    }
                 }
 
-                if (pceStore.getTunnelInfo(tunnel.tunnelId()) != null) {
+                /*if (pceStore.getTunnelInfo(tunnel.tunnelId()) != null) {
                     pceStore.removeTunnelInfo(tunnel.tunnelId());
-                }
+                }*/
 
                 break;
 
diff --git a/apps/pce/app/src/main/java/org/onosproject/pce/pceservice/constraint/CostConstraint.java b/apps/pce/app/src/main/java/org/onosproject/pce/pceservice/constraint/CostConstraint.java
index 229644d..9aed3a2 100644
--- a/apps/pce/app/src/main/java/org/onosproject/pce/pceservice/constraint/CostConstraint.java
+++ b/apps/pce/app/src/main/java/org/onosproject/pce/pceservice/constraint/CostConstraint.java
@@ -16,9 +16,12 @@
 package org.onosproject.pce.pceservice.constraint;
 
 import org.onosproject.net.Link;
+import org.onosproject.net.LinkKey;
 import org.onosproject.net.Path;
-import org.onosproject.net.intent.ResourceContext;
+import org.onosproject.net.config.NetworkConfigService;
 import org.onosproject.net.intent.Constraint;
+import org.onosproject.net.intent.ResourceContext;
+import org.onosproject.pcep.api.TeLinkConfig;
 
 import java.util.Objects;
 
@@ -130,25 +133,38 @@
 
     @Override
     public double cost(Link link, ResourceContext context) {
-        //TODO: Usage of annotations are for transient solution. In future will be replaces with the
-        // network config service / Projection model.
+        return 0;
+    }
+
+    /**
+     * Validates the link based on cost type specified.
+     *
+     * @param link to validate cost type constraint
+     * @param netCfgService instance of netCfgService
+     * @return true if link satisfies cost constraint otherwise false
+     */
+    public double isValidLink(Link link, NetworkConfigService netCfgService) {
+        if (netCfgService == null) {
+            return -1;
+        }
+
+        TeLinkConfig cfg = netCfgService.getConfig(LinkKey.linkKey(link.src(), link.dst()), TeLinkConfig.class);
+        if (cfg == null) {
+            //If cost configuration absent return -1[It is not L3 device]
+            return -1;
+        }
+
         switch (type) {
-        case COST:
-            if (link.annotations().value(COST) != null) {
-                return Double.parseDouble(link.annotations().value(COST));
-            }
+            case COST:
+                //If IGP cost is zero then IGP cost is not assigned for that link
+                return cfg.igpCost() == 0 ? -1 : cfg.igpCost();
 
-            //If cost annotations absent return -1[It is not L3 device]
-            return -1;
-        case TE_COST:
-            if (link.annotations().value(TE_COST) != null) {
-                return Double.parseDouble(link.annotations().value(TE_COST));
-            }
+            case TE_COST:
+                //If TE cost is zero then TE cost is not assigned for that link
+                return cfg.teCost() == 0 ? -1 : cfg.teCost();
 
-            //If TE cost annotations absent return -1[It is not L3 device]
-            return -1;
-        default:
-            return -1;
+            default:
+                return -1;
         }
     }
 
diff --git a/apps/pce/app/src/main/java/org/onosproject/pce/pceservice/constraint/PceBandwidthConstraint.java b/apps/pce/app/src/main/java/org/onosproject/pce/pceservice/constraint/PceBandwidthConstraint.java
new file mode 100644
index 0000000..6a15023
--- /dev/null
+++ b/apps/pce/app/src/main/java/org/onosproject/pce/pceservice/constraint/PceBandwidthConstraint.java
@@ -0,0 +1,114 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.pce.pceservice.constraint;
+
+import org.onlab.util.Bandwidth;
+import org.onlab.util.DataRateUnit;
+import org.onosproject.net.Link;
+import org.onosproject.net.intent.ResourceContext;
+import org.onosproject.net.intent.constraint.BooleanConstraint;
+import org.onosproject.bandwidthmgr.api.BandwidthMgmtService;
+
+import java.util.Objects;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * Constraint that evaluates links based on available pce bandwidths.
+ */
+public final class PceBandwidthConstraint extends BooleanConstraint {
+
+    private final Bandwidth bandwidth;
+
+    /**
+     * Creates a new pce bandwidth constraint.
+     *
+     * @param bandwidth required bandwidth
+     */
+    public PceBandwidthConstraint(Bandwidth bandwidth) {
+        this.bandwidth = checkNotNull(bandwidth, "Bandwidth cannot be null");
+    }
+
+    /**
+     * Creates a new pce bandwidth constraint.
+     *
+     * @param v         required amount of bandwidth
+     * @param unit      {@link DataRateUnit} of {@code v}
+     * @return  {@link PceBandwidthConstraint} instance with given bandwidth requirement
+     */
+    public static PceBandwidthConstraint of(double v, DataRateUnit unit) {
+        return new PceBandwidthConstraint(Bandwidth.of(v, unit));
+    }
+
+    // Constructor for serialization
+    private PceBandwidthConstraint() {
+        this.bandwidth = null;
+    }
+
+    @Override
+    public boolean isValid(Link link, ResourceContext context) {
+        return false;
+        //Do nothing instead using isValidLink needs bandwidthMgmtService to validate link
+    }
+
+    /**
+     * Validates the link based on pce bandwidth constraint.
+     *
+     * @param link to validate pce bandwidth constraint
+     * @param bandwidthMgmtService instance of BandwidthMgmtService
+     * @return true if link satisfies pce bandwidth constraint otherwise false
+     */
+    public boolean isValidLink(Link link, BandwidthMgmtService bandwidthMgmtService) {
+        if (bandwidthMgmtService == null) {
+            return false;
+        }
+
+        return bandwidthMgmtService.isBandwidthAvailable(link, bandwidth.bps());
+
+    }
+
+    /**
+     * Returns the bandwidth required by this constraint.
+     *
+     * @return required bandwidth
+     */
+    public Bandwidth bandwidth() {
+        return bandwidth;
+    }
+
+    @Override
+    public int hashCode() {
+        return bandwidth.hashCode();
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null || getClass() != obj.getClass()) {
+            return false;
+        }
+        final PceBandwidthConstraint other = (PceBandwidthConstraint) obj;
+        return Objects.equals(this.bandwidth, other.bandwidth);
+    }
+
+    @Override
+    public String toString() {
+        return toStringHelper(this).add("bandwidth", bandwidth).toString();
+    }
+}
diff --git a/apps/pce/app/src/main/java/org/onosproject/pce/pceservice/constraint/SharedBandwidthConstraint.java b/apps/pce/app/src/main/java/org/onosproject/pce/pceservice/constraint/SharedBandwidthConstraint.java
index 2985f24..c5ced44 100644
--- a/apps/pce/app/src/main/java/org/onosproject/pce/pceservice/constraint/SharedBandwidthConstraint.java
+++ b/apps/pce/app/src/main/java/org/onosproject/pce/pceservice/constraint/SharedBandwidthConstraint.java
@@ -19,11 +19,10 @@
 import org.onosproject.net.Link;
 import org.onosproject.net.intent.ResourceContext;
 import org.onosproject.net.intent.constraint.BooleanConstraint;
-import org.onosproject.net.resource.Resources;
+import org.onosproject.bandwidthmgr.api.BandwidthMgmtService;
 
 import java.util.List;
 import java.util.Objects;
-import java.util.stream.Stream;
 
 import static com.google.common.base.MoreObjects.toStringHelper;
 
@@ -99,16 +98,28 @@
 
     @Override
     public boolean isValid(Link link, ResourceContext context) {
+        return false;
+        //Do nothing instead using isValidLink needs pce service to validate link
+    }
+
+    /**
+     * Validates the link based on shared bandwidth constraint.
+     *
+     * @param link to validate shared bandwidth constraint
+     * @param bandwidthMgmtService instance of BandwidthMgmtService
+     * @return true if link satisfies shared bandwidth constraint otherwise false
+     */
+    public boolean isValidLink(Link link, BandwidthMgmtService bandwidthMgmtService) {
+        if (bandwidthMgmtService == null) {
+            return false;
+        }
         changedBwValue = requestBwValue;
         if (links.contains(link)) {
             changedBwValue = requestBwValue.isGreaterThan(sharedBwValue) ? requestBwValue.subtract(sharedBwValue)
                     : Bandwidth.bps(0);
         }
 
-        return Stream
-                .of(link.src(), link.dst())
-                .map(cp -> Resources.continuous(cp.deviceId(), cp.port(), Bandwidth.class).resource(
-                        changedBwValue.bps())).allMatch(context::isAvailable);
+        return bandwidthMgmtService.isBandwidthAvailable(link, changedBwValue.bps());
     }
 
     @Override
diff --git a/apps/pce/app/src/main/java/org/onosproject/pce/pcestore/DistributedPceStore.java b/apps/pce/app/src/main/java/org/onosproject/pce/pcestore/DistributedPceStore.java
index 001f74b..eb6fadd 100644
--- a/apps/pce/app/src/main/java/org/onosproject/pce/pcestore/DistributedPceStore.java
+++ b/apps/pce/app/src/main/java/org/onosproject/pce/pcestore/DistributedPceStore.java
@@ -15,30 +15,19 @@
  */
 package org.onosproject.pce.pcestore;
 
-import static com.google.common.base.Preconditions.checkNotNull;
-
 import com.google.common.collect.ImmutableSet;
-
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-
 import org.apache.felix.scr.annotations.Activate;
 import org.apache.felix.scr.annotations.Component;
 import org.apache.felix.scr.annotations.Deactivate;
 import org.apache.felix.scr.annotations.Reference;
 import org.apache.felix.scr.annotations.ReferenceCardinality;
 import org.apache.felix.scr.annotations.Service;
-
 import org.onlab.util.KryoNamespace;
-import org.onosproject.incubator.net.tunnel.TunnelId;
-import org.onosproject.net.intent.constraint.BandwidthConstraint;
-import org.onosproject.net.resource.ResourceConsumer;
 import org.onosproject.pce.pceservice.ExplicitPathInfo;
+import org.onosproject.pce.pceservice.LspType;
 import org.onosproject.pce.pceservice.constraint.CapabilityConstraint;
 import org.onosproject.pce.pceservice.constraint.CostConstraint;
-import org.onosproject.pce.pceservice.TunnelConsumerId;
-import org.onosproject.pce.pceservice.LspType;
+import org.onosproject.pce.pceservice.constraint.PceBandwidthConstraint;
 import org.onosproject.pce.pceservice.constraint.SharedBandwidthConstraint;
 import org.onosproject.pce.pcestore.api.PceStore;
 import org.onosproject.store.serializers.KryoNamespaces;
@@ -46,10 +35,13 @@
 import org.onosproject.store.service.DistributedSet;
 import org.onosproject.store.service.Serializer;
 import org.onosproject.store.service.StorageService;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.util.List;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
 /**
  * Manages the pool of available labels to devices, links and tunnels.
  */
@@ -65,9 +57,6 @@
     @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
     protected StorageService storageService;
 
-    // Mapping tunnel with device local info with tunnel consumer id
-    private ConsistentMap<TunnelId, ResourceConsumer> tunnelInfoMap;
-
     // List of Failed path info
     private DistributedSet<PcePathInfo> failedPathSet;
 
@@ -81,7 +70,7 @@
                     .register(ExplicitPathInfo.Type.class)
                     .register(CostConstraint.class)
                     .register(CostConstraint.Type.class)
-                    .register(BandwidthConstraint.class)
+                    .register(PceBandwidthConstraint.class)
                     .register(SharedBandwidthConstraint.class)
                     .register(CapabilityConstraint.class)
                     .register(CapabilityConstraint.CapabilityType.class)
@@ -90,15 +79,6 @@
 
     @Activate
     protected void activate() {
-        tunnelInfoMap = storageService.<TunnelId, ResourceConsumer>consistentMapBuilder()
-                .withName("onos-pce-tunnelinfomap")
-                .withSerializer(Serializer.using(
-                        new KryoNamespace.Builder()
-                                .register(KryoNamespaces.API)
-                                .register(TunnelId.class,
-                                          TunnelConsumerId.class)
-                                .build()))
-                .build();
 
         failedPathSet = storageService.<PcePathInfo>setBuilder()
                 .withName("failed-path-info")
@@ -125,21 +105,11 @@
     }
 
     @Override
-    public boolean existsTunnelInfo(TunnelId tunnelId) {
-        checkNotNull(tunnelId, TUNNEL_ID_NULL);
-        return tunnelInfoMap.containsKey(tunnelId);
-    }
-
-    @Override
     public boolean existsFailedPathInfo(PcePathInfo failedPathInfo) {
         checkNotNull(failedPathInfo, PATH_INFO_NULL);
         return failedPathSet.contains(failedPathInfo);
     }
 
-    @Override
-    public int getTunnelInfoCount() {
-        return tunnelInfoMap.size();
-    }
 
     @Override
     public int getFailedPathInfoCount() {
@@ -147,29 +117,11 @@
     }
 
     @Override
-    public Map<TunnelId, ResourceConsumer> getTunnelInfos() {
-       return tunnelInfoMap.entrySet().stream()
-                 .collect(Collectors.toMap(Map.Entry::getKey, e -> e.getValue().value()));
-    }
-
-    @Override
     public Iterable<PcePathInfo> getFailedPathInfos() {
        return ImmutableSet.copyOf(failedPathSet);
     }
 
-    @Override
-    public ResourceConsumer getTunnelInfo(TunnelId tunnelId) {
-        checkNotNull(tunnelId, TUNNEL_ID_NULL);
-        return tunnelInfoMap.get(tunnelId) == null ? null : tunnelInfoMap.get(tunnelId).value();
-    }
 
-    @Override
-    public void addTunnelInfo(TunnelId tunnelId, ResourceConsumer tunnelConsumerId) {
-        checkNotNull(tunnelId, TUNNEL_ID_NULL);
-        checkNotNull(tunnelConsumerId, PCECC_TUNNEL_INFO_NULL);
-
-        tunnelInfoMap.put(tunnelId, tunnelConsumerId);
-    }
 
     @Override
     public void addFailedPathInfo(PcePathInfo failedPathInfo) {
@@ -177,16 +129,6 @@
         failedPathSet.add(failedPathInfo);
     }
 
-    @Override
-    public boolean removeTunnelInfo(TunnelId tunnelId) {
-        checkNotNull(tunnelId, TUNNEL_ID_NULL);
-
-        if (tunnelInfoMap.remove(tunnelId) == null) {
-            log.error("Tunnel info deletion for tunnel id {} has failed.", tunnelId.toString());
-            return false;
-        }
-        return true;
-    }
 
     @Override
     public boolean removeFailedPathInfo(PcePathInfo failedPathInfo) {
diff --git a/apps/pce/app/src/main/java/org/onosproject/pce/pcestore/api/PceStore.java b/apps/pce/app/src/main/java/org/onosproject/pce/pcestore/api/PceStore.java
index 0a7fa94..61f7fda 100644
--- a/apps/pce/app/src/main/java/org/onosproject/pce/pcestore/api/PceStore.java
+++ b/apps/pce/app/src/main/java/org/onosproject/pce/pcestore/api/PceStore.java
@@ -15,26 +15,15 @@
  */
 package org.onosproject.pce.pcestore.api;
 
-import java.util.List;
-
-import org.onosproject.incubator.net.tunnel.TunnelId;
-import org.onosproject.net.resource.ResourceConsumer;
 import org.onosproject.pce.pceservice.ExplicitPathInfo;
 import org.onosproject.pce.pcestore.PcePathInfo;
 
-import java.util.Map;
+import java.util.List;
 
 /**
  * Abstraction of an entity providing pool of available labels to devices, links and tunnels.
  */
 public interface PceStore {
-    /**
-     * Checks whether tunnel id is present in tunnel info store.
-     *
-     * @param tunnelId tunnel id
-     * @return success of failure
-     */
-    boolean existsTunnelInfo(TunnelId tunnelId);
 
     /**
      * Checks whether path info is present in failed path info list.
@@ -45,13 +34,6 @@
     boolean existsFailedPathInfo(PcePathInfo failedPathInfo);
 
     /**
-     * Retrieves the tunnel info count.
-     *
-     * @return tunnel info count
-     */
-    int getTunnelInfoCount();
-
-    /**
      * Retrieves the failed path info count.
      *
      * @return failed path info count
@@ -59,13 +41,6 @@
     int getFailedPathInfoCount();
 
     /**
-     * Retrieves tunnel id and pcecc tunnel info pairs collection from tunnel info store.
-     *
-     * @return collection of tunnel id and resource consumer pairs
-     */
-    Map<TunnelId, ResourceConsumer> getTunnelInfos();
-
-    /**
      * Retrieves path info collection from failed path info store.
      *
      * @return collection of failed path info
@@ -73,35 +48,12 @@
     Iterable<PcePathInfo> getFailedPathInfos();
 
     /**
-     * Retrieves local label info with tunnel consumer id from tunnel info store.
-     *
-     * @param tunnelId tunnel id
-     * @return resource consumer
-     */
-    ResourceConsumer getTunnelInfo(TunnelId tunnelId);
-
-    /**
-     * Stores local label info with tunnel consumer id into tunnel info store for specified tunnel id.
-     *
-     * @param tunnelId tunnel id
-     * @param tunnelConsumerId tunnel consumer id
-     */
-    void addTunnelInfo(TunnelId tunnelId, ResourceConsumer tunnelConsumerId);
-
-    /**
      * Stores path information into failed path info store.
      *
      * @param failedPathInfo failed path information
      */
     void addFailedPathInfo(PcePathInfo failedPathInfo);
 
-    /**
-     * Removes local label info with tunnel consumer id from tunnel info store for specified tunnel id.
-     *
-     * @param tunnelId tunnel id
-     * @return success or failure
-     */
-    boolean removeTunnelInfo(TunnelId tunnelId);
 
     /**
      * Removes path info from failed path info store.
diff --git a/apps/pce/app/src/test/java/org/onosproject/pce/pceservice/BandwidthMgmtServiceAdapter.java b/apps/pce/app/src/test/java/org/onosproject/pce/pceservice/BandwidthMgmtServiceAdapter.java
new file mode 100644
index 0000000..19786d0
--- /dev/null
+++ b/apps/pce/app/src/test/java/org/onosproject/pce/pceservice/BandwidthMgmtServiceAdapter.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.pce.pceservice;
+
+import org.onosproject.net.Link;
+import org.onosproject.net.LinkKey;
+import org.onosproject.bandwidthmgr.api.BandwidthMgmtService;
+
+import java.util.Set;
+
+/**
+ * Adapter for Bandwidth Management service.
+ */
+public class BandwidthMgmtServiceAdapter implements BandwidthMgmtService {
+    @Override
+    public boolean allocLocalReservedBw(LinkKey linkkey, Double bandwidth) {
+        return false;
+    }
+
+    @Override
+    public boolean releaseLocalReservedBw(LinkKey linkkey, Double bandwidth) {
+        return false;
+    }
+
+    @Override
+    public Double getAllocatedLocalReservedBw(LinkKey linkkey) {
+        return null;
+    }
+
+    @Override
+    public boolean addUnreservedBw(LinkKey linkkey, Set<Double> bandwidth) {
+        return false;
+    }
+
+    @Override
+    public boolean removeUnreservedBw(LinkKey linkkey) {
+        return false;
+    }
+
+    @Override
+    public Set<Double> getUnreservedBw(LinkKey linkkey) {
+        return null;
+    }
+
+    @Override
+    public boolean isBandwidthAvailable(Link link, Double bandwidth) {
+        return false;
+    }
+
+    @Override
+    public Double getTeCost(LinkKey linkKey) {
+        return null;
+    }
+
+    @Override
+    public Double getAvailableBandwidth(LinkKey linkKey) {
+        return null;
+    }
+}
diff --git a/apps/pce/app/src/test/java/org/onosproject/pce/pceservice/DefaultPcePathTest.java b/apps/pce/app/src/test/java/org/onosproject/pce/pceservice/DefaultPcePathTest.java
index 3a5eff4..59fa89c 100644
--- a/apps/pce/app/src/test/java/org/onosproject/pce/pceservice/DefaultPcePathTest.java
+++ b/apps/pce/app/src/test/java/org/onosproject/pce/pceservice/DefaultPcePathTest.java
@@ -34,8 +34,8 @@
 import org.onlab.rest.BaseResource;
 import org.onosproject.incubator.net.tunnel.TunnelId;
 import org.onosproject.pce.pceservice.constraint.CostConstraint;
+import org.onosproject.pce.pceservice.constraint.PceBandwidthConstraint;
 import org.onosproject.pce.pcestore.api.PceStore;
-import org.onosproject.net.intent.constraint.BandwidthConstraint;
 
 import java.util.List;
 
@@ -147,7 +147,7 @@
         CostConstraint costConstExpected = CostConstraint.of(CostConstraint.Type.values()[Integer.valueOf(cost) - 1]);
         CostConstraint costConstActual = (CostConstraint) path.costConstraint();
         assertThat(costConstActual.type(), is(costConstExpected.type()));
-        BandwidthConstraint bandwidthActual = (BandwidthConstraint) path.bandwidthConstraint();
+        PceBandwidthConstraint bandwidthActual = (PceBandwidthConstraint) path.bandwidthConstraint();
         assertThat(bandwidthActual.bandwidth().bps(), is(Double.valueOf(bandwidth)));
     }
 }
diff --git a/apps/pce/app/src/test/java/org/onosproject/pce/pceservice/PathComputationTest.java b/apps/pce/app/src/test/java/org/onosproject/pce/pceservice/PathComputationTest.java
index 60a84cc..36b7eb5 100644
--- a/apps/pce/app/src/test/java/org/onosproject/pce/pceservice/PathComputationTest.java
+++ b/apps/pce/app/src/test/java/org/onosproject/pce/pceservice/PathComputationTest.java
@@ -15,6 +15,12 @@
  */
 package org.onosproject.pce.pceservice;
 
+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;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableSet;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -25,7 +31,6 @@
 import org.onlab.graph.GraphPathSearch;
 import org.onlab.packet.ChassisId;
 import org.onlab.util.Bandwidth;
-import org.onlab.util.Tools;
 import org.onosproject.net.AnnotationKeys;
 import org.onosproject.net.ConnectPoint;
 import org.onosproject.net.DefaultAnnotations;
@@ -33,45 +38,30 @@
 import org.onosproject.net.DefaultLink;
 import org.onosproject.net.DefaultPath;
 import org.onosproject.net.Device;
+import org.onosproject.net.Device.Type;
 import org.onosproject.net.DeviceId;
 import org.onosproject.net.Link;
+import org.onosproject.net.LinkKey;
 import org.onosproject.net.Path;
 import org.onosproject.net.PortNumber;
-import org.onosproject.net.intent.Constraint;
-import org.onosproject.net.intent.IntentId;
-import org.onosproject.net.Device.Type;
 import org.onosproject.net.config.Config;
 import org.onosproject.net.config.ConfigApplyDelegate;
 import org.onosproject.net.config.ConfigFactory;
 import org.onosproject.net.config.NetworkConfigRegistryAdapter;
-import org.onosproject.net.intent.constraint.BandwidthConstraint;
 import org.onosproject.net.device.DeviceServiceAdapter;
-import org.onosproject.net.resource.ContinuousResource;
-import org.onosproject.net.resource.ContinuousResourceId;
-import org.onosproject.net.resource.DiscreteResource;
-import org.onosproject.net.resource.DiscreteResourceId;
-import org.onosproject.net.resource.Resource;
-import org.onosproject.net.resource.ResourceAllocation;
-import org.onosproject.net.resource.ResourceConsumer;
-import org.onosproject.net.resource.ResourceId;
-import org.onosproject.net.resource.Resources;
+import org.onosproject.net.intent.Constraint;
 import org.onosproject.net.provider.ProviderId;
 import org.onosproject.net.topology.DefaultTopologyEdge;
 import org.onosproject.net.topology.DefaultTopologyVertex;
-import org.onosproject.net.topology.LinkWeigher;
 import org.onosproject.net.topology.LinkWeight;
 import org.onosproject.net.topology.TopologyEdge;
 import org.onosproject.net.topology.TopologyVertex;
 import org.onosproject.pce.pceservice.constraint.CapabilityConstraint;
 import org.onosproject.pce.pceservice.constraint.CostConstraint;
+import org.onosproject.pce.pceservice.constraint.PceBandwidthConstraint;
 import org.onosproject.pce.pceservice.constraint.SharedBandwidthConstraint;
 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;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSet;
+import org.onosproject.pcep.api.TeLinkConfig;
 
 import java.util.Collections;
 import java.util.HashMap;
@@ -80,19 +70,18 @@
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
-import java.util.Optional;
 import java.util.Set;
 import java.util.stream.Collectors;
 
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.collect.ImmutableSet.of;
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.core.Is.is;
 import static org.onlab.graph.GraphPathSearch.ALL_PATHS;
 import static org.onosproject.core.CoreService.CORE_PROVIDER_ID;
-import static com.google.common.collect.ImmutableSet.of;
-import static org.onosproject.net.resource.Resources.continuous;
-import static org.onosproject.net.Link.Type.DIRECT;
-import static org.onosproject.net.Link.State.ACTIVE;
 import static org.onosproject.net.DeviceId.deviceId;
+import static org.onosproject.net.Link.State.ACTIVE;
+import static org.onosproject.net.Link.Type.DIRECT;
 import static org.onosproject.net.topology.AdapterLinkWeigher.adapt;
 import static org.onosproject.pce.pceservice.constraint.CostConstraint.Type.COST;
 import static org.onosproject.pce.pceservice.constraint.CostConstraint.Type.TE_COST;
@@ -102,10 +91,10 @@
  */
 public class PathComputationTest {
 
-    private final MockPathResourceService resourceService = new MockPathResourceService();
     private final MockDeviceService deviceService = new MockDeviceService();
     private final MockNetConfigRegistryAdapter netConfigRegistry = new MockNetConfigRegistryAdapter();
     private PceManager pceManager = new PceManager();
+    private final MockBandwidthMgmtService bandwidthMgmtService = new MockBandwidthMgmtService();
     public static ProviderId providerId = new ProviderId("pce", "foo");
     public static final String DEVICE1 = "D001";
     public static final String DEVICE2 = "D002";
@@ -132,7 +121,6 @@
 
     @Before
     public void startUp() {
-        pceManager.resourceService = resourceService;
         pceManager.deviceService = deviceService;
         pceManager.netCfgService = netConfigRegistry;
     }
@@ -160,11 +148,6 @@
         ConnectPoint dst = new ConnectPoint(DeviceId.deviceId(device2), PortNumber.portNumber(port2));
         Link curLink;
         DefaultAnnotations.Builder annotationBuilder = DefaultAnnotations.builder();
-        if (setCost) {
-            annotationBuilder.set(ANNOTATION_COST, String.valueOf(value));
-        } else {
-            annotationBuilder.set(ANNOTATION_TE_COST, String.valueOf(value));
-        }
 
         //TODO:If cost not set cost : default value case
         curLink = DefaultLink.builder().src(src).dst(dst).state(ACTIVE).type(DIRECT)
@@ -174,7 +157,6 @@
 
     @After
     public void tearDown() {
-        pceManager.resourceService = null;
         pceManager.deviceService = null;
         pceManager.netCfgService = null;
     }
@@ -186,8 +168,8 @@
      * @param constraints path constraints
      * @return edge-weight function
      */
-    private LinkWeigher weight(List<Constraint> constraints) {
-        return adapt(new MockTeConstraintBasedLinkWeight(constraints));
+    private LinkWeight weight(List<Constraint> constraints) {
+        return new MockTeConstraintBasedLinkWeight(constraints);
     }
 
     private Set<Path> computePath(Link link1, Link link2, Link link3, Link link4, List<Constraint> constraints) {
@@ -198,7 +180,7 @@
                    new DefaultTopologyEdge(D3, D4, link4)));
 
         GraphPathSearch.Result<TopologyVertex, TopologyEdge> result =
-                graphSearch().search(graph, D1, D4, weight(constraints), ALL_PATHS);
+                graphSearch().search(graph, D1, D4, adapt(weight(constraints)), ALL_PATHS);
         ImmutableSet.Builder<Path> builder = ImmutableSet.builder();
         for (org.onlab.graph.Path<TopologyVertex, TopologyEdge> path : result.paths()) {
             builder.add(networkPath(path));
@@ -262,9 +244,19 @@
                 Constraint constraint = it.next();
                 if (constraint instanceof CapabilityConstraint) {
                     cost = ((CapabilityConstraint) constraint).isValidLink(edge.link(), deviceService,
-                                                                           netConfigRegistry) ? 1 : -1;
+                            netConfigRegistry) ? 1 : -1;
+                } else if (constraint instanceof PceBandwidthConstraint) {
+                    cost = ((PceBandwidthConstraint) constraint).isValidLink(edge.link(),
+                            bandwidthMgmtService) ? 1 : -1;
+
+                } else if (constraint instanceof SharedBandwidthConstraint) {
+                    cost = ((SharedBandwidthConstraint) constraint).isValidLink(edge.link(),
+                            bandwidthMgmtService) ? 1 : -1;
+
+                } else if (constraint instanceof CostConstraint) {
+                    cost = ((CostConstraint) constraint).isValidLink(edge.link(), netConfigRegistry);
                 } else {
-                    cost = constraint.cost(edge.link(), resourceService::isAvailable);
+                    cost = constraint.cost(edge.link(), null);
                 }
             }
             return cost;
@@ -279,85 +271,92 @@
         return new DefaultPath(CORE_PROVIDER_ID, links, path.cost());
     }
 
-    /**
-     * Tests Resource service for path computation.
-     */
-    public class MockPathResourceService extends ResourceServiceAdapter {
-        private final Map<Resource, ResourceConsumer> assignment = new HashMap<>();
-        private Map<ResourceId, List<ResourceAllocation>> resourcesAllocations = new HashMap<>();
+    public static class MockBandwidthMgmtService extends BandwidthMgmtServiceAdapter {
+        private Map<LinkKey, Double> teCost = new HashMap<>();
+        // Locally maintain unreserved bandwidth of each link.
+        private Map<LinkKey, Set<Double>> unResvBw = new HashMap<>();
+
+        // Mapping tunnel with link key with local reserved bandwidth
+        private Map<LinkKey, Double> localReservedBw = new HashMap<>();
 
         @Override
-        public Optional<ResourceAllocation> allocate(ResourceConsumer consumer, Resource resources) {
-            List<ResourceAllocation> allocations = allocate(consumer, ImmutableList.of(resources));
-            if (allocations.isEmpty()) {
-                return Optional.empty();
+        public boolean allocLocalReservedBw(LinkKey linkkey, Double bandwidth) {
+            Double allocatedBw = localReservedBw.get(linkkey);
+            if (allocatedBw != null) {
+                localReservedBw.put(linkkey, (allocatedBw + bandwidth));
+            } else {
+                localReservedBw.put(linkkey, bandwidth);
             }
 
-            assert allocations.size() == 1;
-            ResourceAllocation allocation = allocations.get(0);
-            assert allocation.resource().equals(resources);
-
-            // cast is ensured by the assertions above
-            return Optional.of(allocation);
+            return true;
         }
 
         @Override
-        public List<ResourceAllocation> allocate(ResourceConsumer consumer, List<? extends Resource> resources) {
-            for (Resource resource: resources) {
-                if (resource instanceof ContinuousResource) {
-                    List<ResourceAllocation> allocs = new LinkedList<>();
-                    allocs.add(new ResourceAllocation(resource, consumer));
-                    resourcesAllocations.put(resource.id(), allocs);
-                }
+        public boolean releaseLocalReservedBw(LinkKey linkkey, Double bandwidth) {
+            Double allocatedBw = localReservedBw.get(linkkey);
+            if (allocatedBw == null || allocatedBw < bandwidth) {
+                return false;
             }
-            return resources.stream()
-                    .map(x -> new ResourceAllocation(x, consumer))
-                    .collect(Collectors.toList());
+
+            Double releasedBw = allocatedBw - bandwidth;
+            if (releasedBw == 0.0) {
+                localReservedBw.remove(linkkey);
+            } else {
+                localReservedBw.put(linkkey, releasedBw);
+            }
+            return true;
         }
 
         @Override
-        public List<ResourceAllocation> getResourceAllocations(ResourceId id) {
-            if (id instanceof ContinuousResourceId) {
-                return resourcesAllocations.get(id);
-            }
-            DiscreteResource discrete = Resources.discrete((DiscreteResourceId) id).resource();
-            return Optional.ofNullable(assignment.get(discrete))
-                    .map(x -> ImmutableList.of(new ResourceAllocation(discrete, x)))
-                    .orElse(ImmutableList.of());
+        public Double getAllocatedLocalReservedBw(LinkKey linkkey) {
+            return localReservedBw.get(linkkey);
         }
 
         @Override
-        public <T> Set<Resource> getAvailableResources(DiscreteResourceId parent, Class<T> cls) {
-            return getAvailableResources(parent).stream()
-                    .filter(x -> x.isTypeOf(cls))
-                    .collect(Collectors.toSet());
+        public boolean addUnreservedBw(LinkKey linkkey, Set<Double> bandwidth) {
+            unResvBw.put(linkkey, bandwidth);
+            return true;
         }
 
         @Override
-        public <T> Set<T> getAvailableResourceValues(DiscreteResourceId parent, Class<T> cls) {
-            return getAvailableResources(parent).stream()
-                    .filter(x -> x.isTypeOf(cls))
-                    .flatMap(x -> Tools.stream(x.valueAs(cls)))
-                    .collect(Collectors.toSet());
+        public boolean removeUnreservedBw(LinkKey linkkey) {
+            unResvBw.remove(linkkey);
+            return true;
         }
 
         @Override
-        public boolean isAvailable(Resource resource) {
-            if (resource instanceof DiscreteResource) {
-                return true;
-            }
+        public Set<Double> getUnreservedBw(LinkKey linkkey) {
+            checkNotNull(linkkey);
+            return unResvBw.get(linkkey);
+        }
 
-            if (resource instanceof ContinuousResource) {
-                List<ResourceAllocation> resalloc = resourcesAllocations.get(resource.id());
+        @Override
+        public boolean isBandwidthAvailable(Link link, Double bandwidth) {
+            LinkKey linkKey = LinkKey.linkKey(link);
+            Double localAllocBw = getAllocatedLocalReservedBw(linkKey);
 
-                if ((resalloc != null) && (!resalloc.isEmpty())) {
-                    if (((ContinuousResource) resalloc.iterator().next().resource()).value()
-                            >= ((ContinuousResource) resource).value()) {
-                        return true;
-                    }
-                }
+            Set<Double> unResvBw = getUnreservedBw(linkKey);
+
+            Double prirZeroBw = unResvBw.iterator().next();
+            return (bandwidth <= prirZeroBw -  (localAllocBw != null ? localAllocBw : 0));
+        }
+
+        @Override
+        public Double getTeCost(LinkKey linkKey) {
+            if (teCost.get(linkKey) != null) {
+                return teCost.get(linkKey);
             }
-            return false;
+            return null;
+        }
+
+        @Override
+        public Double getAvailableBandwidth(LinkKey linkKey) {
+            if (unResvBw.get(linkKey) != null && localReservedBw.get(linkKey) != null) {
+
+                return unResvBw.get(linkKey).iterator().next().doubleValue()
+                        - localReservedBw.get(linkKey).doubleValue();
+            }
+            return unResvBw.get(linkKey).iterator().next().doubleValue();
         }
     }
 
@@ -365,6 +364,7 @@
     public static class MockNetConfigRegistryAdapter extends NetworkConfigRegistryAdapter {
         private ConfigFactory cfgFactory;
         private Map<DeviceId, DeviceCapability> classConfig = new HashMap<>();
+        private Map<LinkKey, TeLinkConfig> teLinkConfig = new HashMap<>();
 
         @Override
         public void registerConfigFactory(ConfigFactory configFactory) {
@@ -387,6 +387,15 @@
                 ConfigApplyDelegate delegate = new InternalApplyDelegate();
                 devCap.init((DeviceId) subject, null, node, mapper, delegate);
                 return (C) devCap;
+            } else if (configClass == TeLinkConfig.class) {
+                TeLinkConfig teConfig = new TeLinkConfig();
+                teLinkConfig.put((LinkKey) subject, teConfig);
+
+                JsonNode node = new ObjectNode(new MockJsonNode());
+                ObjectMapper mapper = new ObjectMapper();
+                ConfigApplyDelegate delegate = new InternalApplyDelegate();
+                teConfig.init((LinkKey) subject, null, node, mapper, delegate);
+                return (C) teConfig;
             }
 
             return null;
@@ -394,13 +403,19 @@
 
         @Override
         public <S, C extends Config<S>> void removeConfig(S subject, Class<C> configClass) {
-            classConfig.remove(subject);
+            if (configClass == DeviceCapability.class) {
+                classConfig.remove(subject);
+            } else if (configClass == TeLinkConfig.class) {
+                teLinkConfig.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);
+            } else if (configClass == TeLinkConfig.class) {
+                return (C) teLinkConfig.get(subject);
             }
             return null;
         }
@@ -432,6 +447,23 @@
         List<Constraint> constraints = new LinkedList<>();
         constraints.add(costConst);
 
+        TeLinkConfig teLinkConfig = netConfigRegistry.addConfig(LinkKey.linkKey(link1), TeLinkConfig.class);
+        teLinkConfig.igpCost(50)
+                .apply();
+
+
+        TeLinkConfig teLinkConfig2 = netConfigRegistry.addConfig(LinkKey.linkKey(link2), TeLinkConfig.class);
+        teLinkConfig2.igpCost(20)
+                .apply();
+
+        TeLinkConfig teLinkConfig3 = netConfigRegistry.addConfig(LinkKey.linkKey(link3), TeLinkConfig.class);
+        teLinkConfig3.igpCost(100)
+                .apply();
+
+        TeLinkConfig teLinkConfig4 = netConfigRegistry.addConfig(LinkKey.linkKey(link4), TeLinkConfig.class);
+        teLinkConfig4.igpCost(50)
+                .apply();
+
         Set<Path> paths = computePath(link1, link2, link3, link4, constraints);
 
         List<Link> links = new LinkedList<>();
@@ -456,6 +488,24 @@
         CostConstraint costConst = CostConstraint.of(COST);
         List<Constraint> constraints = new LinkedList<>();
         constraints.add(costConst);
+
+        TeLinkConfig teLinkConfig = netConfigRegistry.addConfig(LinkKey.linkKey(link1), TeLinkConfig.class);
+        teLinkConfig.igpCost(100)
+                .apply();
+
+
+        TeLinkConfig teLinkConfig2 = netConfigRegistry.addConfig(LinkKey.linkKey(link2), TeLinkConfig.class);
+        teLinkConfig2.igpCost(100)
+                .apply();
+
+        TeLinkConfig teLinkConfig3 = netConfigRegistry.addConfig(LinkKey.linkKey(link3), TeLinkConfig.class);
+        teLinkConfig3.igpCost(1000)
+                .apply();
+
+        TeLinkConfig teLinkConfig4 = netConfigRegistry.addConfig(LinkKey.linkKey(link4), TeLinkConfig.class);
+        teLinkConfig4.igpCost(100)
+                .apply();
+
         Set<Path> paths = computePath(link1, link2, link3, link4, constraints);
 
         List<Link> links = new LinkedList<>();
@@ -476,29 +526,24 @@
         Link link3 = addLink(DEVICE1, 80, DEVICE3, 70, true, 100);
         Link link4 = addLink(DEVICE3, 60, DEVICE4, 50, true, 50);
 
-        List<Resource> resources = new LinkedList<>();
+        Set<Double> unreserved = new HashSet<>();
+        unreserved.add(new Double(50));
 
-        resources.add(continuous(link1.src().deviceId(), link1.src().port(), Bandwidth.class)
-                .resource(50));
-        resources.add(continuous(link2.src().deviceId(), link2.src().port(), Bandwidth.class)
-                .resource(50));
-        resources.add(continuous(link3.src().deviceId(), link3.src().port(), Bandwidth.class)
-                .resource(100));
-        resources.add(continuous(link4.src().deviceId(), link4.src().port(), Bandwidth.class)
-                .resource(100));
+        bandwidthMgmtService.addUnreservedBw(LinkKey.linkKey(link1), unreserved);
+        bandwidthMgmtService.allocLocalReservedBw(LinkKey.linkKey(link1), new Double(0));
 
-        resources.add(continuous(link1.dst().deviceId(), link1.dst().port(), Bandwidth.class)
-                .resource(50));
-        resources.add(continuous(link2.dst().deviceId(), link2.dst().port(), Bandwidth.class)
-                .resource(50));
-        resources.add(continuous(link3.dst().deviceId(), link3.src().port(), Bandwidth.class)
-                .resource(100));
-        resources.add(continuous(link4.dst().deviceId(), link4.dst().port(), Bandwidth.class)
-                .resource(100));
+        bandwidthMgmtService.addUnreservedBw(LinkKey.linkKey(link2), unreserved);
+        bandwidthMgmtService.allocLocalReservedBw(LinkKey.linkKey(link2), new Double(0));
 
-        resourceService.allocate(IntentId.valueOf(70), resources);
+        unreserved.remove(new Double(50));
+        unreserved.add(new Double(100));
+        bandwidthMgmtService.addUnreservedBw(LinkKey.linkKey(link3), unreserved);
+        bandwidthMgmtService.allocLocalReservedBw(LinkKey.linkKey(link3), new Double(0));
 
-        BandwidthConstraint bandwidthConst = new BandwidthConstraint(Bandwidth.bps(10.0));
+        bandwidthMgmtService.addUnreservedBw(LinkKey.linkKey(link4), unreserved);
+        bandwidthMgmtService.allocLocalReservedBw(LinkKey.linkKey(link4), new Double(0));
+
+        PceBandwidthConstraint bandwidthConst = new PceBandwidthConstraint(Bandwidth.bps(10.0));
 
         List<Constraint> constraints = new LinkedList<>();
         constraints.add(bandwidthConst);
@@ -518,21 +563,24 @@
         Link link3 = addLink(DEVICE1, 80, DEVICE3, 70, true, 100);
         Link link4 = addLink(DEVICE3, 60, DEVICE4, 50, true, 100);
 
-        List<Resource> resources = new LinkedList<>();
+        Set<Double> unreserved = new HashSet<>();
+        unreserved.add(new Double(50));
 
-        resources.add(continuous(link1.src().deviceId(), link1.src().port(), Bandwidth.class).resource(50));
-        resources.add(continuous(link2.src().deviceId(), link2.src().port(), Bandwidth.class).resource(50));
-        resources.add(continuous(link3.src().deviceId(), link3.src().port(), Bandwidth.class).resource(100));
-        resources.add(continuous(link4.src().deviceId(), link4.src().port(), Bandwidth.class).resource(100));
+        bandwidthMgmtService.addUnreservedBw(LinkKey.linkKey(link1), unreserved);
+        bandwidthMgmtService.allocLocalReservedBw(LinkKey.linkKey(link1), new Double(0));
 
-        resources.add(continuous(link1.dst().deviceId(), link1.dst().port(), Bandwidth.class).resource(50));
-        resources.add(continuous(link2.dst().deviceId(), link2.dst().port(), Bandwidth.class).resource(50));
-        resources.add(continuous(link3.dst().deviceId(), link3.dst().port(), Bandwidth.class).resource(100));
-        resources.add(continuous(link4.dst().deviceId(), link4.dst().port(), Bandwidth.class).resource(100));
+        bandwidthMgmtService.addUnreservedBw(LinkKey.linkKey(link2), unreserved);
+        bandwidthMgmtService.allocLocalReservedBw(LinkKey.linkKey(link2), new Double(0));
 
-        resourceService.allocate(IntentId.valueOf(70), resources);
+        unreserved.remove(new Double(50));
+        unreserved.add(new Double(100));
+        bandwidthMgmtService.addUnreservedBw(LinkKey.linkKey(link3), unreserved);
+        bandwidthMgmtService.allocLocalReservedBw(LinkKey.linkKey(link3), new Double(0));
 
-        BandwidthConstraint bandwidthConst = new BandwidthConstraint(Bandwidth.bps(60.0));
+        bandwidthMgmtService.addUnreservedBw(LinkKey.linkKey(link4), unreserved);
+        bandwidthMgmtService.allocLocalReservedBw(LinkKey.linkKey(link4), new Double(0));
+
+        PceBandwidthConstraint bandwidthConst = new PceBandwidthConstraint(Bandwidth.bps(60.0));
 
         List<Constraint> constraints = new LinkedList<>();
         constraints.add(bandwidthConst);
@@ -551,18 +599,22 @@
         Link link3 = addLink(DEVICE1, 80, DEVICE3, 70, true, 100);
         Link link4 = addLink(DEVICE3, 60, DEVICE4, 50, true, 80);
 
-        List<Resource> resources = new LinkedList<>();
+        Set<Double> unreserved = new HashSet<>();
+        unreserved.add(new Double(50));
 
-        resources.add(continuous(link1.src().deviceId(), link1.src().port(), Bandwidth.class).resource(50));
-        resources.add(continuous(link2.src().deviceId(), link2.src().port(), Bandwidth.class).resource(50));
-        resources.add(continuous(link3.src().deviceId(), link3.src().port(), Bandwidth.class).resource(100));
-        resources.add(continuous(link4.src().deviceId(), link4.src().port(), Bandwidth.class).resource(100));
+        bandwidthMgmtService.addUnreservedBw(LinkKey.linkKey(link1), unreserved);
+        bandwidthMgmtService.allocLocalReservedBw(LinkKey.linkKey(link1), new Double(0));
 
-        resources.add(continuous(link1.dst().deviceId(), link1.dst().port(), Bandwidth.class).resource(50));
-        resources.add(continuous(link2.dst().deviceId(), link2.dst().port(), Bandwidth.class).resource(50));
-        resources.add(continuous(link3.dst().deviceId(), link3.dst().port(), Bandwidth.class).resource(100));
-        resources.add(continuous(link4.dst().deviceId(), link4.dst().port(), Bandwidth.class).resource(100));
-        resourceService.allocate(IntentId.valueOf(70), resources);
+        bandwidthMgmtService.addUnreservedBw(LinkKey.linkKey(link2), unreserved);
+        bandwidthMgmtService.allocLocalReservedBw(LinkKey.linkKey(link2), new Double(0));
+
+        unreserved.remove(new Double(50));
+        unreserved.add(new Double(100));
+        bandwidthMgmtService.addUnreservedBw(LinkKey.linkKey(link3), unreserved);
+        bandwidthMgmtService.allocLocalReservedBw(LinkKey.linkKey(link3), new Double(0));
+
+        bandwidthMgmtService.addUnreservedBw(LinkKey.linkKey(link4), unreserved);
+        bandwidthMgmtService.allocLocalReservedBw(LinkKey.linkKey(link4), new Double(0));
 
         List<Constraint> constraints = new LinkedList<>();
 
@@ -573,6 +625,25 @@
         links.add(link2);
 
         CostConstraint costConst = CostConstraint.of(COST);
+
+
+        TeLinkConfig teLinkConfig = netConfigRegistry.addConfig(LinkKey.linkKey(link1), TeLinkConfig.class);
+        teLinkConfig.igpCost(50)
+                .apply();
+
+
+        TeLinkConfig teLinkConfig2 = netConfigRegistry.addConfig(LinkKey.linkKey(link2), TeLinkConfig.class);
+        teLinkConfig2.igpCost(20)
+                .apply();
+
+        TeLinkConfig teLinkConfig3 = netConfigRegistry.addConfig(LinkKey.linkKey(link3), TeLinkConfig.class);
+        teLinkConfig3.igpCost(100)
+                .apply();
+
+        TeLinkConfig teLinkConfig4 = netConfigRegistry.addConfig(LinkKey.linkKey(link4), TeLinkConfig.class);
+        teLinkConfig4.igpCost(50)
+                .apply();
+
         sharedLinks.addAll(links);
         SharedBandwidthConstraint sharedBw = new SharedBandwidthConstraint(sharedLinks, Bandwidth.bps(10),
                 Bandwidth.bps(20.0));
@@ -593,18 +664,22 @@
         Link link3 = addLink(DEVICE1, 80, DEVICE3, 70, true, 100);
         Link link4 = addLink(DEVICE3, 60, DEVICE4, 50, true, 80);
 
-        List<Resource> resources = new LinkedList<>();
+        Set<Double> unreserved = new HashSet<>();
+        unreserved.add(new Double(50));
 
-        resources.add(continuous(link1.src().deviceId(), link1.src().port(), Bandwidth.class).resource(50));
-        resources.add(continuous(link2.src().deviceId(), link2.src().port(), Bandwidth.class).resource(50));
-        resources.add(continuous(link3.src().deviceId(), link3.src().port(), Bandwidth.class).resource(100));
-        resources.add(continuous(link4.src().deviceId(), link4.src().port(), Bandwidth.class).resource(100));
+        bandwidthMgmtService.addUnreservedBw(LinkKey.linkKey(link1), unreserved);
+        bandwidthMgmtService.allocLocalReservedBw(LinkKey.linkKey(link1), new Double(0));
 
-        resources.add(continuous(link1.dst().deviceId(), link1.dst().port(), Bandwidth.class).resource(50));
-        resources.add(continuous(link2.dst().deviceId(), link2.dst().port(), Bandwidth.class).resource(50));
-        resources.add(continuous(link3.dst().deviceId(), link3.dst().port(), Bandwidth.class).resource(100));
-        resources.add(continuous(link4.dst().deviceId(), link4.dst().port(), Bandwidth.class).resource(100));
-        resourceService.allocate(IntentId.valueOf(70), resources);
+        bandwidthMgmtService.addUnreservedBw(LinkKey.linkKey(link2), unreserved);
+        bandwidthMgmtService.allocLocalReservedBw(LinkKey.linkKey(link2), new Double(0));
+
+        unreserved.remove(new Double(50));
+        unreserved.add(new Double(100));
+        bandwidthMgmtService.addUnreservedBw(LinkKey.linkKey(link3), unreserved);
+        bandwidthMgmtService.allocLocalReservedBw(LinkKey.linkKey(link3), new Double(0));
+
+        bandwidthMgmtService.addUnreservedBw(LinkKey.linkKey(link4), unreserved);
+        bandwidthMgmtService.allocLocalReservedBw(LinkKey.linkKey(link4), new Double(0));
 
         List<Constraint> constraints = new LinkedList<>();
 
@@ -614,6 +689,25 @@
         links.add(link1);
         links.add(link2);
         CostConstraint costConst = CostConstraint.of(COST);
+
+
+        TeLinkConfig teLinkConfig = netConfigRegistry.addConfig(LinkKey.linkKey(link1), TeLinkConfig.class);
+        teLinkConfig.igpCost(50)
+                .apply();
+
+
+        TeLinkConfig teLinkConfig2 = netConfigRegistry.addConfig(LinkKey.linkKey(link2), TeLinkConfig.class);
+        teLinkConfig2.igpCost(20)
+                .apply();
+
+        TeLinkConfig teLinkConfig3 = netConfigRegistry.addConfig(LinkKey.linkKey(link3), TeLinkConfig.class);
+        teLinkConfig3.igpCost(100)
+                .apply();
+
+        TeLinkConfig teLinkConfig4 = netConfigRegistry.addConfig(LinkKey.linkKey(link4), TeLinkConfig.class);
+        teLinkConfig4.igpCost(80)
+                .apply();
+
         sharedLinks.addAll(links);
         SharedBandwidthConstraint sharedBwConst = new SharedBandwidthConstraint(sharedLinks, Bandwidth.bps(20),
                 Bandwidth.bps(10.0));
@@ -654,6 +748,25 @@
 
         List<Constraint> constraints = new LinkedList<>();
         constraints.add(tecostConst);
+
+
+        TeLinkConfig teLinkConfig = netConfigRegistry.addConfig(LinkKey.linkKey(link1), TeLinkConfig.class);
+        teLinkConfig.teCost(50)
+                .apply();
+
+
+        TeLinkConfig teLinkConfig2 = netConfigRegistry.addConfig(LinkKey.linkKey(link2), TeLinkConfig.class);
+        teLinkConfig2.teCost(20)
+                .apply();
+
+        TeLinkConfig teLinkConfig3 = netConfigRegistry.addConfig(LinkKey.linkKey(link3), TeLinkConfig.class);
+        teLinkConfig3.teCost(100)
+                .apply();
+
+        TeLinkConfig teLinkConfig4 = netConfigRegistry.addConfig(LinkKey.linkKey(link4), TeLinkConfig.class);
+        teLinkConfig4.teCost(80)
+                .apply();
+
         Set<Path> paths = computePath(link1, link2, link3, link4, constraints);
 
         List<Link> links = new LinkedList<>();
@@ -674,6 +787,25 @@
         Link link4 = addLink(DEVICE3, 60, DEVICE4, 50, false, 80);
 
         CostConstraint tecostConst = CostConstraint.of(TE_COST);
+
+        TeLinkConfig teLinkConfig = netConfigRegistry.addConfig(LinkKey.linkKey(link1), TeLinkConfig.class);
+        teLinkConfig.teCost(50)
+                .apply();
+
+
+        TeLinkConfig teLinkConfig2 = netConfigRegistry.addConfig(LinkKey.linkKey(link2), TeLinkConfig.class);
+        teLinkConfig2.teCost(20)
+                .apply();
+
+        TeLinkConfig teLinkConfig3 = netConfigRegistry.addConfig(LinkKey.linkKey(link3), TeLinkConfig.class);
+        teLinkConfig3.teCost(100)
+                .apply();
+
+        TeLinkConfig teLinkConfig4 = netConfigRegistry.addConfig(LinkKey.linkKey(link4), TeLinkConfig.class);
+        teLinkConfig4.teCost(80)
+                .apply();
+
+
         CapabilityConstraint capabilityConst = CapabilityConstraint
                 .of(CapabilityConstraint.CapabilityType.WITH_SIGNALLING);
 
@@ -754,6 +886,23 @@
         constraints.add(capabilityConst);
         CostConstraint costConst = CostConstraint.of(COST);
         constraints.add(costConst);
+        TeLinkConfig teLinkConfig = netConfigRegistry.addConfig(LinkKey.linkKey(link1), TeLinkConfig.class);
+        teLinkConfig.igpCost(50)
+                .apply();
+
+
+        TeLinkConfig teLinkConfig2 = netConfigRegistry.addConfig(LinkKey.linkKey(link2), TeLinkConfig.class);
+        teLinkConfig2.igpCost(20)
+                .apply();
+
+        TeLinkConfig teLinkConfig3 = netConfigRegistry.addConfig(LinkKey.linkKey(link3), TeLinkConfig.class);
+        teLinkConfig3.igpCost(100)
+                .apply();
+
+        TeLinkConfig teLinkConfig4 = netConfigRegistry.addConfig(LinkKey.linkKey(link4), TeLinkConfig.class);
+        teLinkConfig4.igpCost(80)
+                .apply();
+
         //Device1
         DefaultAnnotations.Builder builder = DefaultAnnotations.builder();
         builder.set(AnnotationKeys.TYPE, L3);
@@ -824,6 +973,23 @@
         constraints.add(capabilityConst);
         CostConstraint costConst = CostConstraint.of(COST);
         constraints.add(costConst);
+
+        TeLinkConfig teLinkConfig = netConfigRegistry.addConfig(LinkKey.linkKey(link1), TeLinkConfig.class);
+        teLinkConfig.igpCost(50)
+                .apply();
+
+
+        TeLinkConfig teLinkConfig2 = netConfigRegistry.addConfig(LinkKey.linkKey(link2), TeLinkConfig.class);
+        teLinkConfig2.igpCost(20)
+                .apply();
+
+        TeLinkConfig teLinkConfig3 = netConfigRegistry.addConfig(LinkKey.linkKey(link3), TeLinkConfig.class);
+        teLinkConfig3.igpCost(100)
+                .apply();
+
+        TeLinkConfig teLinkConfig4 = netConfigRegistry.addConfig(LinkKey.linkKey(link4), TeLinkConfig.class);
+        teLinkConfig4.igpCost(80)
+                .apply();
         //Device1
         DefaultAnnotations.Builder builder = DefaultAnnotations.builder();
         builder.set(AnnotationKeys.TYPE, L3);
@@ -894,6 +1060,23 @@
 
         constraints.add(capabilityConst);
         constraints.add(tecostConst);
+
+        TeLinkConfig teLinkConfig = netConfigRegistry.addConfig(LinkKey.linkKey(link1), TeLinkConfig.class);
+        teLinkConfig.teCost(50)
+                .apply();
+
+
+        TeLinkConfig teLinkConfig2 = netConfigRegistry.addConfig(LinkKey.linkKey(link2), TeLinkConfig.class);
+        teLinkConfig2.teCost(20)
+                .apply();
+
+        TeLinkConfig teLinkConfig3 = netConfigRegistry.addConfig(LinkKey.linkKey(link3), TeLinkConfig.class);
+        teLinkConfig3.teCost(100)
+                .apply();
+
+        TeLinkConfig teLinkConfig4 = netConfigRegistry.addConfig(LinkKey.linkKey(link4), TeLinkConfig.class);
+        teLinkConfig4.teCost(80)
+                .apply();
         //Device1
         DefaultAnnotations.Builder builder = DefaultAnnotations.builder();
         builder.set(AnnotationKeys.TYPE, L3);
@@ -1061,6 +1244,28 @@
 
         List<Constraint> constraints = new LinkedList<>();
         constraints.add(costConst);
+
+        TeLinkConfig teLinkConfig = netConfigRegistry.addConfig(LinkKey.linkKey(link1), TeLinkConfig.class);
+        teLinkConfig.igpCost(50)
+                .apply();
+
+
+        TeLinkConfig teLinkConfig2 = netConfigRegistry.addConfig(LinkKey.linkKey(link2), TeLinkConfig.class);
+        teLinkConfig2.igpCost(100)
+                .apply();
+
+        TeLinkConfig teLinkConfig3 = netConfigRegistry.addConfig(LinkKey.linkKey(link3), TeLinkConfig.class);
+        teLinkConfig3.igpCost(10)
+                .apply();
+
+        TeLinkConfig teLinkConfig4 = netConfigRegistry.addConfig(LinkKey.linkKey(link4), TeLinkConfig.class);
+        teLinkConfig4.igpCost(10)
+                .apply();
+
+        TeLinkConfig teLinkConfig5 = netConfigRegistry.addConfig(LinkKey.linkKey(link5), TeLinkConfig.class);
+        teLinkConfig5.igpCost(20)
+                .apply();
+
         Graph<TopologyVertex, TopologyEdge> graph = new AdjacencyListsGraph<>(of(D1, D2, D3, D4, D5),
                 of(new DefaultTopologyEdge(D1, D2, link1),
                    new DefaultTopologyEdge(D2, D4, link2),
@@ -1069,7 +1274,7 @@
                    new DefaultTopologyEdge(D4, D5, link5)));
 
         GraphPathSearch.Result<TopologyVertex, TopologyEdge> result =
-                graphSearch().search(graph, D1, D5, weight(constraints), ALL_PATHS);
+                graphSearch().search(graph, D1, D5, adapt(weight(constraints)), ALL_PATHS);
         ImmutableSet.Builder<Path> builder = ImmutableSet.builder();
         for (org.onlab.graph.Path<TopologyVertex, TopologyEdge> path : result.paths()) {
             builder.add(networkPath(path));
@@ -1154,6 +1359,24 @@
         CapabilityConstraint capabilityConst = CapabilityConstraint
                 .of(CapabilityConstraint.CapabilityType.WITHOUT_SIGNALLING_AND_WITHOUT_SR);
         CostConstraint costConst = CostConstraint.of(COST);
+
+        TeLinkConfig teLinkConfig = netConfigRegistry.addConfig(LinkKey.linkKey(link1), TeLinkConfig.class);
+        teLinkConfig.igpCost(50)
+                .apply();
+
+
+        TeLinkConfig teLinkConfig2 = netConfigRegistry.addConfig(LinkKey.linkKey(link2), TeLinkConfig.class);
+        teLinkConfig2.igpCost(20)
+                .apply();
+
+        TeLinkConfig teLinkConfig3 = netConfigRegistry.addConfig(LinkKey.linkKey(link3), TeLinkConfig.class);
+        teLinkConfig3.igpCost(10)
+                .apply();
+
+        TeLinkConfig teLinkConfig4 = netConfigRegistry.addConfig(LinkKey.linkKey(link4), TeLinkConfig.class);
+        teLinkConfig4.igpCost(10)
+                .apply();
+
         List<Constraint> constraints = new LinkedList<>();
         constraints.add(capabilityConst);
         constraints.add(costConst);
@@ -1199,4 +1422,4 @@
         UNKNOWN, UNKNOWN, UNKNOWN,
         UNKNOWN, new ChassisId(), builder.build()));
     }
-}
+}
\ No newline at end of file
diff --git a/apps/pce/app/src/test/java/org/onosproject/pce/pceservice/PceManagerTest.java b/apps/pce/app/src/test/java/org/onosproject/pce/pceservice/PceManagerTest.java
index beeabdd..06d8df6 100644
--- a/apps/pce/app/src/test/java/org/onosproject/pce/pceservice/PceManagerTest.java
+++ b/apps/pce/app/src/test/java/org/onosproject/pce/pceservice/PceManagerTest.java
@@ -15,43 +15,8 @@
  */
 package org.onosproject.pce.pceservice;
 
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.Is.is;
-import static org.onlab.graph.GraphPathSearch.ALL_PATHS;
-import static org.onosproject.incubator.net.tunnel.Tunnel.State.ESTABLISHED;
-import static org.onosproject.incubator.net.tunnel.Tunnel.State.UNSTABLE;
-import static org.onosproject.net.MastershipRole.MASTER;
-import static org.onosproject.net.resource.Resources.continuous;
-import static org.onosproject.net.topology.AdapterLinkWeigher.adapt;
-import static org.onosproject.pce.pceservice.LspType.SR_WITHOUT_SIGNALLING;
-import static org.onosproject.pce.pceservice.LspType.WITHOUT_SIGNALLING_AND_WITHOUT_SR;
-import static org.onosproject.pce.pceservice.LspType.WITH_SIGNALLING;
-import static org.onosproject.pce.pceservice.PathComputationTest.D1;
-import static org.onosproject.pce.pceservice.PathComputationTest.D2;
-import static org.onosproject.pce.pceservice.PathComputationTest.D3;
-import static org.onosproject.pce.pceservice.PathComputationTest.D4;
-import static org.onosproject.pce.pceservice.PathComputationTest.D5;
-import static org.onosproject.pce.pceservice.PathComputationTest.DEVICE1;
-import static org.onosproject.pce.pceservice.PathComputationTest.DEVICE2;
-import static org.onosproject.pce.pceservice.PathComputationTest.DEVICE3;
-import static org.onosproject.pce.pceservice.PathComputationTest.DEVICE4;
-import static org.onosproject.pce.pceservice.PathComputationTest.DEVICE5;
-import static org.onosproject.pce.pceservice.PcepAnnotationKeys.LOCAL_LSP_ID;
-import static org.onosproject.pce.pceservice.PcepAnnotationKeys.PLSP_ID;
-import static org.onosproject.pce.pceservice.constraint.CostConstraint.Type.COST;
-import static org.onosproject.pce.pceservice.constraint.CostConstraint.Type.TE_COST;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.atomic.AtomicLong;
-
+import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Lists;
-
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -82,15 +47,13 @@
 import org.onosproject.net.DeviceId;
 import org.onosproject.net.ElementId;
 import org.onosproject.net.Link;
+import org.onosproject.net.LinkKey;
 import org.onosproject.net.MastershipRole;
 import org.onosproject.net.Path;
 import org.onosproject.net.SparseAnnotations;
 import org.onosproject.net.intent.Constraint;
-import org.onosproject.net.intent.IntentId;
-import org.onosproject.net.intent.constraint.BandwidthConstraint;
 import org.onosproject.net.link.LinkEvent;
 import org.onosproject.net.provider.ProviderId;
-import org.onosproject.net.resource.Resource;
 import org.onosproject.net.topology.DefaultTopologyEdge;
 import org.onosproject.net.topology.DefaultTopologyVertex;
 import org.onosproject.net.topology.LinkWeight;
@@ -103,16 +66,50 @@
 import org.onosproject.net.topology.TopologyServiceAdapter;
 import org.onosproject.net.topology.TopologyVertex;
 import org.onosproject.pce.pceservice.PathComputationTest.MockNetConfigRegistryAdapter;
-import org.onosproject.pce.pceservice.PathComputationTest.MockPathResourceService;
 import org.onosproject.pce.pceservice.constraint.CostConstraint;
+import org.onosproject.pce.pceservice.constraint.PceBandwidthConstraint;
 import org.onosproject.pce.pcestore.api.PceStore;
 import org.onosproject.pce.util.MockDeviceService;
 import org.onosproject.pce.util.PceStoreAdapter;
 import org.onosproject.pce.util.TunnelServiceAdapter;
 import org.onosproject.pcep.api.DeviceCapability;
+import org.onosproject.pcep.api.TeLinkConfig;
 import org.onosproject.store.service.TestStorageService;
 
-import com.google.common.collect.ImmutableSet;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.function.Consumer;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+import static org.onlab.graph.GraphPathSearch.ALL_PATHS;
+import static org.onosproject.incubator.net.tunnel.Tunnel.State.ESTABLISHED;
+import static org.onosproject.incubator.net.tunnel.Tunnel.State.UNSTABLE;
+import static org.onosproject.net.MastershipRole.MASTER;
+import static org.onosproject.net.topology.AdapterLinkWeigher.adapt;
+import static org.onosproject.pce.pceservice.LspType.SR_WITHOUT_SIGNALLING;
+import static org.onosproject.pce.pceservice.LspType.WITHOUT_SIGNALLING_AND_WITHOUT_SR;
+import static org.onosproject.pce.pceservice.LspType.WITH_SIGNALLING;
+import static org.onosproject.pce.pceservice.PathComputationTest.D1;
+import static org.onosproject.pce.pceservice.PathComputationTest.D2;
+import static org.onosproject.pce.pceservice.PathComputationTest.D3;
+import static org.onosproject.pce.pceservice.PathComputationTest.D4;
+import static org.onosproject.pce.pceservice.PathComputationTest.D5;
+import static org.onosproject.pce.pceservice.PathComputationTest.DEVICE1;
+import static org.onosproject.pce.pceservice.PathComputationTest.DEVICE2;
+import static org.onosproject.pce.pceservice.PathComputationTest.DEVICE3;
+import static org.onosproject.pce.pceservice.PathComputationTest.DEVICE4;
+import static org.onosproject.pce.pceservice.PathComputationTest.DEVICE5;
+import static org.onosproject.pce.pceservice.PcepAnnotationKeys.LOCAL_LSP_ID;
+import static org.onosproject.pce.pceservice.PcepAnnotationKeys.PLSP_ID;
+import static org.onosproject.pce.pceservice.constraint.CostConstraint.Type.COST;
+import static org.onosproject.pce.pceservice.constraint.CostConstraint.Type.TE_COST;
 
 /**
  * Tests the functions of PceManager.
@@ -120,8 +117,6 @@
 public class PceManagerTest {
 
     private PathComputationTest pathCompTest = new PathComputationTest();
-    private MockPathResourceService resourceService =
-            pathCompTest.new MockPathResourceService();
     private MockTopologyService topologyService = new MockTopologyService();
     private MockMastershipService mastershipService = new MockMastershipService();
     private MockPathService pathService = new MockPathService();
@@ -130,9 +125,10 @@
     private MockTunnelServiceAdapter tunnelService = new MockTunnelServiceAdapter();
     private TestStorageService storageService = new TestStorageService();
     private MockDeviceService deviceService = new MockDeviceService();
-    private MockNetConfigRegistryAdapter netConfigRegistry =
-            new PathComputationTest.MockNetConfigRegistryAdapter();
+    private MockNetConfigRegistryAdapter netConfigRegistry = new PathComputationTest.MockNetConfigRegistryAdapter();
     private PceStore pceStore = new PceStoreAdapter();
+    private PathComputationTest.MockBandwidthMgmtService bandwidthMgmtService = new PathComputationTest
+                                                                                            .MockBandwidthMgmtService();
 
     public static ProviderId providerId = new ProviderId("pce", "foo");
     private static final String L3 = "L3";
@@ -140,12 +136,12 @@
     private static final String PCECC_CAPABILITY = "pceccCapability";
     private static final String SR_CAPABILITY = "srCapability";
     private static final String LABEL_STACK_CAPABILITY = "labelStackCapability";
-    private static final String TUNNEL_NAME = "T123";
 
     private TopologyGraph graph = null;
     private Device deviceD1, deviceD2, deviceD3, deviceD4, deviceD5;
     private Device pcepDeviceD1, pcepDeviceD2, pcepDeviceD3, pcepDeviceD4;
     private Link link1, link2, link3, link4, link5, link6;
+    protected static int flowsDownloaded;
     private TunnelListener tunnelListener;
     private TopologyListener listener;
     private Topology topology;
@@ -156,15 +152,16 @@
     public void startUp() throws TestUtilsException {
         listener = TestUtils.getField(pceManager, "topologyListener");
         pceManager.pathService = pathService;
-        pceManager.resourceService = resourceService;
         pceManager.topologyService = topologyService;
         pceManager.tunnelService = tunnelService;
         pceManager.coreService = coreService;
         pceManager.storageService = storageService;
         pceManager.deviceService = deviceService;
         pceManager.netCfgService = netConfigRegistry;
+        pceManager.netConfigRegistry = netConfigRegistry;
         pceManager.pceStore = pceStore;
         pceManager.mastershipService = mastershipService;
+        pceManager.bandwidthMgmtService = bandwidthMgmtService;
         pceManager.activate();
     }
 
@@ -180,9 +177,8 @@
         }
     }
 
-    private void build4RouterTopo(boolean setCost, boolean setPceccCap,
-                                  boolean setSrCap, boolean setLabelStackCap,
-                                  int bandwidth) {
+    private void build4RouterTopo(boolean setCost, boolean setPceccCap, boolean setSrCap,
+                                 boolean setLabelStackCap, int bandwidth) {
         link1 = PathComputationTest.addLink(DEVICE1, 10, DEVICE2, 20, setCost, 50);
         link2 = PathComputationTest.addLink(DEVICE2, 30, DEVICE4, 40, setCost, 20);
         link3 = PathComputationTest.addLink(DEVICE1, 80, DEVICE3, 70, setCost, 100);
@@ -190,6 +186,58 @@
         link5 = PathComputationTest.addLink(DEVICE2, 60, DEVICE5, 50, setCost, 80);
         link6 = PathComputationTest.addLink(DEVICE4, 60, DEVICE5, 50, setCost, 80);
 
+        if (setCost) {
+            TeLinkConfig teLinkConfig = netConfigRegistry.addConfig(LinkKey.linkKey(link1), TeLinkConfig.class);
+            teLinkConfig.igpCost(50)
+                    .apply();
+
+            TeLinkConfig teLinkConfig2 = netConfigRegistry.addConfig(LinkKey.linkKey(link2), TeLinkConfig.class);
+            teLinkConfig2.igpCost(20)
+                    .apply();
+
+            TeLinkConfig teLinkConfig3 = netConfigRegistry.addConfig(LinkKey.linkKey(link3), TeLinkConfig.class);
+            teLinkConfig3.igpCost(100)
+                    .apply();
+
+            TeLinkConfig teLinkConfig4 = netConfigRegistry.addConfig(LinkKey.linkKey(link4), TeLinkConfig.class);
+            teLinkConfig4.igpCost(80)
+                    .apply();
+
+            TeLinkConfig teLinkConfig5 = netConfigRegistry.addConfig(LinkKey.linkKey(link5), TeLinkConfig.class);
+            teLinkConfig5.igpCost(80)
+                    .apply();
+
+            TeLinkConfig teLinkConfig6 = netConfigRegistry.addConfig(LinkKey.linkKey(link6), TeLinkConfig.class);
+            teLinkConfig6.igpCost(80)
+                    .apply();
+        } else {
+            TeLinkConfig teLinkConfig = netConfigRegistry.addConfig(LinkKey.linkKey(link1), TeLinkConfig.class);
+            teLinkConfig.teCost(50)
+                    .apply();
+
+
+            TeLinkConfig teLinkConfig2 = netConfigRegistry.addConfig(LinkKey.linkKey(link2), TeLinkConfig.class);
+            teLinkConfig2.teCost(20)
+                    .apply();
+
+            TeLinkConfig teLinkConfig3 = netConfigRegistry.addConfig(LinkKey.linkKey(link3), TeLinkConfig.class);
+            teLinkConfig3.teCost(100)
+                    .apply();
+
+            TeLinkConfig teLinkConfig4 = netConfigRegistry.addConfig(LinkKey.linkKey(link4), TeLinkConfig.class);
+            teLinkConfig4.teCost(80)
+                    .apply();
+
+            TeLinkConfig teLinkConfig5 = netConfigRegistry.addConfig(LinkKey.linkKey(link5), TeLinkConfig.class);
+            teLinkConfig5.teCost(80)
+                    .apply();
+
+            TeLinkConfig teLinkConfig6 = netConfigRegistry.addConfig(LinkKey.linkKey(link6), TeLinkConfig.class);
+            teLinkConfig6.teCost(80)
+                    .apply();
+        }
+
+
         Set<TopologyVertex> vertexes = new HashSet<TopologyVertex>();
         vertexes.add(D1);
         vertexes.add(D2);
@@ -256,63 +304,71 @@
         deviceService.addDevice(deviceD4);
         deviceService.addDevice(deviceD5);
 
-        mkDevCap("1.1.1.1", setLabelStackCap, setPceccCap, setSrCap);
-        mkDevCap("2.2.2.2", setLabelStackCap, setPceccCap, setSrCap);
-        mkDevCap("3.3.3.3", setLabelStackCap, setPceccCap, setSrCap);
-        mkDevCap("4.4.4.4", setLabelStackCap, setPceccCap, setSrCap);
-        mkDevCap("5.5.5.5", setLabelStackCap, setPceccCap, setSrCap);
+        DeviceCapability device1Cap = netConfigRegistry.addConfig(DeviceId.deviceId("1.1.1.1"), DeviceCapability.class);
+        device1Cap.setLabelStackCap(setLabelStackCap)
+        .setLocalLabelCap(setPceccCap)
+        .setSrCap(setSrCap)
+        .apply();
 
-        if (bandwidth != 0) {
-            List<Resource> resources = new LinkedList<>();
+        DeviceCapability device2Cap = netConfigRegistry.addConfig(DeviceId.deviceId("2.2.2.2"), DeviceCapability.class);
+        device2Cap.setLabelStackCap(setLabelStackCap)
+        .setLocalLabelCap(setPceccCap)
+        .setSrCap(setSrCap)
+        .apply();
 
-            resources.add(continuous(link1.src().deviceId(), link1.src().port(),
-                    Bandwidth.class).resource(bandwidth));
-            resources.add(continuous(link2.src().deviceId(), link2.src().port(),
-                    Bandwidth.class).resource(bandwidth));
-            resources.add(continuous(link3.src().deviceId(), link3.src().port(),
-                    Bandwidth.class).resource(bandwidth));
-            resources.add(continuous(link4.src().deviceId(), link4.src().port(),
-                    Bandwidth.class).resource(bandwidth));
-            resources.add(continuous(link5.src().deviceId(), link5.src().port(),
-                    Bandwidth.class).resource(bandwidth));
+        DeviceCapability device3Cap = netConfigRegistry.addConfig(DeviceId.deviceId("3.3.3.3"), DeviceCapability.class);
+        device3Cap.setLabelStackCap(setLabelStackCap)
+        .setLocalLabelCap(setPceccCap)
+        .setSrCap(setSrCap)
+        .apply();
 
-            resources.add(continuous(link1.dst().deviceId(), link1.dst().port(),
-                    Bandwidth.class).resource(bandwidth));
-            resources.add(continuous(link2.dst().deviceId(), link2.dst().port(),
-                    Bandwidth.class).resource(bandwidth));
-            resources.add(continuous(link3.dst().deviceId(), link3.dst().port(),
-                    Bandwidth.class).resource(bandwidth));
-            resources.add(continuous(link4.dst().deviceId(), link4.dst().port(),
-                    Bandwidth.class).resource(bandwidth));
-            resources.add(continuous(link5.dst().deviceId(), link5.dst().port(),
-                    Bandwidth.class).resource(bandwidth));
+        DeviceCapability device4Cap = netConfigRegistry.addConfig(DeviceId.deviceId("4.4.4.4"), DeviceCapability.class);
+        device4Cap.setLabelStackCap(setLabelStackCap)
+        .setLocalLabelCap(setPceccCap)
+        .setSrCap(setSrCap)
+        .apply();
 
-            resourceService.allocate(IntentId.valueOf(bandwidth), resources);
-        }
-    }
-
-    private void mkDevCap(String strDeviceId, boolean setLabelStackCap,
-                          boolean setPceccCap, boolean setSrCap) {
-        DeviceCapability deviceCap = netConfigRegistry.addConfig(
-                DeviceId.deviceId(strDeviceId), DeviceCapability.class);
-        deviceCap.setLabelStackCap(setLabelStackCap)
+        DeviceCapability device5Cap = netConfigRegistry.addConfig(DeviceId.deviceId("5.5.5.5"), DeviceCapability.class);
+        device4Cap.setLabelStackCap(setLabelStackCap)
                 .setLocalLabelCap(setPceccCap)
                 .setSrCap(setSrCap)
                 .apply();
+
+        if (bandwidth != 0) {
+            Set<Double> unreserved = new HashSet<>();
+            unreserved.add(new Double(bandwidth));
+
+            bandwidthMgmtService.addUnreservedBw(LinkKey.linkKey(link1), unreserved);
+            bandwidthMgmtService.allocLocalReservedBw(LinkKey.linkKey(link1), new Double(0));
+
+            bandwidthMgmtService.addUnreservedBw(LinkKey.linkKey(link2), unreserved);
+            bandwidthMgmtService.allocLocalReservedBw(LinkKey.linkKey(link2), new Double(0));
+
+            bandwidthMgmtService.addUnreservedBw(LinkKey.linkKey(link3), unreserved);
+            bandwidthMgmtService.allocLocalReservedBw(LinkKey.linkKey(link3), new Double(0));
+
+            bandwidthMgmtService.addUnreservedBw(LinkKey.linkKey(link4), unreserved);
+            bandwidthMgmtService.allocLocalReservedBw(LinkKey.linkKey(link4), new Double(0));
+
+            bandwidthMgmtService.addUnreservedBw(LinkKey.linkKey(link5), unreserved);
+            bandwidthMgmtService.allocLocalReservedBw(LinkKey.linkKey(link5), new Double(0));
+
+            bandwidthMgmtService.addUnreservedBw(LinkKey.linkKey(link6), unreserved);
+            bandwidthMgmtService.allocLocalReservedBw(LinkKey.linkKey(link6), new Double(0));
+        }
     }
 
     /**
      * Tests path success with (IGP) cost constraint for signalled LSP.
      */
     @Test
-    public void setupPathSuccessIgpCostSignalledLsp() {
+    public void setupPathTest1() {
         build4RouterTopo(true, false, false, false, 0); // IGP cost is set here.
-        List<Constraint> constraints = new LinkedList<>();
+        List<Constraint> constraints = new LinkedList<Constraint>();
         CostConstraint costConstraint = new CostConstraint(COST);
         constraints.add(costConstraint);
 
-        boolean result = pceManager.setupPath(D1.deviceId(), D2.deviceId(),
-                TUNNEL_NAME, constraints, WITH_SIGNALLING, null);
+        boolean result = pceManager.setupPath(D1.deviceId(), D2.deviceId(), "T123", constraints, WITH_SIGNALLING, null);
         assertThat(result, is(true));
     }
 
@@ -320,15 +376,13 @@
      * Tests path failure with (IGP) cost constraint for signalled LSP.
      */
     @Test
-    public void setupPathFailureIgpCostSignalledLsp() {
-        // TE cost is set here, not IGP.
-        build4RouterTopo(false, false, false, false, 0);
-        List<Constraint> constraints = new LinkedList<>();
+    public void setupPathTest2() {
+        build4RouterTopo(false, false, false, false, 0); // TE cost is set here, not IGP.
+        List<Constraint> constraints = new LinkedList<Constraint>();
         CostConstraint costConstraint = new CostConstraint(COST);
         constraints.add(costConstraint);
 
-        boolean result = pceManager.setupPath(D1.deviceId(), D2.deviceId(),
-                TUNNEL_NAME, constraints, WITH_SIGNALLING, null);
+        boolean result = pceManager.setupPath(D1.deviceId(), D2.deviceId(), "T123", constraints, WITH_SIGNALLING, null);
         assertThat(result, is(false));
     }
 
@@ -336,16 +390,14 @@
      * Tests path success with TE-cost constraint for signalled LSP.
      */
     @Test
-    public void setupPathSuccessTeCostSignalledLsp() {
-        // TE cost is set here.
-        build4RouterTopo(false, false, false, false, 0);
+    public void setupPathTest3() {
+        build4RouterTopo(false, false, false, false, 0); // TE cost is set here.
 
-        List<Constraint> constraints = new LinkedList<>();
+        List<Constraint> constraints = new LinkedList<Constraint>();
         CostConstraint costConstraint = new CostConstraint(TE_COST);
         constraints.add(costConstraint);
 
-        boolean result = pceManager.setupPath(D1.deviceId(), D2.deviceId(),
-                TUNNEL_NAME, constraints, WITH_SIGNALLING, null);
+        boolean result = pceManager.setupPath(D1.deviceId(), D2.deviceId(), "T123", constraints, WITH_SIGNALLING, null);
         assertThat(result, is(true));
     }
 
@@ -353,16 +405,14 @@
      * Tests path failure with TE-cost constraint for signalled LSP.
      */
     @Test
-    public void setupPathFailureTeCostSignalledLsp() {
-        // IGP cost is set here, not TE.
-        build4RouterTopo(true, false, false, false, 0);
+    public void setupPathTest4() {
+        build4RouterTopo(true, false, false, false, 0); // IGP cost is set here, not TE.
 
-        List<Constraint> constraints = new LinkedList<>();
+        List<Constraint> constraints = new LinkedList<Constraint>();
         CostConstraint costConstraint = new CostConstraint(TE_COST);
         constraints.add(costConstraint);
 
-        boolean result = pceManager.setupPath(D1.deviceId(), D2.deviceId(),
-                TUNNEL_NAME, constraints, WITH_SIGNALLING, null);
+        boolean result = pceManager.setupPath(D1.deviceId(), D2.deviceId(), "T123", constraints, WITH_SIGNALLING, null);
         assertThat(result, is(false));
     }
 
@@ -370,16 +420,15 @@
      * Tests path success with (IGP) cost constraint for non-SR non-signalled LSP.
      */
     @Test
-    public void setupPathSuccessIgpCostNonSignalledLsp() {
+    public void setupPathTest5() {
         build4RouterTopo(true, true, false, false, 0);
 
-        List<Constraint> constraints = new LinkedList<>();
+        List<Constraint> constraints = new LinkedList<Constraint>();
         CostConstraint costConstraint = new CostConstraint(COST);
         constraints.add(costConstraint);
 
-        boolean result = pceManager.setupPath(D1.deviceId(), D2.deviceId(),
-                TUNNEL_NAME, constraints, WITHOUT_SIGNALLING_AND_WITHOUT_SR,
-                null);
+        boolean result = pceManager.setupPath(D1.deviceId(), D2.deviceId(), "T123", constraints,
+                                              WITHOUT_SIGNALLING_AND_WITHOUT_SR, null);
         assertThat(result, is(true));
     }
 
@@ -387,34 +436,31 @@
      * Tests path success with TE-cost constraint for non-SR non-sgnalled LSP.
      */
     @Test
-    public void setupPathSuccessTeCostNonSignalledLsp() {
+    public void setupPathTest6() {
         build4RouterTopo(false, true, false, false, 0);
 
-        List<Constraint> constraints = new LinkedList<>();
+        List<Constraint> constraints = new LinkedList<Constraint>();
         CostConstraint costConstraint = new CostConstraint(TE_COST);
         constraints.add(costConstraint);
 
-        boolean result = pceManager.setupPath(D1.deviceId(), D2.deviceId(),
-                TUNNEL_NAME, constraints, WITHOUT_SIGNALLING_AND_WITHOUT_SR,
-                null);
+        boolean result = pceManager.setupPath(D1.deviceId(), D2.deviceId(), "T123", constraints,
+                                              WITHOUT_SIGNALLING_AND_WITHOUT_SR, null);
         assertThat(result, is(true));
     }
 
     /**
-     * Tests path failure with TE-cost constraint for non-SR
-     * non-signalled LSP(CR). Label capability not registered.
+     * Tests path failure with TE-cost constraint for non-SR non-signalled LSP(CR). Label capability not registered.
      */
     @Test
-    public void setupPathFailureTeCostNonSignalledLsp() {
+    public void setupPathTest7() {
         build4RouterTopo(true, false, false, false, 0);
 
-        List<Constraint> constraints = new LinkedList<>();
+        List<Constraint> constraints = new LinkedList<Constraint>();
         CostConstraint costConstraint = new CostConstraint(TE_COST);
         constraints.add(costConstraint);
 
-        boolean result = pceManager.setupPath(D1.deviceId(), D2.deviceId(),
-                TUNNEL_NAME, constraints, WITHOUT_SIGNALLING_AND_WITHOUT_SR,
-                null);
+        boolean result = pceManager.setupPath(D1.deviceId(), D2.deviceId(), "T123", constraints,
+                                              WITHOUT_SIGNALLING_AND_WITHOUT_SR, null);
         assertThat(result, is(false));
     }
 
@@ -422,18 +468,18 @@
      * Tests path failure as bandwidth is requested but is not registered.
      */
     @Test
-    public void setupPathFailureBandwidthNotRegistered() {
-        build4RouterTopo(true, false, false, false, 0);
+    public void setupPathTest8() {
+        build4RouterTopo(true, false, false, false, 2);
+
         List<Constraint> constraints = new LinkedList<>();
-        BandwidthConstraint bwConstraint = new BandwidthConstraint(
-                Bandwidth.bps(10.0));
+        PceBandwidthConstraint bwConstraint = new PceBandwidthConstraint(Bandwidth.bps(10.0));
         CostConstraint costConstraint = new CostConstraint(TE_COST);
 
         constraints.add(costConstraint);
         constraints.add(bwConstraint);
 
-        boolean result = pceManager.setupPath(D1.deviceId(), D2.deviceId(),
-                TUNNEL_NAME, constraints, WITH_SIGNALLING, null);
+        boolean result = pceManager.setupPath(D1.deviceId(), D2.deviceId(), "T123", constraints,
+                WITH_SIGNALLING, null);
         assertThat(result, is(false));
     }
 
@@ -441,34 +487,32 @@
      * Tests path failure as bandwidth requested is more than registered.
      */
     @Test
-    public void setupPathFailureNotEnoughBandwidthRegistered() {
+    public void setupPathTest9() {
         build4RouterTopo(false, false, false, false, 5);
-        List<Constraint> constraints = new LinkedList<>();
-        BandwidthConstraint bwConstraint = new BandwidthConstraint(
-                Bandwidth.bps(10.0));
+        List<Constraint> constraints = new LinkedList<Constraint>();
+        PceBandwidthConstraint bwConstraint = new PceBandwidthConstraint(Bandwidth.bps(10.0));
         CostConstraint costConstraint = new CostConstraint(TE_COST);
 
         constraints.add(costConstraint);
         constraints.add(bwConstraint);
 
-        boolean result = pceManager.setupPath(D1.deviceId(), D2.deviceId(),
-                TUNNEL_NAME, constraints, WITH_SIGNALLING, null);
+        boolean result = pceManager.setupPath(D1.deviceId(), D2.deviceId(), "T123",
+                constraints, WITH_SIGNALLING, null);
         assertThat(result, is(false));
     }
 
     /**
-     * Tests path setup failure(without signalling). Label capability is not
-     * present.
+     * Tests path setup failure(without signalling). Label capability is not present.
      */
     @Test
-    public void setupPathFailureNoLabelCapability() {
+    public void setupPathTest10() {
         build4RouterTopo(false, false, false, false, 0);
-        List<Constraint> constraints = new LinkedList<>();
+        List<Constraint> constraints = new LinkedList<Constraint>();
         CostConstraint costConstraint = new CostConstraint(TE_COST);
         constraints.add(costConstraint);
 
-        boolean result = pceManager.setupPath(D1.deviceId(), D2.deviceId(),
-                TUNNEL_NAME, constraints, SR_WITHOUT_SIGNALLING, null);
+        boolean result = pceManager.setupPath(D1.deviceId(), D2.deviceId(), "T123", constraints,
+             SR_WITHOUT_SIGNALLING, null);
         assertThat(result, is(false));
     }
 
@@ -476,18 +520,17 @@
      * Tests path setup without signalling and with bandwidth reservation.
      */
     @Test
-    public void setupPathSuccessWithoutSignalling() {
+    public void setupPathTest12() {
         build4RouterTopo(false, true, true, true, 15);
-        List<Constraint> constraints = new LinkedList<>();
-        BandwidthConstraint bwConstraint = new BandwidthConstraint(
-                Bandwidth.bps(10.0));
+        List<Constraint> constraints = new LinkedList<Constraint>();
+        PceBandwidthConstraint bwConstraint = new PceBandwidthConstraint(Bandwidth.bps(10.0));
         CostConstraint costConstraint = new CostConstraint(TE_COST);
 
         constraints.add(costConstraint);
         constraints.add(bwConstraint);
 
-        boolean result = pceManager.setupPath(D1.deviceId(), D2.deviceId(),
-                TUNNEL_NAME, constraints, SR_WITHOUT_SIGNALLING, null);
+        boolean result = pceManager.setupPath(D1.deviceId(), D2.deviceId(), "T123",
+                constraints, SR_WITHOUT_SIGNALLING, null);
         assertThat(result, is(true));
     }
 
@@ -495,28 +538,26 @@
      * Tests path setup without cost/bandwidth constraints.
      */
     @Test
-    public void setupPathSuccessWithoutConstraints() {
+    public void setupPathTest13() {
         build4RouterTopo(false, false, false, false, 0);
 
-        boolean result = pceManager.setupPath(D1.deviceId(), D2.deviceId(),
-                TUNNEL_NAME, null, WITH_SIGNALLING, null);
+        boolean result = pceManager.setupPath(D1.deviceId(), D2.deviceId(), "T123", null, WITH_SIGNALLING, null);
         assertThat(result, is(true));
     }
 
     /**
      * Tests path setup with explicit path with loose node D2.
      */
-    @Test
-    public void setupPathExplicitPathInfoLooseD2() {
+   @Test
+    public void setupPathTest14() {
         build4RouterTopo(false, false, false, false, 0);
 
         List<ExplicitPathInfo> explicitPathInfoList = Lists.newLinkedList();
-        ExplicitPathInfo obj = new ExplicitPathInfo(ExplicitPathInfo.Type.LOOSE,
-                D2.deviceId());
+        ExplicitPathInfo obj = new ExplicitPathInfo(ExplicitPathInfo.Type.LOOSE, D2.deviceId());
         explicitPathInfoList.add(obj);
 
-        boolean result = pceManager.setupPath(D1.deviceId(), D4.deviceId(),
-                TUNNEL_NAME, null, WITH_SIGNALLING, explicitPathInfoList);
+        boolean result = pceManager.setupPath(D1.deviceId(), D4.deviceId(), "T123", null, WITH_SIGNALLING,
+                explicitPathInfoList);
 
         Tunnel tunnel = pceManager.queryAllPath().iterator().next();
         List<Link> links = new LinkedList<>();
@@ -530,141 +571,134 @@
     /**
      * Tests path setup with explicit path with loose node D3.
      */
-    @Test
-    public void setupPathExplicitPathInfoLooseD3() {
-        build4RouterTopo(false, false, false, false, 0);
+   @Test
+   public void setupPathTest15() {
+       build4RouterTopo(false, false, false, false, 0);
 
-        List<ExplicitPathInfo> explicitPathInfoList = Lists.newLinkedList();
-        ExplicitPathInfo obj = new ExplicitPathInfo(ExplicitPathInfo.Type.LOOSE,
-                D3.deviceId());
-        explicitPathInfoList.add(obj);
+       List<ExplicitPathInfo> explicitPathInfoList = Lists.newLinkedList();
+       ExplicitPathInfo obj = new ExplicitPathInfo(ExplicitPathInfo.Type.LOOSE, D3.deviceId());
+       explicitPathInfoList.add(obj);
 
-        boolean result = pceManager.setupPath(D1.deviceId(), D5.deviceId(),
-                TUNNEL_NAME, null, WITH_SIGNALLING, explicitPathInfoList);
+       boolean result = pceManager.setupPath(D1.deviceId(), D5.deviceId(), "T123", null, WITH_SIGNALLING,
+               explicitPathInfoList);
 
-        Tunnel tunnel = pceManager.queryAllPath().iterator().next();
-        List<Link> links = new LinkedList<>();
-        links.add(link3);
-        links.add(link4);
-        links.add(link6);
+       Tunnel tunnel = pceManager.queryAllPath().iterator().next();
+       List<Link> links = new LinkedList<>();
+       links.add(link3);
+       links.add(link4);
+       links.add(link6);
 
-        assertThat(result, is(true));
-        assertThat(tunnel.path().links().equals(links), is(true));
-    }
+       assertThat(result, is(true));
+       assertThat(tunnel.path().links().equals(links), is(true));
+   }
 
     /**
      * Tests path setup with explicit path with loose node D4 , D3 - path fails.
      */
-    @Test
-    public void setupPathExplicitPathInfoFail() {
-        build4RouterTopo(false, false, false, false, 0);
+   @Test
+   public void setupPathTest16() {
+       build4RouterTopo(false, false, false, false, 0);
 
-        List<ExplicitPathInfo> explicitPathInfoList = Lists.newLinkedList();
-        ExplicitPathInfo obj = new ExplicitPathInfo(ExplicitPathInfo.Type.LOOSE,
-                D4.deviceId());
-        explicitPathInfoList.add(obj);
-        obj = new ExplicitPathInfo(ExplicitPathInfo.Type.LOOSE, D3.deviceId());
-        explicitPathInfoList.add(obj);
+       List<ExplicitPathInfo> explicitPathInfoList = Lists.newLinkedList();
+       ExplicitPathInfo obj = new ExplicitPathInfo(ExplicitPathInfo.Type.LOOSE, D4.deviceId());
+       explicitPathInfoList.add(obj);
+       obj = new ExplicitPathInfo(ExplicitPathInfo.Type.LOOSE, D3.deviceId());
+       explicitPathInfoList.add(obj);
 
-        boolean result = pceManager.setupPath(D1.deviceId(), D5.deviceId(),
-                TUNNEL_NAME, null, WITH_SIGNALLING, explicitPathInfoList);
+       boolean result = pceManager.setupPath(D1.deviceId(), D5.deviceId(), "T123", null, WITH_SIGNALLING,
+               explicitPathInfoList);
 
-        assertThat(result, is(false));
-    }
+       assertThat(result, is(false));
+   }
 
     /**
-     * Tests path setup with explicit path with strict node D2 - without reacble
-     * to src - path fails.
+     * Tests path setup with explicit path with strict node D2 - without reacble to src - path fails.
      */
-    @Test
-    public void setupPathExplicitPathInfoStrictD2Fail() {
-        build4RouterTopo(false, false, false, false, 0);
+   @Test
+   public void setupPathTest17() {
+       build4RouterTopo(false, false, false, false, 0);
 
-        List<ExplicitPathInfo> explicitPathInfoList = Lists.newLinkedList();
-        ExplicitPathInfo obj = new ExplicitPathInfo(ExplicitPathInfo.Type.STRICT,
-                D2.deviceId());
-        explicitPathInfoList.add(obj);
+       List<ExplicitPathInfo> explicitPathInfoList = Lists.newLinkedList();
+       ExplicitPathInfo obj = new ExplicitPathInfo(ExplicitPathInfo.Type.STRICT, D2.deviceId());
+       explicitPathInfoList.add(obj);
 
-        boolean result = pceManager.setupPath(D1.deviceId(), D5.deviceId(),
-                TUNNEL_NAME, null, WITH_SIGNALLING, explicitPathInfoList);
+       boolean result = pceManager.setupPath(D1.deviceId(), D5.deviceId(), "T123", null, WITH_SIGNALLING,
+               explicitPathInfoList);
 
-        assertThat(result, is(false));
-    }
+       assertThat(result, is(false));
+   }
 
     /**
      * Tests path setup with explicit path with loose node D2, strict D2.
      */
-    @Test
-    public void setupPathExplicitPathInfoLooseAndStrictD2() {
-        build4RouterTopo(false, false, false, false, 0);
+   @Test
+   public void setupPathTest18() {
+       build4RouterTopo(false, false, false, false, 0);
 
-        List<ExplicitPathInfo> explicitPathInfoList = Lists.newLinkedList();
-        ExplicitPathInfo obj = new ExplicitPathInfo(ExplicitPathInfo.Type.LOOSE,
-                D2.deviceId());
-        explicitPathInfoList.add(obj);
-        obj = new ExplicitPathInfo(ExplicitPathInfo.Type.STRICT, D2.deviceId());
-        explicitPathInfoList.add(obj);
+       List<ExplicitPathInfo> explicitPathInfoList = Lists.newLinkedList();
+       ExplicitPathInfo obj = new ExplicitPathInfo(ExplicitPathInfo.Type.LOOSE, D2.deviceId());
+       explicitPathInfoList.add(obj);
+       obj = new ExplicitPathInfo(ExplicitPathInfo.Type.STRICT, D2.deviceId());
+       explicitPathInfoList.add(obj);
 
-        boolean result = pceManager.setupPath(D1.deviceId(), D5.deviceId(),
-                TUNNEL_NAME, null, WITH_SIGNALLING, explicitPathInfoList);
+       boolean result = pceManager.setupPath(D1.deviceId(), D5.deviceId(), "T123", null, WITH_SIGNALLING,
+               explicitPathInfoList);
 
-        Tunnel tunnel = pceManager.queryAllPath().iterator().next();
-        List<Link> links = new LinkedList<>();
-        links.add(link1);
-        links.add(link5);
+       Tunnel tunnel = pceManager.queryAllPath().iterator().next();
+       List<Link> links = new LinkedList<>();
+       links.add(link1);
+       links.add(link5);
 
-        assertThat(result, is(true));
-        assertThat(tunnel.path().links().equals(links), is(true));
-    }
+       assertThat(result, is(true));
+       assertThat(tunnel.path().links().equals(links), is(true));
+   }
 
     /**
      * Tests path setup with explicit path with loose D1-D2, strict D2.
      */
-    @Test
-    public void setupPathExplicitPathInfoLooseLink1StrictD2() {
-        build4RouterTopo(false, false, false, false, 0);
+   @Test
+   public void setupPathTest19() {
+       build4RouterTopo(false, false, false, false, 0);
 
-        List<ExplicitPathInfo> explicitPathInfoList = Lists.newLinkedList();
-        ExplicitPathInfo obj = new ExplicitPathInfo(ExplicitPathInfo.Type.LOOSE,
-                link1);
-        explicitPathInfoList.add(obj);
-        obj = new ExplicitPathInfo(ExplicitPathInfo.Type.STRICT, D2.deviceId());
-        explicitPathInfoList.add(obj);
+       List<ExplicitPathInfo> explicitPathInfoList = Lists.newLinkedList();
+       ExplicitPathInfo obj = new ExplicitPathInfo(ExplicitPathInfo.Type.LOOSE, link1);
+       explicitPathInfoList.add(obj);
+       obj = new ExplicitPathInfo(ExplicitPathInfo.Type.STRICT, D2.deviceId());
+       explicitPathInfoList.add(obj);
 
-        boolean result = pceManager.setupPath(D1.deviceId(), D5.deviceId(),
-                TUNNEL_NAME, null, WITH_SIGNALLING, explicitPathInfoList);
+       boolean result = pceManager.setupPath(D1.deviceId(), D5.deviceId(), "T123", null, WITH_SIGNALLING,
+               explicitPathInfoList);
 
-        Tunnel tunnel = pceManager.queryAllPath().iterator().next();
-        List<Link> links = new LinkedList<>();
-        links.add(link1);
-        links.add(link5);
+       Tunnel tunnel = pceManager.queryAllPath().iterator().next();
+       List<Link> links = new LinkedList<>();
+       links.add(link1);
+       links.add(link5);
 
-        assertThat(result, is(true));
-        assertThat(tunnel.path().links().equals(links), is(true));
-    }
+       assertThat(result, is(true));
+       assertThat(tunnel.path().links().equals(links), is(true));
+   }
 
     /**
      * Tests path update with increase in bandwidth.
      */
     @Test
-    public void updatePathIncreaseBandwidth() {
+    public void updatePathTest1() {
         build4RouterTopo(false, true, true, true, 100);
 
         // Setup tunnel.
         List<Constraint> constraints = new LinkedList<>();
-        BandwidthConstraint bwConstraint = new BandwidthConstraint(
-                Bandwidth.bps(60.0));
+        PceBandwidthConstraint bwConstraint = new PceBandwidthConstraint(Bandwidth.bps(60.0));
         constraints.add(bwConstraint);
         CostConstraint costConstraint = new CostConstraint(TE_COST);
         constraints.add(costConstraint);
 
-        boolean result = pceManager.setupPath(D1.deviceId(), D4.deviceId(),
-                TUNNEL_NAME, constraints, WITH_SIGNALLING, null);
+        boolean result = pceManager.setupPath(D1.deviceId(), D4.deviceId(), "T123",
+                constraints, WITH_SIGNALLING, null);
         assertThat(result, is(true));
 
         // Change constraint and update it.
         constraints = new LinkedList<>();
-        bwConstraint = new BandwidthConstraint(Bandwidth.bps(50.0));
+        bwConstraint = new PceBandwidthConstraint(Bandwidth.bps(50.0));
         constraints.add(bwConstraint);
         constraints.add(costConstraint);
 
@@ -687,24 +721,23 @@
      * Tests path update with decrease in bandwidth.
      */
     @Test
-    public void updatePathDecreaseBandwidth() {
+    public void updatePathTest2() {
         build4RouterTopo(false, true, true, true, 100);
 
         // Setup tunnel.
-        List<Constraint> constraints = new LinkedList<>();
-        BandwidthConstraint bwConstraint = new BandwidthConstraint(
-                Bandwidth.bps(60.0));
+        List<Constraint> constraints = new LinkedList<Constraint>();
+        PceBandwidthConstraint bwConstraint = new PceBandwidthConstraint(Bandwidth.bps(60.0));
         constraints.add(bwConstraint);
         CostConstraint costConstraint = new CostConstraint(TE_COST);
         constraints.add(costConstraint);
 
-        boolean result = pceManager.setupPath(D1.deviceId(), D2.deviceId(),
-                TUNNEL_NAME, constraints, SR_WITHOUT_SIGNALLING, null);
+        boolean result = pceManager.setupPath(D1.deviceId(), D2.deviceId(), "T123",
+                constraints, SR_WITHOUT_SIGNALLING, null);
         assertThat(result, is(true));
 
         // Change constraint and update it.
         constraints.remove(bwConstraint);
-        bwConstraint = new BandwidthConstraint(Bandwidth.bps(70.0));
+        bwConstraint = new PceBandwidthConstraint(Bandwidth.bps(70.0));
         constraints.add(bwConstraint);
 
         Collection<Tunnel> tunnels = (Collection<Tunnel>) pceManager.queryAllPath();
@@ -723,15 +756,15 @@
      * Tests path update without cost/bandwidth constraints.
      */
     @Test
-    public void updatePathWithoutConstraints() {
+    public void updatePathTest3() {
         build4RouterTopo(false, true, true, true, 100);
 
         // Setup tunnel.
-        List<Constraint> constraints = new LinkedList<>();
+        List<Constraint> constraints = new LinkedList<Constraint>();
         CostConstraint costConstraint = new CostConstraint(TE_COST);
         constraints.add(costConstraint);
-        boolean result = pceManager.setupPath(D1.deviceId(), D2.deviceId(),
-                TUNNEL_NAME, constraints, WITH_SIGNALLING, null);
+        boolean result = pceManager.setupPath(D1.deviceId(), D2.deviceId(), "T123",
+                constraints, WITH_SIGNALLING, null);
         assertThat(result, is(true));
 
         Collection<Tunnel> tunnels = (Collection<Tunnel>) pceManager.queryAllPath();
@@ -743,40 +776,36 @@
         }
 
         Iterable<Tunnel> queryTunnelResult = pceManager.queryAllPath();
-        assertThat((int) queryTunnelResult.spliterator().getExactSizeIfKnown(),
-                is(2));
+        assertThat((int) queryTunnelResult.spliterator().getExactSizeIfKnown(), is(2));
     }
 
     /**
-     * Tests path update without cost/bandwidth constraints and with explicit
-     * path object.
+     * Tests path update without cost/bandwidth constraints and with explicit path object.
      */
     @Test
-    public void updatePathExplicitPathInfo() {
+    public void updatePathTest4() {
         build4RouterTopo(false, true, true, true, 100);
 
         // Setup tunnel.
         List<Constraint> constraints = new LinkedList<>();
-        BandwidthConstraint bwConstraint = new BandwidthConstraint(
-                Bandwidth.bps(60.0));
+        PceBandwidthConstraint bwConstraint = new PceBandwidthConstraint(Bandwidth.bps(60.0));
         constraints.add(bwConstraint);
         CostConstraint costConstraint = new CostConstraint(TE_COST);
         constraints.add(costConstraint);
 
         List<ExplicitPathInfo> explicitPathInfoList = Lists.newLinkedList();
-        ExplicitPathInfo obj = new ExplicitPathInfo(ExplicitPathInfo.Type.LOOSE,
-                link1);
+        ExplicitPathInfo obj = new ExplicitPathInfo(ExplicitPathInfo.Type.LOOSE, link1);
         explicitPathInfoList.add(obj);
         obj = new ExplicitPathInfo(ExplicitPathInfo.Type.STRICT, D2.deviceId());
         explicitPathInfoList.add(obj);
 
-        boolean result = pceManager.setupPath(D1.deviceId(), D4.deviceId(),
-                TUNNEL_NAME, constraints, WITH_SIGNALLING, explicitPathInfoList);
+        boolean result = pceManager.setupPath(D1.deviceId(), D4.deviceId(), "T123",
+                constraints, WITH_SIGNALLING, explicitPathInfoList);
         assertThat(result, is(true));
 
         // Change constraint and update it.
         constraints = new LinkedList<>();
-        bwConstraint = new BandwidthConstraint(Bandwidth.bps(50.0));
+        bwConstraint = new PceBandwidthConstraint(Bandwidth.bps(50.0));
         constraints.add(bwConstraint);
         constraints.add(costConstraint);
 
@@ -796,14 +825,14 @@
     }
 
     /**
-     * Tests path release with explicit info.
+     * Tests path release.
      */
     @Test
-    public void releasePathExplicitPathInfo() {
+    public void releasePathTest1() {
         build4RouterTopo(false, false, false, false, 5);
-        List<Constraint> constraints = new LinkedList<>();
+        List<Constraint> constraints = new LinkedList<Constraint>();
         CostConstraint costConstraint = new CostConstraint(TE_COST);
-        BandwidthConstraint bwConst = new BandwidthConstraint(Bandwidth.bps(3));
+        PceBandwidthConstraint bwConst = new PceBandwidthConstraint(Bandwidth.bps(3));
         constraints.add(bwConst);
         constraints.add(costConstraint);
 
@@ -813,8 +842,7 @@
         obj = new ExplicitPathInfo(ExplicitPathInfo.Type.STRICT, D2.deviceId());
         explicitPathInfoList.add(obj);
 
-        pceManager.setupPath(D1.deviceId(), D2.deviceId(), TUNNEL_NAME,
-                constraints, WITH_SIGNALLING, explicitPathInfoList);
+        pceManager.setupPath(D1.deviceId(), D2.deviceId(), "T123", constraints, WITH_SIGNALLING, explicitPathInfoList);
 
         Collection<Tunnel> tunnels = (Collection<Tunnel>) pceManager.queryAllPath();
         assertThat(tunnels.size(), is(1));
@@ -831,14 +859,13 @@
      * Tests path release failure.
      */
     @Test
-    public void releasePathFailure() {
+    public void releasePathTest2() {
         build4RouterTopo(false, false, false, false, 5);
-        List<Constraint> constraints = new LinkedList<>();
+        List<Constraint> constraints = new LinkedList<Constraint>();
         CostConstraint costConstraint = new CostConstraint(TE_COST);
         constraints.add(costConstraint);
 
-        pceManager.setupPath(D1.deviceId(), D2.deviceId(), TUNNEL_NAME,
-                constraints, WITH_SIGNALLING, null);
+        pceManager.setupPath(D1.deviceId(), D2.deviceId(), "T123", constraints, WITH_SIGNALLING, null);
 
         Collection<Tunnel> tunnels = (Collection<Tunnel>) pceManager.queryAllPath();
         assertThat(tunnels.size(), is(1));
@@ -852,19 +879,18 @@
     }
 
     /**
-     * Tests path release.
+     * Tests path release failure.
      */
     @Test
-    public void releasePath() {
+    public void releasePathTest3() {
         build4RouterTopo(false, false, false, false, 5);
         List<Constraint> constraints = new LinkedList<Constraint>();
         CostConstraint costConstraint = new CostConstraint(TE_COST);
-        BandwidthConstraint bwConst = new BandwidthConstraint(Bandwidth.bps(3));
+        PceBandwidthConstraint bwConst = new PceBandwidthConstraint(Bandwidth.bps(3));
         constraints.add(bwConst);
         constraints.add(costConstraint);
 
-        pceManager.setupPath(D1.deviceId(), D2.deviceId(), TUNNEL_NAME,
-                constraints, WITH_SIGNALLING, null);
+        pceManager.setupPath(D1.deviceId(), D2.deviceId(), "T123", constraints, WITH_SIGNALLING, null);
 
         Collection<Tunnel> tunnels = (Collection<Tunnel>) pceManager.queryAllPath();
         assertThat(tunnels.size(), is(1));
@@ -881,53 +907,49 @@
      * Tests tunnel events added and removed.
      */
     @Test
-    public void tunnelEventAddedRemoved() {
+    public void tunnelEventTest1() {
         build4RouterTopo(false, true, true, true, 15);
-        List<Constraint> constraints = new LinkedList<>();
-        BandwidthConstraint bwConstraint = new BandwidthConstraint(
-                Bandwidth.bps(10.0));
+        List<Constraint> constraints = new LinkedList<Constraint>();
+        PceBandwidthConstraint bwConstraint = new PceBandwidthConstraint(Bandwidth.bps(10.0));
         CostConstraint costConstraint = new CostConstraint(TE_COST);
 
         constraints.add(costConstraint);
         constraints.add(bwConstraint);
 
-        pceManager.setupPath(D1.deviceId(), D2.deviceId(), "T1", constraints,
+        boolean isSuccess = pceManager.setupPath(D1.deviceId(), D2.deviceId(), "T1", constraints,
                 SR_WITHOUT_SIGNALLING, null);
-        assertThat(pceStore.getTunnelInfoCount(), is(1));
+        assertThat(isSuccess, is(true));
 
         Collection<Tunnel> tunnels = (Collection<Tunnel>) pceManager.queryAllPath();
 
         for (Tunnel tunnel : tunnels) {
-            TunnelEvent event = new TunnelEvent(TunnelEvent.Type.TUNNEL_ADDED,
-                    tunnel);
+            TunnelEvent event = new TunnelEvent(TunnelEvent.Type.TUNNEL_ADDED, tunnel);
             tunnelListener.event(event);
 
-            pceManager.releasePath(tunnel.tunnelId());
+            isSuccess = pceManager.releasePath(tunnel.tunnelId());
+            assertThat(isSuccess, is(true));
 
             event = new TunnelEvent(TunnelEvent.Type.TUNNEL_REMOVED, tunnel);
             tunnelListener.event(event);
         }
-
-        assertThat(pceStore.getTunnelInfoCount(), is(0));
     }
 
     /**
      * Tests label allocation/removal in CR case based on tunnel event.
      */
     @Test
-    public void labelAllocationRemoval() {
+    public void tunnelEventTest2() {
         build4RouterTopo(false, true, true, true, 15);
-        List<Constraint> constraints = new LinkedList<>();
-        BandwidthConstraint bwConstraint = new BandwidthConstraint(
-                Bandwidth.bps(10.0));
+        List<Constraint> constraints = new LinkedList<Constraint>();
+        PceBandwidthConstraint bwConstraint = new PceBandwidthConstraint(Bandwidth.bps(10.0));
         CostConstraint costConstraint = new CostConstraint(TE_COST);
 
         constraints.add(costConstraint);
         constraints.add(bwConstraint);
 
-        pceManager.setupPath(D1.deviceId(), D2.deviceId(), "T2", constraints,
+        boolean isSuccess = pceManager.setupPath(D1.deviceId(), D2.deviceId(), "T2", constraints,
                 WITHOUT_SIGNALLING_AND_WITHOUT_SR, null);
-        assertThat(pceStore.getTunnelInfoCount(), is(1));
+        assertThat(isSuccess, is(true));
 
         TunnelEvent event;
         Collection<Tunnel> tunnels = (Collection<Tunnel>) pceManager.queryAllPath();
@@ -944,32 +966,30 @@
             event = new TunnelEvent(TunnelEvent.Type.TUNNEL_UPDATED, tunnel);
             tunnelListener.event(event);
 
-            pceManager.releasePath(tunnel.tunnelId());
+            isSuccess = pceManager.releasePath(tunnel.tunnelId());
+            assertThat(isSuccess, is(true));
 
             event = new TunnelEvent(TunnelEvent.Type.TUNNEL_REMOVED, tunnel);
             tunnelListener.event(event);
         }
-
-        assertThat(pceStore.getTunnelInfoCount(), is(0));
     }
 
     /**
      * Tests handling UNSTABLE state based on tunnel event.
      */
     @Test
-    public void tunnelEventUnstable() {
+    public void tunnelEventTest3() {
         build4RouterTopo(false, true, true, true, 15);
-        List<Constraint> constraints = new LinkedList<>();
-        BandwidthConstraint bwConstraint = new BandwidthConstraint(
-                Bandwidth.bps(10.0));
+        List<Constraint> constraints = new LinkedList<Constraint>();
+        PceBandwidthConstraint bwConstraint = new PceBandwidthConstraint(Bandwidth.bps(10.0));
         CostConstraint costConstraint = new CostConstraint(TE_COST);
 
         constraints.add(costConstraint);
         constraints.add(bwConstraint);
 
-        pceManager.setupPath(D1.deviceId(), D2.deviceId(), "T2", constraints,
+        boolean isSuccess = pceManager.setupPath(D1.deviceId(), D2.deviceId(), "T2", constraints,
                 WITHOUT_SIGNALLING_AND_WITHOUT_SR, null);
-        assertThat(pceStore.getTunnelInfoCount(), is(1));
+        assertThat(isSuccess, is(true));
         assertThat(pceStore.getFailedPathInfoCount(), is(0));
 
         TunnelEvent event;
@@ -987,35 +1007,32 @@
             event = new TunnelEvent(TunnelEvent.Type.TUNNEL_UPDATED, tunnel);
             tunnelListener.event(event);
         }
-        assertThat(pceStore.getTunnelInfoCount(), is(1));
+
         assertThat(pceStore.getFailedPathInfoCount(), is(1));
     }
 
     /**
-     * Tests resiliency when L2 link is down.
+     * Tests resilency when L2 link is down.
      */
     @Test
-    public void resiliencyLinkFail() {
+    public void resilencyTest1() {
         build4RouterTopo(true, false, false, false, 10);
 
 
-        List<Constraint> constraints = new LinkedList<>();
+        List<Constraint> constraints = new LinkedList<Constraint>();
         CostConstraint costConstraint = new CostConstraint(COST);
         constraints.add(costConstraint);
-        BandwidthConstraint localBwConst = new BandwidthConstraint(
-                Bandwidth.bps(10));
+        PceBandwidthConstraint localBwConst = new PceBandwidthConstraint(Bandwidth.bps(10));
         constraints.add(localBwConst);
 
         //Setup the path , tunnel created
-        boolean result = pceManager.setupPath(D1.deviceId(), D4.deviceId(),
-                TUNNEL_NAME, constraints, WITH_SIGNALLING, null);
+        boolean result = pceManager.setupPath(D1.deviceId(), D4.deviceId(), "T123",
+                constraints, WITH_SIGNALLING, null);
         assertThat(result, is(true));
-        assertThat(pceStore.getTunnelInfoCount(), is(1));
         assertThat(pceStore.getFailedPathInfoCount(), is(0));
 
         List<Event> reasons = new LinkedList<>();
-        final LinkEvent linkEvent = new LinkEvent(LinkEvent.Type.LINK_REMOVED,
-                link2);
+        final LinkEvent linkEvent = new LinkEvent(LinkEvent.Type.LINK_REMOVED, link2);
         reasons.add(linkEvent);
         final TopologyEvent event = new TopologyEvent(
                 TopologyEvent.Type.TOPOLOGY_CHANGED,
@@ -1025,7 +1042,7 @@
         //Change Topology : remove link2
         Set<TopologyEdge> tempEdges = new HashSet<>();
         tempEdges.add(new DefaultTopologyEdge(D2, D4, link2));
-        topologyService.changeInTopology(getGraph(null, tempEdges));
+        topologyService.changeInTopology(getGraph(null,  tempEdges));
         listener.event(event);
 
         List<Link> links = new LinkedList<>();
@@ -1038,22 +1055,21 @@
     }
 
     /**
-     * Tests resiliency when L2 and L4 link is down.
+     * Tests resilency when L2 and L4 link is down.
      */
     @Test
-    public void resiliencyMultipleLinkFailsNoAlternativePath() {
+    public void resilencyTest2() {
         build4RouterTopo(true, false, false, false, 10);
 
-        List<Constraint> constraints = new LinkedList<>();
+        List<Constraint> constraints = new LinkedList<Constraint>();
         CostConstraint costConstraint = new CostConstraint(COST);
         constraints.add(costConstraint);
-        BandwidthConstraint localBwConst = new BandwidthConstraint(
-                Bandwidth.bps(10));
+        PceBandwidthConstraint localBwConst = new PceBandwidthConstraint(Bandwidth.bps(10));
         constraints.add(localBwConst);
 
         //Setup the path , tunnel created
-        boolean result = pceManager.setupPath(D1.deviceId(), D4.deviceId(),
-                TUNNEL_NAME, constraints, WITH_SIGNALLING, null);
+        boolean result = pceManager.setupPath(D1.deviceId(), D4.deviceId(), "T123",
+                constraints, WITH_SIGNALLING, null);
         assertThat(result, is(true));
 
         List<Event> reasons = new LinkedList<>();
@@ -1070,7 +1086,7 @@
         Set<TopologyEdge> tempEdges = new HashSet<>();
         tempEdges.add(new DefaultTopologyEdge(D2, D4, link2));
         tempEdges.add(new DefaultTopologyEdge(D3, D4, link4));
-        topologyService.changeInTopology(getGraph(null, tempEdges));
+        topologyService.changeInTopology(getGraph(null,  tempEdges));
         listener.event(event);
 
         //No Path
@@ -1078,22 +1094,21 @@
     }
 
     /**
-     * Tests resiliency when D2 device is down.
+     * Tests resilency when D2 device is down.
      */
     @Test
-    public void resiliencyDeviceFail() {
+    public void resilencyTest3() {
         build4RouterTopo(true, false, false, false, 10);
 
-        List<Constraint> constraints = new LinkedList<>();
+        List<Constraint> constraints = new LinkedList<Constraint>();
         CostConstraint costConstraint = new CostConstraint(COST);
         constraints.add(costConstraint);
-        BandwidthConstraint localBwConst = new BandwidthConstraint(
-                Bandwidth.bps(10));
+        PceBandwidthConstraint localBwConst = new PceBandwidthConstraint(Bandwidth.bps(10));
         constraints.add(localBwConst);
 
         //Setup the path , tunnel created
-        boolean result = pceManager.setupPath(D1.deviceId(), D4.deviceId(),
-                TUNNEL_NAME, constraints, WITH_SIGNALLING, null);
+        boolean result = pceManager.setupPath(D1.deviceId(), D4.deviceId(), "T123",
+                constraints, WITH_SIGNALLING, null);
         assertThat(result, is(true));
 
         List<Event> reasons = new LinkedList<>();
@@ -1110,35 +1125,35 @@
         Set<TopologyEdge> tempEdges = new HashSet<>();
         tempEdges.add(new DefaultTopologyEdge(D2, D4, link2));
         tempEdges.add(new DefaultTopologyEdge(D1, D2, link1));
-        topologyService.changeInTopology(getGraph(null, tempEdges));
+        topologyService.changeInTopology(getGraph(null,  tempEdges));
         listener.event(event);
 
         List<Link> links = new LinkedList<>();
         links.add(link3);
         links.add(link4);
 
+        Path path = tunnelService.queryAllTunnels().iterator().next().path();
         //Path is D1-D3-D4
-        assertThat(pathService.paths().iterator().next().links(), is(links));
-        assertThat(pathService.paths().iterator().next().cost(), is((double) 180));
+        assertThat(path.links(), is(links));
+        assertThat(path.cost(), is((double) 180));
     }
 
     /**
-     * Tests resiliency when ingress device is down.
+     * Tests resilency when ingress device is down.
      */
     @Test
-    public void resiliencyIngressDeviceFail() {
+    public void resilencyTest4() {
         build4RouterTopo(true, false, false, false, 10);
 
-        List<Constraint> constraints = new LinkedList<>();
+        List<Constraint> constraints = new LinkedList<Constraint>();
         CostConstraint costConstraint = new CostConstraint(COST);
         constraints.add(costConstraint);
-        BandwidthConstraint localBwConst = new BandwidthConstraint(
-                Bandwidth.bps(10));
+        PceBandwidthConstraint localBwConst = new PceBandwidthConstraint(Bandwidth.bps(10));
         constraints.add(localBwConst);
 
         //Setup the path , tunnel created
-        boolean result = pceManager.setupPath(D1.deviceId(), D4.deviceId(),
-                TUNNEL_NAME, constraints, WITH_SIGNALLING, null);
+        boolean result = pceManager.setupPath(D1.deviceId(), D4.deviceId(), "T123",
+                constraints, WITH_SIGNALLING, null);
         assertThat(result, is(true));
 
         List<Event> reasons = new LinkedList<>();
@@ -1163,22 +1178,21 @@
     }
 
     /**
-     * Tests resiliency when D2 and D3 devices are down.
+     * Tests resilency when D2 and D3 devices are down.
      */
     @Test
-    public void resiliencyMultipleDevicesFailNoAlternativePath() {
+    public void resilencyTest5() {
         build4RouterTopo(true, false, false, false, 10);
 
-        List<Constraint> constraints = new LinkedList<>();
+        List<Constraint> constraints = new LinkedList<Constraint>();
         CostConstraint costConstraint = new CostConstraint(COST);
         constraints.add(costConstraint);
-        BandwidthConstraint localBwConst = new BandwidthConstraint(
-                Bandwidth.bps(10));
+        PceBandwidthConstraint localBwConst = new PceBandwidthConstraint(Bandwidth.bps(10));
         constraints.add(localBwConst);
 
         //Setup the path , tunnel created
-        boolean result = pceManager.setupPath(D1.deviceId(), D4.deviceId(),
-                TUNNEL_NAME, constraints, WITH_SIGNALLING, null);
+        boolean result = pceManager.setupPath(D1.deviceId(), D4.deviceId(), "T123",
+                constraints, WITH_SIGNALLING, null);
         assertThat(result, is(true));
 
         List<Event> reasons = new LinkedList<>();
@@ -1213,22 +1227,21 @@
     }
 
     /**
-     * Tests resiliency when egress device is down.
+     * Tests resilency when egress device is down.
      */
     @Test
-    public void resiliencyEgressDeviceFail() {
+    public void resilencyTest6() {
         build4RouterTopo(true, false, false, false, 10);
 
-        List<Constraint> constraints = new LinkedList<>();
+        List<Constraint> constraints = new LinkedList<Constraint>();
         CostConstraint costConstraint = new CostConstraint(COST);
         constraints.add(costConstraint);
-        BandwidthConstraint localBwConst = new BandwidthConstraint(
-                Bandwidth.bps(10));
+        PceBandwidthConstraint localBwConst = new PceBandwidthConstraint(Bandwidth.bps(10));
         constraints.add(localBwConst);
 
         //Setup the path , tunnel created
-        boolean result = pceManager.setupPath(D1.deviceId(), D4.deviceId(),
-                TUNNEL_NAME, constraints, WITH_SIGNALLING, null);
+        boolean result = pceManager.setupPath(D1.deviceId(), D4.deviceId(), "T123",
+                constraints, WITH_SIGNALLING, null);
         assertThat(result, is(true));
 
         List<Event> reasons = new LinkedList<>();
@@ -1256,22 +1269,63 @@
     }
 
     /**
-     * Tests resiliency when D2 device is suspended.
+     * Tests resilency when egress device is down.
      */
     @Test
-    public void resiliencyDeviceSuspended() {
+    public void resilencyTest7() {
         build4RouterTopo(true, false, false, false, 10);
 
-        List<Constraint> constraints = new LinkedList<>();
+        List<Constraint> constraints = new LinkedList<Constraint>();
         CostConstraint costConstraint = new CostConstraint(COST);
         constraints.add(costConstraint);
-        BandwidthConstraint localBwConst = new BandwidthConstraint(
-                Bandwidth.bps(10));
+        PceBandwidthConstraint localBwConst = new PceBandwidthConstraint(Bandwidth.bps(10));
         constraints.add(localBwConst);
 
         //Setup the path , tunnel created
-        boolean result = pceManager.setupPath(D1.deviceId(), D4.deviceId(),
-                TUNNEL_NAME, constraints, WITH_SIGNALLING, null);
+        boolean result = pceManager.setupPath(D1.deviceId(), D4.deviceId(), "T123",
+                constraints, WITH_SIGNALLING, null);
+        assertThat(result, is(true));
+
+        List<Event> reasons = new LinkedList<>();
+        LinkEvent linkEvent = new LinkEvent(LinkEvent.Type.LINK_REMOVED, link2);
+        reasons.add(linkEvent);
+        linkEvent = new LinkEvent(LinkEvent.Type.LINK_REMOVED, link4);
+        reasons.add(linkEvent);
+
+        final TopologyEvent event = new TopologyEvent(
+                TopologyEvent.Type.TOPOLOGY_CHANGED,
+                topology,
+                reasons);
+
+        //Change Topology : remove device4 , link2 and link4
+        Set<TopologyEdge> tempEdges = new HashSet<>();
+        tempEdges.add(new DefaultTopologyEdge(D2, D4, link2));
+        tempEdges.add(new DefaultTopologyEdge(D3, D4, link4));
+        Set<TopologyVertex> tempVertexes = new HashSet<>();
+        tempVertexes.add(D4);
+        topologyService.changeInTopology(getGraph(tempVertexes, tempEdges));
+        listener.event(event);
+
+        //No path
+        assertThat(pathService.paths().size(), is(0));
+    }
+
+    /**
+     * Tests resilency when D2 device is suspended.
+     */
+    @Test
+    public void resilencyTest8() {
+        build4RouterTopo(true, false, false, false, 10);
+
+        List<Constraint> constraints = new LinkedList<Constraint>();
+        CostConstraint costConstraint = new CostConstraint(COST);
+        constraints.add(costConstraint);
+        PceBandwidthConstraint localBwConst = new PceBandwidthConstraint(Bandwidth.bps(10));
+        constraints.add(localBwConst);
+
+        //Setup the path , tunnel created
+        boolean result = pceManager.setupPath(D1.deviceId(), D4.deviceId(), "T123",
+                constraints, WITH_SIGNALLING, null);
         assertThat(result, is(true));
 
         List<Event> reasons = new LinkedList<>();
@@ -1298,42 +1352,89 @@
         links.add(link3);
         links.add(link4);
 
+        Path path = tunnelService.queryAllTunnels().iterator().next().path();
+
         //Path is D1-D3-D4
-        assertThat(pathService.paths().iterator().next().links(), is(links));
-        assertThat(pathService.paths().iterator().next().cost(), is((double) 180));
+        assertThat(path.links(), is(links));
+        assertThat(path.cost(), is((double) 180));
+    }
+
+    /**
+     * Tests resilency when D2 device availability is changed.
+     */
+    @Test
+    public void resilencyTest11() {
+        build4RouterTopo(true, false, false, false, 10);
+
+        List<Constraint> constraints = new LinkedList<Constraint>();
+        CostConstraint costConstraint = new CostConstraint(COST);
+        constraints.add(costConstraint);
+        PceBandwidthConstraint localBwConst = new PceBandwidthConstraint(Bandwidth.bps(10));
+        constraints.add(localBwConst);
+
+        //Setup the path , tunnel created
+        boolean result = pceManager.setupPath(D1.deviceId(), D4.deviceId(), "T123",
+                constraints, WITH_SIGNALLING, null);
+        assertThat(result, is(true));
+
+        List<Event> reasons = new LinkedList<>();
+        LinkEvent linkEvent = new LinkEvent(LinkEvent.Type.LINK_REMOVED, link1);
+        reasons.add(linkEvent);
+        linkEvent = new LinkEvent(LinkEvent.Type.LINK_REMOVED, link2);
+        reasons.add(linkEvent);
+
+        final TopologyEvent event = new TopologyEvent(
+                TopologyEvent.Type.TOPOLOGY_CHANGED,
+                topology,
+                reasons);
+
+        //Change Topology : remove device2 , link1 and link2
+        Set<TopologyEdge> tempEdges = new HashSet<>();
+        tempEdges.add(new DefaultTopologyEdge(D1, D2, link1));
+        tempEdges.add(new DefaultTopologyEdge(D2, D4, link2));
+        Set<TopologyVertex> tempVertexes = new HashSet<>();
+        tempVertexes.add(D2);
+        topologyService.changeInTopology(getGraph(tempVertexes, tempEdges));
+        listener.event(event);
+
+        List<Link> links = new LinkedList<>();
+        links.add(link3);
+        links.add(link4);
+
+        Path path = tunnelService.queryAllTunnels().iterator().next().path();
+
+        //Path is D1-D3-D4
+        assertThat(path.links(), is(links));
+        assertThat(path.cost(), is((double) 180));
     }
 
     /**
      * Tests resilency when link2 availability is changed.
      */
     @Test
-    public void resilencyExplicitPathInfoSpecified() {
+    public void resilencyTest12() {
         build4RouterTopo(true, false, false, false, 10);
 
         List<Constraint> constraints = new LinkedList<Constraint>();
         CostConstraint costConstraint = new CostConstraint(COST);
         constraints.add(costConstraint);
-        BandwidthConstraint localBwConst = new BandwidthConstraint(
-                Bandwidth.bps(10));
+        PceBandwidthConstraint localBwConst = new PceBandwidthConstraint(Bandwidth.bps(10));
         constraints.add(localBwConst);
 
         List<ExplicitPathInfo> explicitPathInfoList = Lists.newLinkedList();
-        ExplicitPathInfo obj = new ExplicitPathInfo(ExplicitPathInfo.Type.LOOSE,
-                link1);
+        ExplicitPathInfo obj = new ExplicitPathInfo(ExplicitPathInfo.Type.LOOSE, link1);
         explicitPathInfoList.add(obj);
         obj = new ExplicitPathInfo(ExplicitPathInfo.Type.STRICT, D2.deviceId());
         explicitPathInfoList.add(obj);
 
         //Setup the path , tunnel created
-        boolean result = pceManager.setupPath(D1.deviceId(), D4.deviceId(),
-                TUNNEL_NAME, constraints, WITH_SIGNALLING, explicitPathInfoList);
+        boolean result = pceManager.setupPath(D1.deviceId(), D4.deviceId(), "T123",
+                constraints, WITH_SIGNALLING, explicitPathInfoList);
         assertThat(result, is(true));
-        assertThat(pceStore.getTunnelInfoCount(), is(1));
         assertThat(pceStore.getFailedPathInfoCount(), is(0));
 
         List<Event> reasons = new LinkedList<>();
-        final LinkEvent linkEvent = new LinkEvent(LinkEvent.Type.LINK_REMOVED,
-                link2);
+        final LinkEvent linkEvent = new LinkEvent(LinkEvent.Type.LINK_REMOVED, link2);
         reasons.add(linkEvent);
         final TopologyEvent event = new TopologyEvent(
                 TopologyEvent.Type.TOPOLOGY_CHANGED,
@@ -1358,7 +1459,6 @@
     public void tearDown() {
         pceManager.deactivate();
         pceManager.pathService = null;
-        pceManager.resourceService = null;
         pceManager.tunnelService = null;
         pceManager.coreService = null;
         pceManager.storageService = null;
@@ -1367,6 +1467,7 @@
         pceManager.pceStore = null;
         pceManager.topologyService = null;
         pceManager.mastershipService = null;
+        flowsDownloaded = 0;
     }
 
     private class MockTopologyService extends TopologyServiceAdapter {
@@ -1375,8 +1476,7 @@
         }
 
         @Override
-        public Set<Path> getPaths(Topology topology, DeviceId src, DeviceId dst,
-                                  LinkWeight weight) {
+        public Set<Path> getPaths(Topology topology, DeviceId src, DeviceId dst, LinkWeight weight) {
             DefaultTopologyVertex srcV = new DefaultTopologyVertex(src);
             DefaultTopologyVertex dstV = new DefaultTopologyVertex(dst);
             Set<TopologyVertex> vertices = graph.getVertexes();
@@ -1385,9 +1485,8 @@
                 return ImmutableSet.of();
             }
 
-            GraphPathSearch.Result<TopologyVertex, TopologyEdge> result =
-                    PathComputationTest.graphSearch()
-                            .search(graph, srcV, dstV, adapt(weight), ALL_PATHS);
+            GraphPathSearch.Result<TopologyVertex, TopologyEdge> result = PathComputationTest.graphSearch()
+                    .search(graph, srcV, dstV, adapt(weight), ALL_PATHS);
             ImmutableSet.Builder<Path> builder = ImmutableSet.builder();
             for (org.onlab.graph.Path<TopologyVertex, TopologyEdge> path : result.paths()) {
                 builder.add(PathComputationTest.networkPath(path));
@@ -1396,14 +1495,24 @@
         }
     }
 
-    private TopologyGraph getGraph(Set<TopologyVertex> removedVertex,
-                                   Set<TopologyEdge> removedEdges) {
+    private TopologyGraph getGraph(Set<TopologyVertex> removedVertex, Set<TopologyEdge> removedEdges) {
         if (removedVertex != null) {
-            removedVertex.forEach(vertexes::remove);
+            vertexes.remove(removedVertex);
+            removedVertex.forEach(new Consumer<TopologyVertex>() {
+                @Override
+                public void accept(TopologyVertex v) {
+                    vertexes.remove(v);
+                }
+            });
         }
 
         if (removedEdges != null) {
-            removedEdges.forEach(edges::remove);
+            removedEdges.forEach(new Consumer<TopologyEdge>() {
+                @Override
+                public void accept(TopologyEdge e) {
+                    edges.remove(e);
+                }
+            });
         }
 
         return new DefaultTopologyGraph(vertexes, edges);
@@ -1420,8 +1529,7 @@
 
             // Otherwise get all paths between the source and destination edge
             // devices.
-            computedPaths = topologyService.getPaths(null, (DeviceId) src,
-                    (DeviceId) dst, weight);
+            computedPaths = topologyService.getPaths(null, (DeviceId) src, (DeviceId) dst, weight);
             return computedPaths;
         }
 
@@ -1431,18 +1539,15 @@
     }
 
     private class MockTunnelServiceAdapter extends TunnelServiceAdapter {
-        private HashMap<TunnelId, Tunnel> tunnelIdAsKeyStore = new HashMap<>();
+        private HashMap<TunnelId, Tunnel> tunnelIdAsKeyStore = new HashMap<TunnelId, Tunnel>();
         private int tunnelIdCounter = 0;
 
         @Override
-        public TunnelId setupTunnel(ApplicationId producerId,
-                                    ElementId srcElementId,
-                                    Tunnel tunnel, Path path) {
+        public TunnelId setupTunnel(ApplicationId producerId, ElementId srcElementId, Tunnel tunnel, Path path) {
             TunnelId tunnelId = TunnelId.valueOf(String.valueOf(++tunnelIdCounter));
-            Tunnel tunnelToInsert = new DefaultTunnel(tunnel.providerId(),
-                    tunnel.src(), tunnel.dst(), tunnel.type(),
-                    tunnel.state(), tunnel.groupId(), tunnelId,
-                    tunnel.tunnelName(), path, tunnel.annotations());
+            Tunnel tunnelToInsert = new DefaultTunnel(tunnel.providerId(), tunnel.src(), tunnel.dst(), tunnel.type(),
+                                                      tunnel.state(), tunnel.groupId(), tunnelId, tunnel.tunnelName(),
+                                                      path, tunnel.annotations());
             tunnelIdAsKeyStore.put(tunnelId, tunnelToInsert);
             return tunnelId;
         }
@@ -1453,33 +1558,28 @@
         }
 
         /**
-         * Stimulates the effect of receiving PLSP id and LSP id from protocol
-         * PCRpt msg.
+         * Stimulates the effect of receiving PLSP id and LSP id from protocol PCRpt msg.
          */
-        public TunnelId updateTunnelWithLspIds(Tunnel tunnel, String pLspId,
-                                               String localLspId, State state) {
+        public TunnelId updateTunnelWithLspIds(Tunnel tunnel, String pLspId, String localLspId, State state) {
             TunnelId tunnelId = tunnel.tunnelId();
             Builder annotationBuilder = DefaultAnnotations.builder();
             annotationBuilder.putAll(tunnel.annotations());
 
-            // PCRpt in response to PCInitate msg will carry PLSP id allocated
-            // by PCC.
+            // PCRpt in response to PCInitate msg will carry PLSP id allocated by PCC.
             if (tunnel.annotations().value(PLSP_ID) == null) {
                 annotationBuilder.set(PLSP_ID, pLspId);
             }
 
-            // Signalled LSPs will carry local LSP id allocated by signalling
-            // protocol(PCC).
+            // Signalled LSPs will carry local LSP id allocated by signalling protocol(PCC).
             if (tunnel.annotations().value(LOCAL_LSP_ID) == null) {
                 annotationBuilder.set(LOCAL_LSP_ID, localLspId);
             }
             SparseAnnotations annotations = annotationBuilder.build();
             tunnelIdAsKeyStore.remove(tunnelId, tunnel);
 
-            Tunnel tunnelToInsert = new DefaultTunnel(tunnel.providerId(),
-                    tunnel.src(), tunnel.dst(), tunnel.type(),
-                    state, tunnel.groupId(), tunnelId, tunnel.tunnelName(),
-                    tunnel.path(), annotations);
+            Tunnel tunnelToInsert = new DefaultTunnel(tunnel.providerId(), tunnel.src(), tunnel.dst(), tunnel.type(),
+                                                      state, tunnel.groupId(), tunnelId, tunnel.tunnelName(),
+                                                      tunnel.path(), annotations);
 
             tunnelIdAsKeyStore.put(tunnelId, tunnelToInsert);
 
@@ -1508,45 +1608,40 @@
         }
 
         @Override
-        public Collection<Tunnel> queryTunnel(TunnelEndPoint src,
-                                              TunnelEndPoint dst) {
-            Collection<Tunnel> result = new HashSet<>();
+        public Collection<Tunnel> queryTunnel(TunnelEndPoint src, TunnelEndPoint dst) {
+            Collection<Tunnel> result = new HashSet<Tunnel>();
             Tunnel tunnel = null;
             for (TunnelId tunnelId : tunnelIdAsKeyStore.keySet()) {
                 tunnel = tunnelIdAsKeyStore.get(tunnelId);
 
-                if ((null != tunnel) && (src.equals(tunnel.src())) &&
-                        (dst.equals(tunnel.dst()))) {
+                if ((null != tunnel) && (src.equals(tunnel.src())) && (dst.equals(tunnel.dst()))) {
                     result.add(tunnel);
                 }
             }
 
-            return result.size() == 0 ? Collections.emptySet() :
-                    ImmutableSet.copyOf(result);
+            return result.size() == 0 ? Collections.emptySet() : ImmutableSet.copyOf(result);
         }
 
         @Override
         public Collection<Tunnel> queryTunnel(Tunnel.Type type) {
-            Collection<Tunnel> result = new HashSet<>();
+            Collection<Tunnel> result = new HashSet<Tunnel>();
 
             for (TunnelId tunnelId : tunnelIdAsKeyStore.keySet()) {
                 result.add(tunnelIdAsKeyStore.get(tunnelId));
             }
 
-            return result.size() == 0 ? Collections.emptySet() :
-                    ImmutableSet.copyOf(result);
+            return result.size() == 0 ? Collections.emptySet() : ImmutableSet.copyOf(result);
         }
 
         @Override
         public Collection<Tunnel> queryAllTunnels() {
-            Collection<Tunnel> result = new HashSet<>();
+            Collection<Tunnel> result = new HashSet<Tunnel>();
 
             for (TunnelId tunnelId : tunnelIdAsKeyStore.keySet()) {
                 result.add(tunnelIdAsKeyStore.get(tunnelId));
             }
 
-            return result.size() == 0 ? Collections.emptySet() :
-                    ImmutableSet.copyOf(result);
+            return result.size() == 0 ? Collections.emptySet() : ImmutableSet.copyOf(result);
         }
 
         @Override
@@ -1555,8 +1650,7 @@
 
             for (Tunnel t : tunnelIdAsKeyStore.values()) {
                 for (Link l : t.path().links()) {
-                    if (l.src().deviceId().equals(deviceId) ||
-                            l.dst().deviceId().equals(deviceId)) {
+                    if (l.src().deviceId().equals(deviceId) || l.dst().deviceId().equals(deviceId)) {
                         tunnelList.add(t);
                         break;
                     }
diff --git a/apps/pce/app/src/test/java/org/onosproject/pce/pcestore/DistributedPceStoreTest.java b/apps/pce/app/src/test/java/org/onosproject/pce/pcestore/DistributedPceStoreTest.java
index c7e6ac9..0039c3c 100644
--- a/apps/pce/app/src/test/java/org/onosproject/pce/pcestore/DistributedPceStoreTest.java
+++ b/apps/pce/app/src/test/java/org/onosproject/pce/pcestore/DistributedPceStoreTest.java
@@ -15,20 +15,11 @@
  */
 package org.onosproject.pce.pcestore;
 
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.notNullValue;
-
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
 import org.junit.After;
 import org.junit.AfterClass;
 import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
-
 import org.onlab.util.DataRateUnit;
 import org.onosproject.incubator.net.resource.label.LabelResourceId;
 import org.onosproject.incubator.net.tunnel.TunnelId;
@@ -36,16 +27,24 @@
 import org.onosproject.net.DefaultAnnotations;
 import org.onosproject.net.DefaultLink;
 import org.onosproject.net.DeviceId;
-import org.onosproject.net.intent.Constraint;
-import org.onosproject.net.intent.constraint.BandwidthConstraint;
 import org.onosproject.net.Link;
 import org.onosproject.net.PortNumber;
+import org.onosproject.net.intent.Constraint;
+import org.onosproject.net.intent.constraint.BandwidthConstraint;
+import org.onosproject.net.provider.ProviderId;
 import org.onosproject.net.resource.ResourceConsumer;
+import org.onosproject.pce.pceservice.ExplicitPathInfo;
 import org.onosproject.pce.pceservice.LspType;
 import org.onosproject.pce.pceservice.TunnelConsumerId;
-import org.onosproject.net.provider.ProviderId;
 import org.onosproject.store.service.TestStorageService;
 
+import java.util.LinkedList;
+import java.util.List;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.notNullValue;
+
 /**
  * Unit tests for DistributedPceStore class.
  */
@@ -164,18 +163,16 @@
      * Checks the operation of addTunnelInfo() method.
      */
     @Test
-    public void testAddTunnelInfo() {
+    public void testAddExplicitPathInfo() {
         // initialization
         distrPceStore.storageService = new TestStorageService();
         distrPceStore.activate();
 
-        // TunnelId with device label store information
-        distrPceStore.addTunnelInfo(tunnelId1, tunnelConsumerId1);
-        assertThat(distrPceStore.existsTunnelInfo(tunnelId1), is(true));
-        assertThat(distrPceStore.getTunnelInfo(tunnelId1), is(tunnelConsumerId1));
-        distrPceStore.addTunnelInfo(tunnelId2, tunnelConsumerId2);
-        assertThat(distrPceStore.existsTunnelInfo(tunnelId2), is(true));
-        assertThat(distrPceStore.getTunnelInfo(tunnelId2), is(tunnelConsumerId2));
+        List<ExplicitPathInfo> infoList = new LinkedList<>();
+        ExplicitPathInfo info1 = new ExplicitPathInfo(ExplicitPathInfo.Type.LOOSE, DeviceId.deviceId("D1"));
+        infoList.add(info1);
+        distrPceStore.tunnelNameExplicitPathInfoMap("Sample1", infoList);
+        assertThat(distrPceStore.getTunnelNameExplicitPathInfoMap("Sample1"), is(infoList));
     }
 
     /**
@@ -195,19 +192,6 @@
     }
 
     /**
-     * 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 existsFailedPathInfo() method.
      */
     @Test
@@ -221,16 +205,6 @@
     }
 
     /**
-     * Checks the operation of getTunnelInfoCount() method.
-     */
-    @Test
-    public void testGetTunnelInfoCount() {
-        testAddTunnelInfo();
-
-        assertThat(distrPceStore.getTunnelInfoCount(), is(2));
-    }
-
-    /**
      * Checks the operation of getFailedPathInfoCount() method.
      */
     @Test
@@ -241,19 +215,6 @@
     }
 
     /**
-     * Checks the operation of getTunnelInfos() method.
-     */
-    @Test
-    public void testGetTunnelInfos() {
-        testAddTunnelInfo();
-
-        Map<TunnelId, ResourceConsumer> tunnelInfoMap = distrPceStore.getTunnelInfos();
-        assertThat(tunnelInfoMap, is(notNullValue()));
-        assertThat(tunnelInfoMap.isEmpty(), is(false));
-        assertThat(tunnelInfoMap.size(), is(2));
-    }
-
-    /**
      * Checks the operation of getFailedPathInfos() method.
      */
     @Test
@@ -266,33 +227,6 @@
     }
 
     /**
-     * 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(tunnelConsumerId1));
-
-        // tunnelId2 with device label store info
-        assertThat(tunnelId2, is(notNullValue()));
-        assertThat(distrPceStore.getTunnelInfo(tunnelId2), is(tunnelConsumerId2));
-    }
-
-    /**
-     * Checks the operation of removeTunnelInfo() method.
-     */
-    @Test
-    public void testRemoveTunnelInfo() {
-        testAddTunnelInfo();
-
-        assertThat(distrPceStore.removeTunnelInfo(tunnelId1), is(true));
-        assertThat(distrPceStore.removeTunnelInfo(tunnelId2), is(true));
-    }
-
-    /**
      * Checks the operation of removeFailedPathInfo() method.
      */
     @Test
diff --git a/apps/pce/app/src/test/java/org/onosproject/pce/util/PceStoreAdapter.java b/apps/pce/app/src/test/java/org/onosproject/pce/util/PceStoreAdapter.java
index cba8801..8688fb3 100644
--- a/apps/pce/app/src/test/java/org/onosproject/pce/util/PceStoreAdapter.java
+++ b/apps/pce/app/src/test/java/org/onosproject/pce/util/PceStoreAdapter.java
@@ -16,22 +16,15 @@
 package org.onosproject.pce.util;
 
 import com.google.common.collect.ImmutableSet;
-
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
+import org.onosproject.pce.pceservice.ExplicitPathInfo;
+import org.onosproject.pce.pcestore.PcePathInfo;
+import org.onosproject.pce.pcestore.api.PceStore;
 
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import java.util.stream.Collectors;
-
-import org.onosproject.incubator.net.tunnel.TunnelId;
-import org.onosproject.net.resource.ResourceConsumer;
-import org.onosproject.pce.pceservice.ExplicitPathInfo;
-import org.onosproject.pce.pcestore.PcePathInfo;
-import org.onosproject.pce.pcestore.api.PceStore;
 
 /**
  * Provides test implementation of PceStore.
@@ -39,7 +32,6 @@
 public class PceStoreAdapter implements PceStore {
 
     // Mapping tunnel with device local info with tunnel consumer id
-    private ConcurrentMap<TunnelId, ResourceConsumer> tunnelInfoMap = new ConcurrentHashMap<>();
 
     // Set of Path info
     private Set<PcePathInfo> failedPathInfoSet = new HashSet<>();
@@ -48,61 +40,26 @@
     private Map<String, List<ExplicitPathInfo>> tunnelNameExplicitPathInfoMap = new HashMap<>();
 
     @Override
-    public boolean existsTunnelInfo(TunnelId tunnelId) {
-        return tunnelInfoMap.containsKey(tunnelId);
-    }
-
-    @Override
     public boolean existsFailedPathInfo(PcePathInfo pathInfo) {
         return failedPathInfoSet.contains(pathInfo);
     }
 
     @Override
-    public int getTunnelInfoCount() {
-        return tunnelInfoMap.size();
-    }
-
-    @Override
     public int getFailedPathInfoCount() {
         return failedPathInfoSet.size();
     }
 
     @Override
-    public Map<TunnelId, ResourceConsumer> getTunnelInfos() {
-       return tunnelInfoMap.entrySet().stream()
-                 .collect(Collectors.toMap(Map.Entry::getKey, e -> e.getValue()));
-    }
-
-    @Override
     public Iterable<PcePathInfo> getFailedPathInfos() {
        return ImmutableSet.copyOf(failedPathInfoSet);
     }
 
     @Override
-    public ResourceConsumer getTunnelInfo(TunnelId tunnelId) {
-        return tunnelInfoMap.get(tunnelId);
-    }
-
-    @Override
-    public void addTunnelInfo(TunnelId tunnelId, ResourceConsumer tunnelConsumerId) {
-        tunnelInfoMap.put(tunnelId, tunnelConsumerId);
-    }
-
-    @Override
     public void addFailedPathInfo(PcePathInfo pathInfo) {
         failedPathInfoSet.add(pathInfo);
     }
 
     @Override
-    public boolean removeTunnelInfo(TunnelId tunnelId) {
-        tunnelInfoMap.remove(tunnelId);
-        if (tunnelInfoMap.containsKey(tunnelId)) {
-            return false;
-        }
-        return true;
-    }
-
-    @Override
     public boolean removeFailedPathInfo(PcePathInfo pathInfo) {
         if (failedPathInfoSet.remove(pathInfo)) {
             return false;
diff --git a/apps/pce/bandwidthmgmt/BUCK b/apps/pce/bandwidthmgmt/BUCK
new file mode 100644
index 0000000..d013ca9
--- /dev/null
+++ b/apps/pce/bandwidthmgmt/BUCK
@@ -0,0 +1,17 @@
+COMPILE_DEPS = [
+    '//lib:CORE_DEPS',
+    '//core/store/serializers:onos-core-serializers',
+    '//apps/pcep-api:onos-apps-pcep-api',
+]
+
+osgi_jar_with_tests (
+    deps = COMPILE_DEPS
+)
+
+onos_app (
+    app_name = 'org.onosproject.bandwidthmgmt',
+    title = 'PCE Bandwidth Management',
+    category = 'default',
+    url = 'http://onosproject.org',
+    description = 'PCE Bandwidth Management.',
+)
\ No newline at end of file
diff --git a/apps/pce/bandwidthmgmt/pom.xml b/apps/pce/bandwidthmgmt/pom.xml
new file mode 100644
index 0000000..4e984d7
--- /dev/null
+++ b/apps/pce/bandwidthmgmt/pom.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Copyright 2017-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.
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.onosproject</groupId>
+        <artifactId>onos-pce</artifactId>
+        <version>1.10.0-SNAPSHOT</version>
+    </parent>
+    <artifactId>onos-app-bandwidthmgmt</artifactId>
+    <packaging>bundle</packaging>
+
+    <description>PCE Bandwidth management</description>
+
+    <properties>
+        <onos.app.name>org.onosproject.bandwidthmgmt</onos.app.name>
+        <onos.app.category>default</onos.app.category>
+        <onos.app.url>http://onosproject.org</onos.app.url>
+        <onos.app.readme>PCE Bandwidth management.</onos.app.readme>
+    </properties>
+
+    <dependencies>
+
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-app-pcep-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-core-serializers</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+    </dependencies>
+</project>
diff --git a/apps/pce/bandwidthmgmt/src/main/java/org/onosproject/bandwidthmgr/BandwidthManager.java b/apps/pce/bandwidthmgmt/src/main/java/org/onosproject/bandwidthmgr/BandwidthManager.java
new file mode 100644
index 0000000..e8fc1c7
--- /dev/null
+++ b/apps/pce/bandwidthmgmt/src/main/java/org/onosproject/bandwidthmgr/BandwidthManager.java
@@ -0,0 +1,127 @@
+/*
+ * Copyright 2017-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.bandwidthmgr;
+
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Deactivate;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.ReferenceCardinality;
+import org.apache.felix.scr.annotations.Service;
+import org.onosproject.net.Link;
+import org.onosproject.net.LinkKey;
+import org.onosproject.bandwidthmgr.api.BandwidthMgmtService;
+import org.onosproject.bandwidthmgr.api.BandwidthMgmtStore;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Set;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * Implementation of PCE service.
+ */
+@Component(immediate = true)
+@Service
+public class BandwidthManager implements BandwidthMgmtService {
+    private static final Logger log = LoggerFactory.getLogger(BandwidthManager.class);
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected BandwidthMgmtStore store;
+
+    @Activate
+    protected void activate() {
+        log.info("Started");
+    }
+
+    @Deactivate
+    protected void deactivate() {
+        log.info("Stopped");
+    }
+
+    @Override
+    public Double getTeCost(LinkKey linkKey) {
+        checkNotNull(linkKey);
+        return store.getTeCost(linkKey);
+    }
+
+    @Override
+    public Double getAvailableBandwidth(LinkKey linkKey) {
+        checkNotNull(linkKey);
+        Set<Double> unResvBw = getUnreservedBw(linkKey);
+        Double localReservedBw = getAllocatedLocalReservedBw(linkKey);
+        if (unResvBw != null && localReservedBw != null) {
+
+            return unResvBw.iterator().next().doubleValue()
+                    - localReservedBw.doubleValue();
+        }
+        return unResvBw.iterator().next().doubleValue();
+    }
+
+    @Override
+    public boolean allocLocalReservedBw(LinkKey linkKey, Double bandwidth) {
+        checkNotNull(linkKey);
+        checkNotNull(bandwidth);
+        return store.allocLocalReservedBw(linkKey, bandwidth);
+    }
+
+    @Override
+    public boolean releaseLocalReservedBw(LinkKey linkkey, Double bandwidth) {
+        checkNotNull(linkkey);
+        checkNotNull(bandwidth);
+        return store.releaseLocalReservedBw(linkkey, bandwidth);
+    }
+
+    @Override
+    public Double getAllocatedLocalReservedBw(LinkKey linkkey) {
+        checkNotNull(linkkey);
+        return store.getAllocatedLocalReservedBw(linkkey);
+    }
+
+    @Override
+    public boolean addUnreservedBw(LinkKey linkKey, Set<Double> bandwidth) {
+        checkNotNull(linkKey);
+        checkNotNull(bandwidth);
+        return store.addUnreservedBw(linkKey, bandwidth);
+    }
+
+    @Override
+    public boolean removeUnreservedBw(LinkKey linkkey) {
+        checkNotNull(linkkey);
+        return store.removeUnreservedBw(linkkey);
+    }
+
+    @Override
+    public Set<Double> getUnreservedBw(LinkKey linkkey) {
+        checkNotNull(linkkey);
+        return store.getUnreservedBw(linkkey);
+    }
+
+    @Override
+    public boolean isBandwidthAvailable(Link link, Double bandwidth) {
+        checkNotNull(link);
+        checkNotNull(bandwidth);
+
+        LinkKey linkKey = LinkKey.linkKey(link);
+        Double localAllocBw = getAllocatedLocalReservedBw(linkKey);
+
+        Set<Double> unResvBw = getUnreservedBw(linkKey);
+        Double prirZeroBw = unResvBw.iterator().next();
+
+        return (bandwidth <= prirZeroBw -  (localAllocBw != null ? localAllocBw : 0));
+    }
+}
\ No newline at end of file
diff --git a/apps/pce/bandwidthmgmt/src/main/java/org/onosproject/bandwidthmgr/DistributedBandwidthMgmtStore.java b/apps/pce/bandwidthmgmt/src/main/java/org/onosproject/bandwidthmgr/DistributedBandwidthMgmtStore.java
new file mode 100644
index 0000000..3568942
--- /dev/null
+++ b/apps/pce/bandwidthmgmt/src/main/java/org/onosproject/bandwidthmgr/DistributedBandwidthMgmtStore.java
@@ -0,0 +1,216 @@
+/*
+ * 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.bandwidthmgr;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static org.onosproject.net.config.NetworkConfigEvent.Type.CONFIG_ADDED;
+import static org.onosproject.net.config.NetworkConfigEvent.Type.CONFIG_REMOVED;
+import static org.onosproject.net.config.NetworkConfigEvent.Type.CONFIG_UPDATED;
+
+import java.util.LinkedHashSet;
+import java.util.Set;
+
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Deactivate;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.ReferenceCardinality;
+import org.apache.felix.scr.annotations.Service;
+
+import org.onlab.util.KryoNamespace;
+import org.onosproject.net.ConnectPoint;
+import org.onosproject.net.LinkKey;
+import org.onosproject.net.config.NetworkConfigEvent;
+import org.onosproject.net.config.NetworkConfigListener;
+import org.onosproject.net.config.NetworkConfigService;
+import org.onosproject.bandwidthmgr.api.BandwidthMgmtStore;
+import org.onosproject.pcep.api.TeLinkConfig;
+import org.onosproject.store.serializers.KryoNamespaces;
+import org.onosproject.store.service.ConsistentMap;
+import org.onosproject.store.service.Serializer;
+import org.onosproject.store.service.StorageService;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Manages the pool of available labels to devices, links and tunnels.
+ */
+@Component(immediate = true)
+@Service
+public class DistributedBandwidthMgmtStore implements BandwidthMgmtStore {
+    private static final Logger log = LoggerFactory.getLogger(BandwidthManager.class);
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected NetworkConfigService netCfgService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected StorageService storageService;
+
+    private InternalConfigListener cfgListener = new InternalConfigListener();
+
+    private ConsistentMap<LinkKey, Double> teCost;
+    // Locally maintain unreserved bandwidth of each link.
+    private ConsistentMap<LinkKey, Set<Double>> unResvBw;
+
+    // Mapping tunnel with link key with local reserved bandwidth
+    private ConsistentMap<LinkKey, Double> localReservedBw;
+
+    private static final Serializer SERIALIZER = Serializer
+            .using(new KryoNamespace.Builder().register(KryoNamespaces.API)
+                    .register(KryoNamespaces.API)
+                    .register(LinkKey.class)
+                    .register(ConnectPoint.class)
+                    .build());
+
+    @Activate
+    protected void activate() {
+        netCfgService.addListener(cfgListener);
+
+        localReservedBw = storageService.<LinkKey, Double>consistentMapBuilder()
+                .withName("local-reserved-bandwith")
+                .withSerializer(SERIALIZER)
+                .build();
+
+        unResvBw = storageService.<LinkKey, Set<Double>>consistentMapBuilder()
+                .withName("onos-unreserved-bandwidth")
+                .withSerializer(SERIALIZER)
+                .build();
+
+        teCost = storageService.<LinkKey, Double>consistentMapBuilder()
+                .withName("onos-tecost")
+                .withSerializer(SERIALIZER)
+                .build();
+        log.info("Started");
+    }
+
+    @Deactivate
+    protected void deactivate() {
+        netCfgService.removeListener(cfgListener);
+        log.info("Stopped");
+    }
+
+    @Override
+    public Double getTeCost(LinkKey linkKey) {
+        if (teCost.get(linkKey) != null) {
+            return teCost.get(linkKey).value();
+        }
+        return null;
+    }
+
+    @Override
+    public boolean allocLocalReservedBw(LinkKey linkkey, Double bandwidth) {
+        Double allocatedBw = null;
+
+        if (localReservedBw.get(linkkey) != null) {
+            allocatedBw = localReservedBw.get(linkkey).value();
+        }
+        if (allocatedBw != null) {
+            localReservedBw.put(linkkey, (allocatedBw + bandwidth));
+        } else {
+            localReservedBw.put(linkkey, bandwidth);
+        }
+
+        return true;
+    }
+
+    @Override
+    public boolean releaseLocalReservedBw(LinkKey linkkey, Double bandwidth) {
+
+        Double allocatedBw = null;
+        if (localReservedBw.get(linkkey) != null) {
+            allocatedBw = localReservedBw.get(linkkey).value();
+        }
+
+        if (allocatedBw == null || allocatedBw < bandwidth) {
+            return false;
+        }
+
+        Double releasedBw = allocatedBw - bandwidth;
+        if (releasedBw == 0.0) {
+            localReservedBw.remove(linkkey);
+        } else {
+            localReservedBw.put(linkkey, releasedBw);
+        }
+        return true;
+    }
+
+    @Override
+    public Double getAllocatedLocalReservedBw(LinkKey linkkey) {
+        return localReservedBw.get(linkkey) != null ? localReservedBw.get(linkkey).value() : null;
+    }
+
+    @Override
+    public boolean addUnreservedBw(LinkKey linkkey, Set<Double> bandwidth) {
+        unResvBw.put(linkkey, bandwidth);
+        return true;
+    }
+
+    @Override
+    public boolean removeUnreservedBw(LinkKey linkkey) {
+        unResvBw.remove(linkkey);
+        return true;
+    }
+
+    @Override
+    public Set<Double> getUnreservedBw(LinkKey linkkey) {
+        checkNotNull(linkkey);
+        return unResvBw.get(linkkey) != null ? unResvBw.get(linkkey).value() : null;
+    }
+
+    private class InternalConfigListener implements NetworkConfigListener {
+
+        @Override
+        public void event(NetworkConfigEvent event) {
+
+            if (event.configClass().equals(TeLinkConfig.class)) {
+                if ((event.type() != CONFIG_ADDED) &&  (event.type() != CONFIG_UPDATED)
+                        && (event.type() != CONFIG_REMOVED)) {
+                    return;
+                }
+                LinkKey linkKey = (LinkKey) event.subject();
+                switch (event.type()) {
+                    case  CONFIG_ADDED:
+                    case  CONFIG_UPDATED:
+
+                        TeLinkConfig cfg = netCfgService.getConfig(linkKey, TeLinkConfig.class);
+                        if (cfg == null) {
+                            log.error("Unable to get the configuration of the link.");
+                            return;
+                        }
+                        Set<Double> unresvBw = new LinkedHashSet<>();
+                        unresvBw.add(cfg.unResvBandwidth());
+                        addUnreservedBw(linkKey, unresvBw);
+
+                        if (cfg.teCost() != 0) {
+                            teCost.put(linkKey, (double) cfg.teCost());
+                        }
+
+                        break;
+                    case CONFIG_REMOVED:
+                        removeUnreservedBw(linkKey);
+                        localReservedBw.remove(linkKey);
+                        teCost.remove(linkKey);
+
+                        break;
+                    default:
+                        break;
+                }
+            }
+        }
+    }
+
+}
diff --git a/apps/pce/bandwidthmgmt/src/main/java/org/onosproject/bandwidthmgr/api/BandwidthMgmtService.java b/apps/pce/bandwidthmgmt/src/main/java/org/onosproject/bandwidthmgr/api/BandwidthMgmtService.java
new file mode 100644
index 0000000..35271bd
--- /dev/null
+++ b/apps/pce/bandwidthmgmt/src/main/java/org/onosproject/bandwidthmgr/api/BandwidthMgmtService.java
@@ -0,0 +1,102 @@
+/*
+ * Copyright 2017-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.bandwidthmgr.api;
+
+import org.onosproject.net.Link;
+import org.onosproject.net.LinkKey;
+
+import java.util.Set;
+
+public interface BandwidthMgmtService {
+
+
+    /**
+     * Allocate local bandwidth(non rsvp-te) to linkKey mapping.
+     *
+     * @param linkkey link key of the link
+     * @param bandwidth requested local bandwidth
+     * @return success or failure
+     */
+    boolean allocLocalReservedBw(LinkKey linkkey, Double bandwidth);
+
+
+    /**
+     * Release local bandwidth(non rsvp-te) to linkKey mapping.
+     *
+     * @param linkkey link key of the link
+     * @param bandwidth releasing local bandwidth
+     * @return success or failure
+     */
+     boolean releaseLocalReservedBw(LinkKey linkkey, Double bandwidth);
+
+    /**
+     * Get local allocated bandwidth of the link.
+     *
+     * @param linkkey link key of the link
+     * @return allocated bandwidth
+     */
+     Double getAllocatedLocalReservedBw(LinkKey linkkey);
+
+    /**
+     * Add unreserved bandwidth to linkKey mapping.
+     *
+     * @param linkkey link key of the link
+     * @param bandwidth set of unreserved bandwidth
+     * @return success or failure
+     */
+     boolean addUnreservedBw(LinkKey linkkey, Set<Double> bandwidth);
+
+    /**
+     * Remove unreserved bandwidth to linkKey mapping.
+     *
+     * @param linkkey link key of the link
+     * @return success or failure
+     */
+     boolean removeUnreservedBw(LinkKey linkkey);
+
+    /**
+     * Get list of unreserved Bandwidth of the link.
+     *
+     * @param linkkey link key of the link
+     * @return Set of unreserved bandwidth
+     */
+     Set<Double> getUnreservedBw(LinkKey linkkey);
+
+    /**
+     * Returns if the link has the available bandwidth or not.
+     *
+     * @param link link
+     * @param bandwidth required bandwidth
+     * @return true if bandwidth is available else false
+     */
+    boolean isBandwidthAvailable(Link link, Double bandwidth);
+
+    /**
+     * Returns Te cost for the specified link key.
+     *
+     * @param linkKey connect point of source and destination of the link
+     * @return Te cost for the linkKey
+     */
+    Double getTeCost(LinkKey linkKey);
+
+    /**
+     * Returns available bandwidth for the linkKey.
+     *
+     * @param linkKey connect point of source and destination of the link
+     * @return available bandwidth for the linkKey
+     */
+    Double getAvailableBandwidth(LinkKey linkKey);
+}
diff --git a/apps/pce/bandwidthmgmt/src/main/java/org/onosproject/bandwidthmgr/api/BandwidthMgmtStore.java b/apps/pce/bandwidthmgmt/src/main/java/org/onosproject/bandwidthmgr/api/BandwidthMgmtStore.java
new file mode 100644
index 0000000..c9aae0e
--- /dev/null
+++ b/apps/pce/bandwidthmgmt/src/main/java/org/onosproject/bandwidthmgr/api/BandwidthMgmtStore.java
@@ -0,0 +1,86 @@
+/*
+ * 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.bandwidthmgr.api;
+
+import org.onosproject.net.LinkKey;
+
+import java.util.Set;
+
+/**
+ * Abstraction of an entity providing pool of available labels to devices, links and tunnels.
+ */
+public interface BandwidthMgmtStore {
+
+    /**
+     * Allocate local bandwidth(non rsvp-te) to linkKey mapping.
+     *
+     * @param linkkey link key of the link
+     * @param bandwidth requested local bandwidth
+     * @return success or failure
+     */
+    boolean allocLocalReservedBw(LinkKey linkkey, Double bandwidth);
+
+
+    /**
+     * Release local bandwidth(non rsvp-te) to linkKey mapping.
+     *
+     * @param linkkey link key of the link
+     * @param bandwidth releasing local bandwidth
+     * @return success or failure
+     */
+    boolean releaseLocalReservedBw(LinkKey linkkey, Double bandwidth);
+
+    /**
+     * Get local allocated bandwidth of the link.
+     *
+     * @param linkkey link key of the link
+     * @return allocated bandwidth
+     */
+    Double getAllocatedLocalReservedBw(LinkKey linkkey);
+
+    /**
+     * Add unreserved bandwidth to linkKey mapping.
+     *
+     * @param linkkey link key of the link
+     * @param bandwidth set of unreserved bandwidth
+     * @return success or failure
+     */
+    boolean addUnreservedBw(LinkKey linkkey, Set<Double> bandwidth);
+
+    /**
+     * Remove unreserved bandwidth to linkKey mapping.
+     *
+     * @param linkkey link key of the link
+     * @return success or failure
+     */
+    boolean removeUnreservedBw(LinkKey linkkey);
+
+    /**
+     * Get list of unreserved Bandwidth of the link.
+     *
+     * @param linkkey link key of the link
+     * @return Set of unreserved bandwidth
+     */
+    Set<Double> getUnreservedBw(LinkKey linkkey);
+
+    /**
+     * Returns Te cost for the specified link key.
+     *
+     * @param linkKey connect point of source and destination of the link
+     * @return Te cost for the linkKey
+     */
+    Double getTeCost(LinkKey linkKey);
+}
diff --git a/apps/pce/bandwidthmgmt/src/main/java/org/onosproject/bandwidthmgr/api/package-info.java b/apps/pce/bandwidthmgmt/src/main/java/org/onosproject/bandwidthmgr/api/package-info.java
new file mode 100644
index 0000000..686aecc
--- /dev/null
+++ b/apps/pce/bandwidthmgmt/src/main/java/org/onosproject/bandwidthmgr/api/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2017-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.
+ */
+
+/**
+ * Bandwidth management service.
+ */
+package org.onosproject.bandwidthmgr.api;
diff --git a/apps/pce/bandwidthmgmt/src/main/java/org/onosproject/bandwidthmgr/package-info.java b/apps/pce/bandwidthmgmt/src/main/java/org/onosproject/bandwidthmgr/package-info.java
new file mode 100644
index 0000000..91336fc
--- /dev/null
+++ b/apps/pce/bandwidthmgmt/src/main/java/org/onosproject/bandwidthmgr/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * PCE Bandwidth management service implementation.
+ */
+package org.onosproject.bandwidthmgr;
\ No newline at end of file
diff --git a/apps/pce/pcerest/src/main/java/org/onosproject/pcerest/PcePathCodec.java b/apps/pce/pcerest/src/main/java/org/onosproject/pcerest/PcePathCodec.java
index 92b9e5e..231f5b7 100644
--- a/apps/pce/pcerest/src/main/java/org/onosproject/pcerest/PcePathCodec.java
+++ b/apps/pce/pcerest/src/main/java/org/onosproject/pcerest/PcePathCodec.java
@@ -34,8 +34,8 @@
 import org.onosproject.pce.pceservice.ExplicitPathInfo;
 import org.onosproject.pce.pceservice.PcePath;
 import org.onosproject.pce.pceservice.DefaultPcePath;
-import org.onosproject.net.intent.constraint.BandwidthConstraint;
 import org.onosproject.pce.pceservice.constraint.CostConstraint;
+import org.onosproject.pce.pceservice.constraint.PceBandwidthConstraint;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -233,7 +233,7 @@
         ObjectNode constraintNode = context.mapper()
                 .createObjectNode()
                 .put(COST, ((CostConstraint) path.costConstraint()).type().type())
-                .put(BANDWIDTH, ((BandwidthConstraint) path.bandwidthConstraint()).bandwidth().bps());
+                .put(BANDWIDTH, ((PceBandwidthConstraint) path.bandwidthConstraint()).bandwidth().bps());
 
         if (path.explicitPathInfo() != null && !path.explicitPathInfo().isEmpty()) {
             ArrayNode arrayNode = context.mapper().createArrayNode();
diff --git a/apps/pce/pcerest/src/test/java/org/onosproject/pcerest/PcePathCodecTest.java b/apps/pce/pcerest/src/test/java/org/onosproject/pcerest/PcePathCodecTest.java
index b8d69c5..8f18aa9 100644
--- a/apps/pce/pcerest/src/test/java/org/onosproject/pcerest/PcePathCodecTest.java
+++ b/apps/pce/pcerest/src/test/java/org/onosproject/pcerest/PcePathCodecTest.java
@@ -28,13 +28,13 @@
 import org.onlab.util.DataRateUnit;
 import org.onosproject.codec.JsonCodec;
 import org.onosproject.pce.pceservice.PcePath;
-import org.onosproject.net.intent.constraint.BandwidthConstraint;
 import org.onosproject.net.intent.Constraint;
 import org.onosproject.pce.pceservice.constraint.CostConstraint;
 
 import com.fasterxml.jackson.databind.JsonNode;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.node.ObjectNode;
+import org.onosproject.pce.pceservice.constraint.PceBandwidthConstraint;
 
 /**
  * PCE path codec unit tests.
@@ -92,7 +92,7 @@
         assertThat(pcePath.costConstraint(), is(costConstraint));
         // testing bandwidth
         String bandwidth = "200";
-        Constraint bandwidthConstraint = BandwidthConstraint.of(Double.valueOf(bandwidth), DataRateUnit
+        Constraint bandwidthConstraint = PceBandwidthConstraint.of(Double.valueOf(bandwidth), DataRateUnit
                     .valueOf("BPS"));
         assertThat(pcePath.bandwidthConstraint(), is(bandwidthConstraint));
     }
diff --git a/apps/pce/pcerest/src/test/java/org/onosproject/pcerest/PcePathResourceTest.java b/apps/pce/pcerest/src/test/java/org/onosproject/pcerest/PcePathResourceTest.java
index 140739d..20a53e1 100644
--- a/apps/pce/pcerest/src/test/java/org/onosproject/pcerest/PcePathResourceTest.java
+++ b/apps/pce/pcerest/src/test/java/org/onosproject/pcerest/PcePathResourceTest.java
@@ -49,7 +49,7 @@
 import org.onlab.packet.IpAddress;
 import org.onlab.rest.BaseResource;
 import org.onosproject.codec.CodecService;
-import org.onosproject.core.GroupId;
+// import org.onosproject.core.DefaultGroupId;
 import org.onosproject.incubator.net.tunnel.DefaultTunnel;
 import org.onosproject.incubator.net.tunnel.IpTunnelEndPoint;
 import org.onosproject.incubator.net.tunnel.Tunnel;
@@ -80,7 +80,7 @@
     private final TunnelService tunnelService = createMock(TunnelService.class);
     private final TunnelEndPoint src = IpTunnelEndPoint.ipTunnelPoint(IpAddress.valueOf(23423));
     private final TunnelEndPoint dst = IpTunnelEndPoint.ipTunnelPoint(IpAddress.valueOf(32421));
-    private final GroupId groupId = new GroupId(92034);
+    // private final DefaultGroupId groupId = new DefaultGroupId(92034);
     private final TunnelName tunnelName = TunnelName.tunnelName("TunnelName");
     private final TunnelId tunnelId = TunnelId.valueOf("41654654");
     private final ProviderId producerName = new ProviderId("producer1", "13");
@@ -174,7 +174,7 @@
 
        // Tunnel
        tunnel = new DefaultTunnel(producerName, src, dst, Tunnel.Type.VXLAN,
-                                  Tunnel.State.ACTIVE, groupId, tunnelId,
+                                  Tunnel.State.ACTIVE, null, tunnelId,
                                   tunnelName, path, builderAnn.build());
 
         explicitPathInfoList = Lists.newLinkedList();
diff --git a/apps/pce/pcerest/src/test/java/org/onosproject/pcerest/PceResourceTest.java b/apps/pce/pcerest/src/test/java/org/onosproject/pcerest/PceResourceTest.java
index 6c96b59..18fa46b 100644
--- a/apps/pce/pcerest/src/test/java/org/onosproject/pcerest/PceResourceTest.java
+++ b/apps/pce/pcerest/src/test/java/org/onosproject/pcerest/PceResourceTest.java
@@ -17,7 +17,6 @@
 
 import org.glassfish.jersey.server.ResourceConfig;
 import org.glassfish.jersey.test.JerseyTest;
-import org.glassfish.jersey.test.TestProperties;
 
 /**
  * Base class for pce rest api tests.  Performs common configuration operations.
@@ -25,17 +24,9 @@
 public class PceResourceTest extends JerseyTest {
 
     /**
-     * Use first available port.
-     *
-     * @see TestProperties#CONTAINER_PORT
-     */
-    protected static final int EPHEMERAL_PORT = 0;
-
-    /**
      * Creates a new web-resource test.
      */
     public PceResourceTest() {
         super(ResourceConfig.forApplicationClass(PceWebApplication.class));
-        set(TestProperties.CONTAINER_PORT, EPHEMERAL_PORT);
     }
 }
diff --git a/apps/pce/pceweb/src/main/java/org/onosproject/pceweb/PceWebTopovMessageHandler.java b/apps/pce/pceweb/src/main/java/org/onosproject/pceweb/PceWebTopovMessageHandler.java
index 95c113c..5c47248 100644
--- a/apps/pce/pceweb/src/main/java/org/onosproject/pceweb/PceWebTopovMessageHandler.java
+++ b/apps/pce/pceweb/src/main/java/org/onosproject/pceweb/PceWebTopovMessageHandler.java
@@ -37,11 +37,11 @@
 import org.onosproject.net.Path;
 import org.onosproject.net.device.DeviceService;
 import org.onosproject.net.intent.Constraint;
-import org.onosproject.net.intent.constraint.BandwidthConstraint;
 import org.onosproject.net.topology.TopologyService;
 import org.onosproject.pce.pceservice.LspType;
 import org.onosproject.pce.pceservice.api.PceService;
 import org.onosproject.pce.pceservice.constraint.CostConstraint;
+import org.onosproject.pce.pceservice.constraint.PceBandwidthConstraint;
 import org.onosproject.ui.RequestHandler;
 import org.onosproject.ui.UiConnection;
 import org.onosproject.ui.UiMessageHandler;
@@ -223,7 +223,6 @@
 
             if (lspType == null || lspType.equals(STRING_NULL)) {
                 log.error("PCE setup path is failed as LSP type is mandatory");
-                return;
             }
 
             if ((src != null) && (dst != null)) {
@@ -620,7 +619,7 @@
         }
 
         if (bwValue != 0.0) {
-            listConstrnt.add(BandwidthConstraint.of(bwValue, DataRateUnit.valueOf(BANDWIDTH_BPS)));
+            listConstrnt.add(PceBandwidthConstraint.of(bwValue, DataRateUnit.valueOf(BANDWIDTH_BPS)));
         }
 
         if (costTypeVal != null) {
@@ -703,12 +702,15 @@
         }
     }
 
+    /**
+     * Handles the event of topology listeners.
+     */
     private void findTunnelAndHighlights() {
         Collection<Tunnel> tunnelSet = null;
         Highlights highlights = new Highlights();
-        paths.clear();
+        paths.removeAll(paths);
         tunnelSet = tunnelService.queryTunnel(MPLS);
-        if (tunnelSet.isEmpty()) {
+        if (tunnelSet.size() == 0) {
             log.warn("Tunnel does not exist");
             sendMessage(highlightsMessage(highlights));
             return;
@@ -745,9 +747,12 @@
         hilightAndSendPaths(highlights);
     }
 
+    /**
+     * Handles the event of topology listeners.
+     */
     private void highlightsForTunnel(Tunnel tunnel) {
         Highlights highlights = new Highlights();
-        paths.clear();
+        paths.removeAll(paths);
         if (tunnel.path() == null) {
             log.error("path does not exist");
             sendMessage(highlightsMessage(highlights));
diff --git a/apps/pce/pom.xml b/apps/pce/pom.xml
index b25ad31..4d8a1ea 100644
--- a/apps/pce/pom.xml
+++ b/apps/pce/pom.xml
@@ -30,6 +30,7 @@
     <description>PCE as central controller</description>
 
     <modules>
+        <module>bandwidthmgmt</module>
         <module>app</module>
         <module>pceweb</module>
         <module>pcerest</module>
diff --git a/providers/bgpcep/BUCK b/providers/bgpcep/BUCK
index 97fb3d1..e11fda8 100644
--- a/providers/bgpcep/BUCK
+++ b/providers/bgpcep/BUCK
@@ -13,6 +13,7 @@
   '//providers/bgpcep/flow:onos-providers-bgpcep-flow',
   '//apps/pce/app:onos-apps-pce-app',
   '//apps/pce/pceweb:onos-apps-pce-pceweb',
+  '//apps/pce/bandwidthmgmt:onos-apps-pce-bandwidthmgmt', 
 ]
 
 onos_app (
diff --git a/providers/bgpcep/app/app.xml b/providers/bgpcep/app/app.xml
index 4e7dadb..7498485 100644
--- a/providers/bgpcep/app/app.xml
+++ b/providers/bgpcep/app/app.xml
@@ -34,4 +34,5 @@
     <artifact>mvn:${project.groupId}/onos-app-pce/${project.version}</artifact>
     <artifact>mvn:${project.groupId}/onos-app-pceweb/${project.version}</artifact>
     <artifact>mvn:${project.groupId}/onos-app-pcerest/${project.version}</artifact>
+    <artifact>mvn:${project.groupId}/onos-app-bandwidthmgmt/${project.version}</artifact>
 </app>
diff --git a/providers/bgpcep/app/features.xml b/providers/bgpcep/app/features.xml
index 444a43f..9634978 100644
--- a/providers/bgpcep/app/features.xml
+++ b/providers/bgpcep/app/features.xml
@@ -33,5 +33,6 @@
         <bundle>mvn:${project.groupId}/onos-app-pceweb/${project.version}</bundle>
         <bundle>mvn:${project.groupId}/onos-bgpcep-provider-flow/${project.version}</bundle>
         <bundle>mvn:${project.groupId}/onos-app-pcerest/${project.version}</bundle>
+	<bundle>mvn:${project.groupId}/onos-app-bandwidthmgmt/${project.version}</bundle>
     </feature>
 </features>
diff --git a/providers/bgpcep/app/pom.xml b/providers/bgpcep/app/pom.xml
index 21d367e..4ddbab0 100644
--- a/providers/bgpcep/app/pom.xml
+++ b/providers/bgpcep/app/pom.xml
@@ -85,6 +85,11 @@
         </dependency>
         <dependency>
             <groupId>org.onosproject</groupId>
+            <artifactId>onos-app-bandwidthmgmt</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.onosproject</groupId>
             <artifactId>onos-app-pcerest</artifactId>
             <version>${project.version}</version>
         </dependency>