mirror of
https://github.com/opennetworkinglab/onos.git
synced 2025-10-18 02:41:49 +02:00
Added ui-cache-regions CLI command.
Change-Id: I196543792c85e40e582f9456e4e50dd33bedf111
This commit is contained in:
parent
bdfb5cb428
commit
10973dd2f1
@ -149,6 +149,16 @@ public class UiTopology extends UiElement {
|
||||
return cnodeLookup.size();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns all regions in the model.
|
||||
*
|
||||
* @return all regions
|
||||
*/
|
||||
public Set<UiRegion> allRegions() {
|
||||
return new HashSet<>(regionLookup.values());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a reference to the null-region. That is, the container for
|
||||
* devices, hosts, and links that belong to no region.
|
||||
|
@ -5,6 +5,8 @@ COMPILE_DEPS = [
|
||||
'//lib:jetty-websocket',
|
||||
'//lib:jetty-util',
|
||||
'//lib:jersey-media-multipart',
|
||||
'//lib:org.apache.karaf.shell.console',
|
||||
'//cli:onos-cli',
|
||||
'//incubator/api:onos-incubator-api',
|
||||
'//incubator/net:onos-incubator-net',
|
||||
'//utils/rest:onlab-rest',
|
||||
|
@ -64,6 +64,15 @@
|
||||
<groupId>org.glassfish.jersey.media</groupId>
|
||||
<artifactId>jersey-media-multipart</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.onosproject</groupId>
|
||||
<artifactId>onos-cli</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.karaf.shell</groupId>
|
||||
<artifactId>org.apache.karaf.shell.console</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright 2016-present Open Networking Laboratory
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.onosproject.ui.impl.topo.cli;
|
||||
|
||||
import org.apache.karaf.shell.commands.Command;
|
||||
import org.onosproject.cli.AbstractShellCommand;
|
||||
import org.onosproject.ui.impl.topo.model.UiSharedTopologyModel;
|
||||
|
||||
/**
|
||||
* CLI command to list the UiRegions stored in the ModelCache.
|
||||
*/
|
||||
@Command(scope = "onos", name = "ui-cache-regions",
|
||||
description = "Lists UiRegions in the Model Cache")
|
||||
public class ListRegions extends AbstractShellCommand {
|
||||
|
||||
@Override
|
||||
protected void execute() {
|
||||
UiSharedTopologyModel model = get(UiSharedTopologyModel.class);
|
||||
model.getRegions().forEach(r -> print("%s", r));
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright 2016-present Open Networking Laboratory
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Topology View Model Cache CLI commands.
|
||||
*/
|
||||
package org.onosproject.ui.impl.topo.cli;
|
@ -240,6 +240,10 @@ class ModelCache {
|
||||
}
|
||||
}
|
||||
|
||||
Set<UiRegion> getAllRegions() {
|
||||
return uiTopology.allRegions();
|
||||
}
|
||||
|
||||
|
||||
// === DEVICES
|
||||
|
||||
|
@ -68,6 +68,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
@ -196,7 +197,7 @@ public final class UiSharedTopologyModel
|
||||
|
||||
|
||||
// =======================================================================
|
||||
// methods that the topo session will use to extract information from us
|
||||
// Methods for topo session (or CLI) to use to get information from us
|
||||
|
||||
/**
|
||||
* Returns the list of cluster members stored in our model cache.
|
||||
@ -207,6 +208,15 @@ public final class UiSharedTopologyModel
|
||||
return cache.getAllClusterMembers();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the set of regions stored in our model cache.
|
||||
*
|
||||
* @return set of regions
|
||||
*/
|
||||
public Set<UiRegion> getRegions() {
|
||||
return cache.getAllRegions();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the region for the given identifier.
|
||||
*
|
||||
|
@ -0,0 +1,27 @@
|
||||
<!--
|
||||
~ Copyright 2016-present Open Networking Laboratory
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
|
||||
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
|
||||
|
||||
<command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
|
||||
<command>
|
||||
<action class="org.onosproject.ui.impl.topo.cli.ListRegions"/>
|
||||
</command>
|
||||
</command-bundle>
|
||||
|
||||
<!--<bean id="macIDCompleter" class="org.onosproject.dhcp.cli.MacIdCompleter"/>-->
|
||||
|
||||
</blueprint>
|
Loading…
x
Reference in New Issue
Block a user