Bug 2750 - migrate drop-test to drop-test-karaf.
[openflowplugin.git] / drop-test-karaf / src / main / java / org / opendaylight / openflowplugin / droptestkaraf / ShowDropStatsCommandProvider.java
1 /**
2  * Copyright (c) 2013 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.droptestkaraf;
10
11 import java.io.PrintStream;
12 import org.apache.karaf.shell.commands.Command;
13 import org.apache.karaf.shell.console.OsgiCommandSupport;
14 import org.opendaylight.openflowplugin.testcommon.DropTestDsProvider;
15 import org.opendaylight.openflowplugin.testcommon.DropTestRpcProvider;
16
17 @Command(scope = "drop-test", name = "showDropStats", description = "Show drop statistics.")
18 public class ShowDropStatsCommandProvider extends OsgiCommandSupport {
19
20     @Override
21     protected Object doExecute() throws Exception {
22         PrintStream out = session.getConsole();
23         final DropTestRpcProvider rpcProvider = DropTestActivator.getDropRpcProvider();
24         final DropTestDsProvider provider = DropTestActivator.getDropDsProvider();
25
26         out.format("RPC Test Statistics: %s%n", rpcProvider.getStats().toString());
27         out.format("FRM Test Statistics: %s%n", provider.getStats().toString());
28
29         return null;
30     }
31
32 }