Eliminate blueprint for drop-test-karaf commands
[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 package org.opendaylight.openflowplugin.droptestkaraf;
9
10 import org.apache.karaf.shell.api.action.Action;
11 import org.apache.karaf.shell.api.action.Command;
12 import org.apache.karaf.shell.api.action.lifecycle.Reference;
13 import org.apache.karaf.shell.api.action.lifecycle.Service;
14 import org.apache.karaf.shell.api.console.Session;
15 import org.opendaylight.openflowplugin.testcommon.DropTestCommiter;
16 import org.opendaylight.openflowplugin.testcommon.DropTestRpcSender;
17
18 @Command(scope = "drop-test", name = "showDropStats", description = "Show drop statistics.")
19 @Service
20 public class ShowDropStatsCommandProvider implements Action {
21     @Reference
22     DropTestRpcSender rpcProvider;
23     @Reference
24     DropTestCommiter dsProvider;
25     @Reference
26     Session session;
27
28     @Override
29     public Object execute() {
30         final var out = session.getConsole();
31         out.format("RPC Test Statistics: %s%n", rpcProvider.getStats().toString());
32         out.format("FRM Test Statistics: %s%n", dsProvider.getStats().toString());
33         return null;
34     }
35 }