Showing
2 changed files
with
6 additions
and
5 deletions
| ... | @@ -7,6 +7,8 @@ import org.onlab.onos.net.intent.Intent; | ... | @@ -7,6 +7,8 @@ import org.onlab.onos.net.intent.Intent; |
| 7 | import org.onlab.onos.net.intent.IntentId; | 7 | import org.onlab.onos.net.intent.IntentId; |
| 8 | import org.onlab.onos.net.intent.IntentService; | 8 | import org.onlab.onos.net.intent.IntentService; |
| 9 | 9 | ||
| 10 | +import java.math.BigInteger; | ||
| 11 | + | ||
| 10 | /** | 12 | /** |
| 11 | * Removes host-to-host connectivity intent. | 13 | * Removes host-to-host connectivity intent. |
| 12 | */ | 14 | */ |
| ... | @@ -22,12 +24,11 @@ public class IntentRemoveCommand extends AbstractShellCommand { | ... | @@ -22,12 +24,11 @@ public class IntentRemoveCommand extends AbstractShellCommand { |
| 22 | protected void execute() { | 24 | protected void execute() { |
| 23 | IntentService service = get(IntentService.class); | 25 | IntentService service = get(IntentService.class); |
| 24 | 26 | ||
| 25 | - int radix = id.startsWith("0x") ? 16 : 10; | 27 | + if (id.startsWith("0x")) { |
| 26 | - if (radix == 16) { | ||
| 27 | id = id.replaceFirst("0x", ""); | 28 | id = id.replaceFirst("0x", ""); |
| 28 | } | 29 | } |
| 29 | 30 | ||
| 30 | - IntentId intentId = IntentId.valueOf(Long.parseLong(id, radix)); | 31 | + IntentId intentId = IntentId.valueOf(new BigInteger(id, 16).longValue()); |
| 31 | Intent intent = service.getIntent(intentId); | 32 | Intent intent = service.getIntent(intentId); |
| 32 | if (intent != null) { | 33 | if (intent != null) { |
| 33 | service.withdraw(intent); | 34 | service.withdraw(intent); | ... | ... |
| ... | @@ -257,8 +257,8 @@ public class IntentManager | ... | @@ -257,8 +257,8 @@ public class IntentManager |
| 257 | * @return result of compilation | 257 | * @return result of compilation |
| 258 | */ | 258 | */ |
| 259 | private List<Intent> compileIntent(Intent intent) { | 259 | private List<Intent> compileIntent(Intent intent) { |
| 260 | - if (intent instanceof Intent) { | 260 | + if (intent.isInstallable()) { |
| 261 | - return ImmutableList.of((Intent) intent); | 261 | + return ImmutableList.of(intent); |
| 262 | } | 262 | } |
| 263 | 263 | ||
| 264 | List<Intent> installable = new ArrayList<>(); | 264 | List<Intent> installable = new ArrayList<>(); | ... | ... |
-
Please register or login to post a comment