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
8 package org.opendaylight.openflowplugin.droptestkaraf;
10 import org.apache.karaf.shell.api.action.Action;
11 import org.apache.karaf.shell.api.action.Argument;
12 import org.apache.karaf.shell.api.action.Command;
13 import org.apache.karaf.shell.api.action.Completion;
14 import org.apache.karaf.shell.api.action.lifecycle.Reference;
15 import org.apache.karaf.shell.api.action.lifecycle.Service;
16 import org.apache.karaf.shell.api.console.Session;
17 import org.opendaylight.openflowplugin.testcommon.DropTestCommiter;
19 @Command(scope = "drop-test", name = "dropAllPackets",
20 description = "drop packet responder involving dataStore and FRM")
22 public class DropAllPacketsCommandProvider implements Action {
24 DropTestCommiter provider;
28 @Argument(index = 0, name = "on-off",
29 description = "target state of drop responder",
30 required = true, multiValued = false)
31 @Completion(DropAllPacketsCompleter.class)
32 String targetStateArg;
35 public Object execute() {
36 final var out = session.getConsole();
38 if ("on".equalsIgnoreCase(targetStateArg)) {
39 if (provider.start()) {
40 out.println("DropAllFlows transitions to on");
42 out.println("DropAllFlows is already on");
44 } else if ("off".equalsIgnoreCase(targetStateArg)) {
45 if (provider.stop()) {
46 out.println("DropAllFlows transitions to off");
48 out.println("DropAllFlows is already off");