mirror of
https://github.com/opennetworkinglab/onos.git
synced 2025-10-14 08:51:01 +02:00
resources CLI
Change-Id: Idac7ae69c8264da80cb1b55628990690803eaf89
This commit is contained in:
parent
5cf77f54e3
commit
84bbd859ab
@ -172,10 +172,18 @@ public class ResourcesCommand extends AbstractShellCommand {
|
||||
List<Resource> nonAggregatable = new ArrayList<>();
|
||||
|
||||
for (Resource r : children) {
|
||||
if (!isPrintTarget(r)) {
|
||||
if (!isPrintTarget(r)) { // A
|
||||
continue;
|
||||
}
|
||||
|
||||
if (r instanceof DiscreteResource) {
|
||||
|
||||
if (resourceService.getRegisteredResources(((DiscreteResource) r).id()).isEmpty()) {
|
||||
// resource which has children should be printed
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (r instanceof ContinuousResource) {
|
||||
// non-aggregatable terminal node
|
||||
nonAggregatable.add(r);
|
||||
@ -188,6 +196,7 @@ public class ResourcesCommand extends AbstractShellCommand {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// print aggregated (terminal)
|
||||
aggregatables.asMap().entrySet()
|
||||
.forEach(e -> {
|
||||
@ -236,12 +245,7 @@ public class ResourcesCommand extends AbstractShellCommand {
|
||||
|
||||
String resourceName = resource.simpleTypeName();
|
||||
if (resource instanceof DiscreteResource) {
|
||||
// TODO This distributed store access incurs overhead.
|
||||
// This should be merged with the one in printResource()
|
||||
if (!resourceService.getRegisteredResources(((DiscreteResource) resource).id()).isEmpty()) {
|
||||
// resource which has children should be printed
|
||||
return true;
|
||||
}
|
||||
|
||||
if (availablesOnly && !resourceService.isAvailable(resource)) {
|
||||
// don't print unavailable discrete resource
|
||||
return false;
|
||||
@ -250,7 +254,6 @@ public class ResourcesCommand extends AbstractShellCommand {
|
||||
log.warn("Unexpected resource class: {}", resource.getClass().getSimpleName());
|
||||
return false;
|
||||
}
|
||||
|
||||
return typesToPrint.contains(resourceName);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user