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;
13 import java.util.ArrayList;
14 import java.util.Arrays;
15 import java.util.HashMap;
16 import java.util.List;
19 public class OVSBridge {
24 public OVSBridge(String uuid, String name){
29 public String getUuid(){
33 public String getName(){
37 @SuppressWarnings("unchecked")
38 public static Map<String, OVSBridge> monitorBridge(){
39 List<String> columns = new ArrayList<String>();
43 Map<String, List<String>> row = new HashMap<String, List<String>>();
44 row.put("columns", columns);
46 Map<String, Map> tables = new HashMap<String, Map>();
47 tables.put("Bridge", row);
49 Object[] params = {"Open_vSwitch", null, tables};
51 Map<String, Object> monitorResponse = new HashMap<String, Object>();
52 Map<String, Object> bridgeTable = (Map) monitorResponse.get("Bridge");
54 Object[] uuidObjects = bridgeTable.keySet().toArray();
55 String[] uuids = Arrays.copyOf(uuidObjects, uuidObjects.length, String[].class);
57 Map<String, OVSBridge> result = new HashMap<String, OVSBridge>();
59 for(String uuid : uuids){
60 Map<String, Object> newRow = (Map) bridgeTable.get(uuid);
61 Map<String, Object> newColumns = (Map) newRow.get("new");
62 String name = (String) newColumns.get("name");
63 result.put(name, new OVSBridge(uuid, name));