[ONOS] update command defect fix for cost type

Change-Id: I6cf35b6cd699904d15df7f08ca47d54e0b9c2138
(cherry picked from commit 7e3bfa4c3f96600a37182fd581d9df08026aa19e)
diff --git a/apps/pce/app/src/main/java/org/onosproject/pce/cli/PceUpdatePathCommand.java b/apps/pce/app/src/main/java/org/onosproject/pce/cli/PceUpdatePathCommand.java
index 536eda8..058a17f 100644
--- a/apps/pce/app/src/main/java/org/onosproject/pce/cli/PceUpdatePathCommand.java
+++ b/apps/pce/app/src/main/java/org/onosproject/pce/cli/PceUpdatePathCommand.java
@@ -47,7 +47,7 @@
 
     @Option(name = "-c", aliases = "--cost", description = "The cost attribute IGP cost (1) or TE cost (2).",
             required = false, multiValued = false)
-    int cost = 0;
+    int cost = -1;
 
     @Option(name = "-b", aliases = "--bandwidth", description = "The bandwidth attribute of path. "
             + "Data rate unit is in Bps.", required = false, multiValued = false)
@@ -66,12 +66,14 @@
         }
 
         // Cost validation
-        if ((cost < 1) || (cost > 2)) {
-            error("The cost attribute value is either IGP cost(1) or TE cost(2).");
-            return;
+        if (cost != -1) {
+            if ((cost < 1) || (cost > 2)) {
+                error("The cost attribute value is either IGP cost(1) or TE cost(2).");
+                return;
+            }
+            CostConstraint.Type costType = CostConstraint.Type.values()[cost - 1];
+            constrntList.add(CostConstraint.of(costType));
         }
-        CostConstraint.Type costType = CostConstraint.Type.values()[cost - 1];
-        constrntList.add(CostConstraint.of(costType));
 
         if (!service.updatePath(TunnelId.valueOf(id), constrntList)) {
             error("Path updation failed.");