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<>();
|
List<Resource> nonAggregatable = new ArrayList<>();
|
||||||
|
|
||||||
for (Resource r : children) {
|
for (Resource r : children) {
|
||||||
if (!isPrintTarget(r)) {
|
if (!isPrintTarget(r)) { // A
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (r instanceof DiscreteResource) {
|
||||||
|
|
||||||
|
if (resourceService.getRegisteredResources(((DiscreteResource) r).id()).isEmpty()) {
|
||||||
|
// resource which has children should be printed
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (r instanceof ContinuousResource) {
|
if (r instanceof ContinuousResource) {
|
||||||
// non-aggregatable terminal node
|
// non-aggregatable terminal node
|
||||||
nonAggregatable.add(r);
|
nonAggregatable.add(r);
|
||||||
@ -188,6 +196,7 @@ public class ResourcesCommand extends AbstractShellCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// print aggregated (terminal)
|
// print aggregated (terminal)
|
||||||
aggregatables.asMap().entrySet()
|
aggregatables.asMap().entrySet()
|
||||||
.forEach(e -> {
|
.forEach(e -> {
|
||||||
@ -236,12 +245,7 @@ public class ResourcesCommand extends AbstractShellCommand {
|
|||||||
|
|
||||||
String resourceName = resource.simpleTypeName();
|
String resourceName = resource.simpleTypeName();
|
||||||
if (resource instanceof DiscreteResource) {
|
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)) {
|
if (availablesOnly && !resourceService.isAvailable(resource)) {
|
||||||
// don't print unavailable discrete resource
|
// don't print unavailable discrete resource
|
||||||
return false;
|
return false;
|
||||||
@ -250,7 +254,6 @@ public class ResourcesCommand extends AbstractShellCommand {
|
|||||||
log.warn("Unexpected resource class: {}", resource.getClass().getSimpleName());
|
log.warn("Unexpected resource class: {}", resource.getClass().getSimpleName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return typesToPrint.contains(resourceName);
|
return typesToPrint.contains(resourceName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user