@Override public ConcurrentMap<UUID, Row<GenericTableSchema>> getRows(Node node, String databaseName, String tableName) throws OvsdbPluginException { return pluginOvsdbConfigurationService .getRows(NodeUtils.getMdsalNode(node), databaseName, tableName); }
@Override public ConcurrentMap<String, Row> getRows(Node node, String tableName) { return pluginOvsdbConfigurationService.getRows(NodeUtils.getMdsalNode(node), tableName); }
@GET @Produces(MediaType.APPLICATION_JSON) public Response getRows() throws JsonProcessingException { OvsdbConfigurationService ovsdbTable = (OvsdbConfigurationService)ServiceHelper.getGlobalInstance(OvsdbConfigurationService.class, this); if (ovsdbTable == null) { throw new ServiceUnavailableException("Ovsdb ConfigurationService " + RestMessages.SERVICEUNAVAILABLE.toString()); } Node node = NodeResource.getOvsdbNode(nodeId, this); Map<UUID,Row<GenericTableSchema>> rows = null; try { rows = ovsdbTable.getRows(node, databaseName, tableName); } catch (Exception e) { throw new BadRequestException(e.getMessage()); } String response = objectMapper.writeValueAsString(rows); return Response.status(Response.Status.OK) .entity(response) .build(); }
public String getBridgeUUID (Node ovsNode, String bridgeName) { String uuid = ""; if (ovsNode == null) { return uuid; } OvsdbConfigurationService ovsdbConfigurationService = getOvsdbConfigurationService(); if (ovsdbConfigurationService == null) { return uuid; } try { Map<String, Row> table = ovsdbConfigurationService. getRows(ovsNode, ovsdbConfigurationService.getTableName(ovsNode, Bridge.class)); if (table != null) { for (String key : table.keySet()) { Bridge bridge = ovsdbConfigurationService.getTypedRow(ovsNode, Bridge.class, table.get(key)); if (bridge.getName().equals(bridgeName)) { uuid = key; } } } } catch (Exception e) { logger.error("Error getting Bridge Identifier for {} / {}", ovsNode, bridgeName, e); } logger.trace("\nOVSSFC {}\n uuid: {}", Thread.currentThread().getStackTrace()[1], uuid); return uuid; }
public String getSystemId (Node ovsNode) { String systemId = ""; if (ovsNode == null) { return systemId; } OvsdbConfigurationService ovsdbConfigurationService = getOvsdbConfigurationService(); if (ovsdbConfigurationService == null) { return systemId; } Map<String, Row> table = ovsdbConfigurationService.getRows(ovsNode, ovsdbConfigurationService.getTableName(ovsNode, OpenVSwitch.class)); if (table == null) { logger.error("OpenVSwitch table is null for Node {} ", ovsNode); return systemId; } // Loop through all the Open_vSwitch rows looking for the first occurrence of external_ids. // The specification does not restrict the number of rows so we choose the first we find. for (Row row : table.values()) { OpenVSwitch ovsRow = ovsdbConfigurationService.getTypedRow(ovsNode, OpenVSwitch.class, row); Map<String, String> externalIds = ovsRow.getExternalIdsColumn().getData(); if (externalIds == null) { continue; } systemId = externalIds.get("system-id"); } logger.trace("\nOVSSFC {}\n system-id: {}", Thread.currentThread().getStackTrace()[1], systemId); return systemId; }
Map<String, Row> rows = null; try { rows = ovsdbTable.getRows(node, bckCompatibleTableName); } catch (Exception e) { throw new BadRequestException(e.getMessage());