[ONOS-4720] GoldenEye - Non-pce-init RSVP learnt tunnels addition to core fix.

Change-Id: I52e8a0125e87368d16bd2035f47b9e9ef94dcb6f
diff --git a/protocols/pcep/ctl/src/main/java/org/onosproject/pcep/controller/impl/PcepClientControllerImpl.java b/protocols/pcep/ctl/src/main/java/org/onosproject/pcep/controller/impl/PcepClientControllerImpl.java
index a607381..46768a7 100644
--- a/protocols/pcep/ctl/src/main/java/org/onosproject/pcep/controller/impl/PcepClientControllerImpl.java
+++ b/protocols/pcep/ctl/src/main/java/org/onosproject/pcep/controller/impl/PcepClientControllerImpl.java
@@ -503,8 +503,8 @@
                         } catch (PcepParseException e) {
                             log.error("Exception occured while sending initiate delete message {}", e.getMessage());
                         }
+                        continue;
                     }
-                    continue;
                 }
 
                 if (!lspObj.getCFlag()) {
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 07b4fec..1397385 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
@@ -1476,23 +1476,29 @@
             }
 
             PcepAttribute attributes = msgPath.getPcepAttribute();
+            float bandwidth = 0;
             int cost = 0;
-            if (attributes != null && attributes.getMetricObjectList() != null) {
-                ListIterator<PcepMetricObject> iterator = attributes.getMetricObjectList().listIterator();
-                PcepMetricObject metricObj = iterator.next();
+            if (attributes != null) {
+                if (attributes.getMetricObjectList() != null) {
+                    ListIterator<PcepMetricObject> iterator = attributes.getMetricObjectList().listIterator();
+                    PcepMetricObject metricObj = iterator.next();
 
-                while (metricObj != null) {
-                    if (metricObj.getBType() == IGP_METRIC) {
-                        costType = "COST";
-                    } else if (metricObj.getBType() == TE_METRIC) {
-                        costType = "TE_COST";
+                    while (metricObj != null) {
+                        if (metricObj.getBType() == IGP_METRIC) {
+                            costType = "COST";
+                        } else if (metricObj.getBType() == TE_METRIC) {
+                            costType = "TE_COST";
+                        }
+                        if (costType != null) {
+                            cost = metricObj.getMetricVal();
+                            log.debug("Path cost {}", cost);
+                            break;
+                        }
+                        metricObj = iterator.next();
                     }
-                    if (costType != null) {
-                        cost = metricObj.getMetricVal();
-                        log.debug("Path cost {}", cost);
-                        break;
-                    }
-                    metricObj = iterator.next();
+                }
+                if (attributes.getBandwidthObject() != null) {
+                    bandwidth = attributes.getBandwidthObject().getBandwidth();
                 }
             }
 
@@ -1510,15 +1516,8 @@
             Path path = new DefaultPath(providerId, links, cost, EMPTY);
             NetworkResource labelStack = new DefaultLabelStack(labels);
 
-            float bandwidth = 0;
-            if (msgPath.getBandwidthObject() != null) {
-                bandwidth = msgPath.getBandwidthObject().getBandwidth();
-            }
-
-            /*
-             * To carry PST TLV, SRP object can be present with value 0 even when PCRpt is not in response to any action
-             * from PCE.
-             */
+            // 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();
             LspType lspType = getLspType(srpObj);