cherry pick [ONOS-5002] [ONOS-4986] defect fix in release bandwidth to master
Change-Id: I8331a071e275925f43f869c9299e7fd6b342ced6
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 97a6913..4505e7e 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
@@ -51,7 +51,7 @@
@Option(name = "-b", aliases = "--bandwidth", description = "The bandwidth attribute of path. "
+ "Data rate unit is in Bps.", required = false, multiValued = false)
- double bandwidth = 0.0;
+ Double bandwidth = null;
@Override
protected void execute() {
@@ -61,7 +61,7 @@
List<Constraint> constrntList = new LinkedList<>();
// Assign bandwidth. Data rate unit is in Bps.
- if (bandwidth != 0.0) {
+ if (bandwidth != null) {
constrntList.add(BandwidthConstraint.of(Double.valueOf(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 c622f0e..f777d4f 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
@@ -850,11 +850,12 @@
return;
}
- if (pceStore.getTunnelInfo(tunnel.tunnelId()) == null) {
+ PceccTunnelInfo tunnelInfo = pceStore.getTunnelInfo(tunnel.tunnelId());
+ if (tunnelInfo == null || tunnelInfo.tunnelConsumerId() == null) {
//If bandwidth for old tunnel is not allocated i,e 0 then no need to release
return;
}
- resourceService.release(pceStore.getTunnelInfo(tunnel.tunnelId()).tunnelConsumerId());
+ resourceService.release(tunnelInfo.tunnelConsumerId());
return;
/*
@@ -873,12 +874,13 @@
resourceService.release(pceStore.getTunnelInfo(oldTunnel.tunnelId()).tunnelConsumerId());
// 2. Release new tunnel's bandwidth, if new tunnel bandwidth is allocated
- if (pceStore.getTunnelInfo(newTunnel.tunnelId()) == null) {
+ PceccTunnelInfo tunnelInfo = pceStore.getTunnelInfo(newTunnel.tunnelId());
+ if (tunnelInfo == null || tunnelInfo.tunnelConsumerId() == null) {
//If bandwidth for new tunnel is not allocated i,e 0 then no need to allocate
return;
}
- ResourceConsumer consumer = pceStore.getTunnelInfo(newTunnel.tunnelId()).tunnelConsumerId();
+ ResourceConsumer consumer = tunnelInfo.tunnelConsumerId();
resourceService.release(consumer);
// 3. Allocate new tunnel's complete bandwidth.
diff --git a/apps/pce/app/src/main/java/org/onosproject/pce/pcestore/DefaultLspLocalLabelInfo.java b/apps/pce/app/src/main/java/org/onosproject/pce/pcestore/DefaultLspLocalLabelInfo.java
index 717044f..cdad3b2 100644
--- a/apps/pce/app/src/main/java/org/onosproject/pce/pcestore/DefaultLspLocalLabelInfo.java
+++ b/apps/pce/app/src/main/java/org/onosproject/pce/pcestore/DefaultLspLocalLabelInfo.java
@@ -121,11 +121,11 @@
public String toString() {
return MoreObjects.toStringHelper(getClass())
.omitNullValues()
- .add("DeviceId", deviceId.toString())
- .add("InLabelId", inLabelId.toString())
- .add("OutLabelId", outLabelId.toString())
- .add("InPort", inPort.toString())
- .add("OutPort", outPort.toString())
+ .add("DeviceId", deviceId)
+ .add("InLabelId", inLabelId)
+ .add("OutLabelId", outLabelId)
+ .add("InPort", inPort)
+ .add("OutPort", outPort)
.toString();
}