@Override public String getBridgeUuid(String bridgeName) { DatabaseSchema dbSchema = schema.get(OvsdbConstant.DATABASENAME); OvsdbRowStore rowStore = getRowStore(OvsdbConstant.DATABASENAME, OvsdbConstant.BRIDGE); if (rowStore == null) { log.debug("The bridge uuid is null"); return null; } ConcurrentMap<String, Row> bridgeTableRows = rowStore.getRowStore(); if (bridgeTableRows == null) { log.debug("The bridge uuid is null"); return null; } for (String uuid : bridgeTableRows.keySet()) { Bridge bridge = (Bridge) TableGenerator.getTable(dbSchema, bridgeTableRows.get(uuid), OvsdbTable.BRIDGE); if (bridge.getName().equals(bridgeName)) { return uuid; } } return null; }
//// Gets ovsdb bridge. private OvsdbBridge getOvsdbBridge(Row row) { DatabaseSchema dbSchema = getDatabaseSchema(OvsdbConstant.DATABASENAME); Bridge bridge = (Bridge) TableGenerator.getTable(dbSchema, row, OvsdbTable.BRIDGE); if (bridge == null) { return null; } OvsdbSet datapathIdSet = (OvsdbSet) bridge.getDatapathIdColumn().data(); @SuppressWarnings("unchecked") Set<String> datapathIds = datapathIdSet.set(); if (datapathIds == null || datapathIds.size() == 0) { return null; } String datapathId = (String) datapathIds.toArray()[0]; String bridgeName = bridge.getName(); if ((datapathId == null) || (bridgeName == null)) { return null; } OvsdbBridge ovsdbBridge = new OvsdbBridge(new OvsdbBridgeName(bridgeName), new OvsdbDatapathId(datapathId)); return ovsdbBridge; }