cherry pick [ONOS-5002] [ONOS-4986] defect fix in release bandwidth to master
Change-Id: I8331a071e275925f43f869c9299e7fd6b342ced6
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 | ... | ... |
... | @@ -850,11 +850,12 @@ public class PceManager implements PceService { | ... | @@ -850,11 +850,12 @@ public class PceManager implements PceService { |
850 | return; | 850 | return; |
851 | } | 851 | } |
852 | 852 | ||
853 | - if (pceStore.getTunnelInfo(tunnel.tunnelId()) == null) { | 853 | + PceccTunnelInfo tunnelInfo = pceStore.getTunnelInfo(tunnel.tunnelId()); |
854 | + if (tunnelInfo == null || tunnelInfo.tunnelConsumerId() == null) { | ||
854 | //If bandwidth for old tunnel is not allocated i,e 0 then no need to release | 855 | //If bandwidth for old tunnel is not allocated i,e 0 then no need to release |
855 | return; | 856 | return; |
856 | } | 857 | } |
857 | - resourceService.release(pceStore.getTunnelInfo(tunnel.tunnelId()).tunnelConsumerId()); | 858 | + resourceService.release(tunnelInfo.tunnelConsumerId()); |
858 | return; | 859 | return; |
859 | 860 | ||
860 | /* | 861 | /* |
... | @@ -873,12 +874,13 @@ public class PceManager implements PceService { | ... | @@ -873,12 +874,13 @@ public class PceManager implements PceService { |
873 | resourceService.release(pceStore.getTunnelInfo(oldTunnel.tunnelId()).tunnelConsumerId()); | 874 | resourceService.release(pceStore.getTunnelInfo(oldTunnel.tunnelId()).tunnelConsumerId()); |
874 | 875 | ||
875 | // 2. Release new tunnel's bandwidth, if new tunnel bandwidth is allocated | 876 | // 2. Release new tunnel's bandwidth, if new tunnel bandwidth is allocated |
876 | - if (pceStore.getTunnelInfo(newTunnel.tunnelId()) == null) { | 877 | + PceccTunnelInfo tunnelInfo = pceStore.getTunnelInfo(newTunnel.tunnelId()); |
878 | + if (tunnelInfo == null || tunnelInfo.tunnelConsumerId() == null) { | ||
877 | //If bandwidth for new tunnel is not allocated i,e 0 then no need to allocate | 879 | //If bandwidth for new tunnel is not allocated i,e 0 then no need to allocate |
878 | return; | 880 | return; |
879 | } | 881 | } |
880 | 882 | ||
881 | - ResourceConsumer consumer = pceStore.getTunnelInfo(newTunnel.tunnelId()).tunnelConsumerId(); | 883 | + ResourceConsumer consumer = tunnelInfo.tunnelConsumerId(); |
882 | resourceService.release(consumer); | 884 | resourceService.release(consumer); |
883 | 885 | ||
884 | // 3. Allocate new tunnel's complete bandwidth. | 886 | // 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