[ONOS-5002] [ONOS-4986] defect fix in release bandwidth
Change-Id: I30fae8fff316a34b9ba592e71a326e583c013ea4
Showing
3 changed files
with
13 additions
and
11 deletions
... | @@ -51,7 +51,7 @@ public class PceUpdatePathCommand extends AbstractShellCommand { | ... | @@ -51,7 +51,7 @@ public class PceUpdatePathCommand extends AbstractShellCommand { |
51 | 51 | ||
52 | @Option(name = "-b", aliases = "--bandwidth", description = "The bandwidth attribute of path. " | 52 | @Option(name = "-b", aliases = "--bandwidth", description = "The bandwidth attribute of path. " |
53 | + "Data rate unit is in Bps.", required = false, multiValued = false) | 53 | + "Data rate unit is in Bps.", required = false, multiValued = false) |
54 | - double bandwidth = 0.0; | 54 | + Double bandwidth = null; |
55 | 55 | ||
56 | @Override | 56 | @Override |
57 | protected void execute() { | 57 | protected void execute() { |
... | @@ -61,7 +61,7 @@ public class PceUpdatePathCommand extends AbstractShellCommand { | ... | @@ -61,7 +61,7 @@ public class PceUpdatePathCommand extends AbstractShellCommand { |
61 | 61 | ||
62 | List<Constraint> constrntList = new LinkedList<>(); | 62 | List<Constraint> constrntList = new LinkedList<>(); |
63 | // Assign bandwidth. Data rate unit is in Bps. | 63 | // Assign bandwidth. Data rate unit is in Bps. |
64 | - if (bandwidth != 0.0) { | 64 | + if (bandwidth != null) { |
65 | constrntList.add(BandwidthConstraint.of(Double.valueOf(bandwidth), DataRateUnit.valueOf("BPS"))); | 65 | constrntList.add(BandwidthConstraint.of(Double.valueOf(bandwidth), DataRateUnit.valueOf("BPS"))); |
66 | } | 66 | } |
67 | 67 | ... | ... |
... | @@ -849,11 +849,12 @@ public class PceManager implements PceService { | ... | @@ -849,11 +849,12 @@ public class PceManager implements PceService { |
849 | return; | 849 | return; |
850 | } | 850 | } |
851 | 851 | ||
852 | - if (pceStore.getTunnelInfo(tunnel.tunnelId()) == null) { | 852 | + PceccTunnelInfo tunnelInfo = pceStore.getTunnelInfo(tunnel.tunnelId()); |
853 | + if (tunnelInfo == null || tunnelInfo.tunnelConsumerId() == null) { | ||
853 | //If bandwidth for old tunnel is not allocated i,e 0 then no need to release | 854 | //If bandwidth for old tunnel is not allocated i,e 0 then no need to release |
854 | return; | 855 | return; |
855 | } | 856 | } |
856 | - resourceService.release(pceStore.getTunnelInfo(tunnel.tunnelId()).tunnelConsumerId()); | 857 | + resourceService.release(tunnelInfo.tunnelConsumerId()); |
857 | return; | 858 | return; |
858 | 859 | ||
859 | /* | 860 | /* |
... | @@ -872,12 +873,13 @@ public class PceManager implements PceService { | ... | @@ -872,12 +873,13 @@ public class PceManager implements PceService { |
872 | resourceService.release(pceStore.getTunnelInfo(oldTunnel.tunnelId()).tunnelConsumerId()); | 873 | resourceService.release(pceStore.getTunnelInfo(oldTunnel.tunnelId()).tunnelConsumerId()); |
873 | 874 | ||
874 | // 2. Release new tunnel's bandwidth, if new tunnel bandwidth is allocated | 875 | // 2. Release new tunnel's bandwidth, if new tunnel bandwidth is allocated |
875 | - if (pceStore.getTunnelInfo(newTunnel.tunnelId()) == null) { | 876 | + PceccTunnelInfo tunnelInfo = pceStore.getTunnelInfo(newTunnel.tunnelId()); |
877 | + if (tunnelInfo == null || tunnelInfo.tunnelConsumerId() == null) { | ||
876 | //If bandwidth for new tunnel is not allocated i,e 0 then no need to allocate | 878 | //If bandwidth for new tunnel is not allocated i,e 0 then no need to allocate |
877 | return; | 879 | return; |
878 | } | 880 | } |
879 | 881 | ||
880 | - ResourceConsumer consumer = pceStore.getTunnelInfo(newTunnel.tunnelId()).tunnelConsumerId(); | 882 | + ResourceConsumer consumer = tunnelInfo.tunnelConsumerId(); |
881 | resourceService.release(consumer); | 883 | resourceService.release(consumer); |
882 | 884 | ||
883 | // 3. Allocate new tunnel's complete bandwidth. | 885 | // 3. Allocate new tunnel's complete bandwidth. | ... | ... |
... | @@ -121,11 +121,11 @@ public final class DefaultLspLocalLabelInfo implements LspLocalLabelInfo { | ... | @@ -121,11 +121,11 @@ public final class DefaultLspLocalLabelInfo implements LspLocalLabelInfo { |
121 | public String toString() { | 121 | public String toString() { |
122 | return MoreObjects.toStringHelper(getClass()) | 122 | return MoreObjects.toStringHelper(getClass()) |
123 | .omitNullValues() | 123 | .omitNullValues() |
124 | - .add("DeviceId", deviceId.toString()) | 124 | + .add("DeviceId", deviceId) |
125 | - .add("InLabelId", inLabelId.toString()) | 125 | + .add("InLabelId", inLabelId) |
126 | - .add("OutLabelId", outLabelId.toString()) | 126 | + .add("OutLabelId", outLabelId) |
127 | - .add("InPort", inPort.toString()) | 127 | + .add("InPort", inPort) |
128 | - .add("OutPort", outPort.toString()) | 128 | + .add("OutPort", outPort) |
129 | .toString(); | 129 | .toString(); |
130 | } | 130 | } |
131 | 131 | ... | ... |
-
Please register or login to post a comment