Priyanka B
Committed by Gerrit Code Review

[ONOS] update command defect fix for cost type

Change-Id: I6cf35b6cd699904d15df7f08ca47d54e0b9c2138
...@@ -47,7 +47,7 @@ public class PceUpdatePathCommand extends AbstractShellCommand { ...@@ -47,7 +47,7 @@ public class PceUpdatePathCommand extends AbstractShellCommand {
47 47
48 @Option(name = "-c", aliases = "--cost", description = "The cost attribute IGP cost (1) or TE cost (2).", 48 @Option(name = "-c", aliases = "--cost", description = "The cost attribute IGP cost (1) or TE cost (2).",
49 required = false, multiValued = false) 49 required = false, multiValued = false)
50 - int cost = 0; 50 + int cost = -1;
51 51
52 @Option(name = "-b", aliases = "--bandwidth", description = "The bandwidth attribute of path. " 52 @Option(name = "-b", aliases = "--bandwidth", description = "The bandwidth attribute of path. "
53 + "Data rate unit is in Bps.", required = false, multiValued = false) 53 + "Data rate unit is in Bps.", required = false, multiValued = false)
...@@ -66,12 +66,14 @@ public class PceUpdatePathCommand extends AbstractShellCommand { ...@@ -66,12 +66,14 @@ public class PceUpdatePathCommand extends AbstractShellCommand {
66 } 66 }
67 67
68 // Cost validation 68 // Cost validation
69 + if (cost != -1) {
69 if ((cost < 1) || (cost > 2)) { 70 if ((cost < 1) || (cost > 2)) {
70 error("The cost attribute value is either IGP cost(1) or TE cost(2)."); 71 error("The cost attribute value is either IGP cost(1) or TE cost(2).");
71 return; 72 return;
72 } 73 }
73 CostConstraint.Type costType = CostConstraint.Type.values()[cost - 1]; 74 CostConstraint.Type costType = CostConstraint.Type.values()[cost - 1];
74 constrntList.add(CostConstraint.of(costType)); 75 constrntList.add(CostConstraint.of(costType));
76 + }
75 77
76 if (!service.updatePath(TunnelId.valueOf(id), constrntList)) { 78 if (!service.updatePath(TunnelId.valueOf(id), constrntList)) {
77 error("Path updation failed."); 79 error("Path updation failed.");
......