Added Karaf Shell framework for OVSDB plugin and printCache command-line.
[ovsdb.git] / plugin-shell / src / main / java / org / opendaylight / ovsdb / plugin / shell / PrintCache.java
1 /**
2  * Copyright (C) 2013 Red Hat, Inc.
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  * Authors : Madhu Venugopal
9  */
10 package org.opendaylight.ovsdb.plugin.shell;
11
12 import java.util.Collection;
13 import java.util.concurrent.ConcurrentMap;
14
15 import org.apache.felix.gogo.commands.Argument;
16 import org.apache.felix.gogo.commands.Command;
17 import org.apache.karaf.shell.console.OsgiCommandSupport;
18 import org.opendaylight.controller.sal.core.Node;
19 import org.opendaylight.ovsdb.lib.notation.Column;
20 import org.opendaylight.ovsdb.lib.notation.Row;
21 import org.opendaylight.ovsdb.plugin.api.OvsdbInventoryService;
22
23 @Command(scope = "ovs", name = "printCache", description="Prints OVSDB Cache")
24 public class PrintCache extends OsgiCommandSupport{
25     private OvsdbInventoryService ovsdbInventory;
26
27     @Argument(index=0, name="nodeName", description="Node Name", required=true, multiValued=false)
28     String nodeName = null;
29
30     @Override
31     protected Object doExecute() throws Exception {
32         Node node = Node.fromString(nodeName);
33         ovsdbInventory.printCache(node);
34         return null;
35     }
36
37     public void setOvsdbInventory(OvsdbInventoryService inventoryService){
38         this.ovsdbInventory = inventoryService;
39     }
40 }