Enhanced app CLI.
apps now support -a|--active option to show only activated apps.
app command now takes a list of app ids to allow single command to activate/deactivate/uninstall multiple apps
Deprecated old CLI commands which were already not included in the run-time config.
Consolidated intent & topology metrics to use the same app id since they are bundled into the same app.
Added 'reinstall' and 'reinstall!' option to onos-app tool.
Change-Id: I1406843bf608acf8e7d969a547b929d056e77067
diff --git a/cli/src/main/java/org/onosproject/cli/app/ApplicationsListCommand.java b/cli/src/main/java/org/onosproject/cli/app/ApplicationsListCommand.java
index 13d5cd8..d9debdb 100644
--- a/cli/src/main/java/org/onosproject/cli/app/ApplicationsListCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/app/ApplicationsListCommand.java
@@ -19,6 +19,7 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.commands.Option;
import org.onosproject.app.ApplicationService;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.cli.Comparators;
@@ -41,6 +42,11 @@
"%s id=%d, name=%s, version=%s, origin=%s, description=%s, " +
"features=%s, featuresRepo=%s, permissions=%s";
+ @Option(name = "-a", aliases = "--active", description = "Show active only",
+ required = false, multiValued = false)
+ private boolean activeOnly = false;
+
+
@Override
protected void execute() {
ApplicationService service = get(ApplicationService.class);
@@ -51,11 +57,14 @@
print("%s", json(service, apps));
} else {
for (Application app : apps) {
- print(FMT, service.getState(app.id()) == ACTIVE ? "*" : " ",
- app.id().id(), app.id().name(), app.version(), app.origin(),
- app.description(), app.features(),
- app.featuresRepo().isPresent() ? app.featuresRepo().get().toString() : "",
- app.permissions());
+ boolean isActive = service.getState(app.id()) == ACTIVE;
+ if (activeOnly && isActive || !activeOnly) {
+ print(FMT, isActive ? "*" : " ",
+ app.id().id(), app.id().name(), app.version(), app.origin(),
+ app.description(), app.features(),
+ app.featuresRepo().isPresent() ? app.featuresRepo().get().toString() : "",
+ app.permissions());
+ }
}
}
}
@@ -64,7 +73,10 @@
ObjectMapper mapper = new ObjectMapper();
ArrayNode result = mapper.createArrayNode();
for (Application app : apps) {
- result.add(json(service, mapper, app));
+ boolean isActive = service.getState(app.id()) == ACTIVE;
+ if (activeOnly && isActive || !activeOnly) {
+ result.add(json(service, mapper, app));
+ }
}
return result;
}