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;
import java.util.Optional;
import java.util.Map.Entry;
import java.util.Set;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import org.onlab.packet.Ethernet;
import org.onlab.packet.IPv4;
......@@ -264,9 +262,6 @@ public class PceManager implements PceService {
packetService.addProcessor(processor, PacketProcessor.director(4));
topologyService.addListener(topologyListener);
executor = Executors.newSingleThreadScheduledExecutor();
//Start a timer when the component is up, with initial delay of 30min and periodic delays at 30min
executor.scheduleAtFixedRate(new GlobalOptimizationTimer(), INITIAL_DELAY, PERIODIC_DELAY, TimeUnit.MINUTES);
// Reserve global node pool
if (!srTeHandler.reserveGlobalPool(GLOBAL_LABEL_SPACE_MIN, GLOBAL_LABEL_SPACE_MAX)) {
......@@ -284,8 +279,6 @@ public class PceManager implements PceService {
netCfgService.removeListener(cfgListener);
packetService.removeProcessor(processor);
topologyService.removeListener(topologyListener);
// Shutdown the thread when component is deactivated
executor.shutdown();
log.info("Stopped");
}
......
......@@ -495,7 +495,7 @@ class BgpChannelHandler extends IdleStateAwareChannelHandler {
@Override
public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) throws Exception {
log.info("[exceptionCaught]: " + e.toString());
log.error("[exceptionCaught]: " + e.toString());
if (e.getCause() instanceof ReadTimeoutException) {
// device timeout
......
......@@ -1524,7 +1524,6 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid
bandwidth = attributes.getBandwidthObject().getBandwidth();
}
}
List<Object> eroSubObjList = buildPathFromEroObj(eroObj, providerId);
List<Link> links = new ArrayList<>();
List<LabelResourceId> labels = new ArrayList<>();
......@@ -1535,10 +1534,8 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid
labels.add(LabelResourceId.labelResourceId(((Integer) linkOrLabel).longValue()));
}
}
Path path = new DefaultPath(providerId, links, cost, EMPTY);
NetworkResource labelStack = new DefaultLabelStack(labels);
// To carry PST TLV, SRP object can be present with value 0 even when PCRpt is not in response to any action
// from PCE.
PcepSrpObject srpObj = stateRpt.getSrpObject();
......@@ -1570,7 +1567,6 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid
log.error("Stateful IPv4 identifier TLV is null in PCRpt msg.");
return;
}
IpTunnelEndPoint tunnelEndPointSrc = IpTunnelEndPoint
.ipTunnelPoint(IpAddress.valueOf(ipv4LspIdenTlv.getIpv4IngressAddress()));
IpTunnelEndPoint tunnelEndPointDst = IpTunnelEndPoint
......@@ -1584,7 +1580,6 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid
pcepClientController.getClient(pccId).setLspAndDelegationInfo(
new LspKey(lspObj.getPlspId(), ipv4LspIdenTlv.getLspId()), lspObj.getDFlag());
}
Tunnel tunnel = null;
// Asynchronous status change message from PCC for LSP reported earlier.
for (Tunnel tunnelObj : tunnelQueryResult) {
......@@ -1677,7 +1672,13 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid
//delegated owner will update can be a master or non-master
if (lspObj.getDFlag()) {
annotations = getAnnotations(lspObj, ipv4LspIdenTlv, bandwidth, lspType, costType);
if (tunnel.annotations().value(BANDWIDTH) != null) {
bandwidth = Float.parseFloat(tunnel.annotations().value(BANDWIDTH));
}
annotations = getAnnotations(lspObj, ipv4LspIdenTlv,
bandwidth, lspType,
tunnel.annotations().value(COST_TYPE));
td = new DefaultTunnelDescription(null, tunnelEndPointSrc, tunnelEndPointDst, MPLS, new DefaultGroupId(
0), providerId, TunnelName.tunnelName(new String(pathNameTlv.getValue())), path, labelStack,
annotations);
......