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