tom | 9b4030d | 2014-10-06 10:39:03 -0700 | [diff] [blame] | 1 | package org.onlab.onos.cli; |
| 2 | |
| 3 | import org.apache.karaf.shell.commands.Command; |
| 4 | import org.onlab.onos.cluster.ClusterService; |
| 5 | import org.onlab.onos.net.device.DeviceService; |
| 6 | import org.onlab.onos.net.flow.FlowRuleService; |
| 7 | import org.onlab.onos.net.host.HostService; |
| 8 | import org.onlab.onos.net.intent.IntentService; |
| 9 | import org.onlab.onos.net.link.LinkService; |
tom | 800709a | 2014-10-06 20:52:14 -0700 | [diff] [blame] | 10 | import org.onlab.onos.net.topology.Topology; |
tom | 9b4030d | 2014-10-06 10:39:03 -0700 | [diff] [blame] | 11 | import org.onlab.onos.net.topology.TopologyService; |
| 12 | |
| 13 | /** |
| 14 | * Provides summary of ONOS model. |
| 15 | */ |
| 16 | @Command(scope = "onos", name = "summary", |
| 17 | description = "Provides summary of ONOS model") |
| 18 | public class SummaryCommand extends AbstractShellCommand { |
| 19 | |
| 20 | @Override |
| 21 | protected void execute() { |
| 22 | TopologyService topologyService = get(TopologyService.class); |
tom | 800709a | 2014-10-06 20:52:14 -0700 | [diff] [blame] | 23 | Topology topology = topologyService.currentTopology(); |
| 24 | print("nodes=%d, devices=%d, links=%d, hosts=%d, clusters=%s, paths=%d, flows=%d, intents=%d", |
tom | 9b4030d | 2014-10-06 10:39:03 -0700 | [diff] [blame] | 25 | get(ClusterService.class).getNodes().size(), |
| 26 | get(DeviceService.class).getDeviceCount(), |
| 27 | get(LinkService.class).getLinkCount(), |
| 28 | get(HostService.class).getHostCount(), |
tom | 800709a | 2014-10-06 20:52:14 -0700 | [diff] [blame] | 29 | topologyService.getClusters(topology).size(), |
| 30 | topology.pathCount(), |
tom | 9b4030d | 2014-10-06 10:39:03 -0700 | [diff] [blame] | 31 | get(FlowRuleService.class).getFlowRuleCount(), |
| 32 | get(IntentService.class).getIntentCount()); |
| 33 | } |
| 34 | |
| 35 | } |