Bug 2750 - migrate drop-test to drop-test-karaf.
[openflowplugin.git] / drop-test-karaf / src / main / java / org / opendaylight / openflowplugin / droptestkaraf / ClearDropStatsCommandProvider.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 org.opendaylight.openflowplugin.testcommon.DropTestDsProvider;
12
13 import java.io.PrintStream;
14 import org.apache.karaf.shell.commands.Command;
15 import org.apache.karaf.shell.console.OsgiCommandSupport;
16 import org.opendaylight.openflowplugin.testcommon.DropTestRpcProvider;
17
18 @Command(scope = "drop-test", name = "clearDropStats", description = "Clear drop statistics.")
19 public class ClearDropStatsCommandProvider extends OsgiCommandSupport {
20
21     @Override
22     protected Object doExecute() throws Exception {
23         PrintStream out = session.getConsole();
24         final DropTestRpcProvider rpcProvider = DropTestActivator.getDropRpcProvider();
25         final DropTestDsProvider provider = DropTestActivator.getDropDsProvider();
26
27         out.println("Clearing drop statistics... ");
28         rpcProvider.clearStats();
29         provider.clearStats();
30         out.println("Done.");
31
32         return null;
33     }
34
35 }