completer should work as command description, enable delete intent by key
Change-Id: Ibc4574f97f69a4c8e266708c0440baa09ee361f3
diff --git a/cli/src/main/java/org/onosproject/cli/net/IntentIdCompleter.java b/cli/src/main/java/org/onosproject/cli/net/IntentIdCompleter.java
index fd96c38..52dfdc2 100644
--- a/cli/src/main/java/org/onosproject/cli/net/IntentIdCompleter.java
+++ b/cli/src/main/java/org/onosproject/cli/net/IntentIdCompleter.java
@@ -39,7 +39,7 @@
Iterator<Intent> it = service.getIntents().iterator();
SortedSet<String> strings = delegate.getStrings();
while (it.hasNext()) {
- strings.add(it.next().key().toString());
+ strings.add(it.next().id().toString());
}
// Now let the completer do the work for figuring out what to offer.
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 23a28cb..f0ce167 100644
--- a/cli/src/main/java/org/onosproject/cli/net/IntentRemoveCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/IntentRemoveCommand.java
@@ -77,13 +77,16 @@
}
}
+ final Key key;
if (id.startsWith("0x")) {
id = id.replaceFirst("0x", "");
+ key = Key.of(new BigInteger(id, 16).longValue(), appId);
+ } else {
+ // This line is to use the intent key to delete an intent
+ key = Key.of(id, appId);
}
- Key key = Key.of(new BigInteger(id, 16).longValue(), appId);
Intent intent = intentService.getIntent(key);
-
if (intent != null) {
IntentListener listener = null;
final CountDownLatch withdrawLatch, purgeLatch;