Bug 2750 - migrate drop-test to drop-test-karaf. 60/15660/5
authorJozef Gloncak <jgloncak@cisco.com>
Tue, 24 Feb 2015 13:00:56 +0000 (14:00 +0100)
committerJozef Gloncak <jgloncak@cisco.com>
Mon, 2 Mar 2015 10:43:31 +0000 (11:43 +0100)
Move methods _showDropStats(....) and _clearDropStats(....) from drop-test artifact to drop-test-karaf artifact.

Change-Id: Iaaa5cab7fd6f3774784a0121c7a98bbe3dbdfaae
Signed-off-by: Jozef Gloncak <jgloncak@cisco.com>
drop-test-karaf/src/main/java/org/opendaylight/openflowplugin/droptestkaraf/ClearDropStatsCommandProvider.java [new file with mode: 0644]
drop-test-karaf/src/main/java/org/opendaylight/openflowplugin/droptestkaraf/ShowDropStatsCommandProvider.java [new file with mode: 0644]
drop-test-karaf/src/main/resources/OSGI-INF/blueprint/commands.xml

diff --git a/drop-test-karaf/src/main/java/org/opendaylight/openflowplugin/droptestkaraf/ClearDropStatsCommandProvider.java b/drop-test-karaf/src/main/java/org/opendaylight/openflowplugin/droptestkaraf/ClearDropStatsCommandProvider.java
new file mode 100644 (file)
index 0000000..192092b
--- /dev/null
@@ -0,0 +1,35 @@
+/**
+ * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.droptestkaraf;
+
+import org.opendaylight.openflowplugin.testcommon.DropTestDsProvider;
+
+import java.io.PrintStream;
+import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.console.OsgiCommandSupport;
+import org.opendaylight.openflowplugin.testcommon.DropTestRpcProvider;
+
+@Command(scope = "drop-test", name = "clearDropStats", description = "Clear drop statistics.")
+public class ClearDropStatsCommandProvider extends OsgiCommandSupport {
+
+    @Override
+    protected Object doExecute() throws Exception {
+        PrintStream out = session.getConsole();
+        final DropTestRpcProvider rpcProvider = DropTestActivator.getDropRpcProvider();
+        final DropTestDsProvider provider = DropTestActivator.getDropDsProvider();
+
+        out.println("Clearing drop statistics... ");
+        rpcProvider.clearStats();
+        provider.clearStats();
+        out.println("Done.");
+
+        return null;
+    }
+
+}
diff --git a/drop-test-karaf/src/main/java/org/opendaylight/openflowplugin/droptestkaraf/ShowDropStatsCommandProvider.java b/drop-test-karaf/src/main/java/org/opendaylight/openflowplugin/droptestkaraf/ShowDropStatsCommandProvider.java
new file mode 100644 (file)
index 0000000..5f48d98
--- /dev/null
@@ -0,0 +1,32 @@
+/**
+ * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.droptestkaraf;
+
+import java.io.PrintStream;
+import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.console.OsgiCommandSupport;
+import org.opendaylight.openflowplugin.testcommon.DropTestDsProvider;
+import org.opendaylight.openflowplugin.testcommon.DropTestRpcProvider;
+
+@Command(scope = "drop-test", name = "showDropStats", description = "Show drop statistics.")
+public class ShowDropStatsCommandProvider extends OsgiCommandSupport {
+
+    @Override
+    protected Object doExecute() throws Exception {
+        PrintStream out = session.getConsole();
+        final DropTestRpcProvider rpcProvider = DropTestActivator.getDropRpcProvider();
+        final DropTestDsProvider provider = DropTestActivator.getDropDsProvider();
+
+        out.format("RPC Test Statistics: %s%n", rpcProvider.getStats().toString());
+        out.format("FRM Test Statistics: %s%n", provider.getStats().toString());
+
+        return null;
+    }
+
+}
index 0bbfafcc8e3c36e105d65ae45cd5df132b269e02..4bb02855d585d23e0702ec7b8cc4ba9e3f810327 100644 (file)
                 <null/>
             </completers>
         </command>
+        <command name="drop-test/showDropStats">
+            <action class="org.opendaylight.openflowplugin.droptestkaraf.ShowDropStatsCommandProvider"/>
+        </command>
+        <command name="drop-test/clearDropStats">
+            <action class="org.opendaylight.openflowplugin.droptestkaraf.ClearDropStatsCommandProvider"/>
+        </command>
     </command-bundle>
-    
+
     <bean id="onOffCompleter" class="org.opendaylight.openflowplugin.droptestkaraf.DropAllPacketsCompleter"/>
 
 </blueprint>
\ No newline at end of file