2 * [[ Authors will Fill in the Copyright header ]]
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
8 * Authors : Brent Salisbury, Evan Zeller
10 package org.opendaylight.ovsdb.lib.database;
\r
13 import org.opendaylight.ovsdb.plugin.Connection;
\r
14 import org.opendaylight.ovsdb.plugin.OvsdbMessage;
\r
16 import java.util.ArrayList;
\r
17 import java.util.HashMap;
\r
18 import java.util.List;
\r
19 import java.util.Map;
\r
21 public class OVSInstance {
\r
22 private String uuid;
\r
24 public OVSInstance(){
\r
28 public OVSInstance(String uuid){
\r
32 @SuppressWarnings("unchecked")
\r
33 public static OVSInstance monitorOVS(Connection connection){
\r
34 List<String> columns = new ArrayList<String>();
\r
35 columns.add("_uuid");
\r
36 columns.add("bridges");
\r
38 Map<String, List<String>> row = new HashMap<String, List<String>>();
\r
39 row.put("columns", columns);
\r
41 Map<String, Map> tables = new HashMap<String, Map>();
\r
42 tables.put("Open_vSwitch", row);
\r
44 Object[] params = {"Open_vSwitch", null, tables};
\r
46 OvsdbMessage msg = new OvsdbMessage("monitor", params);
\r
47 Map<String, Object> monitorResponse = new HashMap<String, Object>();
\r
49 Map<String, Object> vSwitchTable = (Map) monitorResponse.get("Open_vSwitch");
\r
50 if(vSwitchTable != null){
\r
51 String uuid = (String) vSwitchTable.keySet().toArray()[0];
\r
52 return new OVSInstance(uuid);
\r
57 public String getUuid(){
\r