2 * Copyright © 2016 Orange 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.transportpce.cli.commands;
10 import org.apache.karaf.shell.commands.Command;
11 import org.apache.karaf.shell.commands.Option;
12 import org.apache.karaf.shell.console.AbstractAction;
13 import org.opendaylight.transportpce.cli.api.TransportpceCliCommands;
14 import org.slf4j.Logger;
15 import org.slf4j.LoggerFactory;
18 * This is an example class. The class name can be renamed to match the command implementation that it will invoke.
19 * Specify command details by updating the fields in the Command annotation below.
21 @Command(name = "test-command", scope = "add the scope of the command, usually project name", description = "add a description for the command")
22 public class TransportpceCliTestCommand extends AbstractAction {
24 private static final Logger LOG = LoggerFactory.getLogger(TransportpceCliTestCommand.class);
25 protected final TransportpceCliCommands service;
27 public TransportpceCliTestCommand(final TransportpceCliCommands service) {
28 this.service = service;
32 * Add the arguments required by the command.
33 * Any number of arguments can be added using the Option annotation
34 * The below argument is just an example and should be changed as per your requirements
37 aliases = { "--testArgument" },
38 description = "test command argument",
41 private Object testArgument;
44 protected Object doExecute() throws Exception {
46 * Invoke commannd implementation here using the service instance.
47 * Implement how you want the output of the command to be displayed.
48 * Below is just an example.
50 final String testMessage = (String) service.testCommand(testArgument);