code cleanup : removed unused parts of code
[openflowplugin.git] / openflowplugin-impl / src / main / java / org / opendaylight / openflowplugin / impl / karaf / ShowStatsCommandProvider.java
1 /*
2  * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 package org.opendaylight.openflowplugin.impl.karaf;
10
11 import java.io.PrintStream;
12 import java.util.List;
13 import org.apache.karaf.shell.commands.Command;
14 import org.apache.karaf.shell.console.OsgiCommandSupport;
15 import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.MessageIntelligenceAgency;
16 import org.opendaylight.openflowplugin.impl.OpenFlowPluginProviderImpl;
17
18 /**
19  * Created by Martin Bobak <mbobak@cisco.com> on 21.5.2015.
20  */
21
22 @Command(scope = "ofp", name = "showStats", description = "Show openflow statistics.")
23 public class ShowStatsCommandProvider extends OsgiCommandSupport {
24
25     @Override
26     protected Object doExecute() throws Exception {
27         PrintStream out = session.getConsole();
28         final MessageIntelligenceAgency messageIntelligenceAgency = OpenFlowPluginProviderImpl.getMessageIntelligenceAgency();
29         final List<String> statistics = messageIntelligenceAgency.provideIntelligence();
30         final StringBuilder result = new StringBuilder();
31         for (String line : statistics) {
32             result.append(line);
33             result.append("\n");
34         }
35         out.print(result.toString());
36         return null;
37     }
38 }