cherry pick of [ONOS-4794] [ONOS-4793] [ONOS-4669]TE_COST and bandwidth information on update flow was not correct

Change-Id: I66090e6da1307c8530e89c92f2dcbcdf12e18220
diff --git a/providers/pcep/tunnel/src/main/java/org/onosproject/provider/pcep/tunnel/impl/PcepTunnelProvider.java b/providers/pcep/tunnel/src/main/java/org/onosproject/provider/pcep/tunnel/impl/PcepTunnelProvider.java
index 83fd55c..5fc6a95 100644
--- a/providers/pcep/tunnel/src/main/java/org/onosproject/provider/pcep/tunnel/impl/PcepTunnelProvider.java
+++ b/providers/pcep/tunnel/src/main/java/org/onosproject/provider/pcep/tunnel/impl/PcepTunnelProvider.java
@@ -1524,7 +1524,6 @@
                     bandwidth = attributes.getBandwidthObject().getBandwidth();
                 }
             }
-
             List<Object> eroSubObjList = buildPathFromEroObj(eroObj, providerId);
             List<Link> links = new ArrayList<>();
             List<LabelResourceId> labels = new ArrayList<>();
@@ -1535,10 +1534,8 @@
                     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 @@
                 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 @@
                 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 @@
 
             //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);