Refactoring IntentRemoveCommand to be more clear about use of 'key'
Change-Id: I3e84f510ffb5eda30cfe8166e858398c0af28d83
diff --git a/cli/src/main/java/org/onosproject/cli/net/IntentRemoveCommand.java b/cli/src/main/java/org/onosproject/cli/net/IntentRemoveCommand.java
index f0ce167..dceed7b 100644
--- a/cli/src/main/java/org/onosproject/cli/net/IntentRemoveCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/IntentRemoveCommand.java
@@ -48,10 +48,10 @@
required = true, multiValued = false)
String applicationIdString = null;
- @Argument(index = 1, name = "id",
- description = "Intent ID",
+ @Argument(index = 1, name = "key",
+ description = "Intent Key",
required = true, multiValued = false)
- String id = null;
+ String keyString = null;
@Option(name = "-p", aliases = "--purge",
description = "Purge the intent from the store after removal",
@@ -78,12 +78,13 @@
}
final Key key;
- if (id.startsWith("0x")) {
- id = id.replaceFirst("0x", "");
- key = Key.of(new BigInteger(id, 16).longValue(), appId);
+ if (keyString.startsWith("0x")) {
+ // The intent uses a LongKey
+ keyString = keyString.replaceFirst("0x", "");
+ key = Key.of(new BigInteger(keyString, 16).longValue(), appId);
} else {
- // This line is to use the intent key to delete an intent
- key = Key.of(id, appId);
+ // The intent uses a StringKey
+ key = Key.of(keyString, appId);
}
Intent intent = intentService.getIntent(key);