/*
- * Copyright (c) 2015 Cisco Systems, Inc. All rights reserved.
+ * Copyright (c) 2015, 2017 Cisco Systems, Inc. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
package org.opendaylight.lispflowmapping.shell;
import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.commands.Option;
import org.apache.karaf.shell.console.OsgiCommandSupport;
-import org.opendaylight.lispflowmapping.interfaces.lisp.IFlowMappingShell;
+import org.opendaylight.lispflowmapping.interfaces.mappingservice.IMappingServiceShell;
-@Command(scope = "lisp", name = "mappings", description="Print LISP mapping database")
+/**
+ * This class implements the "mappingservice:mappings" Karaf shell command.
+ *
+ * @author Lorand Jakab
+ *
+ */
+@Command(scope = "mappingservice", name = "mappings", description = "Print mapping database")
public class LispMappings extends OsgiCommandSupport {
- private IFlowMappingShell lispShellService;
+ @Option(name = "-d", aliases = "--debug", description = "Debug output", required = false, multiValued = false)
+ private boolean debug;
+
+ private IMappingServiceShell mappingServiceShell;
@Override
+ @SuppressWarnings("checkstyle:RegexpSinglelineJava")
protected Object doExecute() throws Exception {
- System.out.print(lispShellService.printMappings());
+ if (mappingServiceShell != null) {
+ if (debug) {
+ System.out.print(mappingServiceShell.printMappings());
+ } else {
+ System.out.print(mappingServiceShell.prettyPrintMappings());
+ }
+ }
return null;
}
- public void setLispShellService(IFlowMappingShell lispShellService) {
- this.lispShellService = lispShellService;
+ public void setMappingServiceShell(IMappingServiceShell mappingServiceShell) {
+ this.mappingServiceShell = mappingServiceShell;
}
}