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