2 * Copyright (c) 2016 Cisco Systems, Inc. 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.lispflowmapping.shell;
11 import org.apache.karaf.shell.commands.Command;
12 import org.apache.karaf.shell.commands.Option;
13 import org.apache.karaf.shell.console.OsgiCommandSupport;
14 import org.opendaylight.lispflowmapping.interfaces.mappingservice.IMappingServiceShell;
17 * This class implements the "mappingservice:keys" Karaf shell command.
19 * @author Lorand Jakab
22 @Command(scope = "mappingservice", name = "keys", description = "Print LISP authentication keys")
23 public class LispKeys extends OsgiCommandSupport {
24 @Option(name = "-d", aliases = "--debug", description = "Debug output", required = false, multiValued = false)
25 private boolean debug;
27 private IMappingServiceShell mappingServiceShell;
30 * TODO Eventually it would be best to merge the addkey command into this one, using optional arguments.
34 @SuppressWarnings("checkstyle:RegexpSinglelineJava")
35 protected Object doExecute() throws Exception {
36 if (mappingServiceShell != null) {
38 System.out.print(mappingServiceShell.printKeys());
40 System.out.print(mappingServiceShell.prettyPrintKeys());
46 public void setMappingServiceShell(IMappingServiceShell mappingServiceShell) {
47 this.mappingServiceShell = mappingServiceShell;