Priyanka B

[ONOS-5002] [ONOS-4986] defect fix in release bandwidth

Change-Id: I30fae8fff316a34b9ba592e71a326e583c013ea4
......@@ -51,7 +51,7 @@ public class PceUpdatePathCommand extends AbstractShellCommand {
@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 @@ public class PceUpdatePathCommand extends AbstractShellCommand {
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")));
}
......
......@@ -849,11 +849,12 @@ public class PceManager implements PceService {
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;
/*
......@@ -872,12 +873,13 @@ public class PceManager implements PceService {
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.
......
......@@ -121,11 +121,11 @@ public final class DefaultLspLocalLabelInfo implements LspLocalLabelInfo {
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();
}
......