@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((code == null) ? 0 : code.calculateConsistentHashCode()); return result; }
/** * Generates an instance of the Status class based on the passed StatusCode * only. The description field of the Status object will be inferred by the * status code. * * @param errorCode * The status code. If passed as null, code will be stored as * {@code StatusCode.UNDEFINED} */ public Status(StatusCode errorCode) { this.code = (errorCode != null) ? errorCode : StatusCode.UNDEFINED; this.description = (description != null) ? description : this.code .toString(); this.requestId = 0; }
@Override public <T extends TypedBaseTable<?>> T getTypedRow(Node node, Class<T> typedClass, Row row) { Connection connection = connectionService.getConnection(node); if (connection == null) { return null; } OvsdbClient client = connection.getClient(); return (T)client.getTypedRowWrapper(typedClass, row); }
public Status disconnect(Node node) { Connection connection = getConnection(node); if (connection != null) { ovsdbConnections.remove(normalizeId(node.getId().getValue())); connection.disconnect(); ovsdbInventoryService.removeNode(node); return new Status(StatusCode.SUCCESS); } else { return new Status(StatusCode.NOTFOUND); } }
@Override public Row<GenericTableSchema> getRow(Node node, String databaseName, String tableName, UUID uuid) throws OvsdbPluginException { return pluginOvsdbConfigurationService .getRow(NodeUtils.getMdsalNode(node), databaseName, tableName, uuid); }
@Override public ConcurrentMap<UUID, Row<GenericTableSchema>> getRows(Node node, String databaseName, String tableName) throws OvsdbPluginException { return pluginOvsdbConfigurationService .getRows(NodeUtils.getMdsalNode(node), databaseName, tableName); }
@Override @Deprecated public ConcurrentMap<String, Row> getRows(Node node, String tableName) { ConcurrentMap<String, Row> ovsTable = ovsdbInventoryService.getTableCache(node, OvsVswitchdSchemaConstants.DATABASE_NAME, tableName); return ovsTable; }
@Override public UUID insertRow(Node node, String databaseName, String tableName, String parentTable, UUID parentUuid, String parentColumn, Row<GenericTableSchema> row) throws OvsdbPluginException { return pluginOvsdbConfigurationService .insertRow(NodeUtils.getMdsalNode(node), databaseName, tableName, parentTable, parentUuid, parentColumn, row); }
@Override public Row<GenericTableSchema> insertTree(Node node, String databaseName, String tableName, String parentTable, UUID parentUuid, String parentColumn, Row<GenericTableSchema> row) throws OvsdbPluginException { return pluginOvsdbConfigurationService .insertTree(NodeUtils.getMdsalNode(node), databaseName, tableName, parentTable, parentUuid, parentColumn, row); }
@Override public Row<GenericTableSchema> updateRow(Node node, String databaseName, String tableName, UUID rowUuid, Row<GenericTableSchema> row, boolean overwrite) throws OvsdbPluginException { return pluginOvsdbConfigurationService .updateRow(NodeUtils.getMdsalNode(node), databaseName, tableName, rowUuid, row, overwrite); }
@Override public void deleteRow(Node node, String databaseName, String tableName, String parentTable, UUID parentRowUuid, String parentColumn, UUID rowUuid) throws OvsdbPluginException { pluginOvsdbConfigurationService .deleteRow(NodeUtils.getMdsalNode(node), databaseName, tableName, parentTable, parentRowUuid, parentColumn, rowUuid); }
@Override public void notifyNodeAdded(Node node, InetAddress address, int port) { pluginOvsdbInventoryService.notifyNodeAdded(NodeUtils.getMdsalNode(node), address, port); }
@Override public void removeNode(Node node) { pluginOvsdbInventoryService.removeNode(NodeUtils.getMdsalNode(node)); }
@Override public void notifyNodeAdded(Node node, InetAddress address, int port) { if (!ovsdbInventoryListeners.isEmpty()) { for (OvsdbInventoryListener listener : ovsdbInventoryListeners) { listener.nodeAdded(node, address, port); } } }
/** * Function called by the dependency manager before the services exported by * the component are unregistered, this will be followed by a "destroy ()" * calls */ void stopping() { for (Connection connection : ovsdbConnections.values()) { connection.disconnect(); } }
@Override public List<String> getTables(Node node, String databaseName) throws OvsdbPluginException { return pluginOvsdbConfigurationService.getTables(NodeUtils.getMdsalNode(node), databaseName); } }
private Connection getConnection (Node node) { Connection connection = connectionService.getConnection(node); if (connection == null || !connection.getClient().isActive()) { return null; } return connection; } /*
@Override public Row getRow(Node node, String tableName, String uuid) { return pluginOvsdbConfigurationService.getRow(NodeUtils.getMdsalNode(node), tableName, uuid); }
/** * Generates an instance of the Status class. This is used as return code * for internal API2 function calls. This constructor allows to specify, * beside the Status Code, a custom human readable description to add more * information about the status. * * @param errorCode * The status code. If passed as null, code will be stored as * {@code StatusCode.UNDEFINED} * @param description * The human readable description of the status. If passed as * null, description will be inferred by the code */ public Status(StatusCode errorCode, String description) { this.code = (errorCode != null) ? errorCode : StatusCode.UNDEFINED; this.description = (description != null) ? description : this.code .toString(); this.requestId = 0; }
@Override public <T extends TypedBaseTable<?>> T createTypedRow(Node node, Class<T> typedClass) { Connection connection = connectionService.getConnection(node); if (connection == null) { return null; } OvsdbClient client = connection.getClient(); return client.createTypedRowWrapper(typedClass); }