Add support for Karaf shell lisp:* commands
[lispflowmapping.git] / mappingservice / shell / src / main / java / org / opendaylight / lispflowmapping / shell / LispMappings.java
1 /*
2  * Copyright (c) 2015 Cisco Systems, Inc.  All rights reserved.
3  *
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
7  */
8
9 package org.opendaylight.lispflowmapping.shell;
10
11 import org.apache.karaf.shell.commands.Command;
12 import org.apache.karaf.shell.console.OsgiCommandSupport;
13 import org.opendaylight.lispflowmapping.interfaces.lisp.IFlowMappingShell;
14
15 @Command(scope = "lisp", name = "mappings", description="Print LISP mapping database")
16 public class LispMappings  extends OsgiCommandSupport {
17     private IFlowMappingShell lispShellService;
18
19     @Override
20     protected Object doExecute() throws Exception {
21         System.out.print(lispShellService.printMappings());
22         return null;
23     }
24
25     public void setLispShellService(IFlowMappingShell lispShellService) {
26         this.lispShellService = lispShellService;
27     }
28 }