2 * Copyright (c) 2013 Ericsson , Inc. and others. All rights reserved.
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
9 package org.opendaylight.openflowplugin.droptestkaraf;
11 import java.io.PrintStream;
12 import org.apache.karaf.shell.commands.Argument;
13 import org.apache.karaf.shell.commands.Command;
14 import org.apache.karaf.shell.console.OsgiCommandSupport;
15 import org.opendaylight.openflowplugin.testcommon.DropTestDsProvider;
17 @Command(scope = "drop-test", name = "dropAllPackets",
18 description = "drop packet responder involving dataStore and FRM")
19 public class DropAllPacketsCommandProvider extends OsgiCommandSupport {
21 @Argument(index = 0, name = "on-off",
22 description = "target state of drop responder",
23 required = true, multiValued = false)
24 String targetStateArg;
28 protected Object doExecute() throws Exception {
29 PrintStream out = session.getConsole();
30 final DropTestDsProvider provider = DropTestProviderImpl.getDropDsProvider();
32 if ("on".equalsIgnoreCase(targetStateArg)) {
33 if (! provider.isActive()) {
35 out.println("DropAllFlows transitions to on");
37 out.println("DropAllFlows is already on");
39 } else if ("off".equalsIgnoreCase(targetStateArg)) {
40 if (provider.isActive()) {
42 out.println("DropAllFlows transitions to off");
44 out.println("DropAllFlows is already off");