Priyanka B
Committed by Priyankab-Huawei

cherry pick of [ONOS-4794] [ONOS-4793] [ONOS-4669]TE_COST and bandwidth informat…

…ion on update flow was not correct

Change-Id: I66090e6da1307c8530e89c92f2dcbcdf12e18220
...@@ -27,9 +27,7 @@ import java.util.Map; ...@@ -27,9 +27,7 @@ import java.util.Map;
27 import java.util.Optional; 27 import java.util.Optional;
28 import java.util.Map.Entry; 28 import java.util.Map.Entry;
29 import java.util.Set; 29 import java.util.Set;
30 -import java.util.concurrent.Executors;
31 import java.util.concurrent.ScheduledExecutorService; 30 import java.util.concurrent.ScheduledExecutorService;
32 -import java.util.concurrent.TimeUnit;
33 31
34 import org.onlab.packet.Ethernet; 32 import org.onlab.packet.Ethernet;
35 import org.onlab.packet.IPv4; 33 import org.onlab.packet.IPv4;
...@@ -264,9 +262,6 @@ public class PceManager implements PceService { ...@@ -264,9 +262,6 @@ public class PceManager implements PceService {
264 262
265 packetService.addProcessor(processor, PacketProcessor.director(4)); 263 packetService.addProcessor(processor, PacketProcessor.director(4));
266 topologyService.addListener(topologyListener); 264 topologyService.addListener(topologyListener);
267 - executor = Executors.newSingleThreadScheduledExecutor();
268 - //Start a timer when the component is up, with initial delay of 30min and periodic delays at 30min
269 - executor.scheduleAtFixedRate(new GlobalOptimizationTimer(), INITIAL_DELAY, PERIODIC_DELAY, TimeUnit.MINUTES);
270 265
271 // Reserve global node pool 266 // Reserve global node pool
272 if (!srTeHandler.reserveGlobalPool(GLOBAL_LABEL_SPACE_MIN, GLOBAL_LABEL_SPACE_MAX)) { 267 if (!srTeHandler.reserveGlobalPool(GLOBAL_LABEL_SPACE_MIN, GLOBAL_LABEL_SPACE_MAX)) {
...@@ -284,8 +279,6 @@ public class PceManager implements PceService { ...@@ -284,8 +279,6 @@ public class PceManager implements PceService {
284 netCfgService.removeListener(cfgListener); 279 netCfgService.removeListener(cfgListener);
285 packetService.removeProcessor(processor); 280 packetService.removeProcessor(processor);
286 topologyService.removeListener(topologyListener); 281 topologyService.removeListener(topologyListener);
287 - // Shutdown the thread when component is deactivated
288 - executor.shutdown();
289 log.info("Stopped"); 282 log.info("Stopped");
290 } 283 }
291 284
......
...@@ -495,7 +495,7 @@ class BgpChannelHandler extends IdleStateAwareChannelHandler { ...@@ -495,7 +495,7 @@ class BgpChannelHandler extends IdleStateAwareChannelHandler {
495 @Override 495 @Override
496 public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) throws Exception { 496 public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) throws Exception {
497 497
498 - log.info("[exceptionCaught]: " + e.toString()); 498 + log.error("[exceptionCaught]: " + e.toString());
499 499
500 if (e.getCause() instanceof ReadTimeoutException) { 500 if (e.getCause() instanceof ReadTimeoutException) {
501 // device timeout 501 // device timeout
......
...@@ -1524,7 +1524,6 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid ...@@ -1524,7 +1524,6 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid
1524 bandwidth = attributes.getBandwidthObject().getBandwidth(); 1524 bandwidth = attributes.getBandwidthObject().getBandwidth();
1525 } 1525 }
1526 } 1526 }
1527 -
1528 List<Object> eroSubObjList = buildPathFromEroObj(eroObj, providerId); 1527 List<Object> eroSubObjList = buildPathFromEroObj(eroObj, providerId);
1529 List<Link> links = new ArrayList<>(); 1528 List<Link> links = new ArrayList<>();
1530 List<LabelResourceId> labels = new ArrayList<>(); 1529 List<LabelResourceId> labels = new ArrayList<>();
...@@ -1535,10 +1534,8 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid ...@@ -1535,10 +1534,8 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid
1535 labels.add(LabelResourceId.labelResourceId(((Integer) linkOrLabel).longValue())); 1534 labels.add(LabelResourceId.labelResourceId(((Integer) linkOrLabel).longValue()));
1536 } 1535 }
1537 } 1536 }
1538 -
1539 Path path = new DefaultPath(providerId, links, cost, EMPTY); 1537 Path path = new DefaultPath(providerId, links, cost, EMPTY);
1540 NetworkResource labelStack = new DefaultLabelStack(labels); 1538 NetworkResource labelStack = new DefaultLabelStack(labels);
1541 -
1542 // To carry PST TLV, SRP object can be present with value 0 even when PCRpt is not in response to any action 1539 // To carry PST TLV, SRP object can be present with value 0 even when PCRpt is not in response to any action
1543 // from PCE. 1540 // from PCE.
1544 PcepSrpObject srpObj = stateRpt.getSrpObject(); 1541 PcepSrpObject srpObj = stateRpt.getSrpObject();
...@@ -1570,7 +1567,6 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid ...@@ -1570,7 +1567,6 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid
1570 log.error("Stateful IPv4 identifier TLV is null in PCRpt msg."); 1567 log.error("Stateful IPv4 identifier TLV is null in PCRpt msg.");
1571 return; 1568 return;
1572 } 1569 }
1573 -
1574 IpTunnelEndPoint tunnelEndPointSrc = IpTunnelEndPoint 1570 IpTunnelEndPoint tunnelEndPointSrc = IpTunnelEndPoint
1575 .ipTunnelPoint(IpAddress.valueOf(ipv4LspIdenTlv.getIpv4IngressAddress())); 1571 .ipTunnelPoint(IpAddress.valueOf(ipv4LspIdenTlv.getIpv4IngressAddress()));
1576 IpTunnelEndPoint tunnelEndPointDst = IpTunnelEndPoint 1572 IpTunnelEndPoint tunnelEndPointDst = IpTunnelEndPoint
...@@ -1584,7 +1580,6 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid ...@@ -1584,7 +1580,6 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid
1584 pcepClientController.getClient(pccId).setLspAndDelegationInfo( 1580 pcepClientController.getClient(pccId).setLspAndDelegationInfo(
1585 new LspKey(lspObj.getPlspId(), ipv4LspIdenTlv.getLspId()), lspObj.getDFlag()); 1581 new LspKey(lspObj.getPlspId(), ipv4LspIdenTlv.getLspId()), lspObj.getDFlag());
1586 } 1582 }
1587 -
1588 Tunnel tunnel = null; 1583 Tunnel tunnel = null;
1589 // Asynchronous status change message from PCC for LSP reported earlier. 1584 // Asynchronous status change message from PCC for LSP reported earlier.
1590 for (Tunnel tunnelObj : tunnelQueryResult) { 1585 for (Tunnel tunnelObj : tunnelQueryResult) {
...@@ -1677,7 +1672,13 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid ...@@ -1677,7 +1672,13 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid
1677 1672
1678 //delegated owner will update can be a master or non-master 1673 //delegated owner will update can be a master or non-master
1679 if (lspObj.getDFlag()) { 1674 if (lspObj.getDFlag()) {
1680 - annotations = getAnnotations(lspObj, ipv4LspIdenTlv, bandwidth, lspType, costType); 1675 +
1676 + if (tunnel.annotations().value(BANDWIDTH) != null) {
1677 + bandwidth = Float.parseFloat(tunnel.annotations().value(BANDWIDTH));
1678 + }
1679 + annotations = getAnnotations(lspObj, ipv4LspIdenTlv,
1680 + bandwidth, lspType,
1681 + tunnel.annotations().value(COST_TYPE));
1681 td = new DefaultTunnelDescription(null, tunnelEndPointSrc, tunnelEndPointDst, MPLS, new DefaultGroupId( 1682 td = new DefaultTunnelDescription(null, tunnelEndPointSrc, tunnelEndPointDst, MPLS, new DefaultGroupId(
1682 0), providerId, TunnelName.tunnelName(new String(pathNameTlv.getValue())), path, labelStack, 1683 0), providerId, TunnelName.tunnelName(new String(pathNameTlv.getValue())), path, labelStack,
1683 annotations); 1684 annotations);
......