Merge changes Ibe8d0d9f,I31935e1e,I0f1f3bee
[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 org.apache.felix.gogo.commands.Argument;
13 import org.apache.felix.gogo.commands.Command;
14 import org.apache.karaf.shell.console.OsgiCommandSupport;
15 import org.opendaylight.controller.sal.core.Node;
16 import org.opendaylight.ovsdb.plugin.api.OvsdbInventoryService;
17
18 @Command(scope = "ovs", name = "printCache", description="Prints OVSDB Cache")
19 public class PrintCache extends OsgiCommandSupport{
20     private OvsdbInventoryService ovsdbInventory;
21
22     @Argument(index=0, name="nodeName", description="Node Name", required=true, multiValued=false)
23     String nodeName = null;
24
25     @Override
26     protected Object doExecute() throws Exception {
27         Node node = Node.fromString(nodeName);
28         ovsdbInventory.printCache(node);
29         return null;
30     }
31
32     public void setOvsdbInventory(OvsdbInventoryService inventoryService){
33         this.ovsdbInventory = inventoryService;
34     }
35 }