Merge branch 'master' into topic/schema 76/8376/1
authorDave Tucker <djt@redhat.com>
Thu, 26 Jun 2014 15:48:38 +0000 (16:48 +0100)
committerDave Tucker <djt@redhat.com>
Thu, 26 Jun 2014 15:51:35 +0000 (16:51 +0100)
Change-Id: I4fb484be5b48297a3af4f2b41762e5971f9cc980
Signed-off-by: Dave Tucker <djt@redhat.com>
240 files changed:
.gitignore
.gitreview
commons/parent/pom.xml
distribution/opendaylight/pom.xml
library/pom.xml [new file with mode: 0755]
library/src/main/java/org/opendaylight/ovsdb/lib/EchoServiceCallbackFilters.java [new file with mode: 0644]
library/src/main/java/org/opendaylight/ovsdb/lib/LockAquisitionCallback.java [new file with mode: 0644]
library/src/main/java/org/opendaylight/ovsdb/lib/LockStolenCallback.java [new file with mode: 0644]
library/src/main/java/org/opendaylight/ovsdb/lib/MonitorCallBack.java [new file with mode: 0644]
library/src/main/java/org/opendaylight/ovsdb/lib/MonitorHandle.java [new file with mode: 0644]
library/src/main/java/org/opendaylight/ovsdb/lib/OvsdbClient.java [new file with mode: 0644]
library/src/main/java/org/opendaylight/ovsdb/lib/OvsdbConnection.java [new file with mode: 0644]
library/src/main/java/org/opendaylight/ovsdb/lib/OvsdbConnectionInfo.java [new file with mode: 0644]
library/src/main/java/org/opendaylight/ovsdb/lib/OvsdbConnectionListener.java [new file with mode: 0644]
library/src/main/java/org/opendaylight/ovsdb/lib/ParsingException.java [new file with mode: 0644]
library/src/main/java/org/opendaylight/ovsdb/lib/database/Column.java [new file with mode: 0644]
library/src/main/java/org/opendaylight/ovsdb/lib/database/ColumnSchema.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/database/ColumnSchema.java with 80% similarity]
library/src/main/java/org/opendaylight/ovsdb/lib/database/DatabaseSchema.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/database/DatabaseSchema.java with 91% similarity]
library/src/main/java/org/opendaylight/ovsdb/lib/database/OVSBridge.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/database/OVSBridge.java with 86% similarity]
library/src/main/java/org/opendaylight/ovsdb/lib/database/OVSInstance.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/database/OVSInstance.java with 84% similarity]
library/src/main/java/org/opendaylight/ovsdb/lib/database/OvsdbType.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/database/OvsdbType.java with 97% similarity]
library/src/main/java/org/opendaylight/ovsdb/lib/database/Table.java [new file with mode: 0644]
library/src/main/java/org/opendaylight/ovsdb/lib/database/TableSchema.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/database/TableSchema.java with 87% similarity]
library/src/main/java/org/opendaylight/ovsdb/lib/database/Uuid.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/database/Uuid.java with 98% similarity]
library/src/main/java/org/opendaylight/ovsdb/lib/impl/ChannelConnectionHandler.java [new file with mode: 0644]
library/src/main/java/org/opendaylight/ovsdb/lib/impl/OvsdbClientImpl.java [new file with mode: 0644]
library/src/main/java/org/opendaylight/ovsdb/lib/impl/OvsdbConnectionService.java [new file with mode: 0644]
library/src/main/java/org/opendaylight/ovsdb/lib/jsonrpc/ExceptionHandler.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/jsonrpc/ExceptionHandler.java with 100% similarity]
library/src/main/java/org/opendaylight/ovsdb/lib/jsonrpc/InvalidEncodingException.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/jsonrpc/InvalidEncodingException.java with 100% similarity]
library/src/main/java/org/opendaylight/ovsdb/lib/jsonrpc/JsonRpc10Request.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/jsonrpc/JsonRpc10Request.java with 100% similarity]
library/src/main/java/org/opendaylight/ovsdb/lib/jsonrpc/JsonRpc10Response.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/jsonrpc/JsonRpc10Response.java with 100% similarity]
library/src/main/java/org/opendaylight/ovsdb/lib/jsonrpc/JsonRpcDecoder.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/jsonrpc/JsonRpcDecoder.java with 100% similarity]
library/src/main/java/org/opendaylight/ovsdb/lib/jsonrpc/JsonRpcEncoder.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/jsonrpc/JsonRpcEncoder.java with 100% similarity]
library/src/main/java/org/opendaylight/ovsdb/lib/jsonrpc/JsonRpcEndpoint.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/jsonrpc/JsonRpcEndpoint.java with 91% similarity]
library/src/main/java/org/opendaylight/ovsdb/lib/jsonrpc/JsonRpcServiceBinderHandler.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/jsonrpc/JsonRpcServiceBinderHandler.java with 85% similarity]
library/src/main/java/org/opendaylight/ovsdb/lib/jsonrpc/JsonUtils.java [new file with mode: 0644]
library/src/main/java/org/opendaylight/ovsdb/lib/jsonrpc/Params.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/jsonrpc/Params.java with 100% similarity]
library/src/main/java/org/opendaylight/ovsdb/lib/message/EchoResponse.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/message/EchoResponse.java with 100% similarity]
library/src/main/java/org/opendaylight/ovsdb/lib/message/InsertSerializer.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/message/InsertSerializer.java with 93% similarity]
library/src/main/java/org/opendaylight/ovsdb/lib/message/MonitorRequest.java [new file with mode: 0644]
library/src/main/java/org/opendaylight/ovsdb/lib/message/MonitorRequestBuilder.java [new file with mode: 0644]
library/src/main/java/org/opendaylight/ovsdb/lib/message/MonitorSelect.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/message/MonitorSelect.java with 68% similarity]
library/src/main/java/org/opendaylight/ovsdb/lib/message/OvsdbRPC.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/message/OvsdbRPC.java with 69% similarity]
library/src/main/java/org/opendaylight/ovsdb/lib/message/Response.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/message/Response.java with 100% similarity]
library/src/main/java/org/opendaylight/ovsdb/lib/message/TableUpdate.java [new file with mode: 0644]
library/src/main/java/org/opendaylight/ovsdb/lib/message/TableUpdates.java [new file with mode: 0644]
library/src/main/java/org/opendaylight/ovsdb/lib/message/TransactBuilder.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/message/TransactBuilder.java with 94% similarity]
library/src/main/java/org/opendaylight/ovsdb/lib/message/TransactResponse.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/message/TransactResponse.java with 91% similarity]
library/src/main/java/org/opendaylight/ovsdb/lib/message/UpdateNotification.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/message/UpdateNotification.java with 63% similarity]
library/src/main/java/org/opendaylight/ovsdb/lib/message/temp/TableUpdate.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/message/TableUpdate.java with 95% similarity]
library/src/main/java/org/opendaylight/ovsdb/lib/message/temp/TableUpdates.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/message/TableUpdates.java with 89% similarity]
library/src/main/java/org/opendaylight/ovsdb/lib/notation/Column.java [new file with mode: 0644]
library/src/main/java/org/opendaylight/ovsdb/lib/notation/Condition.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/notation/Condition.java with 99% similarity]
library/src/main/java/org/opendaylight/ovsdb/lib/notation/Function.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/notation/Function.java with 100% similarity]
library/src/main/java/org/opendaylight/ovsdb/lib/notation/Mutation.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/notation/Mutation.java with 99% similarity]
library/src/main/java/org/opendaylight/ovsdb/lib/notation/Mutator.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/notation/Mutator.java with 100% similarity]
library/src/main/java/org/opendaylight/ovsdb/lib/notation/OvsDBMap.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/notation/OvsDBMap.java with 76% similarity]
library/src/main/java/org/opendaylight/ovsdb/lib/notation/OvsDBSet.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/notation/OvsDBSet.java with 78% similarity]
library/src/main/java/org/opendaylight/ovsdb/lib/notation/ResultSet.java [new file with mode: 0644]
library/src/main/java/org/opendaylight/ovsdb/lib/notation/Row.java [new file with mode: 0644]
library/src/main/java/org/opendaylight/ovsdb/lib/notation/UUID.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/notation/UUID.java with 100% similarity]
library/src/main/java/org/opendaylight/ovsdb/lib/notation/Version.java [new file with mode: 0644]
library/src/main/java/org/opendaylight/ovsdb/lib/notation/json/ConditionSerializer.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/notation/json/ConditionSerializer.java with 100% similarity]
library/src/main/java/org/opendaylight/ovsdb/lib/notation/json/Converter.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/notation/json/Converter.java with 97% similarity]
library/src/main/java/org/opendaylight/ovsdb/lib/notation/json/MutationSerializer.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/notation/json/MutationSerializer.java with 100% similarity]
library/src/main/java/org/opendaylight/ovsdb/lib/notation/json/OVSDBTypesIDResolver.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/notation/json/OVSDBTypesIDResolver.java with 100% similarity]
library/src/main/java/org/opendaylight/ovsdb/lib/notation/json/OvsDBMapSerializer.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/notation/json/OvsDBMapSerializer.java with 100% similarity]
library/src/main/java/org/opendaylight/ovsdb/lib/notation/json/OvsDBSetSerializer.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/notation/json/OvsDBSetSerializer.java with 100% similarity]
library/src/main/java/org/opendaylight/ovsdb/lib/notation/json/UUIDSerializer.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/notation/json/UUIDSerializer.java with 100% similarity]
library/src/main/java/org/opendaylight/ovsdb/lib/notation/json/UUIDStringConverter.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/notation/json/UUIDStringConverter.java with 100% similarity]
library/src/main/java/org/opendaylight/ovsdb/lib/operations/Abort.java [new file with mode: 0644]
library/src/main/java/org/opendaylight/ovsdb/lib/operations/Assert.java [new file with mode: 0644]
library/src/main/java/org/opendaylight/ovsdb/lib/operations/AssertOperation.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/message/operations/AssertOperation.java with 86% similarity]
library/src/main/java/org/opendaylight/ovsdb/lib/operations/Comment.java [new file with mode: 0644]
library/src/main/java/org/opendaylight/ovsdb/lib/operations/CommentOperation.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/message/operations/CommentOperation.java with 86% similarity]
library/src/main/java/org/opendaylight/ovsdb/lib/operations/Commit.java [new file with mode: 0644]
library/src/main/java/org/opendaylight/ovsdb/lib/operations/ConditionalOperation.java [new file with mode: 0644]
library/src/main/java/org/opendaylight/ovsdb/lib/operations/Delete.java [new file with mode: 0644]
library/src/main/java/org/opendaylight/ovsdb/lib/operations/DeleteOperation.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/message/operations/DeleteOperation.java with 95% similarity]
library/src/main/java/org/opendaylight/ovsdb/lib/operations/Insert.java [new file with mode: 0644]
library/src/main/java/org/opendaylight/ovsdb/lib/operations/InsertOperation.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/message/operations/InsertOperation.java with 93% similarity]
library/src/main/java/org/opendaylight/ovsdb/lib/operations/Mutate.java [new file with mode: 0644]
library/src/main/java/org/opendaylight/ovsdb/lib/operations/MutateOperation.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/message/operations/MutateOperation.java with 93% similarity]
library/src/main/java/org/opendaylight/ovsdb/lib/operations/Operation.java [new file with mode: 0644]
library/src/main/java/org/opendaylight/ovsdb/lib/operations/OperationResult.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/message/operations/OperationResult.java with 86% similarity]
library/src/main/java/org/opendaylight/ovsdb/lib/operations/Operations.java [new file with mode: 0644]
library/src/main/java/org/opendaylight/ovsdb/lib/operations/Select.java [new file with mode: 0644]
library/src/main/java/org/opendaylight/ovsdb/lib/operations/SelectOperation.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/message/operations/SelectOperation.java with 96% similarity]
library/src/main/java/org/opendaylight/ovsdb/lib/operations/TransactionBuilder.java [new file with mode: 0644]
library/src/main/java/org/opendaylight/ovsdb/lib/operations/Update.java [new file with mode: 0644]
library/src/main/java/org/opendaylight/ovsdb/lib/operations/UpdateOperation.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/message/operations/UpdateOperation.java with 92% similarity]
library/src/main/java/org/opendaylight/ovsdb/lib/operations/WaitOperation.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/message/operations/WaitOperation.java with 86% similarity]
library/src/main/java/org/opendaylight/ovsdb/lib/operations/Where.java [new file with mode: 0644]
library/src/main/java/org/opendaylight/ovsdb/lib/schema/BaseType.java [new file with mode: 0644]
library/src/main/java/org/opendaylight/ovsdb/lib/schema/ColumnSchema.java [new file with mode: 0644]
library/src/main/java/org/opendaylight/ovsdb/lib/schema/ColumnType.java [new file with mode: 0644]
library/src/main/java/org/opendaylight/ovsdb/lib/schema/DatabaseSchema.java [new file with mode: 0644]
library/src/main/java/org/opendaylight/ovsdb/lib/schema/GenericTableSchema.java [new file with mode: 0644]
library/src/main/java/org/opendaylight/ovsdb/lib/schema/TableSchema.java [new file with mode: 0644]
library/src/main/java/org/opendaylight/ovsdb/lib/schema/typed/MethodType.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/message/operations/AbortOperation.java with 62% similarity]
library/src/main/java/org/opendaylight/ovsdb/lib/schema/typed/TypedBaseTable.java [new file with mode: 0644]
library/src/main/java/org/opendaylight/ovsdb/lib/schema/typed/TypedColumn.java [new file with mode: 0644]
library/src/main/java/org/opendaylight/ovsdb/lib/schema/typed/TypedTable.java [new file with mode: 0644]
library/src/main/java/org/opendaylight/ovsdb/lib/schema/typed/TyperUtils.java [new file with mode: 0644]
library/src/main/java/org/opendaylight/ovsdb/lib/table/Bridge.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/table/Bridge.java with 97% similarity]
library/src/main/java/org/opendaylight/ovsdb/lib/table/Capability.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/table/Capability.java with 95% similarity]
library/src/main/java/org/opendaylight/ovsdb/lib/table/Column.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/table/internal/Column.java with 87% similarity]
library/src/main/java/org/opendaylight/ovsdb/lib/table/Controller.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/table/Controller.java with 94% similarity]
library/src/main/java/org/opendaylight/ovsdb/lib/table/Flow_Sample_Collector_Set.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/table/Flow_Sample_Collector_Set.java with 94% similarity]
library/src/main/java/org/opendaylight/ovsdb/lib/table/Flow_Table.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/table/Flow_Table.java with 95% similarity]
library/src/main/java/org/opendaylight/ovsdb/lib/table/IPFIX.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/table/IPFIX.java with 98% similarity]
library/src/main/java/org/opendaylight/ovsdb/lib/table/Interface.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/table/Interface.java with 98% similarity]
library/src/main/java/org/opendaylight/ovsdb/lib/table/Manager.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/table/Manager.java with 94% similarity]
library/src/main/java/org/opendaylight/ovsdb/lib/table/Mirror.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/table/Mirror.java with 98% similarity]
library/src/main/java/org/opendaylight/ovsdb/lib/table/NetFlow.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/table/NetFlow.java with 95% similarity]
library/src/main/java/org/opendaylight/ovsdb/lib/table/Open_vSwitch.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/table/Open_vSwitch.java with 97% similarity]
library/src/main/java/org/opendaylight/ovsdb/lib/table/Port.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/table/Port.java with 97% similarity]
library/src/main/java/org/opendaylight/ovsdb/lib/table/Qos.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/table/Qos.java with 96% similarity]
library/src/main/java/org/opendaylight/ovsdb/lib/table/Queue.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/table/Queue.java with 95% similarity]
library/src/main/java/org/opendaylight/ovsdb/lib/table/SFlow.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/table/SFlow.java with 97% similarity]
library/src/main/java/org/opendaylight/ovsdb/lib/table/SSL.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/table/SSL.java with 96% similarity]
library/src/main/java/org/opendaylight/ovsdb/lib/table/Table.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/table/internal/Table.java with 94% similarity]
library/src/main/java/org/opendaylight/ovsdb/lib/table/Tables.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/table/internal/Tables.java with 56% similarity]
library/src/test/java/org/opendaylight/ovsdb/lib/OvsdbClientTestIT.java [new file with mode: 0644]
library/src/test/java/org/opendaylight/ovsdb/lib/OvsdbClientTestITTyped.java [new file with mode: 0644]
library/src/test/java/org/opendaylight/ovsdb/lib/OvsdbTestBase.java [new file with mode: 0644]
library/src/test/java/org/opendaylight/ovsdb/lib/TestBridge.java [new file with mode: 0644]
library/src/test/java/org/opendaylight/ovsdb/lib/VersionIncompatibleBridge.java [new file with mode: 0644]
library/src/test/java/org/opendaylight/ovsdb/lib/jsonrpc/JsonRpcDecoderTest.java [new file with mode: 0644]
library/src/test/java/org/opendaylight/ovsdb/lib/jsonrpc/NettyBootStrapper.java [moved from ovsdb/src/test/java/org/opendaylight/ovsdb/lib/jsonrpc/NettyBootStrapper.java with 100% similarity]
library/src/test/java/org/opendaylight/ovsdb/lib/jsonrpc/TestClient.java [moved from ovsdb/src/test/java/org/opendaylight/ovsdb/lib/jsonrpc/TestClient.java with 100% similarity]
library/src/test/java/org/opendaylight/ovsdb/lib/jsonrpc/TestTokens.java [moved from ovsdb/src/test/java/org/opendaylight/ovsdb/lib/jsonrpc/TestTokens.java with 100% similarity]
library/src/test/java/org/opendaylight/ovsdb/lib/message/MonitorResponseTest.java [moved from ovsdb/src/test/java/org/opendaylight/ovsdb/lib/message/MonitorResponseTest.java with 95% similarity]
library/src/test/java/org/opendaylight/ovsdb/lib/notation/VersionTest.java [new file with mode: 0644]
library/src/test/java/org/opendaylight/ovsdb/lib/schema/OvsdbSchemaTest.java [new file with mode: 0644]
library/src/test/java/org/opendaylight/ovsdb/lib/schema/temp/Reference.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/message/operations/CommitOperation.java with 58% similarity]
library/src/test/java/org/opendaylight/ovsdb/lib/schema/test_schema.json [new file with mode: 0644]
library/src/test/resources/logback.xml [new file with mode: 0644]
library/src/test/resources/org/opendaylight/ovsdb/lib/jsonrpc/pretty-test.json [new file with mode: 0644]
library/src/test/resources/org/opendaylight/ovsdb/lib/jsonrpc/test.json [new file with mode: 0644]
library/src/test/resources/org/opendaylight/ovsdb/lib/message/monitor_response1.json [moved from ovsdb/src/test/resources/org/opendaylight/ovsdb/lib/message/monitor_response1.json with 100% similarity]
library/src/test/resources/org/opendaylight/ovsdb/lib/message/monitor_response_sample.json [moved from ovsdb/src/test/resources/org/opendaylight/ovsdb/lib/message/monitor_response_sample.json with 100% similarity]
library/src/test/resources/org/opendaylight/ovsdb/lib/schema/test_schema.json [new file with mode: 0644]
neutron/pom.xml
neutron/src/main/java/org/opendaylight/ovsdb/neutron/AdminConfigManager.java
neutron/src/main/java/org/opendaylight/ovsdb/neutron/InternalNetworkManager.java
neutron/src/main/java/org/opendaylight/ovsdb/neutron/NetworkHandler.java
neutron/src/main/java/org/opendaylight/ovsdb/neutron/NodeConfiguration.java
neutron/src/main/java/org/opendaylight/ovsdb/neutron/PortHandler.java
neutron/src/main/java/org/opendaylight/ovsdb/neutron/SouthboundEvent.java
neutron/src/main/java/org/opendaylight/ovsdb/neutron/SouthboundHandler.java
neutron/src/main/java/org/opendaylight/ovsdb/neutron/TenantNetworkManager.java
neutron/src/main/java/org/opendaylight/ovsdb/neutron/provider/OF10Provider.java
neutron/src/main/java/org/opendaylight/ovsdb/neutron/provider/OF13Provider.java
neutron/src/test/java/org/opendaylight/ovsdb/neutron/AdminConfigManagerTest.java
northbound/enunciate.xml [moved from northbound/ovsdb/enunciate.xml with 100% similarity]
northbound/pom.xml [moved from northbound/ovsdb/pom.xml with 88% similarity]
northbound/src/main/java/org/opendaylight/ovsdb/northbound/OVSDBNorthbound.java [moved from northbound/ovsdb/src/main/java/org/opendaylight/ovsdb/northbound/OVSDBNorthbound.java with 99% similarity]
northbound/src/main/java/org/opendaylight/ovsdb/northbound/OVSDBRow.java [moved from northbound/ovsdb/src/main/java/org/opendaylight/ovsdb/northbound/OVSDBRow.java with 98% similarity]
northbound/src/main/java/org/opendaylight/ovsdb/northbound/OVSDBRows.java [moved from northbound/ovsdb/src/main/java/org/opendaylight/ovsdb/northbound/OVSDBRows.java with 92% similarity]
northbound/src/main/resources/WEB-INF/web.xml [moved from northbound/ovsdb/src/main/resources/WEB-INF/web.xml with 100% similarity]
ovsdb/src/main/java/org/opendaylight/ovsdb/lib/message/MonitorRequest.java [deleted file]
ovsdb/src/main/java/org/opendaylight/ovsdb/lib/message/MonitorRequestBuilder.java [deleted file]
ovsdb/src/main/java/org/opendaylight/ovsdb/lib/message/operations/Operation.java [deleted file]
ovsdb/src/test/java/org/opendaylight/ovsdb/lib/message/OVSDBNettyFactoryIT.java [deleted file]
ovsdb/src/test/resources/org/opendaylight/ovsdb/lib/message/integration-test.properties [deleted file]
plugin/pom.xml [moved from ovsdb/pom.xml with 85% similarity]
plugin/src/main/java/org/opendaylight/ovsdb/plugin/Activator.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/plugin/Activator.java with 100% similarity]
plugin/src/main/java/org/opendaylight/ovsdb/plugin/ChannelConnectionHandler.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/plugin/ChannelConnectionHandler.java with 100% similarity]
plugin/src/main/java/org/opendaylight/ovsdb/plugin/ConfigurationService.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/plugin/ConfigurationService.java with 99% similarity]
plugin/src/main/java/org/opendaylight/ovsdb/plugin/Connection.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/plugin/Connection.java with 100% similarity]
plugin/src/main/java/org/opendaylight/ovsdb/plugin/ConnectionService.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/plugin/ConnectionService.java with 95% similarity]
plugin/src/main/java/org/opendaylight/ovsdb/plugin/Encapsulation.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/plugin/Encapsulation.java with 100% similarity]
plugin/src/main/java/org/opendaylight/ovsdb/plugin/IConnectionServiceInternal.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/plugin/IConnectionServiceInternal.java with 100% similarity]
plugin/src/main/java/org/opendaylight/ovsdb/plugin/IPAddressProperty.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/plugin/IPAddressProperty.java with 100% similarity]
plugin/src/main/java/org/opendaylight/ovsdb/plugin/InsertRequest.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/plugin/InsertRequest.java with 100% similarity]
plugin/src/main/java/org/opendaylight/ovsdb/plugin/InventoryService.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/plugin/InventoryService.java with 98% similarity]
plugin/src/main/java/org/opendaylight/ovsdb/plugin/InventoryServiceInternal.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/plugin/InventoryServiceInternal.java with 93% similarity]
plugin/src/main/java/org/opendaylight/ovsdb/plugin/L4PortProperty.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/plugin/L4PortProperty.java with 100% similarity]
plugin/src/main/java/org/opendaylight/ovsdb/plugin/MutateRequest.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/plugin/MutateRequest.java with 100% similarity]
plugin/src/main/java/org/opendaylight/ovsdb/plugin/NodeConnectorFactory.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/plugin/NodeConnectorFactory.java with 100% similarity]
plugin/src/main/java/org/opendaylight/ovsdb/plugin/NodeDB.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/plugin/NodeDB.java with 97% similarity]
plugin/src/main/java/org/opendaylight/ovsdb/plugin/NodeFactory.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/plugin/NodeFactory.java with 100% similarity]
plugin/src/main/java/org/opendaylight/ovsdb/plugin/OVSDBConfigService.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/plugin/OVSDBConfigService.java with 95% similarity]
plugin/src/main/java/org/opendaylight/ovsdb/plugin/OVSDBInventoryListener.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/plugin/OVSDBInventoryListener.java with 93% similarity]
plugin/src/main/java/org/opendaylight/ovsdb/plugin/OvsdbMessage.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/plugin/OvsdbMessage.java with 100% similarity]
plugin/src/main/java/org/opendaylight/ovsdb/plugin/ReadService.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/plugin/ReadService.java with 100% similarity]
plugin/src/main/java/org/opendaylight/ovsdb/plugin/StatusWithUuid.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/plugin/StatusWithUuid.java with 100% similarity]
plugin/src/main/java/org/opendaylight/ovsdb/plugin/UpdateRequest.java [moved from ovsdb/src/main/java/org/opendaylight/ovsdb/plugin/UpdateRequest.java with 100% similarity]
plugin/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestAddBridgeIT.java [moved from ovsdb/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestAddBridgeIT.java with 100% similarity]
plugin/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestAddPortIT.java [moved from ovsdb/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestAddPortIT.java with 100% similarity]
plugin/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestAddTunnelIT.java [moved from ovsdb/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestAddTunnelIT.java with 100% similarity]
plugin/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestAddVlanIT.java [moved from ovsdb/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestAddVlanIT.java with 100% similarity]
plugin/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestBase.java [moved from ovsdb/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestBase.java with 75% similarity]
plugin/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestBridgeConfigIT.java [moved from ovsdb/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestBridgeConfigIT.java with 100% similarity]
plugin/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestDeletePortIT.java [moved from ovsdb/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestDeletePortIT.java with 75% similarity]
plugin/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestGetBridgeDomainsIT.java [moved from ovsdb/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestGetBridgeDomainsIT.java with 100% similarity]
plugin/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestSetManagerIT.java [moved from ovsdb/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestSetManagerIT.java with 100% similarity]
plugin/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestSetOFControllerIT.java [moved from ovsdb/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestSetOFControllerIT.java with 100% similarity]
pom.xml
schemas/Open_vSwitch/pom.xml [new file with mode: 0755]
schemas/Open_vSwitch/src/main/java/org/opendaylight/ovsdb/schema/openvswitch/Bridge.java [new file with mode: 0644]
schemas/Open_vSwitch/src/main/java/org/opendaylight/ovsdb/schema/openvswitch/Capability.java [new file with mode: 0644]
schemas/Open_vSwitch/src/main/java/org/opendaylight/ovsdb/schema/openvswitch/Controller.java [new file with mode: 0644]
schemas/Open_vSwitch/src/main/java/org/opendaylight/ovsdb/schema/openvswitch/FlowSampleCollectorSet.java [new file with mode: 0644]
schemas/Open_vSwitch/src/main/java/org/opendaylight/ovsdb/schema/openvswitch/FlowTable.java [new file with mode: 0644]
schemas/Open_vSwitch/src/main/java/org/opendaylight/ovsdb/schema/openvswitch/IPFIX.java [new file with mode: 0644]
schemas/Open_vSwitch/src/main/java/org/opendaylight/ovsdb/schema/openvswitch/Interface.java [new file with mode: 0644]
schemas/Open_vSwitch/src/main/java/org/opendaylight/ovsdb/schema/openvswitch/Manager.java [new file with mode: 0644]
schemas/Open_vSwitch/src/main/java/org/opendaylight/ovsdb/schema/openvswitch/Mirror.java [new file with mode: 0644]
schemas/Open_vSwitch/src/main/java/org/opendaylight/ovsdb/schema/openvswitch/NetFlow.java [new file with mode: 0644]
schemas/Open_vSwitch/src/main/java/org/opendaylight/ovsdb/schema/openvswitch/OpenVSwitch.java [new file with mode: 0644]
schemas/Open_vSwitch/src/main/java/org/opendaylight/ovsdb/schema/openvswitch/Port.java [new file with mode: 0644]
schemas/Open_vSwitch/src/main/java/org/opendaylight/ovsdb/schema/openvswitch/Qos.java [new file with mode: 0644]
schemas/Open_vSwitch/src/main/java/org/opendaylight/ovsdb/schema/openvswitch/Queue.java [new file with mode: 0644]
schemas/Open_vSwitch/src/main/java/org/opendaylight/ovsdb/schema/openvswitch/SFlow.java [new file with mode: 0644]
schemas/Open_vSwitch/src/main/java/org/opendaylight/ovsdb/schema/openvswitch/SSL.java [new file with mode: 0644]
schemas/Open_vSwitch/src/test/java/org/opendaylight/ovsdb/schema/openvswitch/OvsdbTestBase.java [new file with mode: 0644]
schemas/Open_vSwitch/src/test/java/org/opendaylight/ovsdb/schema/openvswitch/TypedVSwitchdSchemaIT.java [new file with mode: 0644]
schemas/Open_vSwitch/src/test/resources/logback.xml [new file with mode: 0644]
schemas/hardware_vtep/pom.xml [new file with mode: 0755]
schemas/hardware_vtep/src/main/java/org/opendaylight/ovsdb/schema/hardwarevtep/ArpSourcesLocal.java [new file with mode: 0644]
schemas/hardware_vtep/src/main/java/org/opendaylight/ovsdb/schema/hardwarevtep/ArpSourcesRemote.java [new file with mode: 0644]
schemas/hardware_vtep/src/main/java/org/opendaylight/ovsdb/schema/hardwarevtep/Global.java [new file with mode: 0644]
schemas/hardware_vtep/src/main/java/org/opendaylight/ovsdb/schema/hardwarevtep/LogicalBindingStats.java [new file with mode: 0644]
schemas/hardware_vtep/src/main/java/org/opendaylight/ovsdb/schema/hardwarevtep/LogicalRouter.java [new file with mode: 0644]
schemas/hardware_vtep/src/main/java/org/opendaylight/ovsdb/schema/hardwarevtep/LogicalSwitch.java [new file with mode: 0644]
schemas/hardware_vtep/src/main/java/org/opendaylight/ovsdb/schema/hardwarevtep/Manager.java [new file with mode: 0644]
schemas/hardware_vtep/src/main/java/org/opendaylight/ovsdb/schema/hardwarevtep/McastMacsLocal.java [new file with mode: 0644]
schemas/hardware_vtep/src/main/java/org/opendaylight/ovsdb/schema/hardwarevtep/McastMacsRemote.java [new file with mode: 0644]
schemas/hardware_vtep/src/main/java/org/opendaylight/ovsdb/schema/hardwarevtep/PhysicalLocator.java [new file with mode: 0644]
schemas/hardware_vtep/src/main/java/org/opendaylight/ovsdb/schema/hardwarevtep/PhysicalLocatorSet.java [new file with mode: 0644]
schemas/hardware_vtep/src/main/java/org/opendaylight/ovsdb/schema/hardwarevtep/PhysicalPort.java [new file with mode: 0644]
schemas/hardware_vtep/src/main/java/org/opendaylight/ovsdb/schema/hardwarevtep/PhysicalSwitch.java [new file with mode: 0644]
schemas/hardware_vtep/src/main/java/org/opendaylight/ovsdb/schema/hardwarevtep/Tunnel.java [new file with mode: 0644]
schemas/hardware_vtep/src/main/java/org/opendaylight/ovsdb/schema/hardwarevtep/UcastMacsLocal.java [new file with mode: 0644]
schemas/hardware_vtep/src/main/java/org/opendaylight/ovsdb/schema/hardwarevtep/UcastMacsRemote.java [new file with mode: 0644]
schemas/hardware_vtep/src/test/java/org/opendaylight/ovsdb/schema/hardwarevtep/OvsdbTestBase.java [new file with mode: 0644]
schemas/hardware_vtep/src/test/java/org/opendaylight/ovsdb/schema/hardwarevtep/TypedHardwareVTepSchemaIT.java [new file with mode: 0644]
schemas/hardware_vtep/src/test/resources/logback.xml [new file with mode: 0644]

index 3801de5b7d4c0bb5d78f4bd720d8660d77d3eedb..ee0c372c10e3e049ca163a9e8213b8b132fb249f 100755 (executable)
@@ -1,19 +1,26 @@
-.idea/\r
-target/\r
-*.class\r
-*.iml\r
-**/target\r
-**/bin\r
-dist\r
-**/logs\r
-products\r
-repository\r
-workspace\r
-*~\r
-target\r
-.classpath\r
-.project\r
-.settings\r
-MANIFEST.MF\r
-.vagrant\r
-.DS_Store\r
+*.class
+**/target
+bin/
+dist
+**/logs
+products
+repository
+workspace
+*~
+target
+.classpath
+.project
+.settings
+MANIFEST.MF
+opendaylight/northbound/integrationtest/logs/*
+*.ipr
+*.iml
+*.iws
+.idea
+*.pyc
+log.html
+output.xml
+report.html
+*.swp
+.gitignore
+target-ide/
index 789dec3b636b45d94c592df82a1e6406bc7a5e32..160728eb3e35fba510fd8f7f1826d0f94e82625f 100644 (file)
@@ -2,3 +2,4 @@
 host=git.opendaylight.org
 port=29418
 project=ovsdb.git
+defaultbranch=topic/schema
index 25a6b4d16126cb053236c54081a5c714071fc348..853afb8227d64e13f10e1cb335f9983815bb80ba 100755 (executable)
@@ -7,8 +7,8 @@
     <version>1.4.2-SNAPSHOT</version>
   </parent>
   <groupId>org.opendaylight.ovsdb</groupId>
-  <artifactId>commons.ovsdb</artifactId>
-  <version>1.0.1-SNAPSHOT</version>
+  <artifactId>ovsdb_commons</artifactId>
+  <version>1.1.0-SNAPSHOT</version>
   <packaging>pom</packaging>
   <prerequisites>
     <maven>3.0</maven>
index 04dd37a7b0543420cef754dd71e49d1dae418556..d81f9b21e12102d37463958b1cc47edcad9dfd0d 100755 (executable)
@@ -7,8 +7,8 @@ see https://git.opendaylight.org/gerrit/#/c/390/
   <modelVersion>4.0.0</modelVersion>
   <parent>
     <groupId>org.opendaylight.ovsdb</groupId>
-    <artifactId>commons.ovsdb</artifactId>
-    <version>1.0.1-SNAPSHOT</version>
+    <artifactId>ovsdb_commons</artifactId>
+    <version>1.1.0-SNAPSHOT</version>
     <relativePath>../../commons/parent/</relativePath>
   </parent>
 
@@ -46,18 +46,23 @@ see https://git.opendaylight.org/gerrit/#/c/390/
     </dependency>
     <dependency>
       <groupId>org.opendaylight.ovsdb</groupId>
-      <artifactId>ovsdb</artifactId>
-      <version>0.5.1-SNAPSHOT</version>
+      <artifactId>ovsdb_library</artifactId>
+      <version>1.0.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.ovsdb</groupId>
-      <artifactId>ovsdb.neutron</artifactId>
+      <artifactId>ovsdb_neutron</artifactId>
       <version>0.7.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.ovsdb</groupId>
-      <artifactId>ovsdb.northbound</artifactId>
-      <version>0.5.1-SNAPSHOT</version>
+      <artifactId>ovsdb_northbound</artifactId>
+      <version>0.6.0-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.ovsdb</groupId>
+      <artifactId>ovsdb_plugin</artifactId>
+      <version>1.0.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
diff --git a/library/pom.xml b/library/pom.xml
new file mode 100755 (executable)
index 0000000..31f5c3c
--- /dev/null
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.opendaylight.ovsdb</groupId>
+    <artifactId>ovsdb_commons</artifactId>
+    <version>1.1.0-SNAPSHOT</version>
+    <relativePath>../commons/parent</relativePath>
+  </parent>
+  <artifactId>ovsdb_library</artifactId>
+  <version>1.0.0-SNAPSHOT</version>
+  <packaging>bundle</packaging>
+
+  <properties>
+    <skip.integrationtest>true</skip.integrationtest>
+  </properties>
+  <dependencies>
+    <dependency>
+      <groupId>ch.qos.logback</groupId>
+      <artifactId>logback-classic</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>ch.qos.logback</groupId>
+      <artifactId>logback-core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>com.fasterxml.jackson.core</groupId>
+      <artifactId>jackson-annotations</artifactId>
+      <version>${jackson.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>com.fasterxml.jackson.core</groupId>
+      <artifactId>jackson-core</artifactId>
+      <version>${jackson.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>com.fasterxml.jackson.core</groupId>
+      <artifactId>jackson-databind</artifactId>
+      <version>${jackson.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>com.google.code.gson</groupId>
+      <artifactId>gson</artifactId>
+      <version>2.1</version>
+      <scope>compile</scope>
+    </dependency>
+    <dependency>
+      <groupId>com.google.guava</groupId>
+      <artifactId>guava</artifactId>
+      <version>${guava.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>commons-codec</groupId>
+      <artifactId>commons-codec</artifactId>
+      <version>1.4</version>
+      <optional>true</optional>
+    </dependency>
+    <dependency>
+      <groupId>commons-collections</groupId>
+      <artifactId>commons-collections</artifactId>
+      <version>1.0</version>
+    </dependency>
+    <dependency>
+      <groupId>commons-lang</groupId>
+      <artifactId>commons-lang</artifactId>
+      <version>2.3</version>
+    </dependency>
+    <dependency>
+      <groupId>equinoxSDK381</groupId>
+      <artifactId>org.eclipse.osgi</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>io.netty</groupId>
+      <artifactId>netty-all</artifactId>
+      <version>4.0.10.Final</version>
+    </dependency>
+    <dependency>
+      <groupId>javax.portlet</groupId>
+      <artifactId>portlet-api</artifactId>
+      <version>2.0</version>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.httpcomponents</groupId>
+      <artifactId>httpcore-nio</artifactId>
+      <version>4.2.1</version>
+      <optional>true</optional>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <testResources>
+      <testResource>
+        <filtering>true</filtering>
+        <directory>src/test/resources</directory>
+      </testResource>
+    </testResources>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <version>2.3.6</version>
+        <extensions>true</extensions>
+        <configuration>
+          <instructions>
+            <Import-Package>org.apache.commons.lang3.builder,
+                org.apache.commons.lang3.tuple,
+                org.apache.felix.dm,
+                org.slf4j,
+                org.eclipse.osgi.framework.console,
+                org.osgi.framework,
+                javax.net.ssl,
+                *</Import-Package>
+            <Embed-Transitive>true</Embed-Transitive>
+            <Export-Package>org.opendaylight.ovsdb.lib,
+                org.opendaylight.ovsdb.lib.table,
+                org.opendaylight.ovsdb.lib.jsonrpc,
+                org.opendaylight.ovsdb.lib.notation,
+                org.opendaylight.ovsdb.lib.database,
+                org.opendaylight.ovsdb.lib.operations,
+                org.opendaylight.ovsdb.lib.message,
+                org.opendaylight.ovsdb.lib.schema,
+                org.opendaylight.ovsdb.lib.schema.typed</Export-Package>
+          </instructions>
+          <manifestLocation>${project.basedir}/META-INF</manifestLocation>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-failsafe-plugin</artifactId>
+        <configuration>
+          <skipITs>${skip.integrationtest}</skipITs>
+          <includes>
+            <include>**/*IT*</include>
+          </includes>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <version>2.16</version>
+        <configuration>
+          <excludes>
+            <!--  Exclude integration tests -->
+            <exclude>**/*IT*</exclude>
+          </excludes>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+  <scm>
+    <connection>scm:git:ssh://git.opendaylight.org:29418/ovsdb.git</connection>
+    <developerConnection>scm:git:ssh://git.opendaylight.org:29418/ovsdb.git</developerConnection>
+    <tag>HEAD</tag>
+    <url>https://wiki.opendaylight.org/view/OVSDB_Integration:Main</url>
+  </scm>
+
+  <profiles>
+    <profile>
+      <id>integrationtest</id>
+      <activation></activation>
+      <properties>
+        <skip.integrationtest>false</skip.integrationtest>
+      </properties>
+    </profile>
+  </profiles>
+</project>
diff --git a/library/src/main/java/org/opendaylight/ovsdb/lib/EchoServiceCallbackFilters.java b/library/src/main/java/org/opendaylight/ovsdb/lib/EchoServiceCallbackFilters.java
new file mode 100644 (file)
index 0000000..296a181
--- /dev/null
@@ -0,0 +1,19 @@
+/*
+ *
+ *  * Copyright (C) 2014 EBay Software Foundation
+ *  *
+ *  * This program and the accompanying materials are made available under the
+ *  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ *  * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *  *
+ *  * Authors : Ashwin Raveendran
+ *
+ */
+
+package org.opendaylight.ovsdb.lib;
+
+/**
+ * @author Ashwin Raveendran (ashwin at gmail)
+ */
+public interface EchoServiceCallbackFilters {
+}
diff --git a/library/src/main/java/org/opendaylight/ovsdb/lib/LockAquisitionCallback.java b/library/src/main/java/org/opendaylight/ovsdb/lib/LockAquisitionCallback.java
new file mode 100644 (file)
index 0000000..3b5f817
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ *
+ *  * Copyright (C) 2014 EBay Software Foundation
+ *  *
+ *  * This program and the accompanying materials are made available under the
+ *  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ *  * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *  *
+ *  * Authors : Ashwin Raveendran
+ *
+ */
+
+package org.opendaylight.ovsdb.lib;
+
+/**
+ *  Callback that can be registered with {@link OvsdbClient} to
+ *  get notified of a lock stolen.
+ *  @see <a href="http://tools.ietf.org/html/draft-pfaff-ovsdb-proto-04#section-4.1.10">ovsdb spec</a>
+ *  <p/>
+ *
+ *  @see OvsdbClient
+ */
+public interface LockAquisitionCallback {
+
+    public void lockAcquired();
+
+}
diff --git a/library/src/main/java/org/opendaylight/ovsdb/lib/LockStolenCallback.java b/library/src/main/java/org/opendaylight/ovsdb/lib/LockStolenCallback.java
new file mode 100644 (file)
index 0000000..64ff6f3
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ *
+ *  * Copyright (C) 2014 EBay Software Foundation
+ *  *
+ *  * This program and the accompanying materials are made available under the
+ *  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ *  * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *  *
+ *  * Authors : Ashwin Raveendran
+ *
+ */
+
+package org.opendaylight.ovsdb.lib;
+
+/**
+ *  Callback that can be registered with {@link org.opendaylight.ovsdb.lib.OvsdbClient} to
+ *  get notified of a lock stolen.
+ *  @see <a href="http://tools.ietf.org/html/draft-pfaff-ovsdb-proto-04#section-4.1.10">ovsdb spec</a>
+ *  <p/>
+ *
+ *  @see org.opendaylight.ovsdb.lib.OvsdbClient#lock(String, LockAquisitionCallback, LockStolenCallback)
+ */
+public interface LockStolenCallback {
+
+    public void lockStolen();
+
+}
diff --git a/library/src/main/java/org/opendaylight/ovsdb/lib/MonitorCallBack.java b/library/src/main/java/org/opendaylight/ovsdb/lib/MonitorCallBack.java
new file mode 100644 (file)
index 0000000..d4d7128
--- /dev/null
@@ -0,0 +1,22 @@
+/*
+ *
+ *  * Copyright (C) 2014 EBay Software Foundation
+ *  *
+ *  * This program and the accompanying materials are made available under the
+ *  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ *  * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *  *
+ *  * Authors : Ashwin Raveendran
+ *
+ */
+
+package org.opendaylight.ovsdb.lib;
+
+import org.opendaylight.ovsdb.lib.message.TableUpdates;
+
+public interface MonitorCallBack {
+
+    void update(TableUpdates result);
+
+    void exception(Throwable t);
+}
diff --git a/library/src/main/java/org/opendaylight/ovsdb/lib/MonitorHandle.java b/library/src/main/java/org/opendaylight/ovsdb/lib/MonitorHandle.java
new file mode 100644 (file)
index 0000000..2a15d98
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ *
+ *  * Copyright (C) 2014 EBay Software Foundation
+ *  *
+ *  * This program and the accompanying materials are made available under the
+ *  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ *  * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *  *
+ *  * Authors : Ashwin Raveendran
+ *
+ */
+
+package org.opendaylight.ovsdb.lib;
+
+import java.io.Serializable;
+
+public class MonitorHandle implements Serializable{
+   String id;
+
+    public MonitorHandle(String id) {
+        this.id = id;
+    }
+
+    public String getId() {
+        return id;
+    }
+}
diff --git a/library/src/main/java/org/opendaylight/ovsdb/lib/OvsdbClient.java b/library/src/main/java/org/opendaylight/ovsdb/lib/OvsdbClient.java
new file mode 100644 (file)
index 0000000..80e572a
--- /dev/null
@@ -0,0 +1,145 @@
+/*
+ *
+ *  * Copyright (C) 2014 EBay Software Foundation
+ *  *
+ *  * This program and the accompanying materials are made available under the
+ *  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ *  * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *  *
+ *  * Authors : Ashwin Raveendran
+ *
+ */
+
+package org.opendaylight.ovsdb.lib;
+
+import java.util.List;
+
+import org.opendaylight.ovsdb.lib.message.MonitorRequest;
+import org.opendaylight.ovsdb.lib.notation.Row;
+import org.opendaylight.ovsdb.lib.operations.Operation;
+import org.opendaylight.ovsdb.lib.operations.OperationResult;
+import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
+import org.opendaylight.ovsdb.lib.schema.DatabaseSchema;
+import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
+import org.opendaylight.ovsdb.lib.schema.TableSchema;
+
+import com.google.common.util.concurrent.ListenableFuture;
+
+/**
+ * The main interface to interact with a device speaking ovsdb protocol in an asynchronous fashion and hence most
+ * operations return a Future object representing the eventual response data from the remote.
+ */
+public interface OvsdbClient {
+
+    /**
+     * Gets the list of database names exposed by this ovsdb capable device
+     * @return list of database names
+     */
+    ListenableFuture<List<String>> getDatabases();
+
+    /**
+     * Asynchronously returns the schema object for a specific database
+     * @param database name of the database schema
+     * @param cacheResult if the results be cached by this instance
+     * @return DatabaseSchema future
+     */
+    ListenableFuture<DatabaseSchema> getSchema(String database, boolean cacheResult);
+
+    /**
+     * Allows for a mini DSL way of collecting the transactions to be executed against the ovsdb instance.
+     * @return TransactionBuilder
+     */
+    TransactionBuilder transactBuilder();
+
+    /**
+     * Execute the list of operations in a single Transactions. Similar to the transactBuilder() method
+     * @param operations List of operations that needs to be part of a transact call
+     * @return Future object representing the result of the transaction. Calling
+     * cancel on the Future would cause OVSDB cancel operation to be fired against
+     * the device.
+     */
+    ListenableFuture<List<OperationResult>> transact(List<Operation> operations);
+
+
+    /**
+     * ovsdb <a href="http://tools.ietf.org/html/draft-pfaff-ovsdb-proto-04#section-4.1.5">monitor</a> operation.
+     * @param monitorRequests represents what needs to be monitored including a client specified monitor handle. This
+     *                       handle is used to later cancel ({@link #cancelMonitor(MonitorHandle)}) the monitor.
+     * @param callback receives the monitor response
+     */
+    public <E extends TableSchema<E>> MonitorHandle monitor(DatabaseSchema schema, List<MonitorRequest<E>> monitorRequests,
+                                 MonitorCallBack callback);
+
+    /**
+     * Cancels an existing monitor method.
+     * @param handler Handle identifying a specific monitor request that is being cancelled.
+     * @throws java.lang.IllegalStateException if there is no outstanding monitor request for this handle
+     */
+    public void cancelMonitor(MonitorHandle handler);
+
+    /**
+     * ovsdb <a href="http://tools.ietf.org/html/draft-pfaff-ovsdb-proto-04#section-4.1.8">lock</a> operation.
+     * @param lockId a client specified id for the lock; this can be used for unlocking ({@link #unLock(String)})
+     * @param lockedCallBack Callback to nofify when the lock is acquired
+     * @param stolenCallback Callback to notify when an acquired lock is stolen by another client
+     */
+    public void lock(String lockId, LockAquisitionCallback lockedCallBack, LockStolenCallback stolenCallback);
+
+    /**
+     * ovsdb steal operation, see {@link #lock(String, LockAquisitionCallback, LockStolenCallback)}
+     * @param lockId
+     * @return
+     */
+    public ListenableFuture<Boolean> steal(String lockId);
+
+    /**
+     * ovsdb unlock operaiton, see {@link #unLock(String)}
+     * @param lockId
+     * @return
+     */
+    public ListenableFuture<Boolean> unLock(String lockId);
+
+    /**
+     * Starts the echo service. The {@code callbackFilters} can be used to get notified on the absence of echo
+     * notifications from the remote device and control the frequency of such notifications.
+     * @param callbackFilters callbacks for notifying the client of missing echo calls from remote.
+     */
+    public void startEchoService(EchoServiceCallbackFilters callbackFilters);
+
+    /**
+     * Stops the echo service, i.e echo requests from the remote would not be acknowledged after this call.
+     */
+    public void stopEchoService();
+
+    public OvsdbConnectionInfo getConnectionInfo();
+
+    public DatabaseSchema getDatabaseSchema (String dbName);
+
+    /**
+     * User friendly convenient methods that make use of TyperUtils.getTypedRowWrapper to create a Typed Row Proxy
+     * given the Typed Table Class
+     *
+     * @param klazz Typed Interface
+     * @return Proxy wrapper for the actual raw Row class.
+     */
+    public <T> T createTypedRowWrapper(Class<T> klazz);
+    /**
+     * User friendly convenient methods that make use of getTypedRowWrapper to create a Typed Row Proxy given
+     * DatabaseSchema and Typed Table Class.
+     *
+     * @param dbSchema Database Schema of interest
+     * @param klazz Typed Interface
+     * @return Proxy wrapper for the actual raw Row class.
+     */
+    public <T> T createTypedRowWrapper(DatabaseSchema dbSchema, Class<T> klazz);
+
+    /**
+     * User friendly convenient method to get a Typed Row Proxy given a Typed Table Class and the Row to be wrapped.
+     *
+     * @param klazz Typed Interface
+     * @param row The actual Row that the wrapper is operating on. It can be null if the caller is just interested in getting ColumnSchema.
+     * @return Proxy wrapper for the actual raw Row class.
+     */
+    public <T> T getTypedRowWrapper(final Class<T> klazz, final Row<GenericTableSchema> row);
+
+}
diff --git a/library/src/main/java/org/opendaylight/ovsdb/lib/OvsdbConnection.java b/library/src/main/java/org/opendaylight/ovsdb/lib/OvsdbConnection.java
new file mode 100644 (file)
index 0000000..f60a096
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal
+ */
+
+package org.opendaylight.ovsdb.lib;
+
+import java.net.InetAddress;
+
+/**
+ * OvsDBConnection Interface provides OVSDB connection management APIs which includes
+ * both Active and Passive connections.
+ * From the Library perspective, Active OVSDB connections are those that are initiated from
+ * the Controller towards the ovsdb-manager.
+ * While Passive OVSDB connections are those that are initiated from the ovs towards
+ * the controller.
+ *
+ * Applications that use OvsDBConnectionService can use the connect APIs to initiate Active
+ * connections and can listen to the asynchronous Passive connections via registerForPassiveConnection
+ * listener API.
+ */
+
+public interface OvsdbConnection {
+    /**
+     * connect API can be used by the applications to initiate Active connection from
+     * the controller towards ovsdb-server
+     * @param address IP Address of the remote server that hosts the ovsdb server.
+     * @param port Layer 4 port on which the remote ovsdb server is listening on.
+     * @return OvsDBClient The primary Client interface for the ovsdb connection.
+     */
+    public OvsdbClient connect(InetAddress address, int port);
+
+    /**
+     * Method to disconnect an existing connection.
+     * @param client that represents the ovsdb connection.
+     */
+    public void disconnect(OvsdbClient client);
+
+    /**
+     * Method to register a Passive Connection Listener with the ConnectionService.
+     * @param listener Passive Connection listener interested in Passive OVSDB connection requests.
+     */
+    public void registerForPassiveConnection(OvsdbConnectionListener listener);
+}
diff --git a/library/src/main/java/org/opendaylight/ovsdb/lib/OvsdbConnectionInfo.java b/library/src/main/java/org/opendaylight/ovsdb/lib/OvsdbConnectionInfo.java
new file mode 100644 (file)
index 0000000..97133d8
--- /dev/null
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal
+ */
+
+package org.opendaylight.ovsdb.lib;
+
+import java.net.InetAddress;
+public class OvsdbConnectionInfo {
+    public enum ConnectionType {
+        ACTIVE, PASSIVE
+    }
+
+    InetAddress address;
+    int port;
+    ConnectionType type;
+
+    public OvsdbConnectionInfo(InetAddress address, int port, ConnectionType type) {
+        this.address = address;
+        this.port = port;
+        this.type = type;
+    }
+
+    public InetAddress getAddress() {
+        return address;
+    }
+    public int getPort() {
+        return port;
+    }
+    public ConnectionType getType() {
+        return type;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((address == null) ? 0 : address.hashCode());
+        result = prime * result + port;
+        result = prime * result + ((type == null) ? 0 : type.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        OvsdbConnectionInfo other = (OvsdbConnectionInfo) obj;
+        if (address == null) {
+            if (other.address != null)
+                return false;
+        } else if (!address.equals(other.address))
+            return false;
+        if (port != other.port)
+            return false;
+        if (type != other.type)
+            return false;
+        return true;
+    }
+    @Override
+    public String toString() {
+        return "ConnectionInfo [address=" + address + ", port=" + port
+                + ", type=" + type + "]";
+    }
+}
diff --git a/library/src/main/java/org/opendaylight/ovsdb/lib/OvsdbConnectionListener.java b/library/src/main/java/org/opendaylight/ovsdb/lib/OvsdbConnectionListener.java
new file mode 100644 (file)
index 0000000..5026daf
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal
+ */
+
+package org.opendaylight.ovsdb.lib;
+
+/**
+ * Applications interested in Passive ovsdb connection events should implement this interface.
+ */
+public interface OvsdbConnectionListener {
+    /**
+     * Event thrown to the connection listener when a new Passive connection is established.
+     * @param OvsdbClient that represents the connection.
+     */
+    public void connected(OvsdbClient client);
+
+    /**
+     * Event thrown to the connection listener when an existing connection is terminated.
+     * @param OvsdbClient that represents the connection.
+     */
+    public void disconnected(OvsdbClient client);
+}
diff --git a/library/src/main/java/org/opendaylight/ovsdb/lib/ParsingException.java b/library/src/main/java/org/opendaylight/ovsdb/lib/ParsingException.java
new file mode 100644 (file)
index 0000000..bc7ec40
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ *
+ *  * Copyright (C) 2014 EBay Software Foundation
+ *  *
+ *  * This program and the accompanying materials are made available under the
+ *  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ *  * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *  *
+ *  * Authors : Ashwin Raveendran
+ *
+ */
+
+package org.opendaylight.ovsdb.lib;
+
+public class ParsingException extends RuntimeException {
+
+    public ParsingException() {
+    }
+
+    public ParsingException(String message) {
+        super(message);
+    }
+
+    public ParsingException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    public ParsingException(Throwable cause) {
+        super(cause);
+    }
+
+    public ParsingException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
+        super(message, cause, enableSuppression, writableStackTrace);
+    }
+}
diff --git a/library/src/main/java/org/opendaylight/ovsdb/lib/database/Column.java b/library/src/main/java/org/opendaylight/ovsdb/lib/database/Column.java
new file mode 100644 (file)
index 0000000..6721c93
--- /dev/null
@@ -0,0 +1,15 @@
+/*
+ * Copyright (C) 2014 EBay Software Foundation
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Ashwin Raveendran
+ */
+package org.opendaylight.ovsdb.lib.database;
+
+
+public class Column<E extends Table> {
+    ColumnSchema schema;
+}
similarity index 80%
rename from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/database/ColumnSchema.java
rename to library/src/main/java/org/opendaylight/ovsdb/lib/database/ColumnSchema.java
index 2067eab074dd7e5bcf812853432cc44d86c82fee..64c3503b7acff93cabdeeec5d937944582b809c2 100644 (file)
@@ -7,29 +7,48 @@
  *
  * Authors : Brent Salisbury, Evan Zeller
  */
-package org.opendaylight.ovsdb.lib.database;\r
-\r
-import com.fasterxml.jackson.annotation.JsonProperty;\r
-\r
-public class ColumnSchema {\r
-    @JsonProperty("type")\r
-    private OvsdbType type;\r
-    @JsonProperty("ephemeral")\r
-    private Boolean ephemeral;\r
-    @JsonProperty("mutable")\r
-    private Boolean mutable;\r
-    public OvsdbType getType() {\r
-        return type;\r
-    }\r
-    public Boolean getEphemeral() {\r
-        return ephemeral;\r
-    }\r
-    public Boolean getMutable() {\r
-        return mutable;\r
-    }\r
-    @Override\r
-    public String toString() {\r
-        return "ColumnSchema [type=" + type + ", ephemeral=" + ephemeral\r
-                + ", mutable=" + mutable + "]";\r
-    }\r
-}\r
+package org.opendaylight.ovsdb.lib.database;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class ColumnSchema {
+
+    String name;
+
+    @JsonProperty("type")
+    private OvsdbType type;
+
+    @JsonProperty("ephemeral")
+    private Boolean ephemeral;
+
+    @JsonProperty("mutable")
+    private Boolean mutable;
+
+    public OvsdbType getType() {
+        return type;
+    }
+
+    public Boolean getEphemeral() {
+        return ephemeral;
+    }
+
+    public Boolean getMutable() {
+        return mutable;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+
+    @Override
+    public String toString() {
+        return "ColumnType [type=" + type + ", ephemeral=" + ephemeral
+                + ", mutable=" + mutable + "]";
+    }
+
+}
similarity index 91%
rename from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/database/DatabaseSchema.java
rename to library/src/main/java/org/opendaylight/ovsdb/lib/database/DatabaseSchema.java
index 5ddd41affba2cd3cb4c8bc1e303a7582a74f8640..b456fc381a22012979140e6bfb24fbdccb7f9a33 100644 (file)
@@ -7,36 +7,48 @@
  *
  * Authors : Brent Salisbury, Evan Zeller
  */
-package org.opendaylight.ovsdb.lib.database;\r
-\r
-import java.util.Map;\r
-\r
-import com.fasterxml.jackson.annotation.JsonProperty;\r
-\r
-public class DatabaseSchema {\r
-    @JsonProperty("name")\r
-    private String name;\r
-    @JsonProperty("version")\r
-    private String version;\r
-    @JsonProperty("cksum")\r
-    private String cksum;\r
-    @JsonProperty("tables")\r
-    private Map<String, TableSchema> tables;\r
-    public String getName() {\r
-        return name;\r
-    }\r
-    public String getVersion() {\r
-        return version;\r
-    }\r
-    public String getCksum() {\r
-        return cksum;\r
-    }\r
-    public Map<String, TableSchema> getTables() {\r
-        return tables;\r
-    }\r
-    @Override\r
-    public String toString() {\r
-        return "DatabaseSchema [name=" + name + ", version=" + version\r
-                + ", cksum=" + cksum + ", tables=" + tables + "]";\r
-    }\r
-}\r
+package org.opendaylight.ovsdb.lib.database;
+
+import java.util.Map;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class DatabaseSchema {
+    @JsonProperty("name")
+    private String name;
+
+    @JsonProperty("version")
+    private String version;
+
+    @JsonProperty("cksum")
+    private String cksum;
+
+    @JsonProperty("tables")
+    private Map<String, TableSchema> tables;
+
+    public String getName() {
+        return name;
+    }
+
+    public String getVersion() {
+        return version;
+    }
+
+    public String getCksum() {
+        return cksum;
+    }
+
+    public Map<String, TableSchema> getTables() {
+        return tables;
+    }
+
+    public TableSchema getTable(String tableName) {
+       return tables.get(tableName);
+    }
+
+    @Override
+    public String toString() {
+        return "DatabaseSchema [name=" + name + ", version=" + version
+                + ", cksum=" + cksum + ", tables=" + tables + "]";
+    }
+}
similarity index 86%
rename from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/database/OVSBridge.java
rename to library/src/main/java/org/opendaylight/ovsdb/lib/database/OVSBridge.java
index 2c404c280cffeb3e5cd1dd3646f0c7b5926071f2..e3f8003dad7ede268f46f6aa8e58c447989e4f32 100644 (file)
@@ -7,67 +7,62 @@
  *
  * Authors : Brent Salisbury, Evan Zeller
  */
-package org.opendaylight.ovsdb.lib.database;\r
-\r
-\r
+package org.opendaylight.ovsdb.lib.database;
+
+
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-import org.opendaylight.ovsdb.plugin.Connection;
-import org.opendaylight.ovsdb.plugin.OvsdbMessage;
-\r
-public class OVSBridge {\r
-\r
-    private String uuid;\r
-    private String name;\r
-\r
-    public OVSBridge(String uuid, String name){\r
-        this.uuid = uuid;\r
-        this.name = name;\r
-    }\r
-\r
-    public String getUuid(){\r
-        return this.uuid;\r
-    }\r
-\r
-    public String getName(){\r
-        return this.name;\r
-    }\r
-\r
-    @SuppressWarnings("unchecked")\r
-    public static Map<String, OVSBridge> monitorBridge(Connection connection){\r
-        List<String> columns = new ArrayList<String>();\r
-        columns.add("_uuid");\r
-        columns.add("name");\r
-\r
-        Map<String, List<String>> row = new HashMap<String, List<String>>();\r
-        row.put("columns", columns);\r
-\r
-        Map<String, Map> tables = new HashMap<String, Map>();\r
-        tables.put("Bridge", row);\r
-\r
-        Object[] params = {"Open_vSwitch", null, tables};\r
-\r
-        OvsdbMessage msg = new OvsdbMessage("monitor", params);\r
-        Map<String, Object> monitorResponse = new HashMap<String, Object>();\r
-\r
-        Map<String, Object> bridgeTable = (Map) monitorResponse.get("Bridge");\r
-\r
-        Object[] uuidObjects = bridgeTable.keySet().toArray();\r
-        String[] uuids = Arrays.copyOf(uuidObjects, uuidObjects.length, String[].class);\r
-\r
-        Map<String, OVSBridge> result = new HashMap<String, OVSBridge>();\r
-\r
-        for(String uuid : uuids){\r
-            Map<String, Object> newRow = (Map) bridgeTable.get(uuid);\r
-            Map<String, Object> newColumns = (Map) newRow.get("new");\r
-            String name = (String) newColumns.get("name");\r
-            result.put(name, new OVSBridge(uuid, name));\r
-        }\r
-\r
-        return result;\r
-    }\r
-}\r
+public class OVSBridge {
+
+    private String uuid;
+    private String name;
+
+    public OVSBridge(String uuid, String name){
+        this.uuid = uuid;
+        this.name = name;
+    }
+
+    public String getUuid(){
+        return this.uuid;
+    }
+
+    public String getName(){
+        return this.name;
+    }
+
+    @SuppressWarnings("unchecked")
+    public static Map<String, OVSBridge> monitorBridge(){
+        List<String> columns = new ArrayList<String>();
+        columns.add("_uuid");
+        columns.add("name");
+
+        Map<String, List<String>> row = new HashMap<String, List<String>>();
+        row.put("columns", columns);
+
+        Map<String, Map> tables = new HashMap<String, Map>();
+        tables.put("Bridge", row);
+
+        Object[] params = {"Open_vSwitch", null, tables};
+
+        Map<String, Object> monitorResponse = new HashMap<String, Object>();
+        Map<String, Object> bridgeTable = (Map) monitorResponse.get("Bridge");
+
+        Object[] uuidObjects = bridgeTable.keySet().toArray();
+        String[] uuids = Arrays.copyOf(uuidObjects, uuidObjects.length, String[].class);
+
+        Map<String, OVSBridge> result = new HashMap<String, OVSBridge>();
+
+        for(String uuid : uuids){
+            Map<String, Object> newRow = (Map) bridgeTable.get(uuid);
+            Map<String, Object> newColumns = (Map) newRow.get("new");
+            String name = (String) newColumns.get("name");
+            result.put(name, new OVSBridge(uuid, name));
+        }
+
+        return result;
+    }
+}
similarity index 84%
rename from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/database/OVSInstance.java
rename to library/src/main/java/org/opendaylight/ovsdb/lib/database/OVSInstance.java
index f5fd7244bea1bd51726a8f90259fdc1f910756fc..5fa6cb650bc1ce752d4b503376942dffe1d69795 100644 (file)
@@ -7,55 +7,50 @@
  *
  * Authors : Brent Salisbury, Evan Zeller
  */
-package org.opendaylight.ovsdb.lib.database;\r
-\r
-\r
-import org.opendaylight.ovsdb.plugin.Connection;\r
-import org.opendaylight.ovsdb.plugin.OvsdbMessage;\r
-\r
-import java.util.ArrayList;\r
-import java.util.HashMap;\r
-import java.util.List;\r
-import java.util.Map;\r
-\r
-public class OVSInstance {\r
-    private String uuid;\r
-\r
-    public OVSInstance(){\r
-        this.uuid = null;\r
-    }\r
-\r
-    public OVSInstance(String uuid){\r
-        this.uuid = uuid;\r
-    }\r
-\r
-    @SuppressWarnings("unchecked")\r
-    public static OVSInstance monitorOVS(Connection connection){\r
-        List<String> columns = new ArrayList<String>();\r
-        columns.add("_uuid");\r
-        columns.add("bridges");\r
-\r
-        Map<String, List<String>> row = new HashMap<String, List<String>>();\r
-        row.put("columns", columns);\r
-\r
-        Map<String, Map> tables = new HashMap<String, Map>();\r
-        tables.put("Open_vSwitch", row);\r
-\r
-        Object[] params = {"Open_vSwitch", null, tables};\r
-\r
-        OvsdbMessage msg = new OvsdbMessage("monitor", params);\r
-        Map<String, Object> monitorResponse = new HashMap<String, Object>();\r
-\r
-        Map<String, Object> vSwitchTable = (Map) monitorResponse.get("Open_vSwitch");\r
-        if(vSwitchTable != null){\r
-            String uuid = (String) vSwitchTable.keySet().toArray()[0];\r
-            return new OVSInstance(uuid);\r
-        }\r
-        return null;\r
-    }\r
-\r
-    public String getUuid(){\r
-        return this.uuid;\r
-    }\r
-\r
-}\r
+package org.opendaylight.ovsdb.lib.database;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class OVSInstance {
+    private String uuid;
+
+    public OVSInstance(){
+        this.uuid = null;
+    }
+
+    public OVSInstance(String uuid){
+        this.uuid = uuid;
+    }
+
+    @SuppressWarnings("unchecked")
+    public static OVSInstance monitorOVS(){
+        List<String> columns = new ArrayList<String>();
+        columns.add("_uuid");
+        columns.add("bridges");
+
+        Map<String, List<String>> row = new HashMap<String, List<String>>();
+        row.put("columns", columns);
+
+        Map<String, Map> tables = new HashMap<String, Map>();
+        tables.put("Open_vSwitch", row);
+
+        Object[] params = {"Open_vSwitch", null, tables};
+
+        Map<String, Object> monitorResponse = new HashMap<String, Object>();
+
+        Map<String, Object> vSwitchTable = (Map) monitorResponse.get("Open_vSwitch");
+        if(vSwitchTable != null){
+            String uuid = (String) vSwitchTable.keySet().toArray()[0];
+            return new OVSInstance(uuid);
+        }
+        return null;
+    }
+
+    public String getUuid(){
+        return this.uuid;
+    }
+
+}
similarity index 97%
rename from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/database/OvsdbType.java
rename to library/src/main/java/org/opendaylight/ovsdb/lib/database/OvsdbType.java
index f7b3ee85dbacfc31a41d133a4820c46151738916..9685ebbe3ad557c9993cbc6f937a7c060dab23e9 100644 (file)
@@ -7,94 +7,94 @@
  *
  * Authors : Brent Salisbury, Evan Zeller
  */
-package org.opendaylight.ovsdb.lib.database;\r
-\r
+package org.opendaylight.ovsdb.lib.database;
+
 import com.fasterxml.jackson.annotation.JsonProperty;
-\r
-\r
-public class OvsdbType {\r
-    public enum PortType {\r
-        VLAN("vlan"),\r
-        TUNNEL("Tunnel"),\r
-        BONDING("Bonding"),\r
-        PATCH("patch"),\r
-        INTERNAL("internal");\r
-\r
-        private PortType(String name) {\r
-            this.name = name;\r
-        }\r
-\r
-        private String name;\r
-\r
+
+
+public class OvsdbType {
+    public enum PortType {
+        VLAN("vlan"),
+        TUNNEL("Tunnel"),
+        BONDING("Bonding"),
+        PATCH("patch"),
+        INTERNAL("internal");
+
+        private PortType(String name) {
+            this.name = name;
+        }
+
+        private String name;
+
         @Override
-        public String toString() {\r
-            return name;\r
-        }\r
-    }\r
-    public OvsdbType(String type){\r
-        this.key = new BaseType(type);\r
-    }\r
-\r
-    public OvsdbType(@JsonProperty("key") BaseType key, @JsonProperty("value") BaseType value,\r
-            @JsonProperty("min") Integer min, @JsonProperty("max") Object max){\r
-        this.key = key;\r
-        this.value = value;\r
-        this.min = min;\r
-        this.max = max;\r
-    }\r
-\r
-    public BaseType key;\r
-    public BaseType value;\r
-    public Integer min;\r
-    public Object max;\r
-\r
-    public static class BaseType{\r
-\r
-        public BaseType(String type){\r
-            this.type = type;\r
-        }\r
-\r
-        public BaseType(@JsonProperty("type") String type, @JsonProperty("enum") Object ovsdbEnum,\r
-                @JsonProperty("minInteger") Integer minInteger, @JsonProperty("maxInteger") Integer maxInteger,\r
-                @JsonProperty("minReal") Double minReal, @JsonProperty("maxReal") Double maxReal,\r
-                @JsonProperty("minLength") Integer minLength, @JsonProperty("maxLength") Integer maxLength,\r
-                @JsonProperty("refTable") String refTable, @JsonProperty("refType") String refType){\r
-            this.type = type;\r
-            this.ovsdbEnum = ovsdbEnum;\r
-            this.minInteger = minInteger;\r
-            this.maxInteger = maxInteger;\r
-            this.minReal = minReal;\r
-            this.maxReal = maxReal;\r
-            this.minLength = minLength;\r
-            this.maxLength = maxLength;\r
-            this.refTable = refTable;\r
-            this.refType = refType;\r
-        }\r
-\r
-        public String type;\r
-        public Object ovsdbEnum;\r
-        public Integer minInteger;\r
-        public Integer maxInteger;\r
-        public Double minReal;\r
-        public Double maxReal;\r
-        public Integer minLength;\r
-        public Integer maxLength;\r
-        public String refTable;\r
-        public String refType;\r
-        @Override\r
-        public String toString() {\r
-            return "BaseType [type=" + type + ", ovsdbEnum="\r
-                    + ovsdbEnum + ", minInteger=" + minInteger\r
-                    + ", maxInteger=" + maxInteger + ", minReal=" + minReal\r
-                    + ", maxReal=" + maxReal + ", minLength=" + minLength\r
-                    + ", maxLength=" + maxLength + ", refTable=" + refTable\r
-                    + ", refType=" + refType + "]";\r
-        }\r
-    }\r
-\r
-    @Override\r
-    public String toString() {\r
-        return "OvsdbType [key=" + key + ", value=" + value + ", min=" + min\r
-                + ", max=" + max + "]";\r
-    }\r
-}\r
+        public String toString() {
+            return name;
+        }
+    }
+    public OvsdbType(String type){
+        this.key = new BaseType(type);
+    }
+
+    public OvsdbType(@JsonProperty("key") BaseType key, @JsonProperty("value") BaseType value,
+            @JsonProperty("min") Integer min, @JsonProperty("max") Object max){
+        this.key = key;
+        this.value = value;
+        this.min = min;
+        this.max = max;
+    }
+
+    public BaseType key;
+    public BaseType value;
+    public Integer min;
+    public Object max;
+
+    public static class BaseType{
+
+        public BaseType(String type){
+            this.type = type;
+        }
+
+        public BaseType(@JsonProperty("type") String type, @JsonProperty("enum") Object ovsdbEnum,
+                @JsonProperty("minInteger") Integer minInteger, @JsonProperty("maxInteger") Integer maxInteger,
+                @JsonProperty("minReal") Double minReal, @JsonProperty("maxReal") Double maxReal,
+                @JsonProperty("minLength") Integer minLength, @JsonProperty("maxLength") Integer maxLength,
+                @JsonProperty("refTable") String refTable, @JsonProperty("refType") String refType){
+            this.type = type;
+            this.ovsdbEnum = ovsdbEnum;
+            this.minInteger = minInteger;
+            this.maxInteger = maxInteger;
+            this.minReal = minReal;
+            this.maxReal = maxReal;
+            this.minLength = minLength;
+            this.maxLength = maxLength;
+            this.refTable = refTable;
+            this.refType = refType;
+        }
+
+        public String type;
+        public Object ovsdbEnum;
+        public Integer minInteger;
+        public Integer maxInteger;
+        public Double minReal;
+        public Double maxReal;
+        public Integer minLength;
+        public Integer maxLength;
+        public String refTable;
+        public String refType;
+        @Override
+        public String toString() {
+            return "BaseType [type=" + type + ", ovsdbEnum="
+                    + ovsdbEnum + ", minInteger=" + minInteger
+                    + ", maxInteger=" + maxInteger + ", minReal=" + minReal
+                    + ", maxReal=" + maxReal + ", minLength=" + minLength
+                    + ", maxLength=" + maxLength + ", refTable=" + refTable
+                    + ", refType=" + refType + "]";
+        }
+    }
+
+    @Override
+    public String toString() {
+        return "OvsdbType [key=" + key + ", value=" + value + ", min=" + min
+                + ", max=" + max + "]";
+    }
+}
diff --git a/library/src/main/java/org/opendaylight/ovsdb/lib/database/Table.java b/library/src/main/java/org/opendaylight/ovsdb/lib/database/Table.java
new file mode 100644 (file)
index 0000000..33e0478
--- /dev/null
@@ -0,0 +1,17 @@
+/*
+ * Copyright (C) 2014 EBay Software Foundation
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Ashwin Raveendran
+ */
+package org.opendaylight.ovsdb.lib.database;
+
+
+public class Table<E extends Table> {
+    TableSchema schema;
+
+
+}
similarity index 87%
rename from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/database/TableSchema.java
rename to library/src/main/java/org/opendaylight/ovsdb/lib/database/TableSchema.java
index 7efc02a07ed9918e2857ea7d5ef95008b99bc981..a0632ef3eb77a0fd12b13dbece5cfb78287c2375 100644 (file)
@@ -7,41 +7,49 @@
  *
  * Authors : Brent Salisbury, Evan Zeller
  */
-package org.opendaylight.ovsdb.lib.database;\r
-\r
-import java.util.Map;\r
-\r
-import com.fasterxml.jackson.annotation.JsonProperty;\r
-\r
-public class TableSchema {\r
-    @JsonProperty("columns")\r
-    private Map<String, ColumnSchema> columns;\r
-    @JsonProperty("maxRows")\r
-    private Integer maxRows;\r
-    @JsonProperty("isRoot")\r
-    private Boolean isRoot;\r
-    @JsonProperty("indexes")\r
-    private Object indexes;\r
-\r
-    public Map<String, ColumnSchema> getColumns(){\r
-        return this.columns;\r
-    }\r
-\r
-    public Integer getMaxRows() {\r
-        return maxRows;\r
-    }\r
-\r
-    public Boolean getIsRoot() {\r
-        return isRoot;\r
-    }\r
-\r
-    public Object getIndexes() {\r
-        return indexes;\r
-    }\r
-\r
-    @Override\r
-    public String toString() {\r
-        return "TableSchema [columns=" + columns + ", maxRows=" + maxRows\r
-                + ", isRoot=" + isRoot + ", indexes=" + indexes + "]";\r
-    }\r
-}\r
+package org.opendaylight.ovsdb.lib.database;
+
+import java.util.Map;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class TableSchema {
+
+    @JsonProperty("columns")
+    private Map<String, ColumnSchema> columns;
+
+    @JsonProperty("maxRows")
+    private Integer maxRows;
+
+    @JsonProperty("isRoot")
+    private Boolean isRoot;
+
+    @JsonProperty("indexes")
+    private Object indexes;
+
+    public Map<String, ColumnSchema> getColumns() {
+        return this.columns;
+    }
+
+    public ColumnSchema getColumn(String columnName) {
+        return this.columns.get(columnName);
+    }
+
+    public Integer getMaxRows() {
+        return maxRows;
+    }
+
+    public Boolean getIsRoot() {
+        return isRoot;
+    }
+
+    public Object getIndexes() {
+        return indexes;
+    }
+
+    @Override
+    public String toString() {
+        return "TableSchema [columns=" + columns + ", maxRows=" + maxRows
+                + ", isRoot=" + isRoot + ", indexes=" + indexes + "]";
+    }
+}
similarity index 98%
rename from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/database/Uuid.java
rename to library/src/main/java/org/opendaylight/ovsdb/lib/database/Uuid.java
index e08af5fd675354946173b68eae43c1b8f1379db3..da4b5950cd54b01d10788c06eeb7bc5f9ac27d9b 100644 (file)
@@ -7,11 +7,11 @@
  *
  * Authors : Brent Salisbury, Evan Zeller
  */
-package org.opendaylight.ovsdb.lib.database;\r
-\r
-import com.fasterxml.jackson.annotation.JsonProperty;\r
-\r
-public class Uuid {\r
-    @JsonProperty("uuid")\r
-    public String[] uuid;\r
-}\r
+package org.opendaylight.ovsdb.lib.database;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class Uuid {
+    @JsonProperty("uuid")
+    public String[] uuid;
+}
diff --git a/library/src/main/java/org/opendaylight/ovsdb/lib/impl/ChannelConnectionHandler.java b/library/src/main/java/org/opendaylight/ovsdb/lib/impl/ChannelConnectionHandler.java
new file mode 100644 (file)
index 0000000..3c7a404
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal
+ */
+
+package org.opendaylight.ovsdb.lib.impl;
+
+import io.netty.channel.ChannelFuture;
+import io.netty.channel.ChannelFutureListener;
+
+import org.opendaylight.ovsdb.lib.OvsdbClient;
+
+public class ChannelConnectionHandler implements ChannelFutureListener {
+    OvsdbClient client;
+    public ChannelConnectionHandler (OvsdbClient client) {
+        this.client = client;
+    }
+    @Override
+    public void operationComplete(ChannelFuture arg0) throws Exception {
+        OvsdbConnectionService.channelClosed(client);
+    }
+}
diff --git a/library/src/main/java/org/opendaylight/ovsdb/lib/impl/OvsdbClientImpl.java b/library/src/main/java/org/opendaylight/ovsdb/lib/impl/OvsdbClientImpl.java
new file mode 100644 (file)
index 0000000..b2fde02
--- /dev/null
@@ -0,0 +1,380 @@
+/*
+ * Copyright (C) 2014 EBay Software Foundation
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Ashwin Raveendran, Madhu Venugopal
+ */
+package org.opendaylight.ovsdb.lib.impl;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Queue;
+import java.util.UUID;
+import java.util.concurrent.ExecutorService;
+
+import org.opendaylight.ovsdb.lib.EchoServiceCallbackFilters;
+import org.opendaylight.ovsdb.lib.LockAquisitionCallback;
+import org.opendaylight.ovsdb.lib.LockStolenCallback;
+import org.opendaylight.ovsdb.lib.MonitorCallBack;
+import org.opendaylight.ovsdb.lib.MonitorHandle;
+import org.opendaylight.ovsdb.lib.OvsdbClient;
+import org.opendaylight.ovsdb.lib.OvsdbConnectionInfo;
+import org.opendaylight.ovsdb.lib.jsonrpc.Params;
+import org.opendaylight.ovsdb.lib.message.MonitorRequest;
+import org.opendaylight.ovsdb.lib.message.OvsdbRPC;
+import org.opendaylight.ovsdb.lib.message.TableUpdate;
+import org.opendaylight.ovsdb.lib.message.TableUpdates;
+import org.opendaylight.ovsdb.lib.message.TransactBuilder;
+import org.opendaylight.ovsdb.lib.message.UpdateNotification;
+import org.opendaylight.ovsdb.lib.notation.Row;
+import org.opendaylight.ovsdb.lib.operations.Operation;
+import org.opendaylight.ovsdb.lib.operations.OperationResult;
+import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
+import org.opendaylight.ovsdb.lib.schema.DatabaseSchema;
+import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
+import org.opendaylight.ovsdb.lib.schema.TableSchema;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedTable;
+import org.opendaylight.ovsdb.lib.schema.typed.TyperUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.google.common.base.Function;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import com.google.common.util.concurrent.FutureCallback;
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
+import com.google.common.util.concurrent.SettableFuture;
+
+
+public class OvsdbClientImpl implements OvsdbClient {
+
+    protected static final Logger logger = LoggerFactory.getLogger(OvsdbClientImpl.class);
+    private ExecutorService executorService;
+    private OvsdbRPC rpc;
+    private Map<String, DatabaseSchema> schema = Maps.newHashMap();
+    private HashMap<String, CallbackContext> monitorCallbacks = Maps.newHashMap();
+    private Queue<Throwable> exceptions;
+    private OvsdbRPC.Callback rpcCallback;
+    private OvsdbConnectionInfo connectionInfo;
+
+    public OvsdbClientImpl(OvsdbRPC rpc, OvsdbConnectionInfo connectionInfo, ExecutorService executorService) {
+        this.rpc = rpc;
+        this.executorService = executorService;
+        this.connectionInfo = connectionInfo;
+    }
+
+    OvsdbClientImpl() {
+    }
+
+    void setupUpdateListener() {
+        if (rpcCallback == null) {
+            OvsdbRPC.Callback temp = new OvsdbRPC.Callback() {
+                @Override
+                public void update(Object node, UpdateNotification upadateNotification) {
+                    Object key = upadateNotification.getContext();
+                    CallbackContext callbackContext = monitorCallbacks.get(key);
+                    MonitorCallBack monitorCallBack = callbackContext.monitorCallBack;
+                    if (monitorCallBack == null) {
+                        //ignore ?
+                        logger.info("callback received with context {}, but no known handler. Ignoring!", key);
+                        return;
+                    }
+                    _transformingCallback(upadateNotification.getUpdates(), monitorCallBack, callbackContext.schema);
+                }
+
+                @Override
+                public void locked(Object node, List<String> ids) {
+
+                }
+
+                @Override
+                public void stolen(Object node, List<String> ids) {
+
+                }
+            };
+            this.rpcCallback = temp;
+            rpc.registerCallback(temp);
+        }
+    }
+
+
+    protected void _transformingCallback(JsonNode tableUpdatesJson, MonitorCallBack monitorCallBack, DatabaseSchema dbSchema) {
+        //todo(ashwin): we should move all the JSON parsing logic to a utility class
+        if (tableUpdatesJson instanceof ObjectNode) {
+            Map<String, TableUpdate> tableUpdateMap = Maps.newHashMap();
+            ObjectNode updatesJson = (ObjectNode) tableUpdatesJson;
+            for (Iterator<Map.Entry<String,JsonNode>> itr = updatesJson.fields(); itr.hasNext();){
+                Map.Entry<String, JsonNode> entry = itr.next();
+
+                DatabaseSchema databaseSchema = this.schema.get(dbSchema.getName());
+                TableSchema table = databaseSchema.table(entry.getKey(), TableSchema.class);
+                tableUpdateMap.put(entry.getKey(), table.updatesFromJson(entry.getValue()));
+
+            }
+            TableUpdates updates = new TableUpdates(tableUpdateMap);
+            monitorCallBack.update(updates);
+        }
+    }
+
+    @Override
+    public ListenableFuture<List<OperationResult>> transact(List<Operation> operations) {
+
+        //todo, we may not need transactionbuilder if we can have JSON objects
+        TransactBuilder builder = new TransactBuilder();
+        for (Operation o : operations) {
+            builder.addOperation(o);
+        }
+
+        return rpc.transact(builder);
+    }
+
+    @Override
+    public <E extends TableSchema<E>> MonitorHandle monitor(final DatabaseSchema dbSchema,
+                                                            List<MonitorRequest<E>> monitorRequest,
+                                                            final MonitorCallBack callback) {
+
+        final ImmutableMap<String, MonitorRequest<E>> reqMap = Maps.uniqueIndex(monitorRequest,
+                new Function<MonitorRequest<E>, String>() {
+                    @Override
+                    public String apply(MonitorRequest<E> input) {
+                        return input.getTableName();
+                    }
+                });
+
+        final MonitorHandle monitorHandle = new MonitorHandle(UUID.randomUUID().toString());
+        registerCallback(monitorHandle, callback, dbSchema);
+
+        ListenableFuture<JsonNode> monitor = rpc.monitor(new Params() {
+            @Override
+            public List<Object> params() {
+                return Lists.<Object>newArrayList(dbSchema.getName(), monitorHandle.getId(), reqMap);
+            }
+        });
+        Futures.addCallback(monitor, new FutureCallback<JsonNode>() {
+            @Override
+            public void onSuccess(JsonNode result) {
+                _transformingCallback(result, callback, dbSchema);
+            }
+
+            @Override
+            public void onFailure(Throwable t) {
+                callback.exception(t);
+            }
+        });
+
+        return monitorHandle;
+    }
+
+    private void registerCallback(MonitorHandle monitorHandle, MonitorCallBack callback, DatabaseSchema schema) {
+        this.monitorCallbacks.put(monitorHandle.getId(), new CallbackContext(callback, schema));
+        setupUpdateListener();
+    }
+
+    @Override
+    public void cancelMonitor(MonitorHandle handler) {
+        throw new UnsupportedOperationException("not yet implemented");
+    }
+
+    @Override
+    public void lock(String lockId, LockAquisitionCallback lockedCallBack, LockStolenCallback stolenCallback) {
+        throw new UnsupportedOperationException("not yet implemented");
+    }
+
+    @Override
+    public ListenableFuture<Boolean> steal(String lockId) {
+        throw new UnsupportedOperationException("not yet implemented");
+    }
+
+    @Override
+    public ListenableFuture<Boolean> unLock(String lockId) {
+        throw new UnsupportedOperationException("not yet implemented");
+    }
+
+    @Override
+    public void startEchoService(EchoServiceCallbackFilters callbackFilters) {
+        throw new UnsupportedOperationException("not yet implemented");
+    }
+
+    @Override
+    public void stopEchoService() {
+        throw new UnsupportedOperationException("not yet implemented");
+    }
+
+    @Override
+    public TransactionBuilder transactBuilder() {
+        return new TransactionBuilder(this);
+    }
+
+
+    public boolean isReady(int timeout) throws InterruptedException {
+        while (timeout > 0) {
+            if (!schema.isEmpty()) {
+                return true;
+            }
+            Thread.sleep(1000);
+            timeout--;
+        }
+        return false;
+    }
+
+    @Override
+    public ListenableFuture<List<String>> getDatabases() {
+        return rpc.list_dbs();
+    }
+
+    @Override
+    public ListenableFuture<DatabaseSchema> getSchema(final String database, final boolean cacheResult) {
+
+        DatabaseSchema databaseSchema = schema.get(database);
+
+        if (databaseSchema == null || cacheResult) {
+            return Futures.transform(
+                    getSchemaFromDevice(Lists.newArrayList(database)),
+                    new Function<Map<String, DatabaseSchema>, DatabaseSchema>() {
+                        @Override
+                        public DatabaseSchema apply(Map<String, DatabaseSchema> result) {
+                            if (result.containsKey(database)) {
+                                DatabaseSchema s = result.get(database);
+                                s.populateInternallyGeneratedColumns();
+                                if (cacheResult) {
+                                    OvsdbClientImpl.this.schema.put(database, s);
+                                }
+                                return s;
+                            } else {
+                                return null;
+                            }
+                        }
+                    }, executorService);
+
+
+        } else {
+            return Futures.immediateFuture(databaseSchema);
+        }
+    }
+
+    private ListenableFuture<Map<String, DatabaseSchema>> getSchemaFromDevice(final List<String> dbNames) {
+        Map<String, DatabaseSchema> schema = Maps.newHashMap();
+        SettableFuture<Map<String, DatabaseSchema>> future = SettableFuture.create();
+        _populateSchema(dbNames, schema, future);
+        return future;
+    }
+
+    private void _populateSchema(final List<String> dbNames,
+                                 final Map<String, DatabaseSchema> schema,
+                                 final SettableFuture<Map<String, DatabaseSchema>> sfuture) {
+
+        if (dbNames == null || dbNames.isEmpty()) {
+            return;
+        }
+
+        Futures.transform(rpc.get_schema(Lists.newArrayList(dbNames.get(0))),
+                new com.google.common.base.Function<JsonNode, Void>() {
+                    @Override
+                    public Void apply(JsonNode jsonNode) {
+                        try {
+                            schema.put(dbNames.get(0), DatabaseSchema.fromJson(dbNames.get(0), jsonNode));
+                            if (schema.size() > 1 && !sfuture.isCancelled()) {
+                                _populateSchema(dbNames.subList(1, dbNames.size()), schema, sfuture);
+                            } else if (schema.size() == 1) {
+                                sfuture.set(schema);
+                            }
+                        } catch (Throwable e) {
+                            sfuture.setException(e);
+                        }
+                        return null;
+                    }
+                });
+    }
+
+    public void setRpc(OvsdbRPC rpc) {
+        this.rpc = rpc;
+    }
+
+    public Queue<Throwable> getExceptions() {
+        return exceptions;
+    }
+
+    static class CallbackContext {
+        MonitorCallBack monitorCallBack;
+        DatabaseSchema schema;
+
+        CallbackContext(MonitorCallBack monitorCallBack, DatabaseSchema schema) {
+            this.monitorCallBack = monitorCallBack;
+            this.schema = schema;
+        }
+    }
+
+    @Override
+    public DatabaseSchema getDatabaseSchema (String dbName) {
+        return schema.get(dbName);
+    }
+
+    /**
+     * This method finds the DatabaseSchema that matches a given Typed Table Class.
+     * With the introduction of TypedTable and TypedColumn annotations, it is possible to express
+     * the Database Name, Table Name & the Database Versions within which the Table is defined and maintained.
+     *
+     * @param klazz Typed Class that represents a Table
+     * @return DatabaseSchema that matches a Typed Table Class
+     */
+    private <T> DatabaseSchema getDatabaseSchemaForTypedTable (Class <T> klazz) {
+        TypedTable typedTable = klazz.getAnnotation(TypedTable.class);
+        if (typedTable != null) {
+            return this.getDatabaseSchema(typedTable.database());
+        }
+        return null;
+    }
+
+    /**
+     * User friendly convenient method that make use of TyperUtils.getTypedRowWrapper to create a Typed Row Proxy
+     * given the Typed Table Class
+     *
+     * @param klazz Typed Interface
+     * @return Proxy wrapper for the actual raw Row class.
+     */
+    @Override
+    public <T> T createTypedRowWrapper(Class<T> klazz) {
+        DatabaseSchema dbSchema = getDatabaseSchemaForTypedTable(klazz);
+        return this.createTypedRowWrapper(dbSchema, klazz);
+    }
+
+    /**
+     * User friendly convenient method that make use of getTypedRowWrapper to create a Typed Row Proxy given
+     * DatabaseSchema and Typed Table Class.
+     *
+     * @param dbSchema Database Schema of interest
+     * @param klazz Typed Interface
+     * @return Proxy wrapper for the actual raw Row class.
+     */
+    @Override
+    public <T> T createTypedRowWrapper(DatabaseSchema dbSchema, Class<T> klazz) {
+        return TyperUtils.getTypedRowWrapper(dbSchema, klazz, new Row<GenericTableSchema>());
+    }
+
+    /**
+     * User friendly convenient method to get a Typed Row Proxy given a Typed Table Class and the Row to be wrapped.
+     *
+     * @param klazz Typed Interface
+     * @param row The actual Row that the wrapper is operating on. It can be null if the caller is just interested in getting ColumnSchema.
+     * @return Proxy wrapper for the actual raw Row class.
+     */
+    @Override
+    public <T> T getTypedRowWrapper(final Class<T> klazz, final Row<GenericTableSchema> row) {
+        DatabaseSchema dbSchema = getDatabaseSchemaForTypedTable(klazz);
+        return TyperUtils.getTypedRowWrapper(dbSchema, klazz, row);
+    }
+
+    @Override
+    public OvsdbConnectionInfo getConnectionInfo() {
+        return connectionInfo;
+    }
+}
diff --git a/library/src/main/java/org/opendaylight/ovsdb/lib/impl/OvsdbConnectionService.java b/library/src/main/java/org/opendaylight/ovsdb/lib/impl/OvsdbConnectionService.java
new file mode 100644 (file)
index 0000000..93bfae9
--- /dev/null
@@ -0,0 +1,235 @@
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal
+ */
+
+package org.opendaylight.ovsdb.lib.impl;
+
+import io.netty.bootstrap.Bootstrap;
+import io.netty.bootstrap.ServerBootstrap;
+import io.netty.channel.AdaptiveRecvByteBufAllocator;
+import io.netty.channel.Channel;
+import io.netty.channel.ChannelFuture;
+import io.netty.channel.ChannelInitializer;
+import io.netty.channel.ChannelOption;
+import io.netty.channel.EventLoopGroup;
+import io.netty.channel.nio.NioEventLoopGroup;
+import io.netty.channel.socket.SocketChannel;
+import io.netty.channel.socket.nio.NioServerSocketChannel;
+import io.netty.channel.socket.nio.NioSocketChannel;
+import io.netty.handler.codec.string.StringEncoder;
+import io.netty.handler.logging.LogLevel;
+import io.netty.handler.logging.LoggingHandler;
+import io.netty.util.CharsetUtil;
+
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+import org.opendaylight.ovsdb.lib.OvsdbClient;
+import org.opendaylight.ovsdb.lib.OvsdbConnection;
+import org.opendaylight.ovsdb.lib.OvsdbConnectionInfo;
+import org.opendaylight.ovsdb.lib.OvsdbConnectionInfo.ConnectionType;
+import org.opendaylight.ovsdb.lib.OvsdbConnectionListener;
+import org.opendaylight.ovsdb.lib.jsonrpc.JsonRpcDecoder;
+import org.opendaylight.ovsdb.lib.jsonrpc.JsonRpcEndpoint;
+import org.opendaylight.ovsdb.lib.jsonrpc.JsonRpcServiceBinderHandler;
+import org.opendaylight.ovsdb.lib.message.OvsdbRPC;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.common.collect.Maps;
+import com.google.common.collect.Sets;
+
+/**
+ * OvsDBConnectionService provides OVSDB connection management functionality which includes
+ * both Active and Passive connections.
+ * From the Library perspective, Active OVSDB connections are those that are initiated from
+ * the Controller towards the ovsdb-manager.
+ * While Passive OVSDB connections are those that are initiated from the ovs towards
+ * the controller.
+ *
+ * Applications that use OvsDBConnectionService can use the OvsDBConnection class' connect APIs
+ * to initiate Active connections and can listen to the asynchronous Passive connections via
+ * registerForPassiveConnection listener API.
+ *
+ * The library is designed as Java modular component that can work in both OSGi and non-OSGi
+ * environment. Hence a single instance of the service will be active (via Service Registry in OSGi)
+ * and a Singleton object in a non-OSGi environment.
+ */
+public class OvsdbConnectionService implements OvsdbConnection {
+    private static final Logger logger = LoggerFactory.getLogger(OvsdbConnectionService.class);
+    private final static int DEFAULT_SERVER_PORT = 6640;
+    private static final String OVSDB_LISTENPORT = "ovsdb.listenPort";
+    private final static int NUM_THREADS = 3;
+
+    // Singleton Service object that can be used in Non-OSGi environment
+    private static Set<OvsdbConnectionListener> connectionListeners = Sets.newHashSet();
+    private static Map<OvsdbClient, Channel> connections = Maps.newHashMap();
+    private static OvsdbConnection connectionService;
+    private static int ovsdbListenPort = DEFAULT_SERVER_PORT;
+
+    public static OvsdbConnection getService() {
+        if (connectionService == null) {
+            connectionService = new OvsdbConnectionService();
+        }
+        return connectionService;
+    }
+    @Override
+    public OvsdbClient connect(InetAddress address, int port) {
+        try {
+            Bootstrap bootstrap = new Bootstrap();
+            bootstrap.group(new NioEventLoopGroup());
+            bootstrap.channel(NioSocketChannel.class);
+            bootstrap.option(ChannelOption.TCP_NODELAY, true);
+            bootstrap.option(ChannelOption.RCVBUF_ALLOCATOR, new AdaptiveRecvByteBufAllocator(65535, 65535, 65535));
+
+            bootstrap.handler(new ChannelInitializer<SocketChannel>() {
+                @Override
+                public void initChannel(SocketChannel channel) throws Exception {
+                    channel.pipeline().addLast(
+                            //new LoggingHandler(LogLevel.INFO),
+                            new JsonRpcDecoder(100000),
+                            new StringEncoder(CharsetUtil.UTF_8));
+                }
+            });
+
+            ChannelFuture future = bootstrap.connect(address, port).sync();
+            Channel channel = future.channel();
+            OvsdbClient client = getChannelClient(channel, ConnectionType.ACTIVE, Executors.newFixedThreadPool(NUM_THREADS));
+            return client;
+        } catch (InterruptedException e) {
+            System.out.println("Thread was interrupted during connect");
+        }
+        return null;
+    }
+
+    @Override
+    public void disconnect(OvsdbClient client) {
+        if (client == null) return;
+        Channel channel = connections.get(client);
+        if (channel != null) {
+            channel.disconnect();
+        }
+        connections.remove(client);
+    }
+
+    @Override
+    public void registerForPassiveConnection(OvsdbConnectionListener listener) {
+        connectionListeners.add(listener);
+    }
+
+    private static OvsdbClient getChannelClient(Channel channel, ConnectionType type,
+                                                ExecutorService executorService) {
+        ObjectMapper objectMapper = new ObjectMapper();
+        objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+        objectMapper.setSerializationInclusion(Include.NON_NULL);
+
+        JsonRpcEndpoint factory = new JsonRpcEndpoint(objectMapper, channel);
+        JsonRpcServiceBinderHandler binderHandler = new JsonRpcServiceBinderHandler(factory);
+        binderHandler.setContext(channel);
+        channel.pipeline().addLast(binderHandler);
+
+        OvsdbRPC rpc = factory.getClient(channel, OvsdbRPC.class);
+        InetSocketAddress channelAddress = (InetSocketAddress)channel.remoteAddress();
+        InetAddress address = channelAddress.getAddress();
+        int port = channelAddress.getPort();
+
+        OvsdbConnectionInfo info = new OvsdbConnectionInfo(address, port, type);
+        OvsdbClientImpl client = new OvsdbClientImpl(rpc, info, executorService);
+        connections.put(client, channel);
+        ChannelFuture closeFuture = channel.closeFuture();
+        closeFuture.addListener(new ChannelConnectionHandler(client));
+        return client;
+    }
+
+    /**
+     * Method that initiates the Passive OVSDB channel listening functionality.
+     * By default the ovsdb passive connection will listen in port 6640 which can
+     * be overridden using the ovsdb.listenPort system property.
+     */
+    private static void startOvsdbManager() {
+        String portString = System.getProperty(OVSDB_LISTENPORT);
+        if (portString != null) {
+            ovsdbListenPort = Integer.decode(portString).intValue();
+        }
+
+        new Thread() {
+            @Override
+            public void run() {
+                ovsdbManager();
+            }
+        }.start();
+    }
+
+
+    /**
+     * OVSDB Passive listening thread that uses Netty ServerBootstrap to open passive connection
+     * and handle channel callbacks.
+     */
+    private static void ovsdbManager() {
+        EventLoopGroup bossGroup = new NioEventLoopGroup();
+        EventLoopGroup workerGroup = new NioEventLoopGroup();
+        try {
+            ServerBootstrap b = new ServerBootstrap();
+            b.group(bossGroup, workerGroup)
+             .channel(NioServerSocketChannel.class)
+             .option(ChannelOption.SO_BACKLOG, 100)
+             .handler(new LoggingHandler(LogLevel.INFO))
+             .childHandler(new ChannelInitializer<SocketChannel>() {
+                 @Override
+                 public void initChannel(SocketChannel channel) throws Exception {
+                     logger.debug("New Passive channel created : "+ channel.toString());
+                     channel.pipeline().addLast(
+                             new JsonRpcDecoder(100000),
+                             new StringEncoder(CharsetUtil.UTF_8));
+
+                     handleNewPassiveConnection(channel);
+                 }
+             });
+            b.option(ChannelOption.TCP_NODELAY, true);
+            b.option(ChannelOption.RCVBUF_ALLOCATOR, new AdaptiveRecvByteBufAllocator(65535, 65535, 65535));
+            // Start the server.
+            ChannelFuture f = b.bind(ovsdbListenPort).sync();
+            Channel serverListenChannel =  f.channel();
+            // Wait until the server socket is closed.
+            serverListenChannel.closeFuture().sync();
+        } catch (InterruptedException e) {
+            logger.error("Thread interrupted", e);
+        } finally {
+            // Shut down all event loops to terminate all threads.
+            bossGroup.shutdownGracefully();
+            workerGroup.shutdownGracefully();
+        }
+    }
+
+    static {
+        startOvsdbManager();
+    }
+
+    private static void handleNewPassiveConnection(Channel channel) {
+        OvsdbClient client = getChannelClient(channel, ConnectionType.PASSIVE, Executors.newFixedThreadPool(NUM_THREADS));
+        for (OvsdbConnectionListener listener : connectionListeners) {
+            listener.connected(client);
+        }
+    }
+
+    public static void channelClosed(OvsdbClient client) {
+        logger.info("Connection closed {}", client.getConnectionInfo().toString());
+        connections.remove(client);
+        for (OvsdbConnectionListener listener : connectionListeners) {
+            listener.disconnected(client);
+        }
+    }
+}
similarity index 91%
rename from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/jsonrpc/JsonRpcEndpoint.java
rename to library/src/main/java/org/opendaylight/ovsdb/lib/jsonrpc/JsonRpcEndpoint.java
index 8357342b4fb5eb4d657a82514aa05593b9e122e9..ce254f5afd41f8cb855744f0d9c9350e163f2222 100644 (file)
@@ -18,7 +18,6 @@ import java.util.List;
 import java.util.Map;
 import java.util.UUID;
 
-import org.opendaylight.controller.sal.core.Node;
 import org.opendaylight.ovsdb.lib.message.OvsdbRPC;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -29,6 +28,7 @@ import com.fasterxml.jackson.databind.JsonNode;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.type.TypeFactory;
 import com.google.common.collect.Maps;
+import com.google.common.reflect.Invokable;
 import com.google.common.reflect.Reflection;
 import com.google.common.reflect.TypeToken;
 import com.google.common.util.concurrent.ListenableFuture;
@@ -65,21 +65,21 @@ public class JsonRpcEndpoint {
     ObjectMapper objectMapper;
     Channel nettyChannel;
     Map<String, CallContext> methodContext = Maps.newHashMap();
-    Map<Node, OvsdbRPC.Callback> requestCallbacks = Maps.newHashMap();
+    Map<Object, OvsdbRPC.Callback> requestCallbacks = Maps.newHashMap();
 
     public JsonRpcEndpoint(ObjectMapper objectMapper, Channel channel) {
         this.objectMapper = objectMapper;
         this.nettyChannel = channel;
     }
 
-    public <T> T getClient(final Node node, Class<T> klazz) {
+    public <T> T getClient(final Object context, Class<T> klazz) {
 
         return Reflection.newProxy(klazz, new InvocationHandler() {
             @Override
             public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
                 if (method.getName().equals(OvsdbRPC.REGISTER_CALLBACK_METHOD)) {
                     if ((args == null) || args.length != 1 || !(args[0] instanceof OvsdbRPC.Callback)) return false;
-                    requestCallbacks.put(node, (OvsdbRPC.Callback)args[0]);
+                    requestCallbacks.put(context, (OvsdbRPC.Callback)args[0]);
                     return true;
                 }
 
@@ -130,8 +130,6 @@ public class JsonRpcEndpoint {
             JavaType javaType =  TypeFactory.defaultInstance().constructType (retType.getType());
 
             JsonNode result = response.get("result");
-            logger.trace("Result : {}", result.toString());
-
             Object result1 = objectMapper.convertValue(result, javaType);
             JsonNode error = response.get("error");
             if (error != null && !error.isNull()) {
@@ -145,11 +143,11 @@ public class JsonRpcEndpoint {
         }
     }
 
-    public void processRequest(Node node, JsonNode requestJson) {
+    public void processRequest(Object context, JsonNode requestJson) {
         JsonRpc10Request request = new JsonRpc10Request(requestJson.get("id").asText());
         request.setMethod(requestJson.get("method").asText());
         logger.trace("Request : {} {}", requestJson.get("method"), requestJson.get("params"));
-        OvsdbRPC.Callback callback = requestCallbacks.get(node);
+        OvsdbRPC.Callback callback = requestCallbacks.get(context);
         if (callback != null) {
             Method[] methods = callback.getClass().getDeclaredMethods();
             for (Method m : methods) {
@@ -158,7 +156,9 @@ public class JsonRpcEndpoint {
                     JsonNode params = requestJson.get("params");
                     Object param = objectMapper.convertValue(params, parameters[1]);
                     try {
-                        m.invoke(callback, node, param);
+                        Invokable from = Invokable.from(m);
+                        from.setAccessible(true);
+                        from.invoke(callback, context, param);
                     } catch (IllegalAccessException | InvocationTargetException e) {
                         logger.error("Unable to invoke callback " + m.getName(), e);
                     }
@@ -182,7 +182,7 @@ public class JsonRpcEndpoint {
             return;
         }
 
-        logger.error("No handler for Request : {} on {}",requestJson.toString(), node);
+        logger.error("No handler for Request : {} on {}",requestJson.toString(), context);
     }
 
     public Map<String, CallContext> getMethodContext() {
similarity index 85%
rename from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/jsonrpc/JsonRpcServiceBinderHandler.java
rename to library/src/main/java/org/opendaylight/ovsdb/lib/jsonrpc/JsonRpcServiceBinderHandler.java
index 46841a37da120647164f026e7e181f9113644acd..8b93dffeda6e58f86573cd1e8e81d2770a5c2331 100644 (file)
@@ -7,62 +7,61 @@
  *
  * Authors : Ashwin Raveendran, Madhu Venugopal
  */
-package org.opendaylight.ovsdb.lib.jsonrpc;\r
-\r
-import com.fasterxml.jackson.databind.JsonNode;\r
-import com.google.common.base.Strings;\r
-import com.google.common.collect.Maps;\r
-import com.google.common.util.concurrent.SettableFuture;\r
-\r
-import io.netty.channel.ChannelHandlerContext;\r
-import io.netty.channel.ChannelInboundHandlerAdapter;\r
-\r
-import org.opendaylight.controller.sal.core.Node;\r
-import org.slf4j.Logger;\r
-import org.slf4j.LoggerFactory;\r
-\r
-import java.util.Map;\r
-\r
-public class JsonRpcServiceBinderHandler extends ChannelInboundHandlerAdapter {\r
-    protected static final Logger logger = LoggerFactory.getLogger(JsonRpcServiceBinderHandler.class);\r
-    Map<Object, SettableFuture<Object>> waitingForReply = Maps.newHashMap();\r
-    JsonRpcEndpoint factory = null;\r
-    Node node = null;\r
-\r
-    public Node getNode() {\r
-        return node;\r
-    }\r
-\r
-    public void setNode(Node node) {\r
-        this.node = node;\r
-    }\r
-\r
-    public JsonRpcServiceBinderHandler(JsonRpcEndpoint factory) {\r
-        this.factory = factory;\r
-    }\r
-\r
-    @Override\r
-    public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {\r
-\r
-        if (msg instanceof JsonNode) {\r
-            JsonNode jsonNode = (JsonNode) msg;\r
-\r
-            if (jsonNode.has("result")) {\r
-                factory.processResult(jsonNode);\r
-            } else if (jsonNode.hasNonNull("method")) {\r
-                if (jsonNode.has("id") && !Strings.isNullOrEmpty(jsonNode.get("id").asText())) {\r
-                    factory.processRequest(node, jsonNode);\r
-                }\r
-            }\r
-\r
-            return;\r
-        }\r
-\r
-        ctx.channel().close();\r
-    }\r
-\r
-    @Override\r
-    public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {\r
-        ctx.flush();\r
-    }\r
+package org.opendaylight.ovsdb.lib.jsonrpc;
+
+import io.netty.channel.ChannelHandlerContext;
+import io.netty.channel.ChannelInboundHandlerAdapter;
+
+import java.util.Map;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.google.common.base.Strings;
+import com.google.common.collect.Maps;
+import com.google.common.util.concurrent.SettableFuture;
+
+public class JsonRpcServiceBinderHandler extends ChannelInboundHandlerAdapter {
+    protected static final Logger logger = LoggerFactory.getLogger(JsonRpcServiceBinderHandler.class);
+    Map<Object, SettableFuture<Object>> waitingForReply = Maps.newHashMap();
+    JsonRpcEndpoint factory = null;
+    Object context = null;
+
+    public Object getContext() {
+        return context;
+    }
+
+    public void setContext(Object context) {
+        this.context = context;
+    }
+
+    public JsonRpcServiceBinderHandler(JsonRpcEndpoint factory) {
+        this.factory = factory;
+    }
+
+    @Override
+    public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
+
+        if (msg instanceof JsonNode) {
+            JsonNode jsonNode = (JsonNode) msg;
+
+            if (jsonNode.has("result")) {
+                factory.processResult(jsonNode);
+            } else if (jsonNode.hasNonNull("method")) {
+                if (jsonNode.has("id") && !Strings.isNullOrEmpty(jsonNode.get("id").asText())) {
+                    factory.processRequest(context, jsonNode);
+                }
+            }
+
+            return;
+        }
+
+        ctx.channel().close();
+    }
+
+    @Override
+    public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
+        ctx.flush();
+    }
 }
diff --git a/library/src/main/java/org/opendaylight/ovsdb/lib/jsonrpc/JsonUtils.java b/library/src/main/java/org/opendaylight/ovsdb/lib/jsonrpc/JsonUtils.java
new file mode 100644 (file)
index 0000000..ca730ae
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2014 EBay Software Foundation
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Ashwin Raveendran
+ */
+package org.opendaylight.ovsdb.lib.jsonrpc;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.ObjectWriter;
+
+
+public class JsonUtils {
+
+    static ObjectMapper mapper = new ObjectMapper();
+
+    static ObjectWriter prettyWriter = mapper.writerWithDefaultPrettyPrinter();
+
+    public static String prettyString(Object jsonNode){
+        try {
+            return prettyWriter.writeValueAsString(jsonNode);
+        } catch (JsonProcessingException e) {
+            throw new RuntimeException(e);
+        }
+    }
+}
similarity index 93%
rename from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/message/InsertSerializer.java
rename to library/src/main/java/org/opendaylight/ovsdb/lib/message/InsertSerializer.java
index 421aa39f30ee47932d2de036ad6aee1014ab9e78..84b8d7cf1f2e95b091e50aad075e8a0213bc7908 100644 (file)
@@ -11,7 +11,7 @@ package org.opendaylight.ovsdb.lib.message;
 
 import java.io.IOException;
 
-import org.opendaylight.ovsdb.lib.message.operations.InsertOperation;
+import org.opendaylight.ovsdb.lib.operations.InsertOperation;
 
 import com.fasterxml.jackson.core.JsonGenerator;
 import com.fasterxml.jackson.core.JsonProcessingException;
diff --git a/library/src/main/java/org/opendaylight/ovsdb/lib/message/MonitorRequest.java b/library/src/main/java/org/opendaylight/ovsdb/lib/message/MonitorRequest.java
new file mode 100644 (file)
index 0000000..109162e
--- /dev/null
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2013 EBay Software Foundation
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Ashwin Raveendran, Madhu Venugopal
+ */
+package org.opendaylight.ovsdb.lib.message;
+
+import java.util.Set;
+
+import org.opendaylight.ovsdb.lib.schema.TableSchema;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.google.common.collect.Sets;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class MonitorRequest<E extends TableSchema<E>> {
+    @JsonIgnore String tableName;
+    Set<String> columns;
+    MonitorSelect select;
+
+    public MonitorRequest() {
+    }
+
+    public MonitorRequest(String tableName, Set<String> columns) {
+        this.tableName = tableName;
+        this.columns = columns;
+    }
+
+    public MonitorRequest(String tableName) {
+        this.tableName = tableName;
+    }
+
+    public String getTableName() {
+        return tableName;
+    }
+
+    public void setTableName(String tableName) {
+        this.tableName = tableName;
+    }
+
+    public MonitorSelect getSelect() {
+        return select;
+    }
+
+    public void setSelect(MonitorSelect select) {
+        this.select = select;
+    }
+
+    public Set<String> getColumns() {
+        return columns;
+    }
+
+    public void setColumns(Set<String> columns) {
+        this.columns = columns;
+    }
+
+    public void addColumn(String column) {
+        if (columns == null) {
+            columns = Sets.<String>newHashSet();
+        }
+        columns.add(column);
+    }
+}
diff --git a/library/src/main/java/org/opendaylight/ovsdb/lib/message/MonitorRequestBuilder.java b/library/src/main/java/org/opendaylight/ovsdb/lib/message/MonitorRequestBuilder.java
new file mode 100644 (file)
index 0000000..2d56355
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2013 EBay Software Foundation
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Ashwin Raveendran, Madhu Venugopal
+ */
+package org.opendaylight.ovsdb.lib.message;
+
+import java.util.List;
+import java.util.Set;
+
+import org.opendaylight.ovsdb.lib.schema.ColumnSchema;
+import org.opendaylight.ovsdb.lib.schema.TableSchema;
+
+public class MonitorRequestBuilder<E extends TableSchema<E>> {
+
+    E tableSchema;
+    MonitorRequest<E> monitorRequest;
+
+    MonitorRequestBuilder(E tableSchema) {
+        this.tableSchema = tableSchema;
+    }
+
+    public static <T extends TableSchema<T>> MonitorRequestBuilder<T> builder(T tableSchema) {
+        return new MonitorRequestBuilder<>(tableSchema);
+    }
+
+    MonitorRequest<E> getMonitorRequest() {
+        if (monitorRequest == null) {
+            monitorRequest = new MonitorRequest<>();
+        }
+        return monitorRequest;
+    }
+
+    public MonitorRequestBuilder<E> addColumn(String column) {
+        getMonitorRequest().addColumn(column);
+        return this;
+    }
+
+    public MonitorRequestBuilder<E> addColumn(ColumnSchema<?, ?> column) {
+        this.addColumn(column.getName());
+        return this;
+    }
+
+    public MonitorRequestBuilder<E> addColumns(List<ColumnSchema<E, ?>> columns) {
+        for(ColumnSchema<E, ?> schema : columns) {
+            this.addColumn(schema);
+        }
+        return this;
+    }
+
+    public Set<String> getColumns() {
+        return getMonitorRequest().getColumns();
+    }
+
+    public MonitorRequestBuilder<E> with(MonitorSelect select) {
+        getMonitorRequest().setSelect(select);
+        return this;
+    }
+
+    public MonitorRequest<E> build() {
+        MonitorRequest<E> monitorRequest = getMonitorRequest();
+        if (monitorRequest.getSelect() == null) {
+            monitorRequest.setSelect(new MonitorSelect());
+        }
+        monitorRequest.setTableName(tableSchema.getName());
+        return monitorRequest;
+    }
+}
similarity index 68%
rename from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/message/MonitorSelect.java
rename to library/src/main/java/org/opendaylight/ovsdb/lib/message/MonitorSelect.java
index eb15498356e77ef0665fba08ab50d391d16ada46..de53e46ab862e4eef2e741b20b59bd86c059b42a 100644 (file)
@@ -11,17 +11,27 @@ package org.opendaylight.ovsdb.lib.message;
 
 public class MonitorSelect {
 
-    boolean inital;
+    boolean initial;
     boolean insert;
     boolean delete;
     boolean modify;
 
-    public boolean isInital() {
-        return inital;
+    public MonitorSelect(boolean initial, boolean insert, boolean delete, boolean modify) {
+        this.initial = initial;
+        this.insert = insert;
+        this.delete = delete;
+        this.modify = modify;
+    }
+
+    public MonitorSelect() {
+    }
+
+    public boolean isInitial() {
+        return initial;
     }
 
-    public void setInital(boolean inital) {
-        this.inital = inital;
+    public void setInitial(boolean initial) {
+        this.initial = initial;
     }
 
     public boolean isInsert() {
similarity index 69%
rename from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/message/OvsdbRPC.java
rename to library/src/main/java/org/opendaylight/ovsdb/lib/message/OvsdbRPC.java
index 3e2ac3250cfca1f9ef306a3f4d6e9b8e13a8c7eb..cb50d6810577ffab6023859ee65a0b91b813eb04 100644 (file)
@@ -11,20 +11,22 @@ package org.opendaylight.ovsdb.lib.message;
 
 import java.util.List;
 
+import org.opendaylight.ovsdb.lib.operations.OperationResult;
+
+import com.fasterxml.jackson.databind.JsonNode;
 import com.google.common.util.concurrent.ListenableFuture;
 
-import org.opendaylight.controller.sal.core.Node;
-import org.opendaylight.ovsdb.lib.database.DatabaseSchema;
-import org.opendaylight.ovsdb.lib.message.operations.OperationResult;
+import org.opendaylight.ovsdb.lib.jsonrpc.Params;
 
 public interface OvsdbRPC {
     public static final String REGISTER_CALLBACK_METHOD = "registerCallback";
 
-    public ListenableFuture<DatabaseSchema> get_schema(List<String> db_names);
+    //public ListenableFuture<DatabaseSchema> get_schema(List<String> db_names);
+    public ListenableFuture<JsonNode> get_schema(List<String> db_names);
 
     public ListenableFuture<List<String>> echo();
 
-    public ListenableFuture<TableUpdates> monitor(MonitorRequestBuilder request);
+    public ListenableFuture<JsonNode> monitor(Params equest);
 
     public ListenableFuture<List<String>> list_dbs();
 
@@ -42,10 +44,11 @@ public interface OvsdbRPC {
 
     public boolean registerCallback(Callback callback);
 
+
     public static interface Callback {
-        public void update(Node node, UpdateNotification upadateNotification);
-        public void locked(Node node, List<String> ids);
-        public void stolen(Node node, List<String> ids);
+        public void update(Object context, UpdateNotification upadateNotification);
+        public void locked(Object context, List<String> ids);
+        public void stolen(Object context, List<String> ids);
         // ECHO is handled by JsonRPCEndpoint directly.
         // We can add Echo request here if there is a need for clients to handle it.
     }
diff --git a/library/src/main/java/org/opendaylight/ovsdb/lib/message/TableUpdate.java b/library/src/main/java/org/opendaylight/ovsdb/lib/message/TableUpdate.java
new file mode 100644 (file)
index 0000000..b127456
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ *
+ *  * Copyright (C) 2014 EBay Software Foundation
+ *  *
+ *  * This program and the accompanying materials are made available under the
+ *  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ *  * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *  *
+ *  * Authors : Ashwin Raveendran
+ *
+ */
+
+package org.opendaylight.ovsdb.lib.message;
+
+import org.opendaylight.ovsdb.lib.notation.Row;
+import org.opendaylight.ovsdb.lib.notation.UUID;
+import org.opendaylight.ovsdb.lib.schema.TableSchema;
+
+public class TableUpdate<E extends TableSchema<E>> {
+    private UUID uuid;
+    private Row<E> old;
+    private Row<E> new_;
+
+    public TableUpdate(UUID uuid) {
+        super();
+        this.uuid = uuid;
+    }
+
+    public UUID getUuid() {
+        return this.uuid;
+    }
+
+    public Row<E> getOld() {
+        return old;
+    }
+
+    public void setOld(Row<E> old) {
+        this.old = old;
+    }
+
+    public Row<E> getNew() {
+        return new_;
+    }
+
+    public void setNew(Row<E> new_) {
+        this.new_ = new_;
+    }
+
+    @Override
+    public String toString() {
+        return "TableUpdate [uuid=" + uuid + ", old=" + old + ", new_=" + new_
+                + "]";
+    }
+}
diff --git a/library/src/main/java/org/opendaylight/ovsdb/lib/message/TableUpdates.java b/library/src/main/java/org/opendaylight/ovsdb/lib/message/TableUpdates.java
new file mode 100644 (file)
index 0000000..91112ee
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ *
+ *  * Copyright (C) 2014 EBay Software Foundation
+ *  *
+ *  * This program and the accompanying materials are made available under the
+ *  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ *  * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *  *
+ *  * Authors : Ashwin Raveendran
+ *
+ */
+package org.opendaylight.ovsdb.lib.message;
+
+import java.util.Map;
+
+import org.opendaylight.ovsdb.lib.schema.TableSchema;
+
+import com.google.common.collect.Maps;
+
+
+public class TableUpdates extends Response {
+
+    Map<String, TableUpdate> map = Maps.newHashMap();
+
+    public TableUpdates() {
+        this(Maps.<String, TableUpdate>newHashMap());
+    }
+
+    public TableUpdates(Map<String, TableUpdate> map) {
+        this.map = map;
+    }
+
+    public <E extends TableSchema<E>> TableUpdate<E> getUpdate(TableSchema<E> table) {
+        return this.map.get(table.getName());
+    }
+
+    public Map<String, TableUpdate> getUpdates() {
+        return map;
+    }
+
+    @Override
+    public String toString() {
+        return "TableUpdates [map=" + map + ", error=" + error + ", details="
+                + details + ", getError()=" + getError() + ", getDetails()="
+                + getDetails() + ", getClass()=" + getClass() + ", hashCode()="
+                + hashCode() + ", toString()=" + super.toString() + "]";
+    }
+}
similarity index 94%
rename from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/message/TransactBuilder.java
rename to library/src/main/java/org/opendaylight/ovsdb/lib/message/TransactBuilder.java
index 26ffe3bad38e78dc55348dc27a4a2d8a63a3e397..344c1b6584caeb8849d9dbfaf0b3b49997a66d14 100644 (file)
@@ -12,7 +12,7 @@ package org.opendaylight.ovsdb.lib.message;
 import com.google.common.collect.Lists;
 
 import org.opendaylight.ovsdb.lib.jsonrpc.Params;
-import org.opendaylight.ovsdb.lib.message.operations.Operation;
+import org.opendaylight.ovsdb.lib.operations.Operation;
 import java.util.List;
 
 public class TransactBuilder implements Params {
similarity index 91%
rename from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/message/TransactResponse.java
rename to library/src/main/java/org/opendaylight/ovsdb/lib/message/TransactResponse.java
index 279ea60d8a1960ce265e7e2d77a6044bd14ad71c..1ea92e4ab874a4d35f79670b611f4081479c48aa 100644 (file)
@@ -11,7 +11,7 @@ package org.opendaylight.ovsdb.lib.message;
 
 import java.util.ArrayList;
 
-import org.opendaylight.ovsdb.lib.message.operations.OperationResult;
+import org.opendaylight.ovsdb.lib.operations.OperationResult;
 
 public class TransactResponse extends Response {
     ArrayList<OperationResult> result;
similarity index 63%
rename from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/message/UpdateNotification.java
rename to library/src/main/java/org/opendaylight/ovsdb/lib/message/UpdateNotification.java
index 07390cf0b35c7a1ff18e927aa4abf29636e2f3a6..cf7412c050dadf0e48c018eee022ebb8f885ac57 100644 (file)
@@ -9,6 +9,9 @@
  */
 package org.opendaylight.ovsdb.lib.message;
 
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.databind.JsonNode;
+import org.opendaylight.ovsdb.lib.message.temp.TableUpdates;
 import org.opendaylight.ovsdb.lib.notation.json.Converter.UpdateNotificationConverter;
 import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
 
@@ -16,6 +19,8 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
 public class UpdateNotification {
     Object context;
     TableUpdates update;
+    private JsonNode updatesJson;
+
     public Object getContext() {
         return context;
     }
@@ -28,4 +33,19 @@ public class UpdateNotification {
     public void setUpdate(TableUpdates update) {
         this.update = update;
     }
+
+    @JsonAnySetter
+    public void setValue(String key, JsonNode val) {
+        System.out.println("key = " + key);
+        System.out.println("val = " + val);
+        System.out.println();
+    }
+
+    public void setUpdates(JsonNode jsonNode) {
+        this.updatesJson = jsonNode;
+    }
+
+    public JsonNode getUpdates() {
+        return updatesJson;
+    }
 }
similarity index 95%
rename from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/message/TableUpdate.java
rename to library/src/main/java/org/opendaylight/ovsdb/lib/message/temp/TableUpdate.java
index 2bebe92b465c25e9d3b6332b4587c8af251b28ee..62e8788b6c6795c84bb19cbb8e46973865733f96 100644 (file)
@@ -7,7 +7,7 @@
  *
  * Authors : Ashwin Raveendran, Madhu Venugopal
  */
-package org.opendaylight.ovsdb.lib.message;
+package org.opendaylight.ovsdb.lib.message.temp;
 
 import com.fasterxml.jackson.annotation.JsonAnyGetter;
 import com.fasterxml.jackson.annotation.JsonAnySetter;
@@ -18,7 +18,7 @@ import com.google.common.collect.Maps;
 import java.util.Collection;
 import java.util.Map;
 
-import org.opendaylight.ovsdb.lib.table.internal.Table;
+import org.opendaylight.ovsdb.lib.table.Table;
 
 
 public  class TableUpdate<T extends Table>  {
similarity index 89%
rename from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/message/TableUpdates.java
rename to library/src/main/java/org/opendaylight/ovsdb/lib/message/temp/TableUpdates.java
index f484102c00a3960bfa52f57079da7a57f5eab587..d26bd0c950c079f51b37997060284729538ff798 100644 (file)
@@ -7,10 +7,13 @@
  *
  * Authors : Ashwin Raveendran, Madhu Venugopal
  */
-package org.opendaylight.ovsdb.lib.message;
+package org.opendaylight.ovsdb.lib.message.temp;
 
 import com.fasterxml.jackson.annotation.JsonProperty;
 import com.google.common.collect.Maps;
+
+import org.opendaylight.ovsdb.lib.message.Response;
+import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
 import org.opendaylight.ovsdb.lib.table.Bridge;
 import org.opendaylight.ovsdb.lib.table.Capability;
 import org.opendaylight.ovsdb.lib.table.Interface;
@@ -27,7 +30,7 @@ import org.opendaylight.ovsdb.lib.table.SSL;
 import org.opendaylight.ovsdb.lib.table.Flow_Sample_Collector_Set;
 import org.opendaylight.ovsdb.lib.table.Flow_Table;
 import org.opendaylight.ovsdb.lib.table.IPFIX;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
+import org.opendaylight.ovsdb.lib.table.Table;
 
 import java.util.Map;
 import java.util.Set;
@@ -35,7 +38,7 @@ import java.util.Set;
 
 public class TableUpdates extends Response {
 
-    Map<Table.Name, TableUpdate> map = Maps.newHashMap();
+    public Map<Table.Name, TableUpdate> map = Maps.newHashMap();
 
     public Set<Table.Name> availableUpdates() {
         return map.keySet();
@@ -193,4 +196,14 @@ public class TableUpdates extends Response {
     public void setIPFIXUpdate(TableUpdate<IPFIX> IPFIXUpdate) {
         put(IPFIX.NAME, IPFIXUpdate);
     }
+
+    public TableUpdate getUpdate(GenericTableSchema table) {
+        //todo Horrible just for time being, before this whole thing is refactored.
+        for (Map.Entry<Table.Name, TableUpdate> s : this.map.entrySet()) {
+            if (table.getName().equals(s.getKey().getName())) {
+                return s.getValue();
+            }
+        }
+        return null;
+    }
 }
diff --git a/library/src/main/java/org/opendaylight/ovsdb/lib/notation/Column.java b/library/src/main/java/org/opendaylight/ovsdb/lib/notation/Column.java
new file mode 100644 (file)
index 0000000..ed2edd8
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ *
+ *  * Copyright (C) 2014 EBay Software Foundation
+ *  *
+ *  * This program and the accompanying materials are made available under the
+ *  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ *  * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *  *
+ *  * Authors : Ashwin Raveendran
+ *
+ */
+
+package org.opendaylight.ovsdb.lib.notation;
+
+
+import org.opendaylight.ovsdb.lib.schema.ColumnSchema;
+import org.opendaylight.ovsdb.lib.schema.TableSchema;
+
+
+public class Column<E extends TableSchema<E>, D> {
+
+    private ColumnSchema<E, D> schema;
+    private D data;
+
+    public Column(ColumnSchema<E, D> schema, D d) {
+        this.schema = schema;
+        this.data = d;
+    }
+
+    public <E extends TableSchema<E>, T> T getData(ColumnSchema<E, T> schema) {
+        return schema.validate(data);
+    }
+
+    public D getData() {
+        return data;
+    }
+
+    public void setData(D data) {
+        this.data = data;
+    }
+
+    public ColumnSchema<E, D> getSchema() {
+        return schema;
+    }
+
+    public void setSchema(ColumnSchema<E, D> schema) {
+        this.schema = schema;
+    }
+
+    @Override
+    public String toString() {
+        return "Column [schema=" + schema + ", data=" + data + "]";
+    }
+}
similarity index 99%
rename from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/notation/Condition.java
rename to library/src/main/java/org/opendaylight/ovsdb/lib/notation/Condition.java
index 199d67d4dc429a2f2ee5c953e452bf4e6c841824..839efe602d285332246dad4b31f39c5544c5bb8f 100644 (file)
@@ -18,27 +18,34 @@ public class Condition {
     String column;
     Function function;
     Object value;
+
     public Condition(String column, Function function, Object value) {
         super();
         this.column = column;
         this.function = function;
         this.value = value;
     }
+
     public String getColumn() {
         return column;
     }
+
     public void setColumn(String column) {
         this.column = column;
     }
+
     public Function getFunction() {
         return function;
     }
+
     public void setFunction(Function function) {
         this.function = function;
     }
+
     public Object getValue() {
         return value;
     }
+
     public void setValue(Object value) {
         this.value = value;
     }
similarity index 99%
rename from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/notation/Mutation.java
rename to library/src/main/java/org/opendaylight/ovsdb/lib/notation/Mutation.java
index 5d5556c02aaa06f04e4c5c49ee5ac9381038d2e2..ab7a68cd2b3af6e5a2ae7955a43d4ffd27358185 100644 (file)
@@ -12,8 +12,8 @@ package org.opendaylight.ovsdb.lib.notation;
 import org.opendaylight.ovsdb.lib.notation.json.MutationSerializer;
 
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
-@JsonSerialize(using = MutationSerializer.class)
 
+@JsonSerialize(using = MutationSerializer.class)
 public class Mutation {
     String column;
     Mutator mutator;
@@ -25,21 +25,27 @@ public class Mutation {
         this.mutator = mutator;
         this.value = value;
     }
+
     public String getColumn() {
         return column;
     }
+
     public void setColumn(String column) {
         this.column = column;
     }
+
     public Mutator getMutator() {
         return mutator;
     }
+
     public void setMutator(Mutator mutator) {
         this.mutator = mutator;
     }
+
     public Object getValue() {
         return value;
     }
+
     public void setValue(Object value) {
         this.value = value;
     }
similarity index 76%
rename from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/notation/OvsDBMap.java
rename to library/src/main/java/org/opendaylight/ovsdb/lib/notation/OvsDBMap.java
index c3e1e84c00ecffe11a33fcaa707a8e6ba57f78ca..c1a43647012a18be85b0a52a2e15b85fbbc8c9ad 100644 (file)
@@ -9,25 +9,36 @@
  */
 package org.opendaylight.ovsdb.lib.notation;
 
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-import com.fasterxml.jackson.databind.annotation.JsonSerialize;
-import com.google.common.collect.ForwardingMap;
-import com.google.common.collect.Maps;
+import java.util.Map;
 
 import org.opendaylight.ovsdb.lib.notation.json.Converter;
 import org.opendaylight.ovsdb.lib.notation.json.OvsDBMapSerializer;
 
-import java.util.HashMap;
-import java.util.Map;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.google.common.collect.ForwardingMap;
+import com.google.common.collect.Maps;
 
 @JsonDeserialize(converter = Converter.MapConverter.class)
 @JsonSerialize(using = OvsDBMapSerializer.class)
 public class OvsDBMap<K, V> extends ForwardingMap<K, V> {
 
-    HashMap<K, V> target = Maps.newHashMap();
+    Map<K, V> target = Maps.newHashMap();
+
+    public OvsDBMap() {
+        this(Maps.<K,V>newHashMap());
+    }
+
+    public OvsDBMap(Map<K, V> value) {
+        this.target = value;
+    }
 
     @Override
     public Map<K, V> delegate() {
         return target;
     }
+
+    public static<K,V> OvsDBMap<K,V> fromMap(Map<K, V> value) {
+        return new OvsDBMap<K,V>(value);
+    }
 }
similarity index 78%
rename from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/notation/OvsDBSet.java
rename to library/src/main/java/org/opendaylight/ovsdb/lib/notation/OvsDBSet.java
index 210083a253a838a80fc1de2051481e4030832e07..3a5892a1486ccc50373903d83635060c321fc632 100644 (file)
@@ -23,10 +23,22 @@ import java.util.Set;
 @JsonSerialize(using = OvsDBSetSerializer.class)
 public class OvsDBSet<T> extends ForwardingSet<T> {
 
-    Set<T> target = Sets.newHashSet();
+    Set<T> target = null;
+
+    public OvsDBSet() {
+        this(Sets.<T>newHashSet());
+    }
+
+    public OvsDBSet(Set<T> backing) {
+       this.target = backing;
+    }
 
     @Override
     public Set<T> delegate() {
         return target;
     }
+
+    public static<D> OvsDBSet<D> fromSet(Set<D> value) {
+        return new OvsDBSet<>(value);
+    }
 }
diff --git a/library/src/main/java/org/opendaylight/ovsdb/lib/notation/ResultSet.java b/library/src/main/java/org/opendaylight/ovsdb/lib/notation/ResultSet.java
new file mode 100644 (file)
index 0000000..6de6721
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ *
+ *  * Copyright (C) 2014 EBay Software Foundation
+ *  *
+ *  * This program and the accompanying materials are made available under the
+ *  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ *  * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *  *
+ *  * Authors : Ashwin Raveendran
+ *
+ */
+
+package org.opendaylight.ovsdb.lib.notation;
+
+import java.util.List;
+
+/**
+ * A collection of Rows as returned by select and other operations on OVSDB
+ */
+public class ResultSet {
+
+    private List<Row> rows;
+
+    public List<Row> getRows() {
+        return rows;
+    }
+
+    public void setRows(List<Row> rows) {
+        this.rows = rows;
+    }
+}
diff --git a/library/src/main/java/org/opendaylight/ovsdb/lib/notation/Row.java b/library/src/main/java/org/opendaylight/ovsdb/lib/notation/Row.java
new file mode 100644 (file)
index 0000000..3260084
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ *
+ *  * Copyright (C) 2014 EBay Software Foundation
+ *  *
+ *  * This program and the accompanying materials are made available under the
+ *  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ *  * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *  *
+ *  * Authors : Ashwin Raveendran
+ *
+ */
+
+package org.opendaylight.ovsdb.lib.notation;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+import org.opendaylight.ovsdb.lib.schema.ColumnSchema;
+import org.opendaylight.ovsdb.lib.schema.TableSchema;
+
+import com.google.common.collect.Maps;
+
+public class Row<E extends TableSchema<E>> {
+    protected Map<String, Column<E, ?>> columns;
+
+    public Row() {
+        this.columns = Maps.newHashMap();
+    }
+
+    public Row(List<Column<E, ?>> columns) {
+        this.columns = Maps.newHashMap();
+        for (Column<E, ?> column : columns) {
+            this.columns.put(column.getSchema().getName(), column);
+        }
+    }
+
+    public <D> Column<E, D> getColumn(ColumnSchema<E, D> schema) {
+        return (Column<E, D>) columns.get(schema.getName());
+    }
+
+    public Collection<Column<E, ?>> getColumns() {
+        return columns.values();
+    }
+
+    public void addColumn(String columnName, Column<E, ?> data) {
+        this.columns.put(columnName, data);
+    }
+
+    @Override
+    public String toString() {
+        return "Row [columns=" + columns + "]";
+    }
+}
diff --git a/library/src/main/java/org/opendaylight/ovsdb/lib/notation/Version.java b/library/src/main/java/org/opendaylight/ovsdb/lib/notation/Version.java
new file mode 100644 (file)
index 0000000..8298ebc
--- /dev/null
@@ -0,0 +1,118 @@
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ *  Authors : Dave Tucker
+ */
+
+package org.opendaylight.ovsdb.lib.notation;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * This class represents a version according to RFC 7047
+ * The default implementation assumes the left-most digit is most significant when performing comparisons
+ * @see <a href-="http://tools.ietf.org/html/rfc7047#section-3.1">RFC7047 Section 3.1</a>
+ */
+public class Version implements Comparable<Version> {
+
+    int major;
+    int minor;
+    int patch;
+
+    private static final String FORMAT = "(\\d+)\\.(\\d+)\\.(\\d+)";
+    private static final Pattern PATTERN = Pattern.compile(Version.FORMAT);
+
+    public Version(int major, int minor, int patch) {
+        this.major = major;
+        this.minor = minor;
+        this.patch = patch;
+    }
+
+    public static final Version NULL = new Version(0,0,0);
+    public static final String NULL_VERSION_STRING = "0.0.0";
+
+    public static Version fromString(String version){
+        final Matcher matcher = Version.PATTERN.matcher(version);
+        if (!matcher.matches()) {
+            throw new IllegalArgumentException("<"+version+"> does not match format "+Version.FORMAT);
+        }
+        int major = Integer.valueOf(matcher.group(1));
+        int minor = Integer.valueOf(matcher.group(2));
+        int patch = Integer.valueOf(matcher.group(3));
+        return new Version(major, minor, patch);
+    }
+
+    public String toString(){
+        return "" + major + "." + minor + "." + patch;
+    }
+
+    public int getMajor() {
+        return major;
+    }
+
+    public void setMajor(int major) {
+        this.major = major;
+    }
+
+    public int getMinor() {
+        return minor;
+    }
+
+    public void setMinor(int minor) {
+        this.minor = minor;
+    }
+
+    public int getPatch() {
+        return patch;
+    }
+
+    public void setPatch(int patch) {
+        this.patch = patch;
+    }
+
+
+    // ToDo: While format is X.X.X semantics are schema dependent.
+    // Therefore we should allow equals to be overridden by the schema
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+
+        Version version = (Version) o;
+
+        if (major != version.major) return false;
+        if (minor != version.minor) return false;
+        if (patch != version.patch) return false;
+
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        int result = major;
+        result = 31 * result + minor;
+        result = 31 * result + patch;
+        return result;
+    }
+
+    // ToDo: While format is X.X.X semantics are schema dependent
+    // Therefore we should allow compareTo to be overridden by the schema
+    @Override
+    public int compareTo(Version o) {
+        if (this.equals(o)) return 0;
+        if (this.major > o.major) return 1;
+        if (this.major < o.major) return -1;
+        // major is equal
+        if (this.minor > o.minor) return 1;
+        if (this.minor < o.minor) return -1;
+        // minor is equal
+        if (this.patch > o.patch) return 1;
+        // must be less than
+        return -1;
+    }
+}
similarity index 97%
rename from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/notation/json/Converter.java
rename to library/src/main/java/org/opendaylight/ovsdb/lib/notation/json/Converter.java
index dcad62bcbe05715bc2662cc925bd8c8bf0b14baf..017122230eaba74906e1e9301a56937c9acbc510 100644 (file)
@@ -9,7 +9,7 @@
  */
 package org.opendaylight.ovsdb.lib.notation.json;
 
-import org.opendaylight.ovsdb.lib.message.TableUpdates;
+import org.opendaylight.ovsdb.lib.message.temp.TableUpdates;
 import org.opendaylight.ovsdb.lib.message.UpdateNotification;
 import org.opendaylight.ovsdb.lib.notation.OvsDBMap;
 import org.opendaylight.ovsdb.lib.notation.OvsDBSet;
@@ -101,6 +101,7 @@ public class Converter {
             if (node.isArray()) {
                 if (node.size() == 2) {
                     un.setContext(node.get(0).asText());
+                    un.setUpdates(node.get(1));
                     ObjectMapper objectMapper = new ObjectMapper();
                     objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
                     TableUpdates updates = objectMapper.convertValue(node.get(1), TableUpdates.class);
diff --git a/library/src/main/java/org/opendaylight/ovsdb/lib/operations/Abort.java b/library/src/main/java/org/opendaylight/ovsdb/lib/operations/Abort.java
new file mode 100644 (file)
index 0000000..78c4b54
--- /dev/null
@@ -0,0 +1,18 @@
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal
+ */
+package org.opendaylight.ovsdb.lib.operations;
+
+public class Abort extends Operation {
+    public static final String ABORT = "abort";
+
+    public Abort() {
+        super(null, ABORT);
+    }
+}
diff --git a/library/src/main/java/org/opendaylight/ovsdb/lib/operations/Assert.java b/library/src/main/java/org/opendaylight/ovsdb/lib/operations/Assert.java
new file mode 100644 (file)
index 0000000..2d3e291
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal
+ */
+package org.opendaylight.ovsdb.lib.operations;
+
+
+public class Assert extends Operation {
+
+    public static final String ASSERT = "assert";
+    String lock;
+
+    public Assert(String lock) {
+        super(null, ASSERT);
+        this.lock = lock;
+    }
+
+    public String getLock() {
+        return lock;
+    }
+}
similarity index 86%
rename from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/message/operations/AssertOperation.java
rename to library/src/main/java/org/opendaylight/ovsdb/lib/operations/AssertOperation.java
index 0c9bde3041fa3e8e5935b0a1c3599c8c683cec1e..c83ab8473edfdb97f8a338ceb8a5fedaf6a2cf66 100644 (file)
@@ -7,7 +7,7 @@
  *
  * Authors : Madhu Venugopal
  */
-package org.opendaylight.ovsdb.lib.message.operations;
+package org.opendaylight.ovsdb.lib.operations;
 
 public class AssertOperation extends Operation {
 
diff --git a/library/src/main/java/org/opendaylight/ovsdb/lib/operations/Comment.java b/library/src/main/java/org/opendaylight/ovsdb/lib/operations/Comment.java
new file mode 100644 (file)
index 0000000..f2a6ba5
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal
+ */
+package org.opendaylight.ovsdb.lib.operations;
+
+
+public class Comment extends Operation {
+
+    public static final String COMMENT = "comment";
+    String comment;
+
+    public Comment(String comment) {
+        super(null, COMMENT);
+        this.comment = comment;
+    }
+
+    public String getComment() {
+        return comment;
+    }
+}
similarity index 86%
rename from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/message/operations/CommentOperation.java
rename to library/src/main/java/org/opendaylight/ovsdb/lib/operations/CommentOperation.java
index cf38369c54ce24e3a5cf1b329fe18aa0435839e8..90035d4a2449db8f430fbfe74a6d2015f5d36bf3 100644 (file)
@@ -7,7 +7,7 @@
  *
  * Authors : Madhu Venugopal
  */
-package org.opendaylight.ovsdb.lib.message.operations;
+package org.opendaylight.ovsdb.lib.operations;
 
 public class CommentOperation extends Operation {
 
diff --git a/library/src/main/java/org/opendaylight/ovsdb/lib/operations/Commit.java b/library/src/main/java/org/opendaylight/ovsdb/lib/operations/Commit.java
new file mode 100644 (file)
index 0000000..19ddd8d
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal
+ */
+package org.opendaylight.ovsdb.lib.operations;
+
+
+public class Commit extends Operation {
+
+    public static final String COMMIT = "commit";
+    Boolean durable;
+
+    public Commit(Boolean durable) {
+        super(null, COMMIT);
+        this.durable = durable;
+    }
+
+    public Boolean isDurable() {
+        return durable;
+    }
+}
diff --git a/library/src/main/java/org/opendaylight/ovsdb/lib/operations/ConditionalOperation.java b/library/src/main/java/org/opendaylight/ovsdb/lib/operations/ConditionalOperation.java
new file mode 100644 (file)
index 0000000..fc10cce
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 EBay Software Foundation
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Ashwin Raveendran
+ */
+package org.opendaylight.ovsdb.lib.operations;
+
+import org.opendaylight.ovsdb.lib.notation.Condition;
+
+/**
+ * Represents an Operation type that accepts a condition, for e.g Update, Select etc
+ */
+public interface ConditionalOperation {
+
+    public void addCondition(Condition condition);
+}
diff --git a/library/src/main/java/org/opendaylight/ovsdb/lib/operations/Delete.java b/library/src/main/java/org/opendaylight/ovsdb/lib/operations/Delete.java
new file mode 100644 (file)
index 0000000..c4e8290
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2014 Red Hat Inc,
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Dave Tucker
+ *
+ */
+
+package org.opendaylight.ovsdb.lib.operations;
+
+import java.util.List;
+
+import org.opendaylight.ovsdb.lib.notation.Condition;
+import org.opendaylight.ovsdb.lib.schema.TableSchema;
+
+import com.google.common.collect.Lists;
+
+public class Delete<E extends TableSchema<E>> extends Operation<E> implements ConditionalOperation {
+
+    public static final String DELETE = "delete";
+    List<Condition> where = Lists.newArrayList();
+    Integer count;
+
+    public Delete(TableSchema<E> schema) {
+        super(schema, DELETE);
+    }
+
+    public Delete<E> on(TableSchema schema){
+        return this;
+    }
+
+    public Where where(Condition condition) {
+        where.add(condition);
+        return new Where(this);
+    }
+
+    @Override
+    public void addCondition(Condition condition) {
+        this.where.add(condition);
+    }
+
+    public List<Condition> getWhere() {
+        return where;
+    }
+
+    public void setWhere(List<Condition> where) {
+        this.where = where;
+    }
+
+    public Integer getCount() {
+        return count;
+    }
+
+    public void setCount(Integer count) {
+        this.count = count;
+    }
+}
similarity index 95%
rename from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/message/operations/DeleteOperation.java
rename to library/src/main/java/org/opendaylight/ovsdb/lib/operations/DeleteOperation.java
index 612a5ebd1f43d89731bd27c0419936c4062a6948..6cafeb2fcf9a3f8098f3b65916048a51ced4841d 100644 (file)
@@ -7,7 +7,7 @@
  *
  * Authors : Madhu Venugopal
  */
-package org.opendaylight.ovsdb.lib.message.operations;
+package org.opendaylight.ovsdb.lib.operations;
 
 import java.util.List;
 
diff --git a/library/src/main/java/org/opendaylight/ovsdb/lib/operations/Insert.java b/library/src/main/java/org/opendaylight/ovsdb/lib/operations/Insert.java
new file mode 100644 (file)
index 0000000..95d7054
--- /dev/null
@@ -0,0 +1,85 @@
+/*
+ * Copyright (C) 2014 EBay Software Foundation
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Ashwin Raveendran
+ */
+package org.opendaylight.ovsdb.lib.operations;
+
+import java.util.Map;
+
+import org.opendaylight.ovsdb.lib.notation.Column;
+import org.opendaylight.ovsdb.lib.schema.ColumnSchema;
+import org.opendaylight.ovsdb.lib.schema.TableSchema;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.google.common.collect.Maps;
+
+
+public class Insert<E extends TableSchema<E>> extends Operation<E> {
+
+    public static final String INSERT = "insert";
+
+    String uuid;
+
+    @JsonProperty("uuid-name")
+    private String uuidName;
+
+    private Map<String, Object> row = Maps.newHashMap();
+
+    public Insert<E> on(TableSchema schema){
+        this.setTableSchema(schema);
+        return this;
+    }
+
+    public Insert<E> withId(String name) {
+        this.uuidName = name;
+        this.setOp(INSERT);
+        return this;
+    }
+
+
+    public Insert(TableSchema<E> schema) {
+        super(schema, INSERT);
+    }
+
+    public <D, C extends TableSchema<C>> Insert<E> value(ColumnSchema<C, D> columnSchema, D value) {
+        Object untypedValue = columnSchema.getNormalizeData(value);
+        row.put(columnSchema.getName(), untypedValue);
+        return this;
+    }
+
+    public <D, C extends TableSchema<C>> Insert<E> value(Column<C, D> column) {
+        ColumnSchema<C, D> columnSchema = column.getSchema();
+        D value = column.getData();
+        return this.value(columnSchema, value);
+    }
+
+    public String getUuid() {
+        return uuid;
+    }
+
+    public void setUuid(String uuid) {
+        this.uuid = uuid;
+    }
+
+    public String getUuidName() {
+        return uuidName;
+    }
+
+    public void setUuidName(String uuidName) {
+        this.uuidName = uuidName;
+    }
+
+    public Map<String, Object> getRow() {
+        return row;
+    }
+
+    public void setRow(Map<String, Object> row) {
+        this.row = row;
+    }
+
+}
similarity index 93%
rename from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/message/operations/InsertOperation.java
rename to library/src/main/java/org/opendaylight/ovsdb/lib/operations/InsertOperation.java
index 57e507739aed0d4c27f5fc1e4e747d91c1b4af82..5552665d4ffed707751dec99ae080b12919c57a4 100644 (file)
@@ -7,9 +7,9 @@
  *
  * Authors : Madhu Venugopal
  */
-package org.opendaylight.ovsdb.lib.message.operations;
+package org.opendaylight.ovsdb.lib.operations;
 
-import org.opendaylight.ovsdb.lib.table.internal.Table;
+import org.opendaylight.ovsdb.lib.table.Table;
 
 import com.fasterxml.jackson.annotation.JsonProperty;
 // TODO Madhu : This is not complete. Getting it in to enable other committers to make progress
diff --git a/library/src/main/java/org/opendaylight/ovsdb/lib/operations/Mutate.java b/library/src/main/java/org/opendaylight/ovsdb/lib/operations/Mutate.java
new file mode 100644 (file)
index 0000000..4bb494c
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2014 Matt Oswalt
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Matt Oswalt
+ *
+ */
+package org.opendaylight.ovsdb.lib.operations;
+
+import java.util.List;
+
+import org.opendaylight.ovsdb.lib.notation.Condition;
+import org.opendaylight.ovsdb.lib.notation.Mutation;
+import org.opendaylight.ovsdb.lib.notation.Mutator;
+import org.opendaylight.ovsdb.lib.schema.ColumnSchema;
+import org.opendaylight.ovsdb.lib.schema.TableSchema;
+
+import com.google.common.collect.Lists;
+
+public class Mutate<E extends TableSchema<E>> extends Operation<E> implements ConditionalOperation {
+
+    public static final String MUTATE = "mutate";
+    List<Condition> where = Lists.newArrayList();
+    private List<Mutation> mutations = Lists.newArrayList();
+
+    public Mutate on(TableSchema schema){
+        this.setTableSchema(schema);
+        return this;
+    }
+
+    public Mutate(TableSchema<E> schema) {
+        super(schema, MUTATE);
+    }
+
+    public <T extends TableSchema<T>, D> Mutate<E> addMutation(ColumnSchema<T, D> columnSchema, Mutator mutator, D value) {
+        columnSchema.validate(value);
+        Object untypedValue = columnSchema.getNormalizeData(value);
+        mutations.add(new Mutation(columnSchema.getName(), mutator, untypedValue));
+        return this;
+    }
+
+    public List<Mutation> getMutations() {
+        return mutations;
+    }
+
+    public void setMutations(List<Mutation> mutations) {
+        this.mutations = mutations;
+    }
+
+    @Override
+    public void addCondition(Condition condition) {
+        this.where.add(condition);
+    }
+
+    public Where where(Condition condition) {
+        this.where.add(condition);
+        return new Where(this);
+    }
+
+    public List<Condition> getWhere() {
+        return where;
+    }
+
+    public void setWhere(List<Condition> where) {
+        this.where = where;
+    }
+}
\ No newline at end of file
similarity index 93%
rename from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/message/operations/MutateOperation.java
rename to library/src/main/java/org/opendaylight/ovsdb/lib/operations/MutateOperation.java
index 72ab481da2dffe8c86f129f661d31f81de79a897..24d99d9e3b3577d491a42c3a2a295e30edbb315c 100644 (file)
@@ -7,7 +7,7 @@
  *
  * Authors : Madhu Venugopal
  */
-package org.opendaylight.ovsdb.lib.message.operations;
+package org.opendaylight.ovsdb.lib.operations;
 
 import java.util.List;
 
@@ -20,31 +20,38 @@ public class MutateOperation extends Operation {
     List<Mutation> mutations;
 
     public MutateOperation(String table, List<Condition> where,
-            List<Mutation> mutations) {
+                           List<Mutation> mutations) {
         super();
         super.setOp("mutate");
         this.table = table;
         this.where = where;
         this.mutations = mutations;
     }
+
     public String getTable() {
         return table;
     }
+
     public void setTable(String table) {
         this.table = table;
     }
+
     public List<Condition> getWhere() {
         return where;
     }
+
     public void setWhere(List<Condition> where) {
         this.where = where;
     }
+
     public List<Mutation> getMutations() {
         return mutations;
     }
+
     public void setMutations(List<Mutation> mutations) {
         this.mutations = mutations;
     }
+
     @Override
     public String toString() {
         return "MutateOperation [table=" + table + ", where=" + where
diff --git a/library/src/main/java/org/opendaylight/ovsdb/lib/operations/Operation.java b/library/src/main/java/org/opendaylight/ovsdb/lib/operations/Operation.java
new file mode 100644 (file)
index 0000000..00156aa
--- /dev/null
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2013 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal, Ashwin Raveendran
+ */
+package org.opendaylight.ovsdb.lib.operations;
+
+import org.opendaylight.ovsdb.lib.schema.TableSchema;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public abstract class Operation<E extends TableSchema<E>> {
+
+    @JsonIgnore
+    private TableSchema<E> tableSchema;
+
+    private String op;
+
+    @JsonIgnore
+    //todo(Ashwin): remove this
+    // Just a simple way to retain the result of a transact operation which the client can refer to.
+    private OperationResult result;
+
+
+    protected Operation() {
+    }
+
+    protected Operation(TableSchema<E> tableSchema) {
+        this.tableSchema = tableSchema;
+    }
+
+    public Operation(TableSchema<E> schema, String operation) {
+        this.tableSchema = schema;
+        this.op = operation;
+    }
+
+    public String getOp() {
+        return op;
+    }
+
+    public void setOp(String op) {
+        this.op = op;
+    }
+
+    public OperationResult getResult() {
+        return result;
+    }
+
+    public void setResult(OperationResult result) {
+        this.result = result;
+    }
+
+    public TableSchema<E> getTableSchema() {
+        return tableSchema;
+    }
+
+    public void setTableSchema(TableSchema<E> tableSchema) {
+        this.tableSchema = tableSchema;
+    }
+
+    @JsonProperty
+    public String getTable() {
+        return (tableSchema == null) ? null : tableSchema.getName();
+    }
+
+    @Override
+    public String toString() {
+        return "Operation [op=" + op + ", result=" + result + "]";
+    }
+
+}
similarity index 86%
rename from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/message/operations/OperationResult.java
rename to library/src/main/java/org/opendaylight/ovsdb/lib/operations/OperationResult.java
index e019394894b497ebf61052d2352d5a52f388be9e..1840e5a662ccfbb705e832f403771bac2a1c0823 100644 (file)
@@ -7,12 +7,14 @@
  *
  * Authors : Madhu Venugopal
  */
-package org.opendaylight.ovsdb.lib.message.operations;
+package org.opendaylight.ovsdb.lib.operations;
 
 import java.util.ArrayList;
 import java.util.List;
 
+import org.opendaylight.ovsdb.lib.notation.Row;
 import org.opendaylight.ovsdb.lib.notation.UUID;
+import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
 
 import com.fasterxml.jackson.annotation.JsonIgnore;
 import com.fasterxml.jackson.annotation.JsonProperty;
@@ -30,7 +32,7 @@ public class OperationResult {
     private int count;
     @JsonIgnore
     private UUID uuid;
-    private ArrayList<Object> rows;
+    private ArrayList<Row<GenericTableSchema>> rows;
     private String error;
     private String details;
 
@@ -47,10 +49,10 @@ public class OperationResult {
     public void setUuid(List<String> uuidList) {
         this.uuid = new UUID(uuidList.get(1));
     }
-    public ArrayList<Object> getRows() {
+    public ArrayList<Row<GenericTableSchema>> getRows() {
         return rows;
     }
-    public void setRows(ArrayList<Object> rows) {
+    public void setRows(ArrayList<Row<GenericTableSchema>> rows) {
         this.rows = rows;
     }
     public String getError() {
diff --git a/library/src/main/java/org/opendaylight/ovsdb/lib/operations/Operations.java b/library/src/main/java/org/opendaylight/ovsdb/lib/operations/Operations.java
new file mode 100644 (file)
index 0000000..c88b0ad
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ *
+ *  * Copyright (C) 2014 EBay Software Foundation
+ *  *
+ *  * This program and the accompanying materials are made available under the
+ *  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ *  * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *  *
+ *  * Authors : Ashwin Raveendran
+ *
+ */
+
+package org.opendaylight.ovsdb.lib.operations;
+
+import org.opendaylight.ovsdb.lib.schema.TableSchema;
+
+public class Operations {
+    public static Operations op = new Operations();
+
+    public <E extends TableSchema<E>> Insert<E> insert(TableSchema<E> schema) {
+        return new Insert<>(schema);
+    }
+
+    public <E extends TableSchema<E>> Update<E> update(TableSchema<E> schema) {
+        return new Update<>(schema);
+    }
+
+    public <E extends TableSchema<E>> Delete<E> delete(TableSchema<E> schema) {
+        return new Delete<>(schema);
+    }
+
+    public <E extends TableSchema<E>> Mutate<E> mutate(TableSchema<E> schema) {
+        return new Mutate<>(schema);
+    }
+
+    public Commit commit(Boolean durable) {
+        return new Commit(durable);
+    }
+
+    public Abort abort() {
+        return new Abort();
+    }
+
+    public <E extends TableSchema<E>> Select<E> select(TableSchema<E> schema) {
+        return new Select<>(schema);
+    }
+
+    public Comment comment(String comment) {
+        return new Comment(comment);
+    }
+
+    /*
+     * Could not use Java keyword "assert" which clashes with the ovsdb json-rpc method.
+     * using assertion instead.
+     */
+    public Assert assertion(String lock) {
+        return new Assert(lock);
+    }
+}
diff --git a/library/src/main/java/org/opendaylight/ovsdb/lib/operations/Select.java b/library/src/main/java/org/opendaylight/ovsdb/lib/operations/Select.java
new file mode 100644 (file)
index 0000000..d3d7805
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2014 Red Hat Inc,
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Dave Tucker
+ *
+ */
+package org.opendaylight.ovsdb.lib.operations;
+
+import com.google.common.collect.Lists;
+import org.opendaylight.ovsdb.lib.notation.Condition;
+import org.opendaylight.ovsdb.lib.schema.ColumnSchema;
+import org.opendaylight.ovsdb.lib.schema.TableSchema;
+
+import java.util.List;
+
+public class Select<E extends TableSchema<E>> extends Operation<E> implements ConditionalOperation {
+
+    public static final String SELECT = "select";
+    List<Condition> where = Lists.newArrayList();
+    private List<String> columns = Lists.newArrayList();
+
+    public Select on(TableSchema schema){
+        this.setTableSchema(schema);
+        return this;
+    }
+
+    public Select(TableSchema<E> schema) {
+        super(schema, SELECT);
+    }
+
+    public <D, C extends TableSchema<C>> Select<E> column(ColumnSchema<C, D> columnSchema) {
+        columns.add(columnSchema.getName());
+        return this;
+    }
+
+    public Where where(Condition condition) {
+        where.add(condition);
+        return new Where(this);
+    }
+
+    public List<String> getColumns() {
+        return columns;
+    }
+
+    public void setColumns(List<String> columns) {
+        this.columns = columns;
+    }
+
+    @Override
+    public void addCondition(Condition condition) {
+        this.where.add(condition);
+    }
+
+    public List<Condition> getWhere() {
+        return where;
+    }
+
+    public void setWhere(List<Condition> where) {
+        this.where = where;
+    }
+}
\ No newline at end of file
similarity index 96%
rename from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/message/operations/SelectOperation.java
rename to library/src/main/java/org/opendaylight/ovsdb/lib/operations/SelectOperation.java
index edcfb2a949a9ebe2ead66f038c9c9359e6b46a86..5857e3372ba4c081f959b6203fdfdd73a12580ed 100644 (file)
@@ -7,7 +7,7 @@
  *
  * Authors : Madhu Venugopal
  */
-package org.opendaylight.ovsdb.lib.message.operations;
+package org.opendaylight.ovsdb.lib.operations;
 
 import java.util.List;
 
diff --git a/library/src/main/java/org/opendaylight/ovsdb/lib/operations/TransactionBuilder.java b/library/src/main/java/org/opendaylight/ovsdb/lib/operations/TransactionBuilder.java
new file mode 100644 (file)
index 0000000..37eb2aa
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ *
+ *  * Copyright (C) 2014 EBay Software Foundation
+ *  *
+ *  * This program and the accompanying materials are made available under the
+ *  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ *  * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *  *
+ *  * Authors : Ashwin Raveendran
+ *
+ */
+
+package org.opendaylight.ovsdb.lib.operations;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.opendaylight.ovsdb.lib.impl.OvsdbClientImpl;
+import org.opendaylight.ovsdb.lib.schema.DatabaseSchema;
+
+import com.google.common.collect.Lists;
+import com.google.common.util.concurrent.ListenableFuture;
+
+public class TransactionBuilder {
+
+    private DatabaseSchema eDatabaseSchema;
+    OvsdbClientImpl ovs;
+    ArrayList<Operation> operations = Lists.newArrayList();
+
+    public TransactionBuilder(OvsdbClientImpl ovs) {
+        this.ovs = ovs;
+    }
+
+    public TransactionBuilder(DatabaseSchema eDatabaseSchema) {
+        this.eDatabaseSchema = eDatabaseSchema;
+    }
+
+    public ArrayList<Operation> getOperations() {
+        return operations;
+    }
+
+    public TransactionBuilder add(Operation operation) {
+        operations.add(operation);
+        return this;
+    }
+
+    public List<Operation> build() {
+        return operations;
+    }
+
+    public ListenableFuture<List<OperationResult>> execute() {
+        return ovs.transact(operations);
+    }
+}
diff --git a/library/src/main/java/org/opendaylight/ovsdb/lib/operations/Update.java b/library/src/main/java/org/opendaylight/ovsdb/lib/operations/Update.java
new file mode 100644 (file)
index 0000000..3f71b51
--- /dev/null
@@ -0,0 +1,99 @@
+/*
+ *
+ *  * Copyright (C) 2014 EBay Software Foundation
+ *  *
+ *  * This program and the accompanying materials are made available under the
+ *  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ *  * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *  *
+ *  * Authors : Ashwin Raveendran
+ *
+ */
+
+package org.opendaylight.ovsdb.lib.operations;
+
+import java.util.List;
+import java.util.Map;
+
+import org.opendaylight.ovsdb.lib.notation.Column;
+import org.opendaylight.ovsdb.lib.notation.Condition;
+import org.opendaylight.ovsdb.lib.schema.ColumnSchema;
+import org.opendaylight.ovsdb.lib.schema.TableSchema;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+
+public class Update<E extends TableSchema<E>> extends Operation<E> implements ConditionalOperation {
+
+    public static final String UPDATE = "update";
+
+    Map<String, Object> row = Maps.newHashMap();
+    String uuid;
+    //Where where;
+    List<Condition> where = Lists.newArrayList();
+
+    private String uuidName;
+
+    public Update(TableSchema<E> schema) {
+        super(schema, UPDATE);
+    }
+
+    public Update<E> on(TableSchema schema){
+        return this;
+    }
+
+    public <T extends TableSchema<T>, D> Update<E> set(ColumnSchema<T, D> columnSchema, D value) {
+        columnSchema.validate(value);
+        Object untypedValue = columnSchema.getNormalizeData(value);
+        this.row.put(columnSchema.getName(), untypedValue);
+        return this;
+    }
+
+    public <T extends TableSchema<T>, D> Update<E> set(Column<T, D> column) {
+        ColumnSchema<T, D> columnSchema = column.getSchema();
+        D value = column.getData();
+        return this.set(columnSchema, value);
+    }
+
+    public Where where(Condition condition) {
+        where.add(condition);
+        return new Where(this);
+    }
+
+    public String getUuid() {
+        return uuid;
+    }
+
+    public void setUuid(String uuid) {
+        this.uuid = uuid;
+    }
+
+    public String getUuidName() {
+        return uuidName;
+    }
+
+    public void setUuidName(String uuidName) {
+        this.uuidName = uuidName;
+    }
+
+    public Map<String, Object> getRow() {
+        return row;
+    }
+
+    public void setRow(Map<String, Object> row) {
+        this.row = row;
+    }
+
+    @Override
+    public void addCondition(Condition condition) {
+        this.where.add(condition);
+    }
+
+    public List<Condition> getWhere() {
+        return where;
+    }
+
+    public void setWhere(List<Condition> where) {
+        this.where = where;
+    }
+}
similarity index 92%
rename from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/message/operations/UpdateOperation.java
rename to library/src/main/java/org/opendaylight/ovsdb/lib/operations/UpdateOperation.java
index e676f613ae1d20d54f2e50f1db33f38a3d6af875..0103d965c26e38dd5a6e3e0bcd8146df52230abd 100644 (file)
@@ -7,12 +7,12 @@
  *
  * Authors : Madhu Venugopal
  */
-package org.opendaylight.ovsdb.lib.message.operations;
+package org.opendaylight.ovsdb.lib.operations;
 
 import java.util.List;
 
 import org.opendaylight.ovsdb.lib.notation.Condition;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
+import org.opendaylight.ovsdb.lib.table.Table;
 //TODO Madhu : This is not complete. Getting it in to enable other committers to make progress
 public class UpdateOperation extends Operation {
     String table;
similarity index 86%
rename from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/message/operations/WaitOperation.java
rename to library/src/main/java/org/opendaylight/ovsdb/lib/operations/WaitOperation.java
index 49ecd5bf6b58e184ec26cd4fcc0af31733bab509..c152c82a4458cd539c1b036eb6b82a88b7b029b6 100644 (file)
@@ -7,7 +7,7 @@
  *
  * Authors : Madhu Venugopal
  */
-package org.opendaylight.ovsdb.lib.message.operations;
+package org.opendaylight.ovsdb.lib.operations;
 
 public class WaitOperation extends Operation {
 
diff --git a/library/src/main/java/org/opendaylight/ovsdb/lib/operations/Where.java b/library/src/main/java/org/opendaylight/ovsdb/lib/operations/Where.java
new file mode 100644 (file)
index 0000000..de2894b
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ *
+ *  * Copyright (C) 2014 EBay Software Foundation
+ *  *
+ *  * This program and the accompanying materials are made available under the
+ *  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ *  * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *  *
+ *  * Authors : Ashwin Raveendran
+ *
+ */
+
+package org.opendaylight.ovsdb.lib.operations;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import org.opendaylight.ovsdb.lib.notation.Condition;
+import org.opendaylight.ovsdb.lib.notation.Function;
+import org.opendaylight.ovsdb.lib.schema.ColumnSchema;
+
+public class Where {
+
+    @JsonIgnore
+    ConditionalOperation operation;
+
+    public Where() {
+    }
+
+    public Where(ConditionalOperation operation) {
+        this.operation = operation;
+    }
+
+    public Where condition(Condition condition) {
+        operation.addCondition(condition);
+        return this;
+    }
+
+    public Where condition(ColumnSchema column, Function function, Object value) {
+        this.condition(new Condition(column.getName(), function, value));
+        return this;
+    }
+
+    public Where and(ColumnSchema column, Function function, Object value) {
+        condition(column, function, value);
+        return this;
+    }
+
+    public Where and(Condition condition) {
+        condition(condition);
+        return this;
+    }
+
+    public Operation build() {
+        return (Operation) this.operation;
+    }
+
+}
diff --git a/library/src/main/java/org/opendaylight/ovsdb/lib/schema/BaseType.java b/library/src/main/java/org/opendaylight/ovsdb/lib/schema/BaseType.java
new file mode 100644 (file)
index 0000000..52c2f1a
--- /dev/null
@@ -0,0 +1,412 @@
+/*
+ * Copyright (C) 2014 EBay Software Foundation
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Ashwin Raveendran
+ */
+package org.opendaylight.ovsdb.lib.schema;
+
+import java.util.Set;
+
+import org.opendaylight.ovsdb.lib.notation.UUID;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.google.common.collect.Sets;
+
+public abstract class BaseType<E extends BaseType<E>> {
+
+    private static BaseType[] types = new BaseType[]{
+            new StringBaseType(),
+            new IntegerBaseType(),
+            new RealBaseType(),
+            new BooleanBaseType(),
+            new UuidBaseType(),
+    };
+
+    public static BaseType fromJson(JsonNode json, String keyorval) {
+        BaseType baseType = null;
+        if (json.isValueNode()) {
+            for (BaseType baseTypeFactory : types) {
+                String type = json.asText().trim();
+                baseType = baseTypeFactory.fromString(type);
+                if (baseType != null) {
+                    break;
+                }
+            }
+        } else {
+            if (!json.has(keyorval)) {
+                throw new RuntimeException("Not a type");
+            }
+
+            for (BaseType baseTypeFactory : types) {
+                baseType = baseTypeFactory.fromJsonNode(json.get(keyorval), keyorval);
+                if (baseType != null) {
+                    break;
+                }
+            }
+        }
+        return baseType;
+    }
+
+    protected abstract E fromString(String type);
+
+    protected abstract void getConstraints(E baseType, JsonNode type);
+
+    protected E fromJsonNode(JsonNode type, String keyorval) {
+
+        E baseType = null;
+
+        //json like  "string"
+        if (type.isTextual()) {
+            baseType = fromString(type.asText());
+            if (baseType != null) {
+                return baseType;
+            }
+        }
+
+        //json like  {"type" : "string", "enum": ["set", ["access", "native-tagged"]]}" for key or value
+        if (type.isObject() && type.has("type")) {
+            baseType = fromString(type.get("type").asText());
+            if (baseType != null) {
+                getConstraints(baseType, type);
+            }
+        }
+
+        return baseType;
+    }
+
+    public abstract Object toValue(JsonNode value);
+
+    public abstract void validate(Object value);
+
+    public static class IntegerBaseType extends BaseType<IntegerBaseType> {
+        long min = Long.MIN_VALUE;
+        long max = Long.MAX_VALUE;
+        Set<Integer> enums;
+
+        @Override
+        public IntegerBaseType fromString(String typeString) {
+            return "integer".equals(typeString) ? new IntegerBaseType() : null;
+        }
+
+        @Override
+        protected void getConstraints(IntegerBaseType baseType, JsonNode type) {
+
+            JsonNode node = null;
+
+            if ((node = type.get("maxInteger")) != null) {
+                baseType.setMax(node.asLong());
+            }
+
+            if ((node = type.get("minInteger")) != null) {
+                baseType.setMin(node.asLong());
+            }
+
+            populateEnum(type);
+        }
+
+        @Override
+        public Object toValue(JsonNode value) {
+            return value.asLong();
+        }
+
+        @Override
+        public void validate(Object value) {
+
+        }
+
+        private void populateEnum(JsonNode node) {
+            if (node.has("enum")) {
+                Set<Long> s = Sets.newHashSet();
+                JsonNode anEnum = node.get("enum").get(1);
+                for (JsonNode n : anEnum) {
+                    s.add(n.asLong());
+                }
+            }
+        }
+
+
+        public long getMin() {
+            return min;
+        }
+
+        public void setMin(long min) {
+            this.min = min;
+        }
+
+        public long getMax() {
+            return max;
+        }
+
+        public void setMax(long max) {
+            this.max = max;
+        }
+
+        public Set<Integer> getEnums() {
+            return enums;
+        }
+
+        public void setEnums(Set<Integer> enums) {
+            this.enums = enums;
+        }
+
+        @Override
+        public String toString() {
+            return "IntegerBaseType";
+        }
+    }
+
+    public static class RealBaseType extends BaseType<RealBaseType> {
+        double min = Double.MIN_VALUE;
+        double max = Double.MAX_VALUE;
+        Set<Double> enums;
+
+        @Override
+        public RealBaseType fromString(String typeString) {
+            return "real".equals(typeString) ? new RealBaseType() : null;
+        }
+
+        @Override
+        protected void getConstraints(RealBaseType baseType, JsonNode type) {
+
+            JsonNode node = null;
+
+            if ((node = type.get("maxReal")) != null) {
+                baseType.setMax(node.asLong());
+            }
+
+            if ((node = type.get("minReal")) != null) {
+                baseType.setMin(node.asLong());
+            }
+
+            populateEnum(type);
+        }
+
+        @Override
+        public Object toValue(JsonNode value) {
+            return value.asDouble();
+        }
+
+        @Override
+        public void validate(Object value) {
+
+        }
+
+        private void populateEnum(JsonNode node) {
+            if (node.has("enum")) {
+                Set<Double> s = Sets.newHashSet();
+                JsonNode anEnum = node.get("enum").get(1);
+                for (JsonNode n : anEnum) {
+                    s.add(n.asDouble());
+                }
+            }
+        }
+
+        public double getMin() {
+            return min;
+        }
+
+        public void setMin(double min) {
+            this.min = min;
+        }
+
+        public double getMax() {
+            return max;
+        }
+
+        public void setMax(double max) {
+            this.max = max;
+        }
+
+        public Set<Double> getEnums() {
+            return enums;
+        }
+
+        public void setEnums(Set<Double> enums) {
+            this.enums = enums;
+        }
+
+        @Override
+        public String toString() {
+            return "RealBaseType";
+        }
+    }
+
+
+    public static class BooleanBaseType extends BaseType {
+
+        @Override
+        public BooleanBaseType fromString(String typeString) {
+            return "boolean".equals(typeString) ? new BooleanBaseType() : null;
+        }
+
+        @Override
+        protected void getConstraints(BaseType baseType, JsonNode node) {
+            //no op
+        }
+
+        @Override
+        public Object toValue(JsonNode value) {
+            return value.asBoolean();
+        }
+
+        @Override
+        public void validate(Object value) {
+
+        }
+
+        @Override
+        public String toString() {
+            return "BooleanBaseType";
+        }
+    }
+
+    public static class StringBaseType extends BaseType<StringBaseType> {
+        int minLength = Integer.MIN_VALUE;
+        int maxLength = Integer.MAX_VALUE;
+        Set<String> enums;
+
+        @Override
+        public StringBaseType fromString(String typeString) {
+            return "string".equals(typeString) ? new StringBaseType() : null;
+        }
+
+        @Override
+        protected void getConstraints(StringBaseType baseType, JsonNode type) {
+
+            JsonNode node = null;
+
+            if ((node = type.get("maxLength")) != null) {
+                baseType.setMaxLength(node.asInt());
+            }
+
+            if ((node = type.get("minLength")) != null) {
+                baseType.setMinLength(node.asInt());
+            }
+
+            populateEnum(baseType, type);
+        }
+
+        @Override
+        public Object toValue(JsonNode value) {
+            return value.asText();
+        }
+
+        @Override
+        public void validate(Object value) {
+
+        }
+
+        private void populateEnum(StringBaseType baseType, JsonNode node) {
+            if (node.has("enum")) {
+                Set<String> s = Sets.newHashSet();
+                JsonNode enumVal = node.get("enum");
+                if (enumVal.isArray()) {
+                    JsonNode anEnum = enumVal.get(1);
+                    for (JsonNode n : anEnum) {
+                        s.add(n.asText());
+                    }
+                } else if (enumVal.isTextual()) {
+                    s.add(enumVal.asText());
+                }
+                baseType.setEnums(s);
+            }
+        }
+
+        public int getMinLength() {
+            return minLength;
+        }
+
+        public void setMinLength(int minLength) {
+            this.minLength = minLength;
+        }
+
+        public int getMaxLength() {
+            return maxLength;
+        }
+
+        public void setMaxLength(int maxLength) {
+            this.maxLength = maxLength;
+        }
+
+        public Set<String> getEnums() {
+            return enums;
+        }
+
+        public void setEnums(Set<String> enums) {
+            this.enums = enums;
+        }
+
+        @Override
+        public String toString() {
+            return "StringBaseType";
+        }
+
+    }
+
+
+    public static class UuidBaseType extends BaseType<UuidBaseType> {
+        public static enum RefType {strong, weak}
+
+        String refTable;
+        RefType refType;
+
+
+        @Override
+        public UuidBaseType fromString(String typeString) {
+            return "uuid".equals(typeString) ? new UuidBaseType() : null;
+        }
+
+        @Override
+        protected void getConstraints(UuidBaseType baseType, JsonNode node) {
+
+            JsonNode refTable = node.get("refTable");
+            baseType.setRefTable(refTable != null ? refTable.asText() : null);
+
+            JsonNode refTypeJson = node.get("refType");
+            baseType.setRefType(refTypeJson != null ? RefType.valueOf(refTypeJson.asText()) : RefType.strong);
+
+        }
+
+        @Override
+        public Object toValue(JsonNode value) {
+            if(value.isArray()) {
+                if (value.size() == 2) {
+                    if (value.get(0).isTextual() && "uuid".equals(value.get(0).asText())) {
+                        return new UUID(value.get(1).asText());
+                    }
+                }
+            }
+            return null;
+        }
+
+        @Override
+        public void validate(Object value) {
+
+        }
+
+        public String getRefTable() {
+            return refTable;
+        }
+
+        public void setRefTable(String refTable) {
+            this.refTable = refTable;
+        }
+
+        public RefType getRefType() {
+            return refType;
+        }
+
+        public void setRefType(RefType refType) {
+            this.refType = refType;
+        }
+
+        @Override
+        public String toString() {
+            return "UuidBaseType";
+        }
+    }
+}
diff --git a/library/src/main/java/org/opendaylight/ovsdb/lib/schema/ColumnSchema.java b/library/src/main/java/org/opendaylight/ovsdb/lib/schema/ColumnSchema.java
new file mode 100644 (file)
index 0000000..2d0f32a
--- /dev/null
@@ -0,0 +1,112 @@
+/*
+ * Copyright (C) 2014 EBay Software Foundation
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Ashwin Raveendran
+ */
+package org.opendaylight.ovsdb.lib.schema;
+
+import java.util.Map;
+import java.util.Set;
+
+import org.opendaylight.ovsdb.lib.notation.Condition;
+import org.opendaylight.ovsdb.lib.notation.Function;
+import org.opendaylight.ovsdb.lib.notation.OvsDBMap;
+import org.opendaylight.ovsdb.lib.notation.OvsDBSet;
+
+import com.fasterxml.jackson.databind.JsonNode;
+
+
+public class ColumnSchema<E extends TableSchema<E>, D> {
+    String name;
+    ColumnType type;
+    boolean ephemeral;
+    boolean mutable;
+
+    public ColumnSchema(String name, ColumnType columnType) {
+        this.name = name;
+        this.type = columnType;
+    }
+
+    public static ColumnSchema fromJson(String name, JsonNode json) {
+        if (!json.isObject() || !json.has("type")) {
+            //todo specific types of exception
+            throw new RuntimeException("bad column schema root, expected \"type\" as child");
+        }
+
+        return new ColumnSchema(name, ColumnType.fromJson(json.get("type")));
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public ColumnType getType() { return type; }
+
+    // --- Operations on the column ----------//
+
+    public Condition opEqual(D data) {
+        return new Condition(this.getName(), Function.EQUALS, data);
+    }
+
+    public Condition opGreaterThan(D data) {
+        return new Condition(this.getName(), Function.GREATER_THAN, data);
+    }
+
+    public Condition opLesserThan(D data) {
+        return new Condition(this.getName(), Function.GREATER_THAN, data);
+    }
+
+    public Condition opLesserThanOrEquals(D data) {
+        return new Condition(this.getName(), Function.LESS_THAN_OR_EQUALS, data);
+    }
+
+    // --- Operations on the column ----------//:w
+
+
+    @Override
+    public String toString() {
+        return "ColumnSchema{" +
+                "name='" + name + '\'' +
+                ", type=" + type +
+                '}';
+    }
+
+    /**
+     * Validates the passed in value against the constraints set for this ColumnSchema
+     * @param value
+     * @throws java.lang.RuntimeException (validation exception)
+     */
+    public D validate(Object value)throws RuntimeException {
+        //todo(type check and validate based on constraints set)
+        this.type.validate(value);
+        return (D) value;
+    }
+
+    /**
+     * Verifies if this Column if of the specified type
+     * @param type the type to check for
+     */
+    public void validateType(Class<?> type) {
+
+    }
+
+    public D valueFromJson(JsonNode value) {
+      return (D) this.getType().valueFromJson(value);
+    }
+
+    public Object getNormalizeData(D value) {
+        Object untypedValue = null;
+        if (value instanceof Set) {
+            untypedValue = OvsDBSet.fromSet((Set) value);
+        } else if (value instanceof Map) {
+            untypedValue = OvsDBMap.fromMap((Map)value);
+        } else {
+            untypedValue = value;
+        }
+        return untypedValue;
+    }
+}
diff --git a/library/src/main/java/org/opendaylight/ovsdb/lib/schema/ColumnType.java b/library/src/main/java/org/opendaylight/ovsdb/lib/schema/ColumnType.java
new file mode 100644 (file)
index 0000000..c9829cf
--- /dev/null
@@ -0,0 +1,252 @@
+/*
+ * Copyright (C) 2014 EBay Software Foundation
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Ashwin Raveendran
+ */
+package org.opendaylight.ovsdb.lib.schema;
+
+import java.util.Set;
+
+import org.opendaylight.ovsdb.lib.jsonrpc.JsonUtils;
+import org.opendaylight.ovsdb.lib.notation.OvsDBMap;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.google.common.collect.Sets;
+
+
+public abstract class ColumnType {
+    BaseType baseType;
+    long min = 1;
+    long max = 1;
+
+    public long getMin() {
+        return min;
+    }
+
+    void setMin(long min) {
+        this.min = min;
+    }
+
+    public long getMax() {
+        return max;
+    }
+
+    void setMax(long max) {
+        this.max = max;
+    }
+
+    private static ColumnType columns[] = new ColumnType[]{
+            new AtomicColumnType(),
+            new KeyValuedColumnType()
+    };
+
+
+    public ColumnType() {
+
+    }
+
+    public ColumnType(BaseType baseType) {
+        this.baseType = baseType;
+    }
+
+    public BaseType getBaseType() {
+        return baseType;
+    }
+
+    /**
+            "type": {
+                "key": {
+                     "maxInteger": 4294967295,
+                     "minInteger": 0,
+                     "type": "integer"
+                },
+                "min": 0,
+                "value": {
+                    "type": "uuid",
+                    "refTable": "Queue"
+                 },
+                 "max": "unlimited"
+            }
+     * @param json
+     * @return
+     */
+    public static ColumnType fromJson(JsonNode json) {
+        for (ColumnType colType : columns) {
+            ColumnType columnType = colType.fromJsonNode(json);
+            if (null != columnType) {
+                return columnType;
+            }
+        }
+        //todo move to speicfic typed exception
+        throw new RuntimeException(String.format("could not find the right column type %s",
+                JsonUtils.prettyString(json)));
+    }
+
+
+    /**
+     * Creates a ColumnType from the JsonNode if the implementation  knows how to, returns null otherwise
+     *
+     * @param json the JSONNode object that needs to converted
+     * @return a valid SubType or Null (if the JsonNode does not represent
+     * the subtype)
+     */
+    protected abstract ColumnType fromJsonNode(JsonNode json);
+
+    public boolean isMultiValued() {
+        //todo check if this is the right logic
+        return this.min != this.max && this.min != 1;
+    }
+
+    public abstract Object valueFromJson(JsonNode value);
+
+    public abstract void validate(Object value);
+
+    @Override
+    public String toString() {
+        return "ColumnType{" +
+                "baseType=" + baseType +
+                ", min=" + min +
+                ", max=" + max +
+                '}';
+    }
+
+    public static class AtomicColumnType extends ColumnType {
+
+        public AtomicColumnType() {
+        }
+
+        public AtomicColumnType(BaseType baseType1) {
+            super(baseType1);
+        }
+
+        @Override
+        public AtomicColumnType fromJsonNode(JsonNode json) {
+            if (json.isObject() && json.has("value")) {
+                return null;
+            }
+            BaseType baseType = BaseType.fromJson(json, "key");
+
+            if (baseType != null) {
+
+                AtomicColumnType atomicColumnType = new AtomicColumnType(baseType);
+
+                JsonNode node = null;
+                if ((node = json.get("min")) != null) {
+                    atomicColumnType.setMin(node.asLong());
+                }
+
+                if ((node = json.get("max")) != null) {
+                    if (node.isLong()){
+                        atomicColumnType.setMax(node.asLong());
+                    } else if (node.isTextual() && "unlimited".equals(node.asText())) {
+                        max = Long.MAX_VALUE;
+                    }
+                }
+                return atomicColumnType;
+            }
+
+            return null;
+        }
+
+        @Override
+        public Object valueFromJson(JsonNode value) {
+            if (isMultiValued()) {
+                Set<Object> result = Sets.newHashSet();
+               if(value.isArray()) {
+                     if (value.size() == 2) {
+                         if (value.get(0).isTextual() && "set".equals(value.get(0).asText())) {
+                              for(JsonNode node: value.get(1)) {
+                                 result.add(getBaseType().toValue(node));
+                              }
+                         } else {
+                             result.add(getBaseType().toValue(value));
+                         }
+                     }
+               } else {
+                   result.add(getBaseType().toValue(value));
+               }
+                return result;
+            } else {
+                return getBaseType().toValue(value);
+            }
+        }
+
+        @Override
+        public void validate(Object value) {
+            this.baseType.validate(value);
+        }
+
+    }
+
+    public static class KeyValuedColumnType extends ColumnType {
+        BaseType keyType;
+
+        public BaseType getKeyType() {
+            return keyType;
+        }
+
+        public KeyValuedColumnType() {
+        }
+
+        public KeyValuedColumnType(BaseType keyType, BaseType valueType) {
+            super(valueType);
+            this.keyType = keyType;
+        }
+
+        @Override
+        public KeyValuedColumnType fromJsonNode(JsonNode json) {
+            if (json.isValueNode() || !json.has("value")) {
+                return null;
+            }
+            BaseType keyType = BaseType.fromJson(json, "key");
+            BaseType valueType = BaseType.fromJson(json, "value");
+
+            KeyValuedColumnType keyValueColumnType = new KeyValuedColumnType(keyType, valueType);
+            JsonNode node = null;
+            if ((node = json.get("min")) != null) {
+                keyValueColumnType.setMin(node.asLong());
+            }
+
+            if ((node = json.get("max")) != null) {
+                if (node.isLong()){
+                    keyValueColumnType.setMax(node.asLong());
+                } else if (node.isTextual() && "unlimited".equals(node.asText())) {
+                    max = Long.MAX_VALUE;
+                }
+            }
+
+            return keyValueColumnType;
+        }
+
+        @Override
+        public Object valueFromJson(JsonNode node) {
+            if (node.isArray()) {
+                if (node.size() == 2) {
+                    if (node.get(0).isTextual() && "map".equals(node.get(0).asText())) {
+                        OvsDBMap<Object, Object> map = new OvsDBMap<Object, Object>();
+                        for (JsonNode pairNode : node.get(1)) {
+                            if (pairNode.isArray() && node.size() == 2) {
+                                Object key = getKeyType().toValue(pairNode.get(0));
+                                Object value = getBaseType().toValue(pairNode.get(1));
+                                map.put(key, value);
+                            }
+                        }
+                        return map;
+                    } else if (node.size() == 0) {
+                        return null;
+                    }
+                }
+            }
+            return null;
+        }
+
+        @Override
+        public void validate(Object value) {
+            this.baseType.validate(value);
+        }
+    }
+}
diff --git a/library/src/main/java/org/opendaylight/ovsdb/lib/schema/DatabaseSchema.java b/library/src/main/java/org/opendaylight/ovsdb/lib/schema/DatabaseSchema.java
new file mode 100644 (file)
index 0000000..9ad7cba
--- /dev/null
@@ -0,0 +1,130 @@
+/*
+ * Copyright (C) 2014 EBay Software Foundation
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Ashwin Raveendran
+ */
+package org.opendaylight.ovsdb.lib.schema;
+
+import java.lang.reflect.Constructor;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+import org.opendaylight.ovsdb.lib.ParsingException;
+import org.opendaylight.ovsdb.lib.notation.Version;
+import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.google.common.reflect.Invokable;
+
+/**
+ * Represents an ovsdb database schema, which is comprised of a set of tables.
+ */
+public class DatabaseSchema {
+
+    public static Logger logger = LoggerFactory.getLogger(DatabaseSchema.class);
+
+    private String name;
+
+    private Version version;
+    private Map<String, TableSchema> tables;
+
+    public DatabaseSchema(Map<String, TableSchema> tables) {
+        this.tables = tables;
+    }
+
+    public DatabaseSchema(String name, Version version, Map<String, TableSchema> tables) {
+        this.name = name;
+        this.version = version;
+        this.tables = tables;
+    }
+
+    public Set<String> getTables() {
+        return this.tables.keySet();
+    }
+
+    public boolean hasTable(String table) {
+        return this.getTables().contains(table);
+    }
+
+    public TransactionBuilder beginTransaction() {
+        return new TransactionBuilder(this);
+    }
+
+    public <E extends TableSchema<E>> E table(String tableName, Class<E> clazz) {
+        TableSchema<E> table = tables.get(tableName);
+
+        if (clazz.isInstance(table)) {
+            return clazz.cast(table);
+        }
+
+        return createTableSchema(clazz, table);
+    }
+
+    protected <E extends TableSchema<E>> E createTableSchema(Class<E> clazz, TableSchema<E> table) {
+        Constructor<E> declaredConstructor = null;
+        try {
+            declaredConstructor = clazz.getDeclaredConstructor(TableSchema.class);
+        } catch (NoSuchMethodException e) {
+            String message = String.format("Class %s does not have public constructor that accepts TableSchema object",
+                    clazz);
+            throw new IllegalArgumentException(message, e);
+        }
+        Invokable<E, E> invokable = Invokable.from(declaredConstructor);
+        try {
+            return invokable.invoke(null, table);
+        } catch (Exception e) {
+            String message = String.format("Not able to create instance of class %s using public constructor " +
+                    "that accepts TableSchema object", clazz);
+            throw new IllegalArgumentException(message, e);
+        }
+    }
+
+    //todo : this needs to move to a custom factory
+    public static DatabaseSchema fromJson(String dbName, JsonNode json) {
+        if (!json.isObject() || !json.has("tables")) {
+            throw new ParsingException("bad DatabaseSchema root, expected \"tables\" as child but was not found");
+        }
+        if (!json.isObject() || !json.has("version")) {
+            throw new ParsingException("bad DatabaseSchema root, expected \"version\" as child but was not found");
+        }
+
+        Version dbVersion = Version.fromString(json.get("version").asText());
+
+        Map<String, TableSchema> tables = new HashMap<>();
+        for (Iterator<Map.Entry<String, JsonNode>> iter = json.get("tables").fields(); iter.hasNext(); ) {
+            Map.Entry<String, JsonNode> table = iter.next();
+            logger.debug("Read schema for table[{}]:{}", table.getKey(), table.getValue());
+
+            //todo : this needs to done by a factory
+            tables.put(table.getKey(), new GenericTableSchema().fromJson(table.getKey(), table.getValue()));
+        }
+
+        return new DatabaseSchema(dbName, dbVersion, tables);
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public Version getVersion() { return version; }
+
+    public void setVersion(Version version) { this.version = version; }
+
+    public void populateInternallyGeneratedColumns() {
+        for (TableSchema tableSchema : tables.values()) {
+            tableSchema.populateInternallyGeneratedColumns();
+        }
+    }
+}
diff --git a/library/src/main/java/org/opendaylight/ovsdb/lib/schema/GenericTableSchema.java b/library/src/main/java/org/opendaylight/ovsdb/lib/schema/GenericTableSchema.java
new file mode 100644 (file)
index 0000000..2b35a3e
--- /dev/null
@@ -0,0 +1,78 @@
+/*
+ *
+ *  * Copyright (C) 2014 EBay Software Foundation
+ *  *
+ *  * This program and the accompanying materials are made available under the
+ *  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ *  * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *  *
+ *  * Authors : Ashwin Raveendran
+ *
+ */
+
+package org.opendaylight.ovsdb.lib.schema;
+
+import com.fasterxml.jackson.databind.JsonNode;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+public class GenericTableSchema extends TableSchema<GenericTableSchema> {
+
+    public GenericTableSchema() {
+    }
+
+    public GenericTableSchema(String tableName) {
+        super(tableName);
+    }
+
+    public GenericTableSchema (TableSchema tableSchema) {
+        super(tableSchema.getName(), tableSchema.getColumnSchemas());
+    }
+
+    public GenericTableSchema fromJson(String tableName, JsonNode json) {
+
+        if (!json.isObject() || !json.has("columns")) {
+            //todo specific types of exception
+            throw new RuntimeException("bad tableschema root, expected \"columns\" as child");
+        }
+
+        Map<String, ColumnSchema> columns = new HashMap<>();
+        for (Iterator<Map.Entry<String, JsonNode>> iter = json.get("columns").fields(); iter.hasNext(); ) {
+            Map.Entry<String, JsonNode> column = iter.next();
+            logger.debug("%s:%s", tableName, column.getKey());
+            columns.put(column.getKey(), ColumnSchema.fromJson(column.getKey(), column.getValue()));
+        }
+
+        this.setName(tableName);
+        this.setColumns(columns);
+        return this;
+    }
+
+//    public TableUpdate<GenericTableSchema> updatesFromJson(JsonNode value) {
+//        ObjectNode new_ = (ObjectNode) value.get("new");
+//        ObjectNode old = (ObjectNode) value.get("new");
+//
+//        Row<GenericTableSchema> newRow = createRow(new_);
+//        Row<GenericTableSchema> oldRow = createRow(old);
+//
+//        TableUpdate<GenericTableSchema> tableUpdate = new TableUpdate<GenericTableSchema>();
+//        tableUpdate.setNew(newRow);
+//        tableUpdate.setNew(oldRow);
+//
+//
+//        return null;
+//    }
+//
+//    protected Row<GenericTableSchema> createRow(ObjectNode rowNode) {
+//        List<Column<GenericTableSchema, ?>> columns = Lists.newArrayList();
+//        for (Iterator<Map.Entry<String, JsonNode>> iter = rowNode.fields(); iter.hasNext();) {
+//            Map.Entry<String, JsonNode> next = iter.next();
+//            ColumnSchema schema = column(next.getKey());
+//            Object o = schema.valueFromJson(next.getValue());
+//            columns.add(new Column(schema, o));
+//        }
+//        return new Row<>(columns);
+//    }
+}
diff --git a/library/src/main/java/org/opendaylight/ovsdb/lib/schema/TableSchema.java b/library/src/main/java/org/opendaylight/ovsdb/lib/schema/TableSchema.java
new file mode 100644 (file)
index 0000000..cf08c23
--- /dev/null
@@ -0,0 +1,176 @@
+/*
+ * Copyright (C) 2014 EBay Software Foundation
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Ashwin Raveendran
+ */
+package org.opendaylight.ovsdb.lib.schema;
+
+import java.lang.reflect.Constructor;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.opendaylight.ovsdb.lib.message.TableUpdate;
+import org.opendaylight.ovsdb.lib.notation.Column;
+import org.opendaylight.ovsdb.lib.notation.Row;
+import org.opendaylight.ovsdb.lib.notation.UUID;
+import org.opendaylight.ovsdb.lib.operations.Insert;
+import org.opendaylight.ovsdb.lib.schema.BaseType.UuidBaseType;
+import org.opendaylight.ovsdb.lib.schema.ColumnType.AtomicColumnType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.google.common.collect.Lists;
+
+
+public abstract class TableSchema<E extends TableSchema<E>> {
+
+
+    protected static final Logger logger = LoggerFactory.getLogger(TableSchema.class);
+    private String name;
+    private Map<String, ColumnSchema> columns;
+
+    public TableSchema() {
+    }
+
+    protected TableSchema(String name) {
+        this.name = name;
+    }
+
+    public TableSchema(String name, Map<String, ColumnSchema> columns) {
+        this.name = name;
+        this.columns = columns;
+    }
+
+    public Set<String> getColumns() {
+        return this.columns.keySet();
+    }
+
+    public Map<String, ColumnSchema> getColumnSchemas() {
+        return columns;
+    }
+
+    public boolean hasColumn(String column) {
+        return this.getColumns().contains(column);
+    }
+
+
+    public ColumnType getColumnType(String column) {
+        return this.columns.get(column).getType();
+    }
+
+    public <E extends TableSchema<E>> E as(Class<E> clazz) {
+        try {
+            Constructor<E> e = clazz.getConstructor(TableSchema.class);
+            return e.newInstance(this);
+        } catch (Exception e) {
+            throw new RuntimeException("exception constructing instance of clazz " + clazz, e);
+        }
+    }
+
+    public Insert<E> insert() {
+        return new Insert<>(this);
+    }
+
+    public <D> ColumnSchema<E, Set<D>> multiValuedColumn(String column, Class<D> type) {
+        //todo exception handling
+
+        ColumnSchema columnSchema = columns.get(column);
+        columnSchema.validateType(type);
+        return columnSchema;
+    }
+
+    public <K,V> ColumnSchema<E, Map<K,V>> multiValuedColumn(String column, Class<K> keyType, Class<V> valueType) {
+        //todo exception handling
+
+        ColumnSchema columnSchema = columns.get(column);
+        columnSchema.validateType(valueType);
+        return columnSchema;
+    }
+
+    public <D> ColumnSchema<E, D> column(String column, Class<D> type) {
+        //todo exception handling
+
+        ColumnSchema columnSchema = columns.get(column);
+        if (columnSchema != null) {
+            columnSchema.validateType(type);
+        }
+        return columnSchema;
+    }
+
+    public ColumnSchema column(String column) {
+        return this.columns.get(column);
+    }
+
+
+    public String getName() {
+        return name;
+    }
+
+    protected void setName(String name) {
+        this.name = name;
+    }
+
+    protected void setColumns(Map<String, ColumnSchema> columns) {
+        this.columns = columns;
+    }
+
+    public TableUpdate<E> updatesFromJson(JsonNode value) {
+
+        Map.Entry<String, JsonNode> idOldNew = value.fields().next();
+        String uuid = idOldNew.getKey();
+
+        ObjectNode new_ = (ObjectNode) idOldNew.getValue().get("new");
+        ObjectNode old = (ObjectNode) idOldNew.getValue().get("old");
+
+        Row<E> newRow = new_ != null ? createRow(new_) : null;
+        Row<E> oldRow = old != null ? createRow(old) : null;
+
+        TableUpdate<E> tableUpdate = new TableUpdate<>(new UUID(uuid));
+        tableUpdate.setNew(newRow);
+        tableUpdate.setOld(oldRow);
+
+        return tableUpdate;
+    }
+
+    protected Row<E> createRow(ObjectNode rowNode) {
+        List<Column<E, ?>> columns = Lists.newArrayList();
+        for (Iterator<Map.Entry<String, JsonNode>> iter = rowNode.fields(); iter.hasNext();) {
+            Map.Entry<String, JsonNode> next = iter.next();
+            ColumnSchema<E, Object> schema = column(next.getKey(), Object.class);
+            /*
+             * Ideally the ColumnSchema shouldn't be null at this stage. But there can be cases in which
+             * the OVSDB manager Schema implementation might decide to include some "hidden" columns that
+             * are NOT reported in getSchema, but decide to report it in unfiltered monitor.
+             * Hence adding some safety checks around that.
+             */
+            if (schema != null) {
+                Object o = schema.valueFromJson(next.getValue());
+                columns.add(new Column<>(schema, o));
+            }
+        }
+        return new Row<>(columns);
+    }
+
+    /*
+     * RFC 7047 Section 3.2 specifies 2 internally generated columns in each table
+     * namely _uuid and _version which are not exposed in get_schema call.
+     * Since these 2 columns are extremely useful for Mutate, update and select operations,
+     * the ColumnSchema for these 2 columns are manually populated.
+     *
+     * It is to be noted that these 2 columns are specified as part of the RFC7047 and not
+     * a specific Schema implementation detail & hence adding it by default in the Library
+     * for better application experience using the library.
+     */
+    public void populateInternallyGeneratedColumns() {
+        columns.put("_uuid", new ColumnSchema("_uuid", new AtomicColumnType(new UuidBaseType())));
+        columns.put("_version", new ColumnSchema("_version", new AtomicColumnType(new UuidBaseType())));
+    }
+}
similarity index 62%
rename from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/message/operations/AbortOperation.java
rename to library/src/main/java/org/opendaylight/ovsdb/lib/schema/typed/MethodType.java
index f6f485332f842eae10c5356c32926b47626273eb..8ba7f6837543e984c1646fcb758469da6430dfcf 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013 Red Hat, Inc.
+ * Copyright (C) 2014 Red Hat, Inc.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -7,8 +7,9 @@
  *
  * Authors : Madhu Venugopal
  */
-package org.opendaylight.ovsdb.lib.message.operations;
 
-public class AbortOperation extends Operation {
+package org.opendaylight.ovsdb.lib.schema.typed;
 
+public enum MethodType {
+    GETCOLUMN, GETDATA, SETDATA, GETTABLESCHEMA
 }
diff --git a/library/src/main/java/org/opendaylight/ovsdb/lib/schema/typed/TypedBaseTable.java b/library/src/main/java/org/opendaylight/ovsdb/lib/schema/typed/TypedBaseTable.java
new file mode 100644 (file)
index 0000000..8a2b5ec
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal
+ */
+package org.opendaylight.ovsdb.lib.schema.typed;
+
+import org.opendaylight.ovsdb.lib.notation.Column;
+import org.opendaylight.ovsdb.lib.notation.UUID;
+import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
+
+public interface TypedBaseTable {
+    @TypedColumn(name="", method=MethodType.GETTABLESCHEMA)
+    GenericTableSchema getSchema();
+
+    @TypedColumn(name="_uuid", method=MethodType.GETDATA)
+    public UUID getUuid();
+
+    @TypedColumn(name="_uuid", method=MethodType.GETCOLUMN)
+    public Column<GenericTableSchema, UUID> getUuidColumn();
+
+    @TypedColumn(name="_version", method=MethodType.GETDATA)
+    public UUID getVersion();
+
+    @TypedColumn(name="_version", method=MethodType.GETCOLUMN)
+    public Column<GenericTableSchema, UUID> getVersionColumn();
+}
diff --git a/library/src/main/java/org/opendaylight/ovsdb/lib/schema/typed/TypedColumn.java b/library/src/main/java/org/opendaylight/ovsdb/lib/schema/typed/TypedColumn.java
new file mode 100644 (file)
index 0000000..71cce2f
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal
+ */
+
+package org.opendaylight.ovsdb.lib.schema.typed;
+
+import org.opendaylight.ovsdb.lib.notation.Version;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import java.lang.annotation.ElementType;;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+public @interface TypedColumn {
+    public String name();
+    public MethodType method();
+    public String fromVersion() default Version.NULL_VERSION_STRING;
+    public String untilVersion() default Version.NULL_VERSION_STRING;
+}
diff --git a/library/src/main/java/org/opendaylight/ovsdb/lib/schema/typed/TypedTable.java b/library/src/main/java/org/opendaylight/ovsdb/lib/schema/typed/TypedTable.java
new file mode 100644 (file)
index 0000000..e8a7d9a
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal
+ */
+
+package org.opendaylight.ovsdb.lib.schema.typed;
+
+import org.opendaylight.ovsdb.lib.notation.Version;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import java.lang.annotation.ElementType;;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+public @interface TypedTable {
+    public String name();
+    public String database();
+    public String fromVersion() default Version.NULL_VERSION_STRING;
+    public String untilVersion() default Version.NULL_VERSION_STRING;
+}
diff --git a/library/src/main/java/org/opendaylight/ovsdb/lib/schema/typed/TyperUtils.java b/library/src/main/java/org/opendaylight/ovsdb/lib/schema/typed/TyperUtils.java
new file mode 100644 (file)
index 0000000..25e2868
--- /dev/null
@@ -0,0 +1,287 @@
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal
+ */
+
+package org.opendaylight.ovsdb.lib.schema.typed;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+
+import org.opendaylight.ovsdb.lib.notation.Column;
+import org.opendaylight.ovsdb.lib.notation.Row;
+import org.opendaylight.ovsdb.lib.notation.Version;
+import org.opendaylight.ovsdb.lib.schema.ColumnSchema;
+import org.opendaylight.ovsdb.lib.schema.DatabaseSchema;
+import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
+
+import com.google.common.reflect.Reflection;
+
+public class TyperUtils {
+    private static final String GET_STARTS_WITH="get";
+    private static final String SET_STARTS_WITH="set";
+    private static final String GETCOLUMN_ENDS_WITH="Column";
+
+    private static <T> String getTableName (Class<T> klazz) {
+        TypedTable typedTable = klazz.getAnnotation(TypedTable.class);
+        if (typedTable != null) {
+            return typedTable.name();
+        }
+        return klazz.getSimpleName();
+    }
+
+    public static <T> GenericTableSchema getTableSchema(DatabaseSchema dbSchema, Class<T> klazz) {
+        String tableName = getTableName(klazz);
+        return dbSchema.table(tableName, GenericTableSchema.class);
+    }
+
+    public static ColumnSchema<GenericTableSchema, Object> getColumnSchema(GenericTableSchema tableSchema, String columnName, Class<Object> metaClass) {
+        return tableSchema.column(columnName, metaClass);
+    }
+
+    private static String getColumnName (Method method) {
+        TypedColumn typedColumn = method.getAnnotation(TypedColumn.class);
+        if (typedColumn != null) {
+            return typedColumn.name();
+        }
+
+        /*
+         * Attempting to get the column name by parsing the method name with a following convention :
+         * 1. GETDATA : get<ColumnName>
+         * 2. SETDATA : set<ColumnName>
+         * 3. GETCOLUMN : get<ColumnName>Column
+         * where <ColumnName> is the name of the column that we are interested in.
+         */
+        int index = GET_STARTS_WITH.length();
+        if (isGetData(method) || isSetData(method)) {
+            return method.getName().substring(index, method.getName().length()).toLowerCase();
+        } else if (isGetColumn(method)) {
+            return method.getName().substring(index, method.getName().indexOf(GETCOLUMN_ENDS_WITH, index)).toLowerCase();
+        }
+
+        return null;
+    }
+
+    private static boolean isGetTableSchema (Method method) {
+        TypedColumn typedColumn = method.getAnnotation(TypedColumn.class);
+        if (typedColumn != null) {
+            return typedColumn.method().equals(MethodType.GETTABLESCHEMA) ? true : false;
+        }
+        return false;
+    }
+
+    private static boolean isGetColumn (Method method) {
+        TypedColumn typedColumn = method.getAnnotation(TypedColumn.class);
+        if (typedColumn != null) {
+            return typedColumn.method().equals(MethodType.GETCOLUMN) ? true : false;
+        }
+
+        if (method.getName().startsWith(GET_STARTS_WITH) && method.getName().endsWith(GETCOLUMN_ENDS_WITH)) {
+            return true;
+        }
+        return false;
+    }
+
+    private static boolean isGetData (Method method) {
+        TypedColumn typedColumn = method.getAnnotation(TypedColumn.class);
+        if (typedColumn != null) {
+            return typedColumn.method().equals(MethodType.GETDATA) ? true : false;
+        }
+
+        if (method.getName().startsWith(GET_STARTS_WITH) && !method.getName().endsWith(GETCOLUMN_ENDS_WITH)) {
+            return true;
+        }
+        return false;
+    }
+
+    private static boolean isSetData (Method method) {
+        TypedColumn typedColumn = method.getAnnotation(TypedColumn.class);
+        if (typedColumn != null) {
+            return typedColumn.method().equals(MethodType.SETDATA) ? true : false;
+        }
+
+        if (method.getName().startsWith(SET_STARTS_WITH)) {
+            return true;
+        }
+        return false;
+    }
+
+    public static Version getFromVersion (Method method) {
+        TypedColumn typedColumn = method.getAnnotation(TypedColumn.class);
+        if (typedColumn != null) {
+            return Version.fromString(typedColumn.fromVersion());
+        }
+        TypedTable typedTable = method.getAnnotation(TypedTable.class);
+        if (typedTable != null) {
+            return Version.fromString(typedTable.fromVersion());
+        }
+        return Version.NULL;
+    }
+
+    public static Version getUntilVersion(Method method) {
+        TypedColumn typedColumn = method.getAnnotation(TypedColumn.class);
+        if (typedColumn != null) {
+            return Version.fromString(typedColumn.untilVersion());
+        }
+        TypedTable typedTable = method.getAnnotation(TypedTable.class);
+        if (typedTable != null) {
+            return Version.fromString(typedTable.untilVersion());
+        }
+        return Version.NULL;
+    }
+
+    /**
+     * Method that checks validity of the parameter passed to getTypedRowWrapper.
+     * This method checks for a valid Database Schema matching the expected Database for a given table
+     * and checks for the presence of the Table in Database Schema.
+     *
+     * @param dbSchema DatabaseSchema as learnt from a OVSDB connection
+     * @param klazz Typed Class that represents a Table
+     * @return true if valid, false otherwise
+     */
+    private static <T> boolean isValid (DatabaseSchema dbSchema, final Class<T> klazz) {
+        if (dbSchema == null) {
+            return false;
+        }
+
+        TypedTable typedTable = klazz.getAnnotation(TypedTable.class);
+        if (typedTable != null) {
+            if (!dbSchema.getName().equalsIgnoreCase(typedTable.database())) {
+                return false;
+            }
+        }
+
+        if (!dbSchema.getTables().contains(getTableName(klazz))) {
+            return false;
+        }
+        return true;
+    }
+
+    private static void checkSchemaVersion(DatabaseSchema dbSchema, Method method) {
+        Version fromVersion = getFromVersion(method);
+        Version untilVersion = getUntilVersion(method);
+        if (!fromVersion.equals(Version.NULL)) {
+            if (dbSchema.getVersion().compareTo(fromVersion) < 0) {
+                throw new RuntimeException("This row is not supported until version "
+                        + fromVersion + "of the Schema");
+            }
+        }
+        if (!untilVersion.equals(Version.NULL)) {
+            if (dbSchema.getVersion().compareTo(untilVersion) > 0) {
+                throw new RuntimeException("This row was deprecated in "
+                        + untilVersion + "of the Schema");
+            }
+        }
+    }
+
+    /**
+     * This method returns a Typed Proxy implementation for the klazz passed as a parameter.
+     * Per design choice, the Typed Proxy implementation is just a Wrapper on top of the actual Row which is untyped.
+     * Being just a wrapper, it is state-less and more of a convenience functionality to provide a type-safe infrastructure
+     * for the applications to built on top of. And this Typed infra is completely optional.
+     *
+     * It is the applications responsibilty to pass on the raw Row parameter & this method will return the appropriate
+     * Proxy wrapper for the passed klazz Type. The raw Row parameter may be null if the caller is interested in just the
+     * ColumnSchema. But that is not a very common use-case.
+     *
+     * @param dbSchema DatabaseSchema as learnt from a OVSDB connection
+     * @param klazz Typed Class that represents a Table
+     * @param row The actual Row that the wrapper is operating on. It can be null if the caller is just interested in getting ColumnSchema.
+     * @return
+     */
+    public static <T> T getTypedRowWrapper(final DatabaseSchema dbSchema, final Class<T> klazz, final Row<GenericTableSchema> row) {
+        if (!isValid(dbSchema, klazz)) {
+            return null;
+        }
+        return Reflection.newProxy(klazz, new InvocationHandler() {
+            private Object processGetData(Method method) throws Throwable {
+                String columnName = getColumnName(method);
+                checkSchemaVersion(dbSchema, method);
+                if (columnName == null) {
+                    throw new RuntimeException("Error processing Getter : "+ method.getName());
+                }
+                GenericTableSchema tableSchema = getTableSchema(dbSchema, klazz);
+                if (tableSchema == null) {
+                    throw new RuntimeException("Unable to locate TableSchema for "+getTableName(klazz)+ " in "+ dbSchema.getName());
+                }
+                ColumnSchema<GenericTableSchema, Object> columnSchema = getColumnSchema(tableSchema, columnName, (Class<Object>) method.getReturnType());
+                if (columnSchema == null) {
+                    throw new RuntimeException("Unable to locate ColumnSchema for "+columnName+ " in "+ tableSchema.getName());
+                }
+                if (row == null) {
+                    return null;
+                }
+                return row.getColumn(columnSchema).getData();
+            }
+
+            private Object processGetColumn(Method method) throws Throwable {
+                String columnName = getColumnName(method);
+                checkSchemaVersion(dbSchema, method);
+                if (columnName == null) {
+                    throw new RuntimeException("Error processing GetColumn : "+ method.getName());
+                }
+                GenericTableSchema tableSchema = getTableSchema(dbSchema, klazz);
+                if (tableSchema == null) {
+                    throw new RuntimeException("Unable to locate TableSchema for "+getTableName(klazz)+ " in "+ dbSchema.getName());
+                }
+                ColumnSchema<GenericTableSchema, Object> columnSchema = getColumnSchema(tableSchema, columnName, (Class<Object>) method.getReturnType());
+                if (columnSchema == null) {
+                    throw new RuntimeException("Unable to locate ColumnSchema for "+columnName+ " in "+ tableSchema.getName());
+                }
+                // When the row is null, that might indicate that the user maybe interested only in the ColumnSchema and not on the Data.
+                if (row == null) {
+                    return new Column<GenericTableSchema, Object>(columnSchema, null);
+                }
+                return row.getColumn(columnSchema);
+            }
+
+            private Object processSetData(Object proxy, Method method, Object[] args) throws Throwable {
+                if (args == null || args.length != 1) {
+                    throw new RuntimeException("Setter method : "+method.getName() + " requires 1 argument");
+                }
+                checkSchemaVersion(dbSchema, method);
+                String columnName = getColumnName(method);
+                if (columnName == null) {
+                    throw new RuntimeException("Unable to locate Column Name for "+method.getName());
+                }
+                GenericTableSchema tableSchema = getTableSchema(dbSchema, klazz);
+                ColumnSchema<GenericTableSchema, Object> columnSchema = getColumnSchema(tableSchema, columnName,
+                                                                                        (Class<Object>) args[0].getClass());
+                Column<GenericTableSchema, Object> column = new Column<GenericTableSchema, Object>(columnSchema, args[0]);
+                row.addColumn(columnName, column);
+                return proxy;
+            }
+
+            private Object processGetTableSchema() throws Throwable {
+                if (dbSchema == null) return null;
+                return getTableSchema(dbSchema, klazz);
+            }
+
+            @Override
+            public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+                if (isGetTableSchema(method)) {
+                    return processGetTableSchema();
+                } else if (isSetData(method)) {
+                    return processSetData(proxy, method, args);
+                } else if(isGetData(method)) {
+                    return processGetData(method);
+                } else if(isGetColumn(method)) {
+                    return processGetColumn(method);
+                } else {
+                    /*
+                     *  TODO : Handle the methods provided by Object class (such as toString, hashCode, equals, etc.).
+                     *  Reintroduce throwing RuntimeException("Unsupported method : "+method.getName()); after these methods
+                     *  are handled
+                     */
+                    return null;
+                }
+            }
+        }
+        );
+    }
+}
similarity index 97%
rename from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/table/Bridge.java
rename to library/src/main/java/org/opendaylight/ovsdb/lib/table/Bridge.java
index 323ffa99850cbfd31daa9bb13af44406bd151a51..b9ed9c8546d84a65375bf98cd1d787d4029c8bd7 100644 (file)
@@ -12,13 +12,12 @@ package org.opendaylight.ovsdb.lib.table;
 import org.opendaylight.ovsdb.lib.notation.OvsDBMap;
 import org.opendaylight.ovsdb.lib.notation.OvsDBSet;
 import org.opendaylight.ovsdb.lib.notation.UUID;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
 
 import com.fasterxml.jackson.annotation.JsonIgnore;
 
 public class Bridge extends Table<Bridge> {
     public static final Name<Bridge> NAME = new Name<Bridge>("Bridge"){};
-    public enum Column implements org.opendaylight.ovsdb.lib.table.internal.Column<Bridge>{controller, fail_mode, name, ports}
+    public enum Column implements org.opendaylight.ovsdb.lib.table.Column<Bridge>{controller, fail_mode, name, ports}
 
     private String name;
     private OvsDBSet<UUID> ports;
similarity index 95%
rename from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/table/Capability.java
rename to library/src/main/java/org/opendaylight/ovsdb/lib/table/Capability.java
index b431a2cee3b361e9627465d088b077af774d00bf..4ad9203acae2985ffbc663104bb06214371c0cc9 100644 (file)
@@ -10,7 +10,6 @@
 package org.opendaylight.ovsdb.lib.table;
 
 import org.opendaylight.ovsdb.lib.notation.OvsDBMap;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
 
 import com.fasterxml.jackson.annotation.JsonIgnore;
 
similarity index 87%
rename from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/table/internal/Column.java
rename to library/src/main/java/org/opendaylight/ovsdb/lib/table/Column.java
index 5d8645ac10a78f5af0e1f0c5978817f4c73f5614..7c4e18075f267cdff692f25ed9f5f79be91c23ec 100644 (file)
@@ -7,7 +7,7 @@
  *
  * Authors : Ashwin Raveendran
  */
-package org.opendaylight.ovsdb.lib.table.internal;
+package org.opendaylight.ovsdb.lib.table;
 
 
 public interface Column<E> {
similarity index 94%
rename from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/table/Controller.java
rename to library/src/main/java/org/opendaylight/ovsdb/lib/table/Controller.java
index 2225667f61d86ebaed5e79ffc55e5c2d9fe7105a..bca9f9721e49e220a956a30ce9d1e2408aee40d0 100644 (file)
@@ -9,8 +9,6 @@
  */
 package org.opendaylight.ovsdb.lib.table;
 
-import org.opendaylight.ovsdb.lib.table.internal.Table;
-
 import com.fasterxml.jackson.annotation.JsonIgnore;
 
 public class Controller  extends Table<Controller> {
similarity index 94%
rename from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/table/Flow_Sample_Collector_Set.java
rename to library/src/main/java/org/opendaylight/ovsdb/lib/table/Flow_Sample_Collector_Set.java
index 8b2117fc7c41353795f7778ab1e77e38df7b9740..5efeb80102fd891ec38b6f62513b33153bbdb219 100644 (file)
@@ -1,8 +1,8 @@
 package org.opendaylight.ovsdb.lib.table;
 
 import com.fasterxml.jackson.annotation.JsonIgnore;
+
 import org.opendaylight.ovsdb.lib.notation.OvsDBMap;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
 
 /**
  * Per ovs-vswitchd.conf.db 2.0.90
@@ -70,7 +70,7 @@ public class Flow_Sample_Collector_Set extends Table<Flow_Sample_Collector_Set>
                 "]";
     }
 
-    public enum Column implements org.opendaylight.ovsdb.lib.table.internal.Column<Flow_Sample_Collector_Set> {
+    public enum Column implements org.opendaylight.ovsdb.lib.table.Column<Flow_Sample_Collector_Set> {
         id,
         bridge,
         external_ids,
similarity index 95%
rename from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/table/Flow_Table.java
rename to library/src/main/java/org/opendaylight/ovsdb/lib/table/Flow_Table.java
index e7a085baa9cfc79c19fba69f979450212aba0e11..e8003f474c180481d062cdea536749f8cb9c32f3 100644 (file)
@@ -1,8 +1,8 @@
 package org.opendaylight.ovsdb.lib.table;
 
 import com.fasterxml.jackson.annotation.JsonIgnore;
+
 import org.opendaylight.ovsdb.lib.notation.OvsDBSet;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
 
 /**
  * Per ovs-vswitchd.conf.db 2.0.90
@@ -67,7 +67,7 @@ public class Flow_Table extends Table<Flow_Table> {
     }
 
 
-    public enum Column implements org.opendaylight.ovsdb.lib.table.internal.Column<Flow_Table> {
+    public enum Column implements org.opendaylight.ovsdb.lib.table.Column<Flow_Table> {
         name,
         flow_limit,
         overflow_policy,
similarity index 98%
rename from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/table/IPFIX.java
rename to library/src/main/java/org/opendaylight/ovsdb/lib/table/IPFIX.java
index 101a809df48307fa3f1dac646562c4817dbb0bcd..0a78b4f045ef1666c9f230c96c7db1644df21f8a 100644 (file)
@@ -1,9 +1,9 @@
 package org.opendaylight.ovsdb.lib.table;
 
 import com.fasterxml.jackson.annotation.JsonIgnore;
+
 import org.opendaylight.ovsdb.lib.notation.OvsDBMap;
 import org.opendaylight.ovsdb.lib.notation.OvsDBSet;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
 
 /**
  * Per ovs-vswitchd.conf.db 2.0.90
similarity index 98%
rename from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/table/Interface.java
rename to library/src/main/java/org/opendaylight/ovsdb/lib/table/Interface.java
index 4ea314d06940e424a9805281580c2f2285482473..337627c4409c5074864e0f33c264fbcd9e0efd4c 100644 (file)
@@ -13,7 +13,6 @@ import java.math.BigInteger;
 
 import org.opendaylight.ovsdb.lib.notation.OvsDBMap;
 import org.opendaylight.ovsdb.lib.notation.OvsDBSet;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
 
 import com.fasterxml.jackson.annotation.JsonIgnore;
 
similarity index 94%
rename from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/table/Manager.java
rename to library/src/main/java/org/opendaylight/ovsdb/lib/table/Manager.java
index f581db8a4cd664154e89190cc0ccc2c3eaa656c4..d670cb7a9013bc3ca95e22235de5b7087f542205 100644 (file)
@@ -9,8 +9,6 @@
  */
 package org.opendaylight.ovsdb.lib.table;
 
-import org.opendaylight.ovsdb.lib.table.internal.Table;
-
 import com.fasterxml.jackson.annotation.JsonIgnore;
 
 public class Manager  extends Table<Manager> {
similarity index 98%
rename from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/table/Mirror.java
rename to library/src/main/java/org/opendaylight/ovsdb/lib/table/Mirror.java
index d52c2bfb0aaef598ba79d56f732f5f0b649b53fe..63c74578df8a99b6d6591876bca05309fcb37a1b 100644 (file)
@@ -12,7 +12,6 @@ package org.opendaylight.ovsdb.lib.table;
 import org.opendaylight.ovsdb.lib.notation.OvsDBMap;
 import org.opendaylight.ovsdb.lib.notation.OvsDBSet;
 import org.opendaylight.ovsdb.lib.notation.UUID;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
 
 import com.fasterxml.jackson.annotation.JsonIgnore;
 
similarity index 95%
rename from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/table/NetFlow.java
rename to library/src/main/java/org/opendaylight/ovsdb/lib/table/NetFlow.java
index ed57e1f35919d3457083e8516e2a5c3fc0e0a5b1..200ae492aae68af6561a0596f05d48d051a13d00 100644 (file)
@@ -10,7 +10,6 @@
 package org.opendaylight.ovsdb.lib.table;
 
 import org.opendaylight.ovsdb.lib.notation.OvsDBSet;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
 
 import com.fasterxml.jackson.annotation.JsonIgnore;
 
similarity index 97%
rename from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/table/Open_vSwitch.java
rename to library/src/main/java/org/opendaylight/ovsdb/lib/table/Open_vSwitch.java
index ad5cec3d3a53ae1731d1756b3335f4546fc3a6db..4e4aceefc35c094acb4b053611dfcd6b0baf86e7 100644 (file)
@@ -12,7 +12,6 @@ package org.opendaylight.ovsdb.lib.table;
 import org.opendaylight.ovsdb.lib.notation.OvsDBMap;
 import org.opendaylight.ovsdb.lib.notation.OvsDBSet;
 import org.opendaylight.ovsdb.lib.notation.UUID;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
 
 import com.fasterxml.jackson.annotation.JsonIgnore;
 
@@ -168,5 +167,5 @@ public class Open_vSwitch extends Table<Open_vSwitch> {
                 + external_ids + ", statistics=" + statistics + "]";
     }
 
-    public enum Column implements org.opendaylight.ovsdb.lib.table.internal.Column<Open_vSwitch>{ controller, fail_mode, name, ports}
+    public enum Column implements org.opendaylight.ovsdb.lib.table.Column<Open_vSwitch>{ controller, fail_mode, name, ports}
 }
similarity index 97%
rename from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/table/Port.java
rename to library/src/main/java/org/opendaylight/ovsdb/lib/table/Port.java
index 83f58f857072c1042b1500bb1fe8899c96673298..a1f394de8a7c6f4b07ea5229aaa401c867df224e 100644 (file)
@@ -14,7 +14,6 @@ import java.math.BigInteger;
 import org.opendaylight.ovsdb.lib.notation.OvsDBMap;
 import org.opendaylight.ovsdb.lib.notation.OvsDBSet;
 import org.opendaylight.ovsdb.lib.notation.UUID;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
 
 import com.fasterxml.jackson.annotation.JsonIgnore;
 
@@ -112,7 +111,7 @@ public class Port extends Table<Port> {
                 + external_ids + "]";
     }
 
-    public enum Column implements org.opendaylight.ovsdb.lib.table.internal.Column<Port> {
+    public enum Column implements org.opendaylight.ovsdb.lib.table.Column<Port> {
         interfaces,
         name,
         tag,
similarity index 96%
rename from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/table/Qos.java
rename to library/src/main/java/org/opendaylight/ovsdb/lib/table/Qos.java
index 0eb8a615060607945e1d859423aa092f3a6a6d3b..bbbe6fef44f024aeba7e68fcd144aeb80715ef48 100644 (file)
@@ -12,7 +12,6 @@ package org.opendaylight.ovsdb.lib.table;
 
 import org.opendaylight.ovsdb.lib.notation.OvsDBMap;
 import org.opendaylight.ovsdb.lib.notation.UUID;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
 
 import com.fasterxml.jackson.annotation.JsonIgnore;
 
@@ -72,7 +71,7 @@ public class Qos extends Table<Qos> {
                 + other_config + ", external_ids=" + external_ids + "]";
     }
 
-    public enum Column implements org.opendaylight.ovsdb.lib.table.internal.Column<Qos> {
+    public enum Column implements org.opendaylight.ovsdb.lib.table.Column<Qos> {
         queues,
         type,
         other_config,
similarity index 95%
rename from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/table/Queue.java
rename to library/src/main/java/org/opendaylight/ovsdb/lib/table/Queue.java
index 122f3bcf810deec57237c55cb5bd3ce2b2d9ec53..f8a7072f391650b6c401f5e4ad4ffd79c2aa5f32 100644 (file)
@@ -12,7 +12,6 @@ package org.opendaylight.ovsdb.lib.table;
 
 import org.opendaylight.ovsdb.lib.notation.OvsDBMap;
 import org.opendaylight.ovsdb.lib.notation.OvsDBSet;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
 
 import com.fasterxml.jackson.annotation.JsonIgnore;
 
@@ -63,7 +62,7 @@ public class Queue extends Table<Queue> {
                 + ", external_ids=" + external_ids + "]";
     }
 
-    public enum Column implements org.opendaylight.ovsdb.lib.table.internal.Column<Queue> {
+    public enum Column implements org.opendaylight.ovsdb.lib.table.Column<Queue> {
         dscp,
         other_config,
         external_ids}
similarity index 97%
rename from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/table/SFlow.java
rename to library/src/main/java/org/opendaylight/ovsdb/lib/table/SFlow.java
index 27f1cb7bd91557979e43032dfdf3b67d6dcd830c..ef1a0c89077fb2e49f595a07247c4005705db609 100644 (file)
@@ -11,7 +11,6 @@ package org.opendaylight.ovsdb.lib.table;
 
 import org.opendaylight.ovsdb.lib.notation.OvsDBMap;
 import org.opendaylight.ovsdb.lib.notation.OvsDBSet;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
 
 import com.fasterxml.jackson.annotation.JsonIgnore;
 
similarity index 96%
rename from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/table/SSL.java
rename to library/src/main/java/org/opendaylight/ovsdb/lib/table/SSL.java
index 1236d75b9526c97ab2ff28fac0bdd0ff8293ae73..25a762a3cf7ff2a0f3d97cb6f4b06ea548d5c265 100644 (file)
@@ -10,7 +10,6 @@
 package org.opendaylight.ovsdb.lib.table;
 
 import org.opendaylight.ovsdb.lib.notation.OvsDBMap;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
 
 import com.fasterxml.jackson.annotation.JsonIgnore;
 
@@ -68,7 +67,7 @@ public class SSL  extends Table<SSL> {
                 + external_ids + "]";
     }
 
-    public enum Column implements org.opendaylight.ovsdb.lib.table.internal.Column<SSL> {
+    public enum Column implements org.opendaylight.ovsdb.lib.table.Column<SSL> {
         ca_cert,
         bootstrap_ca_cert,
         certificate,
similarity index 94%
rename from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/table/internal/Table.java
rename to library/src/main/java/org/opendaylight/ovsdb/lib/table/Table.java
index 16304e06453f1092178191f7ed2e6ba4b465f4af..791d01a3e31fb7f03dae7624ecdf8ab553f9f6ce 100644 (file)
@@ -7,7 +7,7 @@
  *
  * Authors : Ashwin Raveendran
  */
-package org.opendaylight.ovsdb.lib.table.internal;
+package org.opendaylight.ovsdb.lib.table;
 
 public abstract class Table<E extends Table> {
     public abstract Name<E> getTableName();
similarity index 56%
rename from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/table/internal/Tables.java
rename to library/src/main/java/org/opendaylight/ovsdb/lib/table/Tables.java
index b66a49ee4769d3c5287b0bab3b8e92c08d475aa6..d8148b93149fbae71eb1ea7646aefad60f07f8e1 100644 (file)
@@ -7,24 +7,7 @@
  *
  * Authors : Ashwin Raveendran
  */
-package org.opendaylight.ovsdb.lib.table.internal;
-
-import org.opendaylight.ovsdb.lib.table.Bridge;
-import org.opendaylight.ovsdb.lib.table.Capability;
-import org.opendaylight.ovsdb.lib.table.Interface;
-import org.opendaylight.ovsdb.lib.table.Port;
-import org.opendaylight.ovsdb.lib.table.Controller;
-import org.opendaylight.ovsdb.lib.table.Manager;
-import org.opendaylight.ovsdb.lib.table.Mirror;
-import org.opendaylight.ovsdb.lib.table.NetFlow;
-import org.opendaylight.ovsdb.lib.table.Open_vSwitch;
-import org.opendaylight.ovsdb.lib.table.Qos;
-import org.opendaylight.ovsdb.lib.table.Queue;
-import org.opendaylight.ovsdb.lib.table.SFlow;
-import org.opendaylight.ovsdb.lib.table.SSL;
-import org.opendaylight.ovsdb.lib.table.Flow_Sample_Collector_Set;
-import org.opendaylight.ovsdb.lib.table.Flow_Table;
-import org.opendaylight.ovsdb.lib.table.IPFIX;
+package org.opendaylight.ovsdb.lib.table;
 
 import java.util.ArrayList;
 import java.util.List;
diff --git a/library/src/test/java/org/opendaylight/ovsdb/lib/OvsdbClientTestIT.java b/library/src/test/java/org/opendaylight/ovsdb/lib/OvsdbClientTestIT.java
new file mode 100644 (file)
index 0000000..9dc8f9e
--- /dev/null
@@ -0,0 +1,397 @@
+/*
+ * Copyright (C) 2014 EBay Software Foundation
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Ashwin Raveendran
+ */
+package org.opendaylight.ovsdb.lib;
+
+import static org.opendaylight.ovsdb.lib.operations.Operations.op;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeoutException;
+
+import junit.framework.Assert;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.ovsdb.lib.impl.OvsdbConnectionService;
+import org.opendaylight.ovsdb.lib.message.MonitorRequest;
+import org.opendaylight.ovsdb.lib.message.MonitorRequestBuilder;
+import org.opendaylight.ovsdb.lib.message.MonitorSelect;
+import org.opendaylight.ovsdb.lib.message.TableUpdate;
+import org.opendaylight.ovsdb.lib.message.TableUpdates;
+import org.opendaylight.ovsdb.lib.message.UpdateNotification;
+import org.opendaylight.ovsdb.lib.notation.Column;
+import org.opendaylight.ovsdb.lib.notation.Mutator;
+import org.opendaylight.ovsdb.lib.notation.Row;
+import org.opendaylight.ovsdb.lib.notation.UUID;
+import org.opendaylight.ovsdb.lib.operations.OperationResult;
+import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
+import org.opendaylight.ovsdb.lib.schema.ColumnSchema;
+import org.opendaylight.ovsdb.lib.schema.DatabaseSchema;
+import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
+import org.opendaylight.ovsdb.lib.schema.TableSchema;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
+import com.google.common.util.concurrent.ListenableFuture;
+
+
+public class OvsdbClientTestIT extends OvsdbTestBase {
+    Logger logger = LoggerFactory.getLogger(OvsdbClientTestIT.class);
+
+    OvsdbClient ovs;
+    DatabaseSchema dbSchema = null;
+    static String testBridgeName = "br-test";
+    static UUID testBridgeUuid = null;
+    @Test
+    public void testTransact() throws IOException, InterruptedException, ExecutionException {
+        Assert.assertNotNull(dbSchema);
+        TableSchema<GenericTableSchema> bridge = dbSchema.table("Bridge", GenericTableSchema.class);
+        ColumnSchema<GenericTableSchema, String> name = bridge.column("name", String.class);
+
+        createBridgeTransaction();
+        abortTransaction();
+        assertTransaction();
+    }
+
+    @Test
+    public void testMonitorRequest() throws ExecutionException, InterruptedException, IOException {
+        Assert.assertNotNull(dbSchema);
+        // Create Test Bridge before testing the Monitor operation
+        createBridgeTransaction();
+        sendBridgeMonitorRequest(true); // Test monitor request with Column filters
+        sendBridgeMonitorRequest(false); // Test monitor request without filters
+    }
+
+    public void sendBridgeMonitorRequest(boolean filter) throws ExecutionException, InterruptedException, IOException {
+        Assert.assertNotNull(dbSchema);
+        GenericTableSchema bridge = dbSchema.table("Bridge", GenericTableSchema.class);
+
+        List<MonitorRequest<GenericTableSchema>> monitorRequests = Lists.newArrayList();
+        ColumnSchema<GenericTableSchema, Set<Integer>> flood_vlans = bridge.multiValuedColumn("flood_vlans", Integer.class);
+        ColumnSchema<GenericTableSchema, Map<String, String>> externalIds = bridge.multiValuedColumn("external_ids", String.class, String.class);
+        MonitorRequestBuilder<GenericTableSchema> builder = MonitorRequestBuilder.builder(bridge);
+        if (filter) {
+            builder.addColumn(bridge.column("name"))
+                   .addColumn(bridge.column("fail_mode", String.class))
+                   .addColumn(flood_vlans)
+                   .addColumn(externalIds);
+        }
+        monitorRequests.add(builder.with(new MonitorSelect(true, true, true, true))
+                                   .build());
+
+        final List<Object> results = Lists.newArrayList();
+
+        MonitorHandle monitor = ovs.monitor(dbSchema, monitorRequests, new MonitorCallBack() {
+            @Override
+            public void update(TableUpdates result) {
+                results.add(result);
+                System.out.println("result = " + result);
+            }
+
+            @Override
+            public void exception(Throwable t) {
+                results.add(t);
+                System.out.println("t = " + t);
+            }
+        });
+
+        for (int i = 0; i < 3 ; i++) { //wait 3 seconds to get a result
+            System.out.println("waiting on monitor response for Bridge Table...");
+            if (!results.isEmpty()) break;
+            Thread.sleep(1000);
+        }
+
+        Assert.assertTrue(!results.isEmpty());
+        Object result = results.get(0);
+        Assert.assertTrue(result instanceof TableUpdates);
+        TableUpdates updates = (TableUpdates) result;
+        TableUpdate<GenericTableSchema> update = updates.getUpdate(bridge);
+        Row<GenericTableSchema> aNew = update.getNew();
+        if (filter) {
+            Assert.assertEquals(builder.getColumns().size(), aNew.getColumns().size());
+        } else {
+            // As per RFC7047, Section 4.1.5 : If "columns" is omitted, all columns in the table, except for "_uuid", are monitored.
+            Assert.assertEquals(bridge.getColumns().size() - 1, aNew.getColumns().size());
+        }
+        for (Column<GenericTableSchema, ?> column: aNew.getColumns()) {
+            if (column.getSchema().equals(flood_vlans)) {
+                // Test for the 5 flood_vlans inserted in Bridge br-test in createBridgeTransaction
+                Set<Integer> data = column.getData(flood_vlans);
+                Assert.assertTrue(!data.isEmpty());
+                Assert.assertEquals(5, data.size());
+            } else if (column.getSchema().equals(externalIds)) {
+                // Test for the {"key", "value"} external_ids inserted in Bridge br-test in createBridgeTransaction
+                Map<String, String> data = column.getData(externalIds);
+                Assert.assertNotNull(data.get("key"));
+                Assert.assertEquals("value", data.get("key"));
+                // Test for {"key2", "value2"} external_ids mutation-inserted in Bridge br-test in createBridgeTransaction
+                Assert.assertNotNull(data.get("key2"));
+                Assert.assertEquals("value2", data.get("key2"));
+            }
+        }
+    }
+
+    /*
+     * Ideally we should be using selectOpenVSwitchTableUuid() instead of this method.
+     * But Row.java needs some Jackson Jitsu to obtain the appropriate Row Json mapped to Java object
+     * for Select operation.
+     * Hence using the Monitor approach to obtain the uuid of the open_vSwitch table entry.
+     * Replace this method with selectOpenVSwitchTableUuid() once it is functional,
+     */
+    private UUID getOpenVSwitchTableUuid() throws ExecutionException, InterruptedException {
+        Assert.assertNotNull(dbSchema);
+        GenericTableSchema ovsTable = dbSchema.table("Open_vSwitch", GenericTableSchema.class);
+        List<MonitorRequest<GenericTableSchema>> monitorRequests = Lists.newArrayList();
+        ColumnSchema<GenericTableSchema, UUID> _uuid = ovsTable.column("_uuid", UUID.class);
+
+        monitorRequests.add(
+                MonitorRequestBuilder.builder(ovsTable)
+                        .addColumn(_uuid)
+                        .with(new MonitorSelect(true, true, true, true))
+                        .build());
+
+        final List<Object> results = Lists.newArrayList();
+
+        MonitorHandle monitor = ovs.monitor(dbSchema, monitorRequests, new MonitorCallBack() {
+            @Override
+            public void update(TableUpdates result) {
+                results.add(result);
+            }
+
+            @Override
+            public void exception(Throwable t) {
+                results.add(t);
+                System.out.println("t = " + t);
+            }
+        });
+
+        for (int i = 0; i < 3 ; i++) { //wait 5 seconds to get a result
+            System.out.println("waiting on monitor response for open_vSwtich Table...");
+            if (!results.isEmpty()) break;
+            Thread.sleep(1000);
+        }
+
+        Assert.assertTrue(!results.isEmpty());
+        Object result = results.get(0); // open_vSwitch table has just 1 row.
+        Assert.assertTrue(result instanceof TableUpdates);
+        TableUpdates updates = (TableUpdates) result;
+        TableUpdate<GenericTableSchema> update = updates.getUpdate(ovsTable);
+        Assert.assertNotNull(update.getUuid());
+        return update.getUuid();
+    }
+
+    /*
+     * TODO : selectOpenVSwitchTableUuid method isn't working as expected due to the Jackson
+     * parsing challenges on the Row object returned by the Select operation.
+     */
+    private UUID selectOpenVSwitchTableUuid() throws ExecutionException, InterruptedException {
+        Assert.assertNotNull(dbSchema);
+        GenericTableSchema ovsTable = dbSchema.table("Open_vSwitch", GenericTableSchema.class);
+
+        List<MonitorRequest<GenericTableSchema>> monitorRequests = Lists.newArrayList();
+        ColumnSchema<GenericTableSchema, UUID> _uuid = ovsTable.column("_uuid", UUID.class);
+
+        List<OperationResult> results = ovs.transactBuilder()
+               .add(op.select(ovsTable)
+                      .column(_uuid))
+                      .execute()
+                      .get();
+
+        Assert.assertTrue(!results.isEmpty());
+        OperationResult result = results.get(0);
+        List<Row<GenericTableSchema>> rows = result.getRows();
+        Row<GenericTableSchema> ovsTableRow = rows.get(0);
+        return ovsTableRow.getColumn(_uuid).getData();
+    }
+
+    private void createBridgeTransaction() throws IOException, InterruptedException, ExecutionException {
+        Assert.assertNotNull(dbSchema);
+        TableSchema<GenericTableSchema> bridge = dbSchema.table("Bridge", GenericTableSchema.class);
+        GenericTableSchema ovsTable = dbSchema.table("Open_vSwitch", GenericTableSchema.class);
+
+        ColumnSchema<GenericTableSchema, String> name = bridge.column("name", String.class);
+        ColumnSchema<GenericTableSchema, String> fail_mode = bridge.column("fail_mode", String.class);
+        ColumnSchema<GenericTableSchema, Set<Integer>> flood_vlans = bridge.multiValuedColumn("flood_vlans", Integer.class);
+        ColumnSchema<GenericTableSchema, Map<String, String>> externalIds = bridge.multiValuedColumn("external_ids", String.class, String.class);
+        ColumnSchema<GenericTableSchema, Set<UUID>> bridges = ovsTable.multiValuedColumn("bridges", UUID.class);
+        ColumnSchema<GenericTableSchema, UUID> _uuid = ovsTable.column("_uuid", UUID.class);
+
+        String namedUuid = "br_test";
+        int insertOperationIndex = 0;
+        UUID parentTable = getOpenVSwitchTableUuid();
+        TransactionBuilder transactionBuilder = ovs.transactBuilder()
+                 /*
+                  * Make sure that the position of insert operation matches the insertOperationIndex.
+                  * This will be used later when the Results are processed.
+                  */
+                .add(op.insert(bridge)
+                        .withId(namedUuid)
+                        .value(name, testBridgeName)
+                        .value(flood_vlans, Sets.newHashSet(100, 101, 4001))
+                        .value(externalIds, ImmutableMap.of("key","value")))
+                .add(op.comment("Inserting Bridge br-int"))
+                .add(op.update(bridge)
+                        .set(fail_mode, "secure")
+                        .where(name.opEqual(testBridgeName))
+                        .build())
+                .add(op.select(bridge)
+                        .column(name)
+                        .column(_uuid)
+                        .where(name.opEqual(testBridgeName))
+                        .build())
+                .add(op.mutate(bridge)
+                        .addMutation(flood_vlans, Mutator.INSERT, Sets.newHashSet(200,400))
+                        .where(name.opEqual(testBridgeName))
+                        .build())
+                .add(op.mutate(bridge)
+                        .addMutation(externalIds, Mutator.INSERT, ImmutableMap.of("key2","value2"))
+                        .where(name.opEqual(testBridgeName))
+                        .build())
+                .add(op.mutate(ovsTable)
+                        .addMutation(bridges, Mutator.INSERT, Sets.newHashSet(new UUID(namedUuid)))
+                        .where(_uuid.opEqual(parentTable))
+                        .build())
+                .add(op.commit(true));
+
+        ListenableFuture<List<OperationResult>> results = transactionBuilder.execute();
+        List<OperationResult> operationResults = results.get();
+        Assert.assertFalse(operationResults.isEmpty());
+        // Check if Results matches the number of operations in transaction
+        Assert.assertEquals(transactionBuilder.getOperations().size(), operationResults.size());
+        System.out.println("Insert & Update operation results = " + operationResults);
+        for (OperationResult result : operationResults) {
+            Assert.assertNull(result.getError());
+        }
+        testBridgeUuid = operationResults.get(insertOperationIndex).getUuid();
+    }
+
+    private void assertTransaction() throws InterruptedException, ExecutionException {
+        Assert.assertNotNull(dbSchema);
+        TableSchema<GenericTableSchema> bridge = dbSchema.table("Bridge", GenericTableSchema.class);
+        ColumnSchema<GenericTableSchema, String> name = bridge.column("name", String.class);
+
+        /*
+         * Adding a separate Assert operation in a transaction. Lets not mix this with other
+         * valid transactions as above.
+         */
+        ListenableFuture<List<OperationResult>> results = ovs.transactBuilder()
+                .add(op.delete(bridge)
+                        .where(name.opEqual(testBridgeName))
+                        .build())
+                .add(op.assertion("Assert12345")) // Failing intentionally
+                .execute();
+
+        List<OperationResult> operationResults = results.get();
+        Assert.assertFalse(operationResults.isEmpty());
+        /* Testing for an Assertion Error */
+        Assert.assertFalse(operationResults.get(1).getError() == null);
+        System.out.println("Assert operation results = " + operationResults);
+    }
+
+    private void abortTransaction() throws InterruptedException, ExecutionException {
+        Assert.assertNotNull(dbSchema);
+        TableSchema<GenericTableSchema> bridge = dbSchema.table("Bridge", GenericTableSchema.class);
+        ColumnSchema<GenericTableSchema, String> name = bridge.column("name", String.class);
+
+        /*
+         * Adding a separate Abort operation in a transaction. Lets not mix this with other
+         * valid transactions as above.
+         */
+        ListenableFuture<List<OperationResult>> results = ovs.transactBuilder()
+                .add(op.delete(bridge)
+                        .where(name.opEqual(testBridgeName))
+                        .build())
+                .add(op.abort())
+                .execute();
+
+        List<OperationResult> operationResults = results.get();
+        Assert.assertFalse(operationResults.isEmpty());
+        /* Testing for Abort Error */
+        Assert.assertFalse(operationResults.get(1).getError() == null);
+        System.out.println("Abort operation results = " + operationResults);
+    }
+
+    public void testGetDBs() throws ExecutionException, InterruptedException {
+        ListenableFuture<List<String>> databases = ovs.getDatabases();
+        List<String> dbNames = databases.get();
+        Assert.assertNotNull(dbNames);
+        boolean hasOpenVswitchSchema = false;
+        for(String dbName : dbNames) {
+           if (dbName.equals(OPEN_VSWITCH_SCHEMA)) {
+                hasOpenVswitchSchema = true;
+                break;
+           }
+        }
+        Assert.assertTrue(OPEN_VSWITCH_SCHEMA+" schema is not supported by the switch", hasOpenVswitchSchema);
+    }
+
+    @Before
+    public  void setUp() throws IOException, ExecutionException, InterruptedException, TimeoutException {
+        if (ovs != null) {
+            return;
+        }
+
+        ovs = getTestConnection();
+        System.out.println("Connection Info :" + ovs.getConnectionInfo().toString());
+        testGetDBs();
+        dbSchema = ovs.getSchema(OPEN_VSWITCH_SCHEMA, true).get();
+    }
+
+    @After
+    public void tearDown() throws InterruptedException, ExecutionException {
+        if (dbSchema == null) return;
+        TableSchema<GenericTableSchema> bridge = dbSchema.table("Bridge", GenericTableSchema.class);
+        ColumnSchema<GenericTableSchema, String> name = bridge.column("name", String.class);
+        GenericTableSchema ovsTable = dbSchema.table("Open_vSwitch", GenericTableSchema.class);
+        ColumnSchema<GenericTableSchema, Set<UUID>> bridges = ovsTable.multiValuedColumn("bridges", UUID.class);
+        ColumnSchema<GenericTableSchema, UUID> _uuid = ovsTable.column("_uuid", UUID.class);
+        UUID parentTable = getOpenVSwitchTableUuid();
+
+        ListenableFuture<List<OperationResult>> results = ovs.transactBuilder()
+                .add(op.delete(bridge)
+                        .where(name.opEqual(testBridgeName))
+                        .build())
+                .add(op.mutate(ovsTable)
+                        .addMutation(bridges, Mutator.DELETE, Sets.newHashSet(testBridgeUuid))
+                        .where(_uuid.opEqual(parentTable))
+                        .build())
+                .add(op.commit(true))
+                .execute();
+
+        List<OperationResult> operationResults = results.get();
+        System.out.println("Delete operation results = " + operationResults);
+        OvsdbConnectionService.getService().disconnect(ovs);
+    }
+
+
+    @Override
+    public void update(Object node, UpdateNotification upadateNotification) {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void locked(Object node, List<String> ids) {
+        // TODO Auto-generated method stub
+
+    }
+    @Override
+    public void stolen(Object node, List<String> ids) {
+        // TODO Auto-generated method stub
+
+    }
+}
diff --git a/library/src/test/java/org/opendaylight/ovsdb/lib/OvsdbClientTestITTyped.java b/library/src/test/java/org/opendaylight/ovsdb/lib/OvsdbClientTestITTyped.java
new file mode 100644 (file)
index 0000000..6e43299
--- /dev/null
@@ -0,0 +1,146 @@
+/*
+ * Copyright (C) 2014 EBay Software Foundation
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Ashwin Raveendran, Madhu Venugopal
+ */
+
+package org.opendaylight.ovsdb.lib;
+
+import static org.opendaylight.ovsdb.lib.operations.Operations.op;
+
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeoutException;
+
+import junit.framework.Assert;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.ovsdb.lib.impl.OvsdbConnectionService;
+import org.opendaylight.ovsdb.lib.message.UpdateNotification;
+import org.opendaylight.ovsdb.lib.notation.Mutator;
+import org.opendaylight.ovsdb.lib.notation.UUID;
+import org.opendaylight.ovsdb.lib.operations.OperationResult;
+import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
+import org.opendaylight.ovsdb.lib.schema.ColumnSchema;
+import org.opendaylight.ovsdb.lib.schema.DatabaseSchema;
+import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
+import org.opendaylight.ovsdb.lib.schema.TableSchema;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Sets;
+import com.google.common.util.concurrent.ListenableFuture;
+
+public class OvsdbClientTestITTyped extends OvsdbTestBase {
+
+    Logger logger = LoggerFactory.getLogger(OvsdbClientTestITTyped.class);
+    OvsdbClient ovs;
+    DatabaseSchema dbSchema = null;
+    static String testBridgeName = "br-test";
+    static UUID testBridgeUuid = null;
+
+    @Test
+    public void testTypedBridgeCreate() throws IOException, InterruptedException, ExecutionException, NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+        TestBridge rBridge = ovs.createTypedRowWrapper(TestBridge.class);
+        rBridge.setName(testBridgeName);
+        rBridge.setStatus(ImmutableMap.of("key","value"));
+        rBridge.setFloodVlans(Sets.newHashSet(34));
+
+        GenericTableSchema ovsTable = dbSchema.table("Open_vSwitch", GenericTableSchema.class);
+        ColumnSchema<GenericTableSchema, Set<UUID>> bridges = ovsTable.multiValuedColumn("bridges", UUID.class);
+
+        String namedUuid = "br_test";
+        int insertOperationIndex = 0;
+
+        TransactionBuilder transactionBuilder = ovs.transactBuilder()
+                .add(op.insert(rBridge.getSchema())
+                        .withId(namedUuid)
+                        .value(rBridge.getNameColumn()))
+                .add(op.update(rBridge.getSchema())
+                        .set(rBridge.getStatusColumn())
+                        .set(rBridge.getFloodVlansColumn())
+                        .where(rBridge.getNameColumn().getSchema().opEqual(rBridge.getName()))
+                        .and(rBridge.getNameColumn().getSchema().opEqual(rBridge.getName())).build())
+                .add(op.mutate(ovsTable)
+                        .addMutation(bridges, Mutator.INSERT, Sets.newHashSet(new UUID(namedUuid))));
+
+        ListenableFuture<List<OperationResult>> results = transactionBuilder.execute();
+        List<OperationResult> operationResults = results.get();
+        Assert.assertFalse(operationResults.isEmpty());
+        // Check if Results matches the number of operations in transaction
+        Assert.assertEquals(transactionBuilder.getOperations().size(), operationResults.size());
+        System.out.println("Insert & Update operation results = " + operationResults);
+        testBridgeUuid = operationResults.get(insertOperationIndex).getUuid();
+    }
+
+    public void testGetDBs() throws ExecutionException, InterruptedException {
+        ListenableFuture<List<String>> databases = ovs.getDatabases();
+        List<String> dbNames = databases.get();
+        Assert.assertNotNull(dbNames);
+        boolean hasOpenVswitchSchema = false;
+        for(String dbName : dbNames) {
+           if (dbName.equals(OPEN_VSWITCH_SCHEMA)) {
+                hasOpenVswitchSchema = true;
+                break;
+           }
+        }
+        Assert.assertTrue(OPEN_VSWITCH_SCHEMA+" schema is not supported by the switch", hasOpenVswitchSchema);
+    }
+
+    @Before
+    public  void setUp() throws IOException, ExecutionException, InterruptedException, TimeoutException {
+        if (ovs != null) {
+            return;
+        }
+        ovs = this.getTestConnection();
+        testGetDBs();
+        dbSchema = ovs.getSchema(OPEN_VSWITCH_SCHEMA, true).get();
+    }
+
+    @After
+    public void tearDown() throws InterruptedException, ExecutionException {
+        TableSchema<GenericTableSchema> bridge = dbSchema.table("Bridge", GenericTableSchema.class);
+        ColumnSchema<GenericTableSchema, String> name = bridge.column("name", String.class);
+        GenericTableSchema ovsTable = dbSchema.table("Open_vSwitch", GenericTableSchema.class);
+        ColumnSchema<GenericTableSchema, Set<UUID>> bridges = ovsTable.multiValuedColumn("bridges", UUID.class);
+
+        ListenableFuture<List<OperationResult>> results = ovs.transactBuilder()
+                .add(op.delete(bridge)
+                        .where(name.opEqual(testBridgeName))
+                        .build())
+                .add(op.mutate(ovsTable)
+                        .addMutation(bridges, Mutator.DELETE, Sets.newHashSet(testBridgeUuid)))
+                .add(op.commit(true))
+                .execute();
+
+        List<OperationResult> operationResults = results.get();
+        System.out.println("Delete operation results = " + operationResults);
+        OvsdbConnectionService.getService().disconnect(ovs);
+    }
+
+    @Override
+    public void update(Object node, UpdateNotification upadateNotification) {
+        // TODO Auto-generated method stub
+
+    }
+    @Override
+    public void locked(Object node, List<String> ids) {
+        // TODO Auto-generated method stub
+
+    }
+    @Override
+    public void stolen(Object node, List<String> ids) {
+        // TODO Auto-generated method stub
+
+    }
+}
diff --git a/library/src/test/java/org/opendaylight/ovsdb/lib/OvsdbTestBase.java b/library/src/test/java/org/opendaylight/ovsdb/lib/OvsdbTestBase.java
new file mode 100644 (file)
index 0000000..bcd9fc1
--- /dev/null
@@ -0,0 +1,117 @@
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal
+ */
+package org.opendaylight.ovsdb.lib;
+
+import java.io.IOException;
+import java.net.InetAddress;
+import java.util.Properties;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+
+import junit.framework.Assert;
+
+import org.opendaylight.ovsdb.lib.impl.OvsdbConnectionService;
+import org.opendaylight.ovsdb.lib.message.OvsdbRPC;
+
+public abstract class OvsdbTestBase implements OvsdbRPC.Callback{
+    private final static String SERVER_IPADDRESS = "ovsdbserver.ipaddress";
+    private final static String SERVER_PORT = "ovsdbserver.port";
+    private final static String CONNECTION_TYPE = "ovsdbserver.connection";
+    private final static String CONNECTION_TYPE_ACTIVE = "active";
+    private final static String CONNECTION_TYPE_PASSIVE = "passive";
+
+    private final static String DEFAULT_SERVER_PORT = "6640";
+
+    /**
+     * Represents the Open Vswitch Schema
+     */
+    public final static String OPEN_VSWITCH_SCHEMA = "Open_vSwitch";
+
+    public Properties loadProperties() {
+        Properties props = new Properties(System.getProperties());
+        return props;
+    }
+
+    public OvsdbClient getTestConnection() throws IOException, InterruptedException, ExecutionException, TimeoutException {
+        Properties props = loadProperties();
+        String addressStr = props.getProperty(SERVER_IPADDRESS);
+        String portStr = props.getProperty(SERVER_PORT, DEFAULT_SERVER_PORT);
+        String connectionType = props.getProperty(CONNECTION_TYPE, "active");
+
+        // If the connection type is active, controller connects to the ovsdb-server
+        if (connectionType.equalsIgnoreCase(CONNECTION_TYPE_ACTIVE)) {
+            if (addressStr == null) {
+                Assert.fail(usage());
+            }
+
+            InetAddress address;
+            try {
+                address = InetAddress.getByName(addressStr);
+            } catch (Exception e) {
+                System.out.println("Unable to resolve " + addressStr);
+                e.printStackTrace();
+                return null;
+            }
+
+            Integer port;
+            try {
+                port = Integer.parseInt(portStr);
+            } catch (NumberFormatException e) {
+                System.out.println("Invalid port number : " + portStr);
+                e.printStackTrace();
+                return null;
+            }
+
+            OvsdbConnection connection = OvsdbConnectionService.getService();
+            return connection.connect(address, port);
+        } else if (connectionType.equalsIgnoreCase(CONNECTION_TYPE_PASSIVE)) {
+            ExecutorService executor = Executors.newFixedThreadPool(1);
+            Future<OvsdbClient> passiveConnection = executor.submit(new PassiveListener());
+            return passiveConnection.get(60, TimeUnit.SECONDS);
+        }
+        Assert.fail("Connection parameter ("+CONNECTION_TYPE+") must be either active or passive");
+        return null;
+    }
+
+    private String usage() {
+        return "Integration Test needs a valid connection configuration as follows :\n" +
+               "active connection : mvn -Pintegrationtest -Dovsdbserver.ipaddress=x.x.x.x -Dovsdbserver.port=yyyy verify\n"+
+               "passive connection : mvn -Pintegrationtest -Dovsdbserver.connection=passive verify\n";
+    }
+
+    public class PassiveListener implements Callable<OvsdbClient>, OvsdbConnectionListener {
+        OvsdbClient client = null;
+        @Override
+        public OvsdbClient call() throws Exception {
+            OvsdbConnection connection = OvsdbConnectionService.getService();
+            connection.registerForPassiveConnection(this);
+            while (client == null) {
+                Thread.sleep(500);
+            }
+            return client;
+        }
+
+        @Override
+        public void connected(OvsdbClient client) {
+            this.client = client;
+        }
+
+        @Override
+        public void disconnected(OvsdbClient client) {
+            Assert.assertEquals(this.client.getConnectionInfo(), client.getConnectionInfo());
+            this.client = null;
+        }
+    }
+}
diff --git a/library/src/test/java/org/opendaylight/ovsdb/lib/TestBridge.java b/library/src/test/java/org/opendaylight/ovsdb/lib/TestBridge.java
new file mode 100644 (file)
index 0000000..b2cdb49
--- /dev/null
@@ -0,0 +1,164 @@
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal
+ */
+
+package org.opendaylight.ovsdb.lib;
+import java.util.Map;
+import java.util.Set;
+
+import org.opendaylight.ovsdb.lib.notation.Column;
+import org.opendaylight.ovsdb.lib.notation.UUID;
+import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
+import org.opendaylight.ovsdb.lib.schema.typed.MethodType;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedBaseTable;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedColumn;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedTable;
+
+/**
+ * Statically Typed Bridge Table as defined in ovs-vswitchd.conf.db
+ */
+
+/*
+ * Interface name was set to TestBridge on purpose to test the @TypeTable annotation
+ * functionality of TyperHelper.java
+ */
+@TypedTable(name="Bridge", database="Open_vSwitch")
+public interface TestBridge extends TypedBaseTable {
+    /*
+     * Its a good practice to set the @TypedColumn to these Statically typed Tables & Columns.
+     * Implementations can choose to use GETDATA or GETCOLUMN or both to get the data.
+     * But GETCOLUMN gives more info on ColumnSchema.
+     * The following "name" column is decorated with both GETDATA and GETCOLUMN and the corresponding test
+     * will test both the options.
+     */
+    @TypedColumn(name="name", method=MethodType.GETDATA)
+    public String getName();
+
+    @TypedColumn(name="name", method=MethodType.GETCOLUMN)
+    public Column<GenericTableSchema, String> getNameColumn();
+
+    @TypedColumn(name="name", method=MethodType.SETDATA)
+    public void setName(String name);
+
+   /*
+    * Annotations are NOT added to the Status column on purpose to test the backup
+    * functionality on getter, setter, column name derivation etc.  TyperHelper.java.
+    */
+    public Column<GenericTableSchema, Map<String, String>> getStatusColumn();
+    public void setStatus(Map<String, String> status);
+
+    /*
+     * TypedColumn's name Annotation should override the method name based Column derivation.
+     * The method name and TypedColumn name was kept different on purpose to test the name
+     * resolution priority of TyperHelper.java
+     */
+    @TypedColumn(name="flood_vlans", method=MethodType.GETCOLUMN)
+    public Column<GenericTableSchema, Set<Integer>> getFloodVlansColumn();
+
+    @TypedColumn(name="flood_vlans", method=MethodType.SETDATA)
+    public void setFloodVlans(Set<Integer> vlans);
+
+
+    @TypedColumn(name="ports", method=MethodType.GETCOLUMN)
+    public Column<GenericTableSchema, Set<UUID>> getPortsColumn();
+
+    @TypedColumn(name="ports", method=MethodType.SETDATA)
+    public void setPorts(Set<UUID> ports);
+
+
+    @TypedColumn(name="mirrors", method=MethodType.GETCOLUMN)
+    public Column<GenericTableSchema, Set<UUID>> getMirrorsColumn();
+
+    @TypedColumn(name="mirrors", method=MethodType.SETDATA)
+    public void setMirrors(Set<UUID> mirrors);
+
+
+    @TypedColumn(name="controller", method=MethodType.GETCOLUMN)
+    public Column<GenericTableSchema, Set<UUID>> getControllerColumn();
+
+    @TypedColumn(name="controller", method=MethodType.SETDATA)
+    public void setController(Set<UUID> controller);
+
+
+    @TypedColumn(name="datapath_id", method=MethodType.GETCOLUMN)
+    public Column<GenericTableSchema, Set<String>> getDatapathIdColumn();
+
+    @TypedColumn(name="datapath_id", method=MethodType.SETDATA)
+    public void setDatapathId(Set<String> datapathId);
+
+
+    @TypedColumn(name="datapath_type", method=MethodType.GETCOLUMN)
+    public Column<GenericTableSchema, String> getDatapathTypeColumn();
+
+    @TypedColumn(name="datapath_type", method=MethodType.SETDATA)
+    public void setDatapathType(String datapathType);
+
+
+    @TypedColumn(name="fail_mode", method=MethodType.GETCOLUMN)
+    public Column<GenericTableSchema, Set<String>> getFailModeColumn();
+
+    @TypedColumn(name="fail_mode", method=MethodType.SETDATA)
+    public void setFailMode(Set<String> failMode);
+
+
+    @TypedColumn(name="sflow", method=MethodType.GETCOLUMN)
+    public Column<GenericTableSchema, Set<UUID>> getSflowColumn();
+
+    @TypedColumn(name="sflow", method=MethodType.SETDATA)
+    public void setSflow(Set<UUID> sflow);
+
+
+    @TypedColumn(name="netflow", method=MethodType.GETCOLUMN)
+    public Column<GenericTableSchema, Set<UUID>> getNetflowColumn();
+
+    @TypedColumn(name="netflow", method=MethodType.SETDATA)
+    public void setNetflow(Set<UUID> netflow);
+
+
+    @TypedColumn(name="flow_tables", method=MethodType.GETCOLUMN)
+    public Column<GenericTableSchema, Map<Integer, UUID>> getFlowTablesColumn();
+
+    @TypedColumn(name="flow_tables", method=MethodType.SETDATA)
+    public void setFlowTables(Map<Integer, UUID> flowTables);
+
+
+    @TypedColumn(name="stp_enable", method=MethodType.GETCOLUMN)
+    public Column<GenericTableSchema, Boolean> getStpEnableColumn();
+
+    @TypedColumn(name="stp_enable", method=MethodType.SETDATA)
+    public void setStpEnable(Boolean stp_enable);
+
+
+    @TypedColumn(name="protocols", method=MethodType.GETCOLUMN)
+    public Column<GenericTableSchema, Set<String>> getProtocolsColumn();
+
+    @TypedColumn(name="protocols", method=MethodType.SETDATA)
+    public void setProtocols(Set<String> protocols);
+
+
+    @TypedColumn(name="other_config", method=MethodType.GETCOLUMN)
+    public Column<GenericTableSchema, Map<String, String>> getOtherConfigColumn();
+
+    @TypedColumn(name="other_config", method=MethodType.SETDATA)
+    public void setOtherConfig(Map<String, String> other_config);
+
+
+    @TypedColumn(name="external_ids", method=MethodType.GETCOLUMN)
+    public Column<GenericTableSchema, Map<String, String>> getExternalIdsColumn();
+
+    @TypedColumn(name="external_ids", method=MethodType.SETDATA)
+    public void setExternalIds(Map<String, String> externalIds);
+
+
+    @TypedColumn(name="ipfix", method=MethodType.GETCOLUMN)
+    public Column<GenericTableSchema, Set<UUID>> getIpfixColumn();
+
+    @TypedColumn(name="ipfix", method=MethodType.SETDATA)
+    public void setIpfix(Set<UUID> ipfix);
+}
diff --git a/library/src/test/java/org/opendaylight/ovsdb/lib/VersionIncompatibleBridge.java b/library/src/test/java/org/opendaylight/ovsdb/lib/VersionIncompatibleBridge.java
new file mode 100644 (file)
index 0000000..949c917
--- /dev/null
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal
+ */
+
+package org.opendaylight.ovsdb.lib;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedBaseTable;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedTable;
+
+/**
+ * VersionIncompatibleBridge is used to test the Version Compatibility logic in the Library
+ * with an absurdly low fromVersion and untilVersion which will fail for all the OVS versions.
+ */
+@TypedTable(name="Bridge", database="Open_vSwitch", fromVersion="0.0.1", untilVersion="0.0.2")
+public interface VersionIncompatibleBridge extends TypedBaseTable {
+}
diff --git a/library/src/test/java/org/opendaylight/ovsdb/lib/jsonrpc/JsonRpcDecoderTest.java b/library/src/test/java/org/opendaylight/ovsdb/lib/jsonrpc/JsonRpcDecoderTest.java
new file mode 100644 (file)
index 0000000..a6cf060
--- /dev/null
@@ -0,0 +1,98 @@
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ *  Authors : Dave Tucker
+ */
+
+package org.opendaylight.ovsdb.lib.jsonrpc;
+
+import static io.netty.buffer.Unpooled.copiedBuffer;
+import static org.junit.Assert.assertEquals;
+
+import com.google.common.base.Charsets;
+import com.google.common.io.Resources;
+import io.netty.channel.embedded.EmbeddedChannel;
+import io.netty.handler.codec.DecoderException;
+import io.netty.handler.codec.TooLongFrameException;
+import io.netty.util.CharsetUtil;
+import java.net.URL;
+import org.junit.Before;
+import org.junit.Test;
+
+public class JsonRpcDecoderTest {
+    static int testJson_BYTES = 179;
+    String testJson;
+    String prettyTestJson;
+    static final String PREAMBLE = "                    ";
+    static final String PARTIAL_START = "{\"foo\":";
+    static final String PARTIAL_END = "{\"bar\":\"baz\"}}";
+
+    JsonRpcDecoder decoder;
+    EmbeddedChannel ch;
+
+    @Before
+    public void setUp() throws Exception {
+        decoder = new JsonRpcDecoder(1000);
+        ch = new EmbeddedChannel(decoder);
+
+        URL testJsonUrl = Resources.getResource(JsonRpcDecoderTest.class, "test.json");
+        testJson = Resources.toString(testJsonUrl, Charsets.UTF_8);
+        URL prettyTestJsoUrl = Resources.getResource(JsonRpcDecoderTest.class, "pretty-test.json");
+        prettyTestJson = Resources.toString(prettyTestJsoUrl, Charsets.UTF_8);
+    }
+
+    @Test
+    public void testDecode() throws Exception {
+        for (int i = 0; i < 10; i++) {
+            ch.writeInbound(copiedBuffer(testJson, CharsetUtil.UTF_8));
+        }
+        ch.readInbound();
+        assertEquals(10, decoder.getRecordsRead());
+        ch.finish();
+    }
+
+    @Test
+    public void testDecodePrettyJson() throws Exception {
+        ch.writeInbound(copiedBuffer(prettyTestJson, CharsetUtil.UTF_8));
+        ch.readInbound();
+        assertEquals(1, decoder.getRecordsRead());
+        ch.finish();
+    }
+
+    @Test
+    public void testDecodeSkipSpaces() throws Exception {
+        ch.writeInbound(copiedBuffer(PREAMBLE + testJson + PREAMBLE + testJson, CharsetUtil.UTF_8));
+        ch.readInbound();
+        assertEquals(2, decoder.getRecordsRead());
+        ch.finish();
+    }
+
+    @Test
+    public void testDecodePartial() throws Exception {
+        ch.writeInbound(copiedBuffer(PARTIAL_START, CharsetUtil.UTF_8));
+        ch.readInbound();
+        Thread.sleep(10);
+        ch.writeInbound(copiedBuffer(PARTIAL_END, CharsetUtil.UTF_8));
+        ch.readInbound();
+        assertEquals(1, decoder.getRecordsRead());
+        ch.finish();
+    }
+
+    @Test(expected= DecoderException.class)
+    public void testDecodeInvalidEncoding() throws Exception {
+        ch.writeInbound(copiedBuffer(testJson, CharsetUtil.UTF_16));
+        ch.finish();
+    }
+
+    @Test(expected=TooLongFrameException.class)
+    public void testDecodeFrameLengthExceed() {
+        decoder = new JsonRpcDecoder(testJson_BYTES -1);
+        ch = new EmbeddedChannel(decoder);
+        ch.writeInbound(copiedBuffer(testJson, CharsetUtil.UTF_8));
+        ch.finish();
+    }
+}
\ No newline at end of file
similarity index 95%
rename from ovsdb/src/test/java/org/opendaylight/ovsdb/lib/message/MonitorResponseTest.java
rename to library/src/test/java/org/opendaylight/ovsdb/lib/message/MonitorResponseTest.java
index 97bdcdd103e72cd7443625c21786541d1bf6203c..6ba2979df8f02a0859ea98b886b931deb8df5101 100644 (file)
@@ -19,13 +19,15 @@ import com.google.common.io.Resources;
 
 import junit.framework.TestCase;
 
+import org.opendaylight.ovsdb.lib.message.temp.TableUpdate;
+import org.opendaylight.ovsdb.lib.message.temp.TableUpdates;
 import org.opendaylight.ovsdb.lib.notation.OvsDBMap;
 import org.opendaylight.ovsdb.lib.notation.OvsDBSet;
 import org.opendaylight.ovsdb.lib.notation.UUID;
 import org.opendaylight.ovsdb.lib.table.Bridge;
 import org.opendaylight.ovsdb.lib.table.Interface;
 import org.opendaylight.ovsdb.lib.table.Port;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
+import org.opendaylight.ovsdb.lib.table.Table;
 
 import java.io.IOException;
 import java.io.InputStream;
@@ -96,7 +98,7 @@ public class MonitorResponseTest extends TestCase {
         assertEquals(2, rows.size());
         List<TableUpdate.Row<Port>> sorted = Ordering.natural().onResultOf(new Function<TableUpdate.Row<Port>, String>() {
             @Override
-            public String apply(org.opendaylight.ovsdb.lib.message.TableUpdate.Row<Port> input) {
+            public String apply(TableUpdate.Row<Port> input) {
                 return input.getId();
             }
         }).sortedCopy(rows);
diff --git a/library/src/test/java/org/opendaylight/ovsdb/lib/notation/VersionTest.java b/library/src/test/java/org/opendaylight/ovsdb/lib/notation/VersionTest.java
new file mode 100644 (file)
index 0000000..d875254
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ *  Authors : Dave Tucker
+ */
+
+package org.opendaylight.ovsdb.lib.notation;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public class VersionTest {
+
+    @Test
+    public void testToString() throws Exception {
+        Version a = Version.fromString("1.2.3");
+        assertEquals("1.2.3", a.toString());
+    }
+
+    @Test
+    public void testEquals() throws Exception {
+        Version a = Version.fromString("1.2.3");
+        Version b = Version.fromString("0.0.0");
+        assertEquals(a, Version.fromString("1.2.3"));
+        assertTrue(a.hashCode() == Version.fromString("1.2.3").hashCode());
+        assertEquals(b, Version.fromString("0.0.0"));
+        assertTrue(b.hashCode() == Version.fromString("0.0.0").hashCode());
+    }
+
+    @Test
+    public void testCompareTo() throws Exception {
+        Version a = Version.fromString("1.2.27");
+        Version b = Version.fromString("1.2.0");
+        Version c = Version.fromString("1.99.0");
+        Version d = Version.fromString("99.1.0");
+
+        assertTrue(a.compareTo(b) > 0);
+        assertTrue(b.compareTo(a) < 0);
+        assertTrue(a.compareTo(c) < 0);
+        assertTrue(c.compareTo(b) > 0);
+        assertTrue(d.compareTo(a) > 0);
+        assertTrue(b.compareTo(d) < 0);
+
+    }
+}
diff --git a/library/src/test/java/org/opendaylight/ovsdb/lib/schema/OvsdbSchemaTest.java b/library/src/test/java/org/opendaylight/ovsdb/lib/schema/OvsdbSchemaTest.java
new file mode 100644 (file)
index 0000000..bb5337e
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2014 EBay Software Foundation
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Ashwin Raveendran
+ */
+package org.opendaylight.ovsdb.lib.schema;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.junit.Test;
+import org.opendaylight.ovsdb.lib.notation.Version;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import java.io.IOException;
+import java.io.InputStream;
+
+
+public class OvsdbSchemaTest {
+
+    @Test
+    public void testSchema() throws IOException {
+        InputStream resourceAsStream = OvsdbSchemaTest.class.getResourceAsStream("test_schema.json");
+        ObjectMapper mapper = new ObjectMapper();
+        JsonNode jsonNode = mapper.readTree(resourceAsStream);
+        System.out.println("jsonNode = " + jsonNode.get("id"));
+
+        DatabaseSchema schema = DatabaseSchema.fromJson("some", jsonNode.get("result"));
+        assertNotNull(schema);
+        assertEquals(Version.fromString("6.12.0"), schema.getVersion());
+    }
+}
similarity index 58%
rename from ovsdb/src/main/java/org/opendaylight/ovsdb/lib/message/operations/CommitOperation.java
rename to library/src/test/java/org/opendaylight/ovsdb/lib/schema/temp/Reference.java
index e717ca2a5d13fe37ccc38e17168a467fa785cc9f..eafb3117f22d3228b5c02266a83c50ad0f7496b3 100644 (file)
@@ -1,14 +1,15 @@
 /*
- * Copyright (C) 2013 Red Hat, Inc.
+ * Copyright (C) 2014 EBay Software Foundation
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  *
- * Authors : Madhu Venugopal
+ * Authors : Ashwin Raveendran
  */
-package org.opendaylight.ovsdb.lib.message.operations;
+package org.opendaylight.ovsdb.lib.schema.temp;
 
-public class CommitOperation extends Operation {
+
+public class Reference {
 
 }
diff --git a/library/src/test/java/org/opendaylight/ovsdb/lib/schema/test_schema.json b/library/src/test/java/org/opendaylight/ovsdb/lib/schema/test_schema.json
new file mode 100644 (file)
index 0000000..f7f8405
--- /dev/null
@@ -0,0 +1,1150 @@
+{
+  "id": 0,
+  "result": {
+    "tables": {
+      "Port": {
+        "columns": {
+          "name": {
+            "mutable": false,
+            "type": "string"
+          },
+          "statistics": {
+            "ephemeral": true,
+            "type": {
+              "key": "string",
+              "min": 0,
+              "value": "integer",
+              "max": "unlimited"
+            }
+          },
+          "vlan_mode": {
+            "type": {
+              "key": {
+                "type": "string",
+                "enum": [
+                  "set",
+                  [
+                    "access",
+                    "native-tagged",
+                    "native-untagged",
+                    "trunk"
+                  ]
+                ]
+              },
+              "min": 0
+            }
+          },
+          "qos": {
+            "type": {
+              "key": {
+                "type": "uuid",
+                "refTable": "QoS"
+              },
+              "min": 0
+            }
+          },
+          "status": {
+            "ephemeral": true,
+            "type": {
+              "key": "string",
+              "min": 0,
+              "value": "string",
+              "max": "unlimited"
+            }
+          },
+          "trunks": {
+            "type": {
+              "key": {
+                "maxInteger": 4095,
+                "minInteger": 0,
+                "type": "integer"
+              },
+              "min": 0,
+              "max": 4096
+            }
+          },
+          "mac": {
+            "type": {
+              "key": "string",
+              "min": 0
+            }
+          },
+          "interfaces": {
+            "type": {
+              "key": {
+                "type": "uuid",
+                "refTable": "Interface"
+              },
+              "max": "unlimited"
+            }
+          },
+          "bond_downdelay": {
+            "type": "integer"
+          },
+          "bond_mode": {
+            "type": {
+              "key": {
+                "type": "string",
+                "enum": [
+                  "set",
+                  [
+                    "active-backup",
+                    "balance-slb",
+                    "balance-tcp",
+                    "stable"
+                  ]
+                ]
+              },
+              "min": 0
+            }
+          },
+          "bond_updelay": {
+            "type": "integer"
+          },
+          "external_ids": {
+            "type": {
+              "key": "string",
+              "min": 0,
+              "value": "string",
+              "max": "unlimited"
+            }
+          },
+          "other_config": {
+            "type": {
+              "key": "string",
+              "min": 0,
+              "value": "string",
+              "max": "unlimited"
+            }
+          },
+          "tag": {
+            "type": {
+              "key": {
+                "maxInteger": 4095,
+                "minInteger": 0,
+                "type": "integer"
+              },
+              "min": 0
+            }
+          },
+          "bond_fake_iface": {
+            "type": "boolean"
+          },
+          "fake_bridge": {
+            "type": "boolean"
+          },
+          "lacp": {
+            "type": {
+              "key": {
+                "type": "string",
+                "enum": [
+                  "set",
+                  [
+                    "active",
+                    "off",
+                    "passive"
+                  ]
+                ]
+              },
+              "min": 0
+            }
+          }
+        },
+        "indexes": [
+          [
+            "name"
+          ]
+        ]
+      },
+      "Manager": {
+        "columns": {
+          "is_connected": {
+            "ephemeral": true,
+            "type": "boolean"
+          },
+          "target": {
+            "type": "string"
+          },
+          "other_config": {
+            "type": {
+              "key": "string",
+              "min": 0,
+              "value": "string",
+              "max": "unlimited"
+            }
+          },
+          "external_ids": {
+            "type": {
+              "key": "string",
+              "min": 0,
+              "value": "string",
+              "max": "unlimited"
+            }
+          },
+          "max_backoff": {
+            "type": {
+              "key": {
+                "minInteger": 1000,
+                "type": "integer"
+              },
+              "min": 0
+            }
+          },
+          "connection_mode": {
+            "type": {
+              "key": {
+                "type": "string",
+                "enum": [
+                  "set",
+                  [
+                    "in-band",
+                    "out-of-band"
+                  ]
+                ]
+              },
+              "min": 0
+            }
+          },
+          "status": {
+            "ephemeral": true,
+            "type": {
+              "key": "string",
+              "min": 0,
+              "value": "string",
+              "max": "unlimited"
+            }
+          },
+          "inactivity_probe": {
+            "type": {
+              "key": "integer",
+              "min": 0
+            }
+          }
+        },
+        "indexes": [
+          [
+            "target"
+          ]
+        ]
+      },
+      "Bridge": {
+        "columns": {
+          "name": {
+            "mutable": false,
+            "type": "string"
+          },
+          "flood_vlans": {
+            "type": {
+              "key": {
+                "maxInteger": 4095,
+                "minInteger": 0,
+                "type": "integer"
+              },
+              "min": 0,
+              "max": 4096
+            }
+          },
+          "netflow": {
+            "type": {
+              "key": {
+                "type": "uuid",
+                "refTable": "NetFlow"
+              },
+              "min": 0
+            }
+          },
+          "mirrors": {
+            "type": {
+              "key": {
+                "type": "uuid",
+                "refTable": "Mirror"
+              },
+              "min": 0,
+              "max": "unlimited"
+            }
+          },
+          "status": {
+            "ephemeral": true,
+            "type": {
+              "key": "string",
+              "min": 0,
+              "value": "string",
+              "max": "unlimited"
+            }
+          },
+          "datapath_id": {
+            "ephemeral": true,
+            "type": {
+              "key": "string",
+              "min": 0
+            }
+          },
+          "controller": {
+            "type": {
+              "key": {
+                "type": "uuid",
+                "refTable": "Controller"
+              },
+              "min": 0,
+              "max": "unlimited"
+            }
+          },
+          "protocols": {
+            "type": {
+              "key": {
+                "type": "string",
+                "enum": [
+                  "set",
+                  [
+                    "OpenFlow10",
+                    "OpenFlow12",
+                    "OpenFlow13"
+                  ]
+                ]
+              },
+              "min": 0,
+              "max": "unlimited"
+            }
+          },
+          "fail_mode": {
+            "type": {
+              "key": {
+                "type": "string",
+                "enum": [
+                  "set",
+                  [
+                    "secure",
+                    "standalone"
+                  ]
+                ]
+              },
+              "min": 0
+            }
+          },
+          "ports": {
+            "type": {
+              "key": {
+                "type": "uuid",
+                "refTable": "Port"
+              },
+              "min": 0,
+              "max": "unlimited"
+            }
+          },
+          "external_ids": {
+            "type": {
+              "key": "string",
+              "min": 0,
+              "value": "string",
+              "max": "unlimited"
+            }
+          },
+          "flow_tables": {
+            "type": {
+              "key": {
+                "maxInteger": 254,
+                "minInteger": 0,
+                "type": "integer"
+              },
+              "min": 0,
+              "value": {
+                "type": "uuid",
+                "refTable": "Flow_Table"
+              },
+              "max": "unlimited"
+            }
+          },
+          "sflow": {
+            "type": {
+              "key": {
+                "type": "uuid",
+                "refTable": "sFlow"
+              },
+              "min": 0
+            }
+          },
+          "datapath_type": {
+            "type": "string"
+          },
+          "other_config": {
+            "type": {
+              "key": "string",
+              "min": 0,
+              "value": "string",
+              "max": "unlimited"
+            }
+          },
+          "stp_enable": {
+            "type": "boolean"
+          }
+        },
+        "indexes": [
+          [
+            "name"
+          ]
+        ]
+      },
+      "Interface": {
+        "columns": {
+          "options": {
+            "type": {
+              "key": "string",
+              "min": 0,
+              "value": "string",
+              "max": "unlimited"
+            }
+          },
+          "name": {
+            "mutable": false,
+            "type": "string"
+          },
+          "statistics": {
+            "ephemeral": true,
+            "type": {
+              "key": "string",
+              "min": 0,
+              "value": "integer",
+              "max": "unlimited"
+            }
+          },
+          "link_speed": {
+            "ephemeral": true,
+            "type": {
+              "key": "integer",
+              "min": 0
+            }
+          },
+          "mtu": {
+            "ephemeral": true,
+            "type": {
+              "key": "integer",
+              "min": 0
+            }
+          },
+          "mac_in_use": {
+            "ephemeral": true,
+            "type": {
+              "key": "string",
+              "min": 0
+            }
+          },
+          "type": {
+            "type": "string"
+          },
+          "ingress_policing_rate": {
+            "type": {
+              "key": {
+                "minInteger": 0,
+                "type": "integer"
+              }
+            }
+          },
+          "cfm_remote_opstate": {
+            "ephemeral": true,
+            "type": {
+              "key": {
+                "type": "string",
+                "enum": [
+                  "set",
+                  [
+                    "down",
+                    "up"
+                  ]
+                ]
+              },
+              "min": 0
+            }
+          },
+          "status": {
+            "ephemeral": true,
+            "type": {
+              "key": "string",
+              "min": 0,
+              "value": "string",
+              "max": "unlimited"
+            }
+          },
+          "mac": {
+            "type": {
+              "key": "string",
+              "min": 0
+            }
+          },
+          "ofport": {
+            "type": {
+              "key": "integer",
+              "min": 0
+            }
+          },
+          "cfm_fault_status": {
+            "ephemeral": true,
+            "type": {
+              "key": "string",
+              "min": 0,
+              "max": "unlimited"
+            }
+          },
+          "duplex": {
+            "ephemeral": true,
+            "type": {
+              "key": {
+                "type": "string",
+                "enum": [
+                  "set",
+                  [
+                    "full",
+                    "half"
+                  ]
+                ]
+              },
+              "min": 0
+            }
+          },
+          "lacp_current": {
+            "ephemeral": true,
+            "type": {
+              "key": "boolean",
+              "min": 0
+            }
+          },
+          "cfm_fault": {
+            "ephemeral": true,
+            "type": {
+              "key": "boolean",
+              "min": 0
+            }
+          },
+          "external_ids": {
+            "type": {
+              "key": "string",
+              "min": 0,
+              "value": "string",
+              "max": "unlimited"
+            }
+          },
+          "other_config": {
+            "type": {
+              "key": "string",
+              "min": 0,
+              "value": "string",
+              "max": "unlimited"
+            }
+          },
+          "admin_state": {
+            "ephemeral": true,
+            "type": {
+              "key": {
+                "type": "string",
+                "enum": [
+                  "set",
+                  [
+                    "down",
+                    "up"
+                  ]
+                ]
+              },
+              "min": 0
+            }
+          },
+          "link_state": {
+            "ephemeral": true,
+            "type": {
+              "key": {
+                "type": "string",
+                "enum": [
+                  "set",
+                  [
+                    "down",
+                    "up"
+                  ]
+                ]
+              },
+              "min": 0
+            }
+          },
+          "cfm_remote_mpids": {
+            "ephemeral": true,
+            "type": {
+              "key": "integer",
+              "min": 0,
+              "max": "unlimited"
+            }
+          },
+          "cfm_mpid": {
+            "type": {
+              "key": "integer",
+              "min": 0
+            }
+          },
+          "ofport_request": {
+            "type": {
+              "key": {
+                "maxInteger": 65279,
+                "minInteger": 1,
+                "type": "integer"
+              },
+              "min": 0
+            }
+          },
+          "ingress_policing_burst": {
+            "type": {
+              "key": {
+                "minInteger": 0,
+                "type": "integer"
+              }
+            }
+          },
+          "cfm_health": {
+            "ephemeral": true,
+            "type": {
+              "key": {
+                "maxInteger": 100,
+                "minInteger": 0,
+                "type": "integer"
+              },
+              "min": 0
+            }
+          },
+          "link_resets": {
+            "ephemeral": true,
+            "type": {
+              "key": "integer",
+              "min": 0
+            }
+          }
+        },
+        "indexes": [
+          [
+            "name"
+          ]
+        ]
+      },
+      "SSL": {
+        "columns": {
+          "ca_cert": {
+            "type": "string"
+          },
+          "private_key": {
+            "type": "string"
+          },
+          "bootstrap_ca_cert": {
+            "type": "boolean"
+          },
+          "external_ids": {
+            "type": {
+              "key": "string",
+              "min": 0,
+              "value": "string",
+              "max": "unlimited"
+            }
+          },
+          "certificate": {
+            "type": "string"
+          }
+        },
+        "maxRows": 1
+      },
+      "Open_vSwitch": {
+        "columns": {
+          "ovs_version": {
+            "type": {
+              "key": "string",
+              "min": 0
+            }
+          },
+          "system_version": {
+            "type": {
+              "key": "string",
+              "min": 0
+            }
+          },
+          "bridges": {
+            "type": {
+              "key": {
+                "type": "uuid",
+                "refTable": "Bridge"
+              },
+              "min": 0,
+              "max": "unlimited"
+            }
+          },
+          "statistics": {
+            "ephemeral": true,
+            "type": {
+              "key": "string",
+              "min": 0,
+              "value": "string",
+              "max": "unlimited"
+            }
+          },
+          "other_config": {
+            "type": {
+              "key": "string",
+              "min": 0,
+              "value": "string",
+              "max": "unlimited"
+            }
+          },
+          "external_ids": {
+            "type": {
+              "key": "string",
+              "min": 0,
+              "value": "string",
+              "max": "unlimited"
+            }
+          },
+          "next_cfg": {
+            "type": "integer"
+          },
+          "manager_options": {
+            "type": {
+              "key": {
+                "type": "uuid",
+                "refTable": "Manager"
+              },
+              "min": 0,
+              "max": "unlimited"
+            }
+          },
+          "system_type": {
+            "type": {
+              "key": "string",
+              "min": 0
+            }
+          },
+          "ssl": {
+            "type": {
+              "key": {
+                "type": "uuid",
+                "refTable": "SSL"
+              },
+              "min": 0
+            }
+          },
+          "db_version": {
+            "type": {
+              "key": "string",
+              "min": 0
+            }
+          },
+          "cur_cfg": {
+            "type": "integer"
+          }
+        },
+        "maxRows": 1,
+        "isRoot": true
+      },
+      "Queue": {
+        "columns": {
+          "external_ids": {
+            "type": {
+              "key": "string",
+              "min": 0,
+              "value": "string",
+              "max": "unlimited"
+            }
+          },
+          "other_config": {
+            "type": {
+              "key": "string",
+              "min": 0,
+              "value": "string",
+              "max": "unlimited"
+            }
+          },
+          "dscp": {
+            "type": {
+              "key": {
+                "maxInteger": 63,
+                "minInteger": 0,
+                "type": "integer"
+              },
+              "min": 0
+            }
+          }
+        },
+        "isRoot": true
+      },
+      "NetFlow": {
+        "columns": {
+          "engine_type": {
+            "type": {
+              "key": {
+                "maxInteger": 255,
+                "minInteger": 0,
+                "type": "integer"
+              },
+              "min": 0
+            }
+          },
+          "targets": {
+            "type": {
+              "key": "string",
+              "max": "unlimited"
+            }
+          },
+          "add_id_to_interface": {
+            "type": "boolean"
+          },
+          "active_timeout": {
+            "type": {
+              "key": {
+                "minInteger": -1,
+                "type": "integer"
+              }
+            }
+          },
+          "external_ids": {
+            "type": {
+              "key": "string",
+              "min": 0,
+              "value": "string",
+              "max": "unlimited"
+            }
+          },
+          "engine_id": {
+            "type": {
+              "key": {
+                "maxInteger": 255,
+                "minInteger": 0,
+                "type": "integer"
+              },
+              "min": 0
+            }
+          }
+        }
+      },
+      "Mirror": {
+        "columns": {
+          "name": {
+            "type": "string"
+          },
+          "output_port": {
+            "type": {
+              "key": {
+                "refType": "weak",
+                "type": "uuid",
+                "refTable": "Port"
+              },
+              "min": 0
+            }
+          },
+          "output_vlan": {
+            "type": {
+              "key": {
+                "maxInteger": 4095,
+                "minInteger": 1,
+                "type": "integer"
+              },
+              "min": 0
+            }
+          },
+          "statistics": {
+            "ephemeral": true,
+            "type": {
+              "key": "string",
+              "min": 0,
+              "value": "integer",
+              "max": "unlimited"
+            }
+          },
+          "external_ids": {
+            "type": {
+              "key": "string",
+              "min": 0,
+              "value": "string",
+              "max": "unlimited"
+            }
+          },
+          "select_dst_port": {
+            "type": {
+              "key": {
+                "refType": "weak",
+                "type": "uuid",
+                "refTable": "Port"
+              },
+              "min": 0,
+              "max": "unlimited"
+            }
+          },
+          "select_all": {
+            "type": "boolean"
+          },
+          "select_vlan": {
+            "type": {
+              "key": {
+                "maxInteger": 4095,
+                "minInteger": 0,
+                "type": "integer"
+              },
+              "min": 0,
+              "max": 4096
+            }
+          },
+          "select_src_port": {
+            "type": {
+              "key": {
+                "refType": "weak",
+                "type": "uuid",
+                "refTable": "Port"
+              },
+              "min": 0,
+              "max": "unlimited"
+            }
+          }
+        }
+      },
+      "QoS": {
+        "columns": {
+          "queues": {
+            "type": {
+              "key": {
+                "maxInteger": 4294967295,
+                "minInteger": 0,
+                "type": "integer"
+              },
+              "min": 0,
+              "value": {
+                "type": "uuid",
+                "refTable": "Queue"
+              },
+              "max": "unlimited"
+            }
+          },
+          "other_config": {
+            "type": {
+              "key": "string",
+              "min": 0,
+              "value": "string",
+              "max": "unlimited"
+            }
+          },
+          "external_ids": {
+            "type": {
+              "key": "string",
+              "min": 0,
+              "value": "string",
+              "max": "unlimited"
+            }
+          },
+          "type": {
+            "type": "string"
+          }
+        },
+        "isRoot": true
+      },
+      "Controller": {
+        "columns": {
+          "is_connected": {
+            "ephemeral": true,
+            "type": "boolean"
+          },
+          "enable_async_messages": {
+            "type": {
+              "key": "boolean",
+              "min": 0
+            }
+          },
+          "controller_rate_limit": {
+            "type": {
+              "key": {
+                "minInteger": 100,
+                "type": "integer"
+              },
+              "min": 0
+            }
+          },
+          "target": {
+            "type": "string"
+          },
+          "external_ids": {
+            "type": {
+              "key": "string",
+              "min": 0,
+              "value": "string",
+              "max": "unlimited"
+            }
+          },
+          "other_config": {
+            "type": {
+              "key": "string",
+              "min": 0,
+              "value": "string",
+              "max": "unlimited"
+            }
+          },
+          "local_netmask": {
+            "type": {
+              "key": "string",
+              "min": 0
+            }
+          },
+          "local_gateway": {
+            "type": {
+              "key": "string",
+              "min": 0
+            }
+          },
+          "max_backoff": {
+            "type": {
+              "key": {
+                "minInteger": 1000,
+                "type": "integer"
+              },
+              "min": 0
+            }
+          },
+          "local_ip": {
+            "type": {
+              "key": "string",
+              "min": 0
+            }
+          },
+          "connection_mode": {
+            "type": {
+              "key": {
+                "type": "string",
+                "enum": [
+                  "set",
+                  [
+                    "in-band",
+                    "out-of-band"
+                  ]
+                ]
+              },
+              "min": 0
+            }
+          },
+          "status": {
+            "ephemeral": true,
+            "type": {
+              "key": "string",
+              "min": 0,
+              "value": "string",
+              "max": "unlimited"
+            }
+          },
+          "role": {
+            "ephemeral": true,
+            "type": {
+              "key": {
+                "type": "string",
+                "enum": [
+                  "set",
+                  [
+                    "master",
+                    "other",
+                    "slave"
+                  ]
+                ]
+              },
+              "min": 0
+            }
+          },
+          "inactivity_probe": {
+            "type": {
+              "key": "integer",
+              "min": 0
+            }
+          },
+          "controller_burst_limit": {
+            "type": {
+              "key": {
+                "minInteger": 25,
+                "type": "integer"
+              },
+              "min": 0
+            }
+          }
+        }
+      },
+      "Flow_Table": {
+        "columns": {
+          "groups": {
+            "type": {
+              "key": "string",
+              "min": 0,
+              "max": "unlimited"
+            }
+          },
+          "name": {
+            "type": {
+              "key": "string",
+              "min": 0
+            }
+          },
+          "overflow_policy": {
+            "type": {
+              "key": {
+                "type": "string",
+                "enum": [
+                  "set",
+                  [
+                    "evict",
+                    "refuse"
+                  ]
+                ]
+              },
+              "min": 0
+            }
+          },
+          "flow_limit": {
+            "type": {
+              "key": {
+                "minInteger": 0,
+                "type": "integer"
+              },
+              "min": 0
+            }
+          }
+        }
+      },
+      "sFlow": {
+        "columns": {
+          "polling": {
+            "type": {
+              "key": "integer",
+              "min": 0
+            }
+          },
+          "targets": {
+            "type": {
+              "key": "string",
+              "max": "unlimited"
+            }
+          },
+          "header": {
+            "type": {
+              "key": "integer",
+              "min": 0
+            }
+          },
+          "agent": {
+            "type": {
+              "key": "string",
+              "min": 0
+            }
+          },
+          "external_ids": {
+            "type": {
+              "key": "string",
+              "min": 0,
+              "value": "string",
+              "max": "unlimited"
+            }
+          },
+          "sampling": {
+            "type": {
+              "key": "integer",
+              "min": 0
+            }
+          }
+        }
+      }
+    },
+    "cksum": "2180939265 17455",
+    "name": "Open_vSwitch",
+    "version": "6.12.0"
+  },
+  "error": null
+}
diff --git a/library/src/test/resources/logback.xml b/library/src/test/resources/logback.xml
new file mode 100644 (file)
index 0000000..70118ce
--- /dev/null
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<configuration>
+
+    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+        <!-- encoders are assigned the type
+             ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
+        <encoder>
+            <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{5} - %msg%n</pattern>
+        </encoder>
+    </appender>
+
+    <logger name="org.opendaylight.ovsdb.lib.jsonrpc.JsonRpcEndpoint" level="TRACE" additivity="false">
+        <appender-ref ref="STDOUT" />
+    </logger>
+
+    <!--<logger name="com.lordofthejars.foo" level="INFO" additivity="false">-->
+        <!--<appender-ref ref="STDOUT" />-->
+    <!--</logger>-->
+
+    <root level="INFO">
+        <appender-ref ref="STDOUT" />
+    </root>
+
+</configuration>
\ No newline at end of file
diff --git a/library/src/test/resources/org/opendaylight/ovsdb/lib/jsonrpc/pretty-test.json b/library/src/test/resources/org/opendaylight/ovsdb/lib/jsonrpc/pretty-test.json
new file mode 100644 (file)
index 0000000..43fe107
--- /dev/null
@@ -0,0 +1,18 @@
+{
+  "Image": {
+    "Width": 800,
+    "Height": 600,
+    "Title": "View from 15th Floor",
+    "Thumbnail": {
+      "Url": "http://www.example.com/image/481989943",
+      "Height": 125,
+      "Width": "100"
+    },
+    "IDs": [
+      116,
+      943,
+      234,
+      38793
+    ]
+  }
+}
\ No newline at end of file
diff --git a/library/src/test/resources/org/opendaylight/ovsdb/lib/jsonrpc/test.json b/library/src/test/resources/org/opendaylight/ovsdb/lib/jsonrpc/test.json
new file mode 100644 (file)
index 0000000..9861b42
--- /dev/null
@@ -0,0 +1 @@
+{"Image":{"Width":800,"Height":600,"Title":"View from 15th Floor","Thumbnail":{"Url":"http://www.example.com/image/481989943","Height":125,"Width":"100"},"IDs":[116,943,234,38793]}}
\ No newline at end of file
diff --git a/library/src/test/resources/org/opendaylight/ovsdb/lib/schema/test_schema.json b/library/src/test/resources/org/opendaylight/ovsdb/lib/schema/test_schema.json
new file mode 100644 (file)
index 0000000..f7f8405
--- /dev/null
@@ -0,0 +1,1150 @@
+{
+  "id": 0,
+  "result": {
+    "tables": {
+      "Port": {
+        "columns": {
+          "name": {
+            "mutable": false,
+            "type": "string"
+          },
+          "statistics": {
+            "ephemeral": true,
+            "type": {
+              "key": "string",
+              "min": 0,
+              "value": "integer",
+              "max": "unlimited"
+            }
+          },
+          "vlan_mode": {
+            "type": {
+              "key": {
+                "type": "string",
+                "enum": [
+                  "set",
+                  [
+                    "access",
+                    "native-tagged",
+                    "native-untagged",
+                    "trunk"
+                  ]
+                ]
+              },
+              "min": 0
+            }
+          },
+          "qos": {
+            "type": {
+              "key": {
+                "type": "uuid",
+                "refTable": "QoS"
+              },
+              "min": 0
+            }
+          },
+          "status": {
+            "ephemeral": true,
+            "type": {
+              "key": "string",
+              "min": 0,
+              "value": "string",
+              "max": "unlimited"
+            }
+          },
+          "trunks": {
+            "type": {
+              "key": {
+                "maxInteger": 4095,
+                "minInteger": 0,
+                "type": "integer"
+              },
+              "min": 0,
+              "max": 4096
+            }
+          },
+          "mac": {
+            "type": {
+              "key": "string",
+              "min": 0
+            }
+          },
+          "interfaces": {
+            "type": {
+              "key": {
+                "type": "uuid",
+                "refTable": "Interface"
+              },
+              "max": "unlimited"
+            }
+          },
+          "bond_downdelay": {
+            "type": "integer"
+          },
+          "bond_mode": {
+            "type": {
+              "key": {
+                "type": "string",
+                "enum": [
+                  "set",
+                  [
+                    "active-backup",
+                    "balance-slb",
+                    "balance-tcp",
+                    "stable"
+                  ]
+                ]
+              },
+              "min": 0
+            }
+          },
+          "bond_updelay": {
+            "type": "integer"
+          },
+          "external_ids": {
+            "type": {
+              "key": "string",
+              "min": 0,
+              "value": "string",
+              "max": "unlimited"
+            }
+          },
+          "other_config": {
+            "type": {
+              "key": "string",
+              "min": 0,
+              "value": "string",
+              "max": "unlimited"
+            }
+          },
+          "tag": {
+            "type": {
+              "key": {
+                "maxInteger": 4095,
+                "minInteger": 0,
+                "type": "integer"
+              },
+              "min": 0
+            }
+          },
+          "bond_fake_iface": {
+            "type": "boolean"
+          },
+          "fake_bridge": {
+            "type": "boolean"
+          },
+          "lacp": {
+            "type": {
+              "key": {
+                "type": "string",
+                "enum": [
+                  "set",
+                  [
+                    "active",
+                    "off",
+                    "passive"
+                  ]
+                ]
+              },
+              "min": 0
+            }
+          }
+        },
+        "indexes": [
+          [
+            "name"
+          ]
+        ]
+      },
+      "Manager": {
+        "columns": {
+          "is_connected": {
+            "ephemeral": true,
+            "type": "boolean"
+          },
+          "target": {
+            "type": "string"
+          },
+          "other_config": {
+            "type": {
+              "key": "string",
+              "min": 0,
+              "value": "string",
+              "max": "unlimited"
+            }
+          },
+          "external_ids": {
+            "type": {
+              "key": "string",
+              "min": 0,
+              "value": "string",
+              "max": "unlimited"
+            }
+          },
+          "max_backoff": {
+            "type": {
+              "key": {
+                "minInteger": 1000,
+                "type": "integer"
+              },
+              "min": 0
+            }
+          },
+          "connection_mode": {
+            "type": {
+              "key": {
+                "type": "string",
+                "enum": [
+                  "set",
+                  [
+                    "in-band",
+                    "out-of-band"
+                  ]
+                ]
+              },
+              "min": 0
+            }
+          },
+          "status": {
+            "ephemeral": true,
+            "type": {
+              "key": "string",
+              "min": 0,
+              "value": "string",
+              "max": "unlimited"
+            }
+          },
+          "inactivity_probe": {
+            "type": {
+              "key": "integer",
+              "min": 0
+            }
+          }
+        },
+        "indexes": [
+          [
+            "target"
+          ]
+        ]
+      },
+      "Bridge": {
+        "columns": {
+          "name": {
+            "mutable": false,
+            "type": "string"
+          },
+          "flood_vlans": {
+            "type": {
+              "key": {
+                "maxInteger": 4095,
+                "minInteger": 0,
+                "type": "integer"
+              },
+              "min": 0,
+              "max": 4096
+            }
+          },
+          "netflow": {
+            "type": {
+              "key": {
+                "type": "uuid",
+                "refTable": "NetFlow"
+              },
+              "min": 0
+            }
+          },
+          "mirrors": {
+            "type": {
+              "key": {
+                "type": "uuid",
+                "refTable": "Mirror"
+              },
+              "min": 0,
+              "max": "unlimited"
+            }
+          },
+          "status": {
+            "ephemeral": true,
+            "type": {
+              "key": "string",
+              "min": 0,
+              "value": "string",
+              "max": "unlimited"
+            }
+          },
+          "datapath_id": {
+            "ephemeral": true,
+            "type": {
+              "key": "string",
+              "min": 0
+            }
+          },
+          "controller": {
+            "type": {
+              "key": {
+                "type": "uuid",
+                "refTable": "Controller"
+              },
+              "min": 0,
+              "max": "unlimited"
+            }
+          },
+          "protocols": {
+            "type": {
+              "key": {
+                "type": "string",
+                "enum": [
+                  "set",
+                  [
+                    "OpenFlow10",
+                    "OpenFlow12",
+                    "OpenFlow13"
+                  ]
+                ]
+              },
+              "min": 0,
+              "max": "unlimited"
+            }
+          },
+          "fail_mode": {
+            "type": {
+              "key": {
+                "type": "string",
+                "enum": [
+                  "set",
+                  [
+                    "secure",
+                    "standalone"
+                  ]
+                ]
+              },
+              "min": 0
+            }
+          },
+          "ports": {
+            "type": {
+              "key": {
+                "type": "uuid",
+                "refTable": "Port"
+              },
+              "min": 0,
+              "max": "unlimited"
+            }
+          },
+          "external_ids": {
+            "type": {
+              "key": "string",
+              "min": 0,
+              "value": "string",
+              "max": "unlimited"
+            }
+          },
+          "flow_tables": {
+            "type": {
+              "key": {
+                "maxInteger": 254,
+                "minInteger": 0,
+                "type": "integer"
+              },
+              "min": 0,
+              "value": {
+                "type": "uuid",
+                "refTable": "Flow_Table"
+              },
+              "max": "unlimited"
+            }
+          },
+          "sflow": {
+            "type": {
+              "key": {
+                "type": "uuid",
+                "refTable": "sFlow"
+              },
+              "min": 0
+            }
+          },
+          "datapath_type": {
+            "type": "string"
+          },
+          "other_config": {
+            "type": {
+              "key": "string",
+              "min": 0,
+              "value": "string",
+              "max": "unlimited"
+            }
+          },
+          "stp_enable": {
+            "type": "boolean"
+          }
+        },
+        "indexes": [
+          [
+            "name"
+          ]
+        ]
+      },
+      "Interface": {
+        "columns": {
+          "options": {
+            "type": {
+              "key": "string",
+              "min": 0,
+              "value": "string",
+              "max": "unlimited"
+            }
+          },
+          "name": {
+            "mutable": false,
+            "type": "string"
+          },
+          "statistics": {
+            "ephemeral": true,
+            "type": {
+              "key": "string",
+              "min": 0,
+              "value": "integer",
+              "max": "unlimited"
+            }
+          },
+          "link_speed": {
+            "ephemeral": true,
+            "type": {
+              "key": "integer",
+              "min": 0
+            }
+          },
+          "mtu": {
+            "ephemeral": true,
+            "type": {
+              "key": "integer",
+              "min": 0
+            }
+          },
+          "mac_in_use": {
+            "ephemeral": true,
+            "type": {
+              "key": "string",
+              "min": 0
+            }
+          },
+          "type": {
+            "type": "string"
+          },
+          "ingress_policing_rate": {
+            "type": {
+              "key": {
+                "minInteger": 0,
+                "type": "integer"
+              }
+            }
+          },
+          "cfm_remote_opstate": {
+            "ephemeral": true,
+            "type": {
+              "key": {
+                "type": "string",
+                "enum": [
+                  "set",
+                  [
+                    "down",
+                    "up"
+                  ]
+                ]
+              },
+              "min": 0
+            }
+          },
+          "status": {
+            "ephemeral": true,
+            "type": {
+              "key": "string",
+              "min": 0,
+              "value": "string",
+              "max": "unlimited"
+            }
+          },
+          "mac": {
+            "type": {
+              "key": "string",
+              "min": 0
+            }
+          },
+          "ofport": {
+            "type": {
+              "key": "integer",
+              "min": 0
+            }
+          },
+          "cfm_fault_status": {
+            "ephemeral": true,
+            "type": {
+              "key": "string",
+              "min": 0,
+              "max": "unlimited"
+            }
+          },
+          "duplex": {
+            "ephemeral": true,
+            "type": {
+              "key": {
+                "type": "string",
+                "enum": [
+                  "set",
+                  [
+                    "full",
+                    "half"
+                  ]
+                ]
+              },
+              "min": 0
+            }
+          },
+          "lacp_current": {
+            "ephemeral": true,
+            "type": {
+              "key": "boolean",
+              "min": 0
+            }
+          },
+          "cfm_fault": {
+            "ephemeral": true,
+            "type": {
+              "key": "boolean",
+              "min": 0
+            }
+          },
+          "external_ids": {
+            "type": {
+              "key": "string",
+              "min": 0,
+              "value": "string",
+              "max": "unlimited"
+            }
+          },
+          "other_config": {
+            "type": {
+              "key": "string",
+              "min": 0,
+              "value": "string",
+              "max": "unlimited"
+            }
+          },
+          "admin_state": {
+            "ephemeral": true,
+            "type": {
+              "key": {
+                "type": "string",
+                "enum": [
+                  "set",
+                  [
+                    "down",
+                    "up"
+                  ]
+                ]
+              },
+              "min": 0
+            }
+          },
+          "link_state": {
+            "ephemeral": true,
+            "type": {
+              "key": {
+                "type": "string",
+                "enum": [
+                  "set",
+                  [
+                    "down",
+                    "up"
+                  ]
+                ]
+              },
+              "min": 0
+            }
+          },
+          "cfm_remote_mpids": {
+            "ephemeral": true,
+            "type": {
+              "key": "integer",
+              "min": 0,
+              "max": "unlimited"
+            }
+          },
+          "cfm_mpid": {
+            "type": {
+              "key": "integer",
+              "min": 0
+            }
+          },
+          "ofport_request": {
+            "type": {
+              "key": {
+                "maxInteger": 65279,
+                "minInteger": 1,
+                "type": "integer"
+              },
+              "min": 0
+            }
+          },
+          "ingress_policing_burst": {
+            "type": {
+              "key": {
+                "minInteger": 0,
+                "type": "integer"
+              }
+            }
+          },
+          "cfm_health": {
+            "ephemeral": true,
+            "type": {
+              "key": {
+                "maxInteger": 100,
+                "minInteger": 0,
+                "type": "integer"
+              },
+              "min": 0
+            }
+          },
+          "link_resets": {
+            "ephemeral": true,
+            "type": {
+              "key": "integer",
+              "min": 0
+            }
+          }
+        },
+        "indexes": [
+          [
+            "name"
+          ]
+        ]
+      },
+      "SSL": {
+        "columns": {
+          "ca_cert": {
+            "type": "string"
+          },
+          "private_key": {
+            "type": "string"
+          },
+          "bootstrap_ca_cert": {
+            "type": "boolean"
+          },
+          "external_ids": {
+            "type": {
+              "key": "string",
+              "min": 0,
+              "value": "string",
+              "max": "unlimited"
+            }
+          },
+          "certificate": {
+            "type": "string"
+          }
+        },
+        "maxRows": 1
+      },
+      "Open_vSwitch": {
+        "columns": {
+          "ovs_version": {
+            "type": {
+              "key": "string",
+              "min": 0
+            }
+          },
+          "system_version": {
+            "type": {
+              "key": "string",
+              "min": 0
+            }
+          },
+          "bridges": {
+            "type": {
+              "key": {
+                "type": "uuid",
+                "refTable": "Bridge"
+              },
+              "min": 0,
+              "max": "unlimited"
+            }
+          },
+          "statistics": {
+            "ephemeral": true,
+            "type": {
+              "key": "string",
+              "min": 0,
+              "value": "string",
+              "max": "unlimited"
+            }
+          },
+          "other_config": {
+            "type": {
+              "key": "string",
+              "min": 0,
+              "value": "string",
+              "max": "unlimited"
+            }
+          },
+          "external_ids": {
+            "type": {
+              "key": "string",
+              "min": 0,
+              "value": "string",
+              "max": "unlimited"
+            }
+          },
+          "next_cfg": {
+            "type": "integer"
+          },
+          "manager_options": {
+            "type": {
+              "key": {
+                "type": "uuid",
+                "refTable": "Manager"
+              },
+              "min": 0,
+              "max": "unlimited"
+            }
+          },
+          "system_type": {
+            "type": {
+              "key": "string",
+              "min": 0
+            }
+          },
+          "ssl": {
+            "type": {
+              "key": {
+                "type": "uuid",
+                "refTable": "SSL"
+              },
+              "min": 0
+            }
+          },
+          "db_version": {
+            "type": {
+              "key": "string",
+              "min": 0
+            }
+          },
+          "cur_cfg": {
+            "type": "integer"
+          }
+        },
+        "maxRows": 1,
+        "isRoot": true
+      },
+      "Queue": {
+        "columns": {
+          "external_ids": {
+            "type": {
+              "key": "string",
+              "min": 0,
+              "value": "string",
+              "max": "unlimited"
+            }
+          },
+          "other_config": {
+            "type": {
+              "key": "string",
+              "min": 0,
+              "value": "string",
+              "max": "unlimited"
+            }
+          },
+          "dscp": {
+            "type": {
+              "key": {
+                "maxInteger": 63,
+                "minInteger": 0,
+                "type": "integer"
+              },
+              "min": 0
+            }
+          }
+        },
+        "isRoot": true
+      },
+      "NetFlow": {
+        "columns": {
+          "engine_type": {
+            "type": {
+              "key": {
+                "maxInteger": 255,
+                "minInteger": 0,
+                "type": "integer"
+              },
+              "min": 0
+            }
+          },
+          "targets": {
+            "type": {
+              "key": "string",
+              "max": "unlimited"
+            }
+          },
+          "add_id_to_interface": {
+            "type": "boolean"
+          },
+          "active_timeout": {
+            "type": {
+              "key": {
+                "minInteger": -1,
+                "type": "integer"
+              }
+            }
+          },
+          "external_ids": {
+            "type": {
+              "key": "string",
+              "min": 0,
+              "value": "string",
+              "max": "unlimited"
+            }
+          },
+          "engine_id": {
+            "type": {
+              "key": {
+                "maxInteger": 255,
+                "minInteger": 0,
+                "type": "integer"
+              },
+              "min": 0
+            }
+          }
+        }
+      },
+      "Mirror": {
+        "columns": {
+          "name": {
+            "type": "string"
+          },
+          "output_port": {
+            "type": {
+              "key": {
+                "refType": "weak",
+                "type": "uuid",
+                "refTable": "Port"
+              },
+              "min": 0
+            }
+          },
+          "output_vlan": {
+            "type": {
+              "key": {
+                "maxInteger": 4095,
+                "minInteger": 1,
+                "type": "integer"
+              },
+              "min": 0
+            }
+          },
+          "statistics": {
+            "ephemeral": true,
+            "type": {
+              "key": "string",
+              "min": 0,
+              "value": "integer",
+              "max": "unlimited"
+            }
+          },
+          "external_ids": {
+            "type": {
+              "key": "string",
+              "min": 0,
+              "value": "string",
+              "max": "unlimited"
+            }
+          },
+          "select_dst_port": {
+            "type": {
+              "key": {
+                "refType": "weak",
+                "type": "uuid",
+                "refTable": "Port"
+              },
+              "min": 0,
+              "max": "unlimited"
+            }
+          },
+          "select_all": {
+            "type": "boolean"
+          },
+          "select_vlan": {
+            "type": {
+              "key": {
+                "maxInteger": 4095,
+                "minInteger": 0,
+                "type": "integer"
+              },
+              "min": 0,
+              "max": 4096
+            }
+          },
+          "select_src_port": {
+            "type": {
+              "key": {
+                "refType": "weak",
+                "type": "uuid",
+                "refTable": "Port"
+              },
+              "min": 0,
+              "max": "unlimited"
+            }
+          }
+        }
+      },
+      "QoS": {
+        "columns": {
+          "queues": {
+            "type": {
+              "key": {
+                "maxInteger": 4294967295,
+                "minInteger": 0,
+                "type": "integer"
+              },
+              "min": 0,
+              "value": {
+                "type": "uuid",
+                "refTable": "Queue"
+              },
+              "max": "unlimited"
+            }
+          },
+          "other_config": {
+            "type": {
+              "key": "string",
+              "min": 0,
+              "value": "string",
+              "max": "unlimited"
+            }
+          },
+          "external_ids": {
+            "type": {
+              "key": "string",
+              "min": 0,
+              "value": "string",
+              "max": "unlimited"
+            }
+          },
+          "type": {
+            "type": "string"
+          }
+        },
+        "isRoot": true
+      },
+      "Controller": {
+        "columns": {
+          "is_connected": {
+            "ephemeral": true,
+            "type": "boolean"
+          },
+          "enable_async_messages": {
+            "type": {
+              "key": "boolean",
+              "min": 0
+            }
+          },
+          "controller_rate_limit": {
+            "type": {
+              "key": {
+                "minInteger": 100,
+                "type": "integer"
+              },
+              "min": 0
+            }
+          },
+          "target": {
+            "type": "string"
+          },
+          "external_ids": {
+            "type": {
+              "key": "string",
+              "min": 0,
+              "value": "string",
+              "max": "unlimited"
+            }
+          },
+          "other_config": {
+            "type": {
+              "key": "string",
+              "min": 0,
+              "value": "string",
+              "max": "unlimited"
+            }
+          },
+          "local_netmask": {
+            "type": {
+              "key": "string",
+              "min": 0
+            }
+          },
+          "local_gateway": {
+            "type": {
+              "key": "string",
+              "min": 0
+            }
+          },
+          "max_backoff": {
+            "type": {
+              "key": {
+                "minInteger": 1000,
+                "type": "integer"
+              },
+              "min": 0
+            }
+          },
+          "local_ip": {
+            "type": {
+              "key": "string",
+              "min": 0
+            }
+          },
+          "connection_mode": {
+            "type": {
+              "key": {
+                "type": "string",
+                "enum": [
+                  "set",
+                  [
+                    "in-band",
+                    "out-of-band"
+                  ]
+                ]
+              },
+              "min": 0
+            }
+          },
+          "status": {
+            "ephemeral": true,
+            "type": {
+              "key": "string",
+              "min": 0,
+              "value": "string",
+              "max": "unlimited"
+            }
+          },
+          "role": {
+            "ephemeral": true,
+            "type": {
+              "key": {
+                "type": "string",
+                "enum": [
+                  "set",
+                  [
+                    "master",
+                    "other",
+                    "slave"
+                  ]
+                ]
+              },
+              "min": 0
+            }
+          },
+          "inactivity_probe": {
+            "type": {
+              "key": "integer",
+              "min": 0
+            }
+          },
+          "controller_burst_limit": {
+            "type": {
+              "key": {
+                "minInteger": 25,
+                "type": "integer"
+              },
+              "min": 0
+            }
+          }
+        }
+      },
+      "Flow_Table": {
+        "columns": {
+          "groups": {
+            "type": {
+              "key": "string",
+              "min": 0,
+              "max": "unlimited"
+            }
+          },
+          "name": {
+            "type": {
+              "key": "string",
+              "min": 0
+            }
+          },
+          "overflow_policy": {
+            "type": {
+              "key": {
+                "type": "string",
+                "enum": [
+                  "set",
+                  [
+                    "evict",
+                    "refuse"
+                  ]
+                ]
+              },
+              "min": 0
+            }
+          },
+          "flow_limit": {
+            "type": {
+              "key": {
+                "minInteger": 0,
+                "type": "integer"
+              },
+              "min": 0
+            }
+          }
+        }
+      },
+      "sFlow": {
+        "columns": {
+          "polling": {
+            "type": {
+              "key": "integer",
+              "min": 0
+            }
+          },
+          "targets": {
+            "type": {
+              "key": "string",
+              "max": "unlimited"
+            }
+          },
+          "header": {
+            "type": {
+              "key": "integer",
+              "min": 0
+            }
+          },
+          "agent": {
+            "type": {
+              "key": "string",
+              "min": 0
+            }
+          },
+          "external_ids": {
+            "type": {
+              "key": "string",
+              "min": 0,
+              "value": "string",
+              "max": "unlimited"
+            }
+          },
+          "sampling": {
+            "type": {
+              "key": "integer",
+              "min": 0
+            }
+          }
+        }
+      }
+    },
+    "cksum": "2180939265 17455",
+    "name": "Open_vSwitch",
+    "version": "6.12.0"
+  },
+  "error": null
+}
index 77d9c8cf26defb74b91db46025488b5d48e48724..b7f51c3168725ab5a8aad34c18fe810c424e8827 100644 (file)
@@ -3,12 +3,12 @@
   <modelVersion>4.0.0</modelVersion>
   <parent>
     <groupId>org.opendaylight.ovsdb</groupId>
-    <artifactId>commons.ovsdb</artifactId>
-    <version>1.0.1-SNAPSHOT</version>
+    <artifactId>ovsdb_commons</artifactId>
+    <version>1.1.0-SNAPSHOT</version>
     <relativePath>../commons/parent</relativePath>
   </parent>
 
-  <artifactId>ovsdb.neutron</artifactId>
+  <artifactId>ovsdb_neutron</artifactId>
   <version>0.7.0-SNAPSHOT</version>
   <packaging>bundle</packaging>
 
     </dependency>
     <dependency>
       <groupId>org.opendaylight.ovsdb</groupId>
-      <artifactId>ovsdb</artifactId>
-      <version>0.5.1-SNAPSHOT</version>
+      <artifactId>ovsdb_library</artifactId>
+      <version>1.0.0-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.ovsdb</groupId>
+      <artifactId>ovsdb_plugin</artifactId>
+      <version>1.0.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.yangtools</groupId>
               org.opendaylight.ovsdb.plugin,
               org.opendaylight.ovsdb.lib.notation,
               org.opendaylight.ovsdb.lib.table,
-              org.opendaylight.ovsdb.lib.table.internal,
               org.opendaylight.controller.sal.binding.api,
               org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819,
               org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes,
index cc108fe1e55a211efe4da49c696d90b77685bed5..9df091ed9dac28cc8deafebfb9e4560b8248bed6 100644 (file)
@@ -17,7 +17,7 @@ import java.util.Map;
 import org.opendaylight.controller.sal.core.Node;
 import org.opendaylight.controller.sal.utils.ServiceHelper;
 import org.opendaylight.ovsdb.lib.table.Open_vSwitch;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
+import org.opendaylight.ovsdb.lib.table.Table;
 import org.opendaylight.ovsdb.plugin.OVSDBConfigService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
index 5ff7c18f5e3e52e2bbbdf5341c53e4c011c8f042..dbfd0da99024180ca099e05818a60f06b73aa22f 100644 (file)
@@ -22,7 +22,7 @@ import org.opendaylight.ovsdb.lib.notation.UUID;
 import org.opendaylight.ovsdb.lib.table.Bridge;
 import org.opendaylight.ovsdb.lib.table.Interface;
 import org.opendaylight.ovsdb.lib.table.Port;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
+import org.opendaylight.ovsdb.lib.table.Table;
 import org.opendaylight.ovsdb.neutron.provider.IProviderNetworkManager;
 import org.opendaylight.ovsdb.plugin.IConnectionServiceInternal;
 import org.opendaylight.ovsdb.plugin.OVSDBConfigService;
index 80cf8139ad5c57263d8bd5df0f7e0ab03f4168c2..dc0a6575ad5a2f37eb7781871f86a7dd68ffe81b 100644 (file)
@@ -20,7 +20,7 @@ import org.opendaylight.controller.networkconfig.neutron.NeutronNetwork;
 import org.opendaylight.controller.sal.core.Node;
 import org.opendaylight.controller.sal.utils.ServiceHelper;
 import org.opendaylight.ovsdb.lib.table.Interface;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
+import org.opendaylight.ovsdb.lib.table.Table;
 import org.opendaylight.ovsdb.plugin.IConnectionServiceInternal;
 import org.opendaylight.ovsdb.plugin.OVSDBInventoryListener;
 import org.slf4j.Logger;
index ae9914384e20d8392a5d33a22d1a1f46f223f1a8..0e03bf6db3defc98788888fceb5e87566bfc20ee 100644 (file)
@@ -22,7 +22,7 @@ import org.opendaylight.controller.sal.utils.ServiceHelper;
 import org.opendaylight.ovsdb.lib.notation.UUID;
 import org.opendaylight.ovsdb.lib.table.Interface;
 import org.opendaylight.ovsdb.lib.table.Port;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
+import org.opendaylight.ovsdb.lib.table.Table;
 import org.opendaylight.ovsdb.plugin.OVSDBConfigService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
index ec21561547ad6960f0f056616646210dc8823dcf..128b53bfffc3870e10a1b5571d4a8347f8905a1b 100644 (file)
@@ -21,7 +21,7 @@ import org.opendaylight.controller.networkconfig.neutron.NeutronPort;
 import org.opendaylight.controller.sal.core.Node;
 import org.opendaylight.controller.sal.utils.ServiceHelper;
 import org.opendaylight.ovsdb.lib.table.Interface;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
+import org.opendaylight.ovsdb.lib.table.Table;
 import org.opendaylight.ovsdb.plugin.IConnectionServiceInternal;
 import org.opendaylight.ovsdb.plugin.OVSDBInventoryListener;
 import org.slf4j.Logger;
index 70e69c81432d588aec4e7ced72a0acec546572d8..8204d91d20e09cbf74d5049b5b7160bf2637711f 100644 (file)
@@ -10,7 +10,7 @@
 package org.opendaylight.ovsdb.neutron;
 
 import org.opendaylight.controller.sal.core.Node;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
+import org.opendaylight.ovsdb.lib.table.Table;
 
 public class SouthboundEvent {
     public enum Type { NODE, ROW };
index fb20cbd3d7d2353e32f8753571754aaf1ce0bf21..5b59d683fe2c5d454e064b1d7083bbf3f6910f96 100644 (file)
@@ -29,7 +29,7 @@ import org.opendaylight.ovsdb.lib.notation.UUID;
 import org.opendaylight.ovsdb.lib.table.Interface;
 import org.opendaylight.ovsdb.lib.table.Open_vSwitch;
 import org.opendaylight.ovsdb.lib.table.Port;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
+import org.opendaylight.ovsdb.lib.table.Table;
 import org.opendaylight.ovsdb.neutron.provider.IProviderNetworkManager;
 import org.opendaylight.ovsdb.plugin.OVSDBInventoryListener;
 import org.slf4j.Logger;
index 1d9337d7de4a7f972dd95f2fe351d0e725da8a80..c74796d9dbbe687ac736a5262283f3cadaad5258 100644 (file)
@@ -35,7 +35,7 @@ import org.opendaylight.ovsdb.lib.table.Bridge;
 import org.opendaylight.ovsdb.lib.table.Interface;
 import org.opendaylight.ovsdb.lib.table.Open_vSwitch;
 import org.opendaylight.ovsdb.lib.table.Port;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
+import org.opendaylight.ovsdb.lib.table.Table;
 import org.opendaylight.ovsdb.neutron.provider.IProviderNetworkManager;
 import org.opendaylight.ovsdb.plugin.IConnectionServiceInternal;
 import org.opendaylight.ovsdb.plugin.OVSDBConfigService;
index 94c05423cc1fa5bef64294d94da7fc6487450d33..d8af0c38ccc9ab8249b4896d776a378dde2a2ba0 100644 (file)
@@ -34,7 +34,7 @@ import org.opendaylight.ovsdb.lib.notation.UUID;
 import org.opendaylight.ovsdb.lib.table.Bridge;
 import org.opendaylight.ovsdb.lib.table.Interface;
 import org.opendaylight.ovsdb.lib.table.Port;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
+import org.opendaylight.ovsdb.lib.table.Table;
 import org.opendaylight.ovsdb.neutron.NetworkHandler;
 import org.opendaylight.ovsdb.neutron.IAdminConfigManager;
 import org.opendaylight.ovsdb.neutron.IInternalNetworkManager;
index 542128a4317c76c057f7be39e559c7a7a94a058f..c6cd2591055ec9ccf2ef5d447de5c6c39739930c 100644 (file)
@@ -215,7 +215,7 @@ public class OF13Provider implements NetworkProvider {
             String bridgeUUID = null;
             String tunnelBridgeName = adminConfigManager.getIntegrationBridgeName();
             OVSDBConfigService ovsdbTable = (OVSDBConfigService)ServiceHelper.getGlobalInstance(OVSDBConfigService.class, this);
-            Map<String, org.opendaylight.ovsdb.lib.table.internal.Table<?>> bridgeTable = ovsdbTable.getRows(node, Bridge.NAME.getName());
+            Map<String, org.opendaylight.ovsdb.lib.table.Table<?>> bridgeTable = ovsdbTable.getRows(node, Bridge.NAME.getName());
             if (bridgeTable != null) {
                 for (String uuid : bridgeTable.keySet()) {
                     Bridge bridge = (Bridge)bridgeTable.get(uuid);
@@ -287,7 +287,7 @@ public class OF13Provider implements NetworkProvider {
         try {
             String bridgeUUID = null;
             OVSDBConfigService ovsdbTable = (OVSDBConfigService)ServiceHelper.getGlobalInstance(OVSDBConfigService.class, this);
-            Map<String, org.opendaylight.ovsdb.lib.table.internal.Table<?>> bridgeTable = ovsdbTable.getRows(node, Bridge.NAME.getName());
+            Map<String, org.opendaylight.ovsdb.lib.table.Table<?>> bridgeTable = ovsdbTable.getRows(node, Bridge.NAME.getName());
             if (bridgeTable != null) {
                 for (String uuid : bridgeTable.keySet()) {
                     Bridge bridge = (Bridge)bridgeTable.get(uuid);
@@ -911,9 +911,9 @@ public class OF13Provider implements NetworkProvider {
                 return;
             }
 
-            Map<String, org.opendaylight.ovsdb.lib.table.internal.Table<?>> intfs = ovsdbTable.getRows(node, Interface.NAME.getName());
+            Map<String, org.opendaylight.ovsdb.lib.table.Table<?>> intfs = ovsdbTable.getRows(node, Interface.NAME.getName());
             if (intfs != null) {
-                for (org.opendaylight.ovsdb.lib.table.internal.Table<?> row : intfs.values()) {
+                for (org.opendaylight.ovsdb.lib.table.Table<?> row : intfs.values()) {
                     Interface tunIntf = (Interface)row;
                     if (tunIntf.getName().equals(this.getTunnelName(tunnelType, dst))) {
                         of_ports = tunIntf.getOfport();
@@ -975,9 +975,9 @@ public class OF13Provider implements NetworkProvider {
                 return;
             }
 
-            Map<String, org.opendaylight.ovsdb.lib.table.internal.Table<?>> intfs = ovsdbTable.getRows(node, Interface.NAME.getName());
+            Map<String, org.opendaylight.ovsdb.lib.table.Table<?>> intfs = ovsdbTable.getRows(node, Interface.NAME.getName());
             if (intfs != null) {
-                for (org.opendaylight.ovsdb.lib.table.internal.Table<?> row : intfs.values()) {
+                for (org.opendaylight.ovsdb.lib.table.Table<?> row : intfs.values()) {
                     Interface tunIntf = (Interface)row;
                     if (tunIntf.getName().equals(this.getTunnelName(tunnelType, dst))) {
                         of_ports = tunIntf.getOfport();
@@ -1048,9 +1048,9 @@ public class OF13Provider implements NetworkProvider {
                 return;
             }
 
-            Map<String, org.opendaylight.ovsdb.lib.table.internal.Table<?>> intfs = ovsdbTable.getRows(node, Interface.NAME.getName());
+            Map<String, org.opendaylight.ovsdb.lib.table.Table<?>> intfs = ovsdbTable.getRows(node, Interface.NAME.getName());
             if (intfs != null) {
-                for (org.opendaylight.ovsdb.lib.table.internal.Table<?> row : intfs.values()) {
+                for (org.opendaylight.ovsdb.lib.table.Table<?> row : intfs.values()) {
                     Interface ethIntf = (Interface)row;
                     if (ethIntf.getName().equalsIgnoreCase(adminConfigManager.getPhysicalInterfaceName(node, network.getProviderPhysicalNetwork()))) {
                         of_ports = ethIntf.getOfport();
@@ -1119,9 +1119,9 @@ public class OF13Provider implements NetworkProvider {
                 return;
             }
 
-            Map<String, org.opendaylight.ovsdb.lib.table.internal.Table<?>> intfs = ovsdbTable.getRows(node, Interface.NAME.getName());
+            Map<String, org.opendaylight.ovsdb.lib.table.Table<?>> intfs = ovsdbTable.getRows(node, Interface.NAME.getName());
             if (intfs != null) {
-                for (org.opendaylight.ovsdb.lib.table.internal.Table<?> row : intfs.values()) {
+                for (org.opendaylight.ovsdb.lib.table.Table<?> row : intfs.values()) {
                     Interface ethIntf = (Interface)row;
                     if (ethIntf.getName().equalsIgnoreCase(adminConfigManager.getPhysicalInterfaceName(node,
                                                                    network.getProviderPhysicalNetwork()))) {
@@ -1210,9 +1210,9 @@ public class OF13Provider implements NetworkProvider {
     private Status triggerInterfaceUpdates(Node node) {
         try {
             OVSDBConfigService ovsdbTable = (OVSDBConfigService)ServiceHelper.getGlobalInstance(OVSDBConfigService.class, this);
-            Map<String, org.opendaylight.ovsdb.lib.table.internal.Table<?>> intfs = ovsdbTable.getRows(node, Interface.NAME.getName());
+            Map<String, org.opendaylight.ovsdb.lib.table.Table<?>> intfs = ovsdbTable.getRows(node, Interface.NAME.getName());
             if (intfs != null) {
-                for (org.opendaylight.ovsdb.lib.table.internal.Table<?> row : intfs.values()) {
+                for (org.opendaylight.ovsdb.lib.table.Table<?> row : intfs.values()) {
                     Interface intf = (Interface)row;
                     NeutronNetwork network = tenantNetworkManager.getTenantNetworkForInterface(intf);
                     logger.debug("Trigger Interface update for {}", intf);
@@ -4064,7 +4064,7 @@ public class OF13Provider implements NetworkProvider {
     private String getInternalBridgeUUID (Node node, String bridgeName) {
         try {
             OVSDBConfigService ovsdbTable = (OVSDBConfigService)ServiceHelper.getGlobalInstance(OVSDBConfigService.class, this);
-            Map<String, org.opendaylight.ovsdb.lib.table.internal.Table<?>> bridgeTable = ovsdbTable.getRows(node, Bridge.NAME.getName());
+            Map<String, org.opendaylight.ovsdb.lib.table.Table<?>> bridgeTable = ovsdbTable.getRows(node, Bridge.NAME.getName());
             if (bridgeTable == null) return null;
             for (String key : bridgeTable.keySet()) {
                 Bridge bridge = (Bridge)bridgeTable.get(key);
index 5ac7a2d5a241bbaa44976c98c1caaec9c94372e8..6e3f6774fd07e6bd1cfe27d63b19302790445be1 100644 (file)
@@ -32,7 +32,7 @@ import org.opendaylight.controller.sal.core.Node;
 import org.opendaylight.controller.sal.utils.ServiceHelper;
 import org.opendaylight.ovsdb.lib.notation.OvsDBMap;
 import org.opendaylight.ovsdb.lib.table.Open_vSwitch;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
+import org.opendaylight.ovsdb.lib.table.Table;
 import org.opendaylight.ovsdb.plugin.ConfigurationService;
 import org.opendaylight.ovsdb.plugin.OVSDBConfigService;
 import org.powermock.api.mockito.PowerMockito;
similarity index 88%
rename from northbound/ovsdb/pom.xml
rename to northbound/pom.xml
index f6c0de5671def485072db9ae4b64f505d83a8aae..8f9891ba3f533b558670f90db3bd83eccdece519 100644 (file)
@@ -3,12 +3,12 @@
   <modelVersion>4.0.0</modelVersion>
   <parent>
     <groupId>org.opendaylight.ovsdb</groupId>
-    <artifactId>commons.ovsdb</artifactId>
-    <version>1.0.1-SNAPSHOT</version>
-    <relativePath>../../commons/parent</relativePath>
+    <artifactId>ovsdb_commons</artifactId>
+    <version>1.1.0-SNAPSHOT</version>
+    <relativePath>../commons/parent</relativePath>
   </parent>
-  <artifactId>ovsdb.northbound</artifactId>
-  <version>0.5.1-SNAPSHOT</version>
+  <artifactId>ovsdb_northbound</artifactId>
+  <version>0.6.0-SNAPSHOT</version>
   <packaging>bundle</packaging>
   <dependencies>
 
     </dependency>
     <dependency>
       <groupId>org.opendaylight.ovsdb</groupId>
-      <artifactId>ovsdb</artifactId>
-      <version>0.5.1-SNAPSHOT</version>
+      <artifactId>ovsdb_library</artifactId>
+      <version>1.0.0-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.ovsdb</groupId>
+      <artifactId>ovsdb_plugin</artifactId>
+      <version>1.0.0-SNAPSHOT</version>
     </dependency>
 
   </dependencies>
@@ -69,7 +74,6 @@
               org.opendaylight.controller.sal.core,
               org.opendaylight.controller.sal.authorization,
               org.opendaylight.ovsdb.lib.table,
-              org.opendaylight.ovsdb.lib.table.internal,
               org.opendaylight.ovsdb.lib.notation,
               org.opendaylight.ovsdb.plugin,
               javax.ws.rs,
similarity index 99%
rename from northbound/ovsdb/src/main/java/org/opendaylight/ovsdb/northbound/OVSDBNorthbound.java
rename to northbound/src/main/java/org/opendaylight/ovsdb/northbound/OVSDBNorthbound.java
index a67f66b07283b968f4c36fe15bc379980b0f6522..1a808eac13f5e3cbcb46df404f7d4a6238492b50 100644 (file)
@@ -40,8 +40,8 @@ import org.opendaylight.controller.sal.utils.ServiceHelper;
 import org.opendaylight.controller.sal.utils.Status;
 import org.opendaylight.controller.sal.utils.StatusCode;
 import org.opendaylight.ovsdb.lib.notation.UUID;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
-import org.opendaylight.ovsdb.lib.table.internal.Tables;
+import org.opendaylight.ovsdb.lib.table.Table;
+import org.opendaylight.ovsdb.lib.table.Tables;
 import org.opendaylight.ovsdb.plugin.OVSDBConfigService;
 import org.opendaylight.ovsdb.plugin.StatusWithUuid;
 import org.slf4j.Logger;
similarity index 98%
rename from northbound/ovsdb/src/main/java/org/opendaylight/ovsdb/northbound/OVSDBRow.java
rename to northbound/src/main/java/org/opendaylight/ovsdb/northbound/OVSDBRow.java
index 9f5ab18980c651405a8687a102316624f7b1b904..fc2624ec40b305a48613caeb22e41e3d53d31e95 100644 (file)
@@ -23,7 +23,7 @@ import org.opendaylight.ovsdb.lib.table.Qos;
 import org.opendaylight.ovsdb.lib.table.Queue;
 import org.opendaylight.ovsdb.lib.table.SFlow;
 import org.opendaylight.ovsdb.lib.table.SSL;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
+import org.opendaylight.ovsdb.lib.table.Table;
 
 import com.fasterxml.jackson.annotation.JsonSubTypes;
 import com.fasterxml.jackson.annotation.JsonTypeInfo;
similarity index 92%
rename from northbound/ovsdb/src/main/java/org/opendaylight/ovsdb/northbound/OVSDBRows.java
rename to northbound/src/main/java/org/opendaylight/ovsdb/northbound/OVSDBRows.java
index 0632c87cb1b9d11d0f8e850db8bcd58984e7e2d2..6d15b82c2469dbaf6225a4fe7fb0c44d60e69000 100644 (file)
@@ -11,7 +11,7 @@ package org.opendaylight.ovsdb.northbound;
 
 import java.util.Map;
 
-import org.opendaylight.ovsdb.lib.table.internal.Table;
+import org.opendaylight.ovsdb.lib.table.Table;
 
 public class OVSDBRows {
     Map<String, Table<?>> rows;
diff --git a/ovsdb/src/main/java/org/opendaylight/ovsdb/lib/message/MonitorRequest.java b/ovsdb/src/main/java/org/opendaylight/ovsdb/lib/message/MonitorRequest.java
deleted file mode 100644 (file)
index 99330b0..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 2013 EBay Software Foundation
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Ashwin Raveendran, Madhu Venugopal
- */
-package org.opendaylight.ovsdb.lib.message;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.google.common.collect.Lists;
-
-import java.util.List;
-
-import org.opendaylight.ovsdb.lib.table.internal.Column;
-
-@JsonInclude(JsonInclude.Include.NON_NULL)
-public class MonitorRequest<E> {
-
-    //@JsonSerialize(contentAs = ToStringSerializer.class)
-    List<Column<E>> columns;
-
-    MonitorSelect select;
-
-    public List<? extends Column> getColumns() {
-        return columns;
-    }
-
-    public void setColumns(List<Column<E>> columns) {
-        this.columns = columns;
-    }
-
-
-    public MonitorSelect getSelect() {
-        return select;
-    }
-
-    public void setSelect(MonitorSelect select) {
-        this.select = select;
-    }
-
-    public MonitorRequest<E> column(Column<E> column) {
-        if (null == columns) {
-            columns = Lists.newArrayList();
-        }
-        columns.add(column);
-        return this;
-    }
-}
diff --git a/ovsdb/src/main/java/org/opendaylight/ovsdb/lib/message/MonitorRequestBuilder.java b/ovsdb/src/main/java/org/opendaylight/ovsdb/lib/message/MonitorRequestBuilder.java
deleted file mode 100644 (file)
index 406eb1a..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2013 EBay Software Foundation
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Ashwin Raveendran, Madhu Venugopal
- */
-package org.opendaylight.ovsdb.lib.message;
-
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-
-import org.opendaylight.ovsdb.lib.jsonrpc.Params;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
-
-import java.util.List;
-import java.util.Map;
-
-public class MonitorRequestBuilder implements Params {
-
-    Map<String, MonitorRequest> requests = Maps.newLinkedHashMap();
-
-    @Override
-    public List<Object> params() {
-        return Lists.newArrayList("Open_vSwitch", null, requests);
-    }
-
-    public <T extends Table> MonitorRequest<T> monitor(T table) {
-        MonitorRequest<T> req = new MonitorRequest<T>();
-        requests.put(table.getTableName().getName(), req);
-        return req;
-    }
-}
diff --git a/ovsdb/src/main/java/org/opendaylight/ovsdb/lib/message/operations/Operation.java b/ovsdb/src/main/java/org/opendaylight/ovsdb/lib/message/operations/Operation.java
deleted file mode 100644 (file)
index 856e74f..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2013 Red Hat, Inc.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Madhu Venugopal
- */
-package org.opendaylight.ovsdb.lib.message.operations;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-
-public abstract class Operation {
-    private String op;
-    @JsonIgnore
-    // Just a simple way to retain the result of a transact operation which the client can refer to.
-    private OperationResult result;
-
-    public String getOp() {
-        return op;
-    }
-
-    public void setOp(String op) {
-        this.op = op;
-    }
-
-    public OperationResult getResult() {
-        return result;
-    }
-
-    public void setResult(OperationResult result) {
-        this.result = result;
-    }
-
-    @Override
-    public String toString() {
-        return "Operation [op=" + op + ", result=" + result + "]";
-    }
-}
diff --git a/ovsdb/src/test/java/org/opendaylight/ovsdb/lib/message/OVSDBNettyFactoryIT.java b/ovsdb/src/test/java/org/opendaylight/ovsdb/lib/message/OVSDBNettyFactoryIT.java
deleted file mode 100644 (file)
index 862c5cc..0000000
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- * [[ Authors will Fill in the Copyright header ]]
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Brent Salisbury, Madhu Venugopal, Aswin Raveendran
- */
-package org.opendaylight.ovsdb.lib.message;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-
-import org.apache.commons.collections.MapUtils;
-import org.junit.Before;
-import org.junit.Test;
-import org.opendaylight.controller.sal.connection.ConnectionConstants;
-import org.opendaylight.controller.sal.core.Node;
-import org.opendaylight.ovsdb.lib.database.DatabaseSchema;
-import org.opendaylight.ovsdb.lib.message.operations.InsertOperation;
-import org.opendaylight.ovsdb.lib.message.operations.MutateOperation;
-import org.opendaylight.ovsdb.lib.message.operations.Operation;
-import org.opendaylight.ovsdb.lib.message.operations.OperationResult;
-import org.opendaylight.ovsdb.lib.notation.Condition;
-import org.opendaylight.ovsdb.lib.notation.Function;
-import org.opendaylight.ovsdb.lib.notation.Mutation;
-import org.opendaylight.ovsdb.lib.notation.Mutator;
-import org.opendaylight.ovsdb.lib.notation.OvsDBSet;
-import org.opendaylight.ovsdb.lib.notation.UUID;
-import org.opendaylight.ovsdb.lib.table.Bridge;
-import org.opendaylight.ovsdb.lib.table.Interface;
-import org.opendaylight.ovsdb.lib.table.Open_vSwitch;
-import org.opendaylight.ovsdb.lib.table.Port;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
-import org.opendaylight.ovsdb.lib.table.internal.Tables;
-import org.opendaylight.ovsdb.plugin.Connection;
-import org.opendaylight.ovsdb.plugin.ConnectionService;
-import org.opendaylight.ovsdb.plugin.InventoryService;
-
-import com.google.common.util.concurrent.ListenableFuture;
-
-public class OVSDBNettyFactoryIT {
-    InventoryService inventoryService;
-    private static String bridgeIdentifier = "br1";
-    private static final Integer CONNECTION_TIMEOUT_MSEC = 3000;
-    private Properties props;
-
-    @Before
-    public void initialize() throws IOException {
-        InputStream is = this.getClass().getClassLoader()
-                .getResourceAsStream(
-                        "org/opendaylight/ovsdb/lib/message/integration-test.properties");
-        if (is == null) {
-            throw new IOException("Unable to load integration-test.properties");
-        }
-        props = new Properties();
-        props.load(is);
-
-    }
-
-    @Test
-    public void testSome() throws InterruptedException, ExecutionException, TimeoutException,
-            IOException {
-        ConnectionService connectionService = new ConnectionService();
-        connectionService.init();
-        inventoryService = new InventoryService();
-        inventoryService.init();
-        connectionService.setInventoryServiceInternal(inventoryService);
-        Node.NodeIDType.registerIDType("OVS", String.class);
-        Map<ConnectionConstants, String> params = new HashMap<ConnectionConstants, String>();
-        params.put(ConnectionConstants.ADDRESS,
-                props.getProperty("ovsdbserver.ipaddress"));
-        params.put(ConnectionConstants.PORT,
-                props.getProperty("ovsdbserver.port", "6640"));
-
-        Node node = connectionService.connect("TEST", params);
-        if (node == null) {
-            throw new IOException("Unable to connect to the host");
-        }
-
-        Connection connection = connectionService.getConnection(node);
-        if (connection == null) {
-            throw new IOException("Unable to connect to the host");
-        }
-
-        OvsdbRPC ovsdb = connection.getRpc();
-        if (ovsdb == null) {
-            throw new IOException("Unable to obtain RPC instance");
-        }
-
-        //GET DB-SCHEMA
-        List<String> dbNames = Arrays.asList(Open_vSwitch.NAME.getName());
-        ListenableFuture<DatabaseSchema> dbSchemaF = ovsdb.get_schema(dbNames);
-        DatabaseSchema databaseSchema = null;
-        databaseSchema = dbSchemaF.get(CONNECTION_TIMEOUT_MSEC, TimeUnit.MILLISECONDS);
-
-        MapUtils.debugPrint(System.out, null, databaseSchema.getTables());
-
-        // TEST MONITOR
-        // YES it is expected to fail with "duplicate monitor ID" as we have a perpetual monitor in Inventory Service
-        MonitorRequestBuilder monitorReq = new MonitorRequestBuilder();
-        for (Table<?> table : Tables.getTables()) {
-            monitorReq.monitor(table);
-        }
-
-        ListenableFuture<TableUpdates> monResponse = ovsdb.monitor(monitorReq);
-        System.out.println("Monitor Request sent :");
-        TableUpdates updates = monResponse.get();
-        inventoryService.processTableUpdates(node, updates);
-        inventoryService.printCache(node);
-
-        // TRANSACT INSERT TEST
-
-        Map<String, Table<?>> ovsTable = inventoryService.getTableCache(node, Open_vSwitch.NAME.getName());
-        String newBridge = "new_bridge";
-        String newInterface = "new_interface";
-        String newPort = "new_port";
-        String newSwitch = "new_switch";
-
-        Operation addSwitchRequest = null;
-
-        if(ovsTable != null){
-            String ovsTableUUID = (String) ovsTable.keySet().toArray()[0];
-            UUID bridgeUuidPair = new UUID(newBridge);
-            Mutation bm = new Mutation("bridges", Mutator.INSERT, bridgeUuidPair);
-            List<Mutation> mutations = new ArrayList<Mutation>();
-            mutations.add(bm);
-
-            UUID uuid = new UUID(ovsTableUUID);
-            Condition condition = new Condition("_uuid", Function.EQUALS, uuid);
-            List<Condition> where = new ArrayList<Condition>();
-            where.add(condition);
-            addSwitchRequest = new MutateOperation(Open_vSwitch.NAME.getName(), where, mutations);
-        }
-        else{
-            Open_vSwitch ovsTableRow = new Open_vSwitch();
-            OvsDBSet<UUID> bridges = new OvsDBSet<UUID>();
-            UUID bridgeUuidPair = new UUID(newBridge);
-            bridges.add(bridgeUuidPair);
-            ovsTableRow.setBridges(bridges);
-            addSwitchRequest = new InsertOperation(Open_vSwitch.NAME.getName(), newSwitch, ovsTableRow);
-        }
-
-        Bridge bridgeRow = new Bridge();
-        bridgeRow.setName(bridgeIdentifier);
-        OvsDBSet<UUID> ports = new OvsDBSet<UUID>();
-        UUID port = new UUID(newPort);
-        ports.add(port);
-        bridgeRow.setPorts(ports);
-        InsertOperation addBridgeRequest = new InsertOperation(Bridge.NAME.getName(), newBridge, bridgeRow);
-
-        Port portRow = new Port();
-        portRow.setName(bridgeIdentifier);
-        OvsDBSet<UUID> interfaces = new OvsDBSet<UUID>();
-        UUID interfaceid = new UUID(newInterface);
-        interfaces.add(interfaceid);
-        portRow.setInterfaces(interfaces);
-        InsertOperation addPortRequest = new InsertOperation(Port.NAME.getName(), newPort, portRow);
-
-        Interface interfaceRow = new Interface();
-        interfaceRow.setName(bridgeIdentifier);
-        interfaceRow.setType("internal");
-        InsertOperation addIntfRequest = new InsertOperation(Interface.NAME.getName(), newInterface, interfaceRow);
-
-        TransactBuilder transaction = new TransactBuilder();
-        transaction.addOperations(new ArrayList<Operation>(
-                Arrays.asList(addSwitchRequest, addIntfRequest, addPortRequest, addBridgeRequest)));
-
-        ListenableFuture<List<OperationResult>> transResponse = ovsdb.transact(transaction);
-        System.out.println("Transcation sent :");
-        List<OperationResult> tr = transResponse.get();
-        System.out.println("Transaction response : "+transResponse.toString());
-        List<Operation> requests = transaction.getRequests();
-        for (int i = 0; i < tr.size() ; i++) {
-            if (i < requests.size()) requests.get(i).setResult(tr.get(i));
-        }
-
-        System.out.println("Request + Response : "+requests.toString());
-        if (tr.size() > requests.size()) {
-            System.out.println("ERROR : "+tr.get(tr.size()-1).getError());
-            System.out.println("Details : "+tr.get(tr.size()-1).getDetails());
-        }
-
-        // TEST ECHO
-
-        ListenableFuture<List<String>> some = ovsdb.echo();
-        Object s = some.get();
-        System.out.printf("Result of echo is %s \n", s);
-
-        // TEST ECHO REQUEST/REPLY
-        Thread.sleep(10000);
-
-        connectionService.disconnect(node);
-    }
-}
diff --git a/ovsdb/src/test/resources/org/opendaylight/ovsdb/lib/message/integration-test.properties b/ovsdb/src/test/resources/org/opendaylight/ovsdb/lib/message/integration-test.properties
deleted file mode 100644 (file)
index 7d6453a..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-ovsdbserver.ipaddress=${ovsdbserver.ipaddress}
-ovsdbserver.port=${ovsdbserver.port}
\ No newline at end of file
similarity index 85%
rename from ovsdb/pom.xml
rename to plugin/pom.xml
index 18c890ac96644bfba444affe237cbf6380451d8f..623afc06b3fb4ae3b75cbdbf359a4f7998a89807 100755 (executable)
@@ -3,21 +3,27 @@
   <modelVersion>4.0.0</modelVersion>
   <parent>
     <groupId>org.opendaylight.ovsdb</groupId>
-    <artifactId>commons.ovsdb</artifactId>
-    <version>1.0.1-SNAPSHOT</version>
+    <artifactId>ovsdb_commons</artifactId>
+    <version>1.1.0-SNAPSHOT</version>
     <relativePath>../commons/parent</relativePath>
   </parent>
-  <artifactId>ovsdb</artifactId>
-  <version>0.5.1-SNAPSHOT</version>
+  <artifactId>ovsdb_plugin</artifactId>
+  <version>1.0.0-SNAPSHOT</version>
   <packaging>bundle</packaging>
 
   <properties>
     <!-- used for filtering the integration test resource -->
-    <ovsdbserver.ipaddress>192.168.56.10</ovsdbserver.ipaddress>
-    <ovsdbserver.port>6640</ovsdbserver.port>
     <skip.integrationtest>true</skip.integrationtest>
   </properties>
   <dependencies>
+    <dependency>
+      <groupId>ch.qos.logback</groupId>
+      <artifactId>logback-classic</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>ch.qos.logback</groupId>
+      <artifactId>logback-core</artifactId>
+    </dependency>
     <dependency>
       <groupId>com.fasterxml.jackson.core</groupId>
       <artifactId>jackson-annotations</artifactId>
@@ -67,7 +73,7 @@
     <dependency>
       <groupId>io.netty</groupId>
       <artifactId>netty-all</artifactId>
-      <version>4.0.17.Final</version>
+      <version>4.0.10.Final</version>
     </dependency>
     <dependency>
       <groupId>javax.portlet</groupId>
       <artifactId>sal.networkconfiguration</artifactId>
       <version>0.0.3-SNAPSHOT</version>
     </dependency>
+    <dependency>
+      <groupId>org.opendaylight.ovsdb</groupId>
+      <artifactId>ovsdb_library</artifactId>
+      <version>1.0.0-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+    </dependency>
   </dependencies>
 
   <build>
                             org.opendaylight.controller.sal.connection,
                             org.opendaylight.controller.clustering.services,
                             org.opendaylight.controller.sal.networkconfig.bridgedomain,
+                            org.opendaylight.ovsdb.lib.table,
+                            org.opendaylight.ovsdb.plugin,
+                            org.opendaylight.ovsdb.lib.notation,
+                            org.opendaylight.ovsdb.lib.database,
+                            org.opendaylight.ovsdb.lib.operations,
+                            org.opendaylight.ovsdb.lib.message,
                             org.apache.commons.lang3.builder,
                             org.apache.commons.lang3.tuple,
                             org.apache.felix.dm,
             <Embed-Dependency>httpclient,commons-codec,httpcore-nio,javax.servlet-api,portlet-api,commons-collections;type=!pom;inline=false</Embed-Dependency>
             <Embed-Transitive>true</Embed-Transitive>
             <Bundle-Activator>org.opendaylight.ovsdb.plugin.Activator</Bundle-Activator>
-            <Export-Package>org.opendaylight.ovsdb.lib.table, org.opendaylight.ovsdb.lib.table.internal, org.opendaylight.ovsdb.plugin, org.opendaylight.ovsdb.lib.notation</Export-Package>
+            <Export-Package>org.opendaylight.ovsdb.plugin</Export-Package>
           </instructions>
           <manifestLocation>${project.basedir}/META-INF</manifestLocation>
         </configuration>
similarity index 99%
rename from ovsdb/src/main/java/org/opendaylight/ovsdb/plugin/ConfigurationService.java
rename to plugin/src/main/java/org/opendaylight/ovsdb/plugin/ConfigurationService.java
index 8fec86bc7e826272831f5e55cf038bf98ea21ab7..85b795ebae78dfe32c37c4707c157671f583db9b 100644 (file)
@@ -32,12 +32,12 @@ import org.opendaylight.controller.sal.utils.StatusCode;
 import org.opendaylight.ovsdb.lib.database.OVSInstance;
 import org.opendaylight.ovsdb.lib.database.OvsdbType;
 import org.opendaylight.ovsdb.lib.message.TransactBuilder;
-import org.opendaylight.ovsdb.lib.message.operations.DeleteOperation;
-import org.opendaylight.ovsdb.lib.message.operations.InsertOperation;
-import org.opendaylight.ovsdb.lib.message.operations.MutateOperation;
-import org.opendaylight.ovsdb.lib.message.operations.Operation;
-import org.opendaylight.ovsdb.lib.message.operations.OperationResult;
-import org.opendaylight.ovsdb.lib.message.operations.UpdateOperation;
+import org.opendaylight.ovsdb.lib.operations.DeleteOperation;
+import org.opendaylight.ovsdb.lib.operations.InsertOperation;
+import org.opendaylight.ovsdb.lib.operations.MutateOperation;
+import org.opendaylight.ovsdb.lib.operations.Operation;
+import org.opendaylight.ovsdb.lib.operations.OperationResult;
+import org.opendaylight.ovsdb.lib.operations.UpdateOperation;
 import org.opendaylight.ovsdb.lib.notation.Condition;
 import org.opendaylight.ovsdb.lib.notation.Function;
 import org.opendaylight.ovsdb.lib.notation.Mutation;
@@ -58,7 +58,7 @@ import org.opendaylight.ovsdb.lib.table.Qos;
 import org.opendaylight.ovsdb.lib.table.Queue;
 import org.opendaylight.ovsdb.lib.table.SFlow;
 import org.opendaylight.ovsdb.lib.table.SSL;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
+import org.opendaylight.ovsdb.lib.table.Table;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.FrameworkUtil;
 import org.slf4j.Logger;
@@ -410,7 +410,7 @@ public class ConfigurationService implements IPluginInBridgeDomainConfigService,
             if (connection != null) {
                 String newmanager = "new_manager";
 
-                OVSInstance instance = OVSInstance.monitorOVS(connection);
+                OVSInstance instance = OVSInstance.monitorOVS();
 
                 Map ovsoutter = new LinkedHashMap();
                 Map ovsinner = new LinkedHashMap();
similarity index 95%
rename from ovsdb/src/main/java/org/opendaylight/ovsdb/plugin/ConnectionService.java
rename to plugin/src/main/java/org/opendaylight/ovsdb/plugin/ConnectionService.java
index ad7f71a5a24009099a9fc5830c03156a37ed04fa..534a94605cdcb393544991a12c664a83fd019616 100644 (file)
@@ -54,14 +54,14 @@ import org.opendaylight.ovsdb.lib.jsonrpc.JsonRpcEndpoint;
 import org.opendaylight.ovsdb.lib.jsonrpc.JsonRpcServiceBinderHandler;
 import org.opendaylight.ovsdb.lib.message.MonitorRequestBuilder;
 import org.opendaylight.ovsdb.lib.message.OvsdbRPC;
-import org.opendaylight.ovsdb.lib.message.TableUpdates;
+import org.opendaylight.ovsdb.lib.message.temp.TableUpdates;
 import org.opendaylight.ovsdb.lib.message.UpdateNotification;
 import org.opendaylight.ovsdb.lib.notation.OvsDBSet;
 import org.opendaylight.ovsdb.lib.table.Bridge;
 import org.opendaylight.ovsdb.lib.table.Controller;
 import org.opendaylight.ovsdb.lib.table.Open_vSwitch;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
-import org.opendaylight.ovsdb.lib.table.internal.Tables;
+import org.opendaylight.ovsdb.lib.table.Table;
+import org.opendaylight.ovsdb.lib.table.Tables;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -256,7 +256,7 @@ public class ConnectionService implements IPluginInConnectionService, IConnectio
 
         JsonRpcEndpoint factory = new JsonRpcEndpoint(objectMapper, channel);
         JsonRpcServiceBinderHandler binderHandler = new JsonRpcServiceBinderHandler(factory);
-        binderHandler.setNode(node);
+        binderHandler.setContext(node);
         channel.pipeline().addLast(binderHandler);
 
         OvsdbRPC ovsdb = factory.getClient(node, OvsdbRPC.class);
@@ -310,20 +310,20 @@ public class ConnectionService implements IPluginInConnectionService, IConnectio
         inventoryServiceInternal.addNode(connection.getNode(), props);
 
         List<String> dbNames = Arrays.asList(Open_vSwitch.NAME.getName());
-        ListenableFuture<DatabaseSchema> dbSchemaF = connection.getRpc().get_schema(dbNames);
+        ListenableFuture<DatabaseSchema> dbSchemaF = null;//TODO : fix it up to new structue : connection.getRpc().get_schema(dbNames);
         DatabaseSchema databaseSchema = dbSchemaF.get();
         inventoryServiceInternal.updateDatabaseSchema(connection.getNode(), databaseSchema);
 
-        MonitorRequestBuilder monitorReq = new MonitorRequestBuilder();
+        MonitorRequestBuilder monitorReq = null; //ashwin(not sure if we need) : new MonitorRequestBuilder();
         for (Table<?> table : Tables.getTables()) {
             if (databaseSchema.getTables().keySet().contains(table.getTableName().getName())) {
-                monitorReq.monitor(table);
+                //ashwin(not sure if we need) monitorReq.monitor(table);
             } else {
                 logger.debug("We know about table {} but it is not in the schema of {}", table.getTableName().getName(), connection.getNode().getNodeIDString());
             }
         }
 
-        ListenableFuture<TableUpdates> monResponse = connection.getRpc().monitor(monitorReq);
+        ListenableFuture<TableUpdates> monResponse = null; //TODO : ashwin(not sure if we need)connection.getRpc().monitor(monitorReq);
         TableUpdates updates = monResponse.get();
         if (updates.getError() != null) {
             logger.error("Error configuring monitor, error : {}, details : {}",
@@ -527,19 +527,18 @@ public class ConnectionService implements IPluginInConnectionService, IConnectio
     }
 
     @Override
-    public void update(Node node, UpdateNotification updateNotification) {
+    public void update(Object context, UpdateNotification updateNotification) {
         if (updateNotification == null) return;
-        inventoryServiceInternal.processTableUpdates(node, updateNotification.getUpdate());
+        inventoryServiceInternal.processTableUpdates((Node)context, updateNotification.getUpdate());
     }
 
     @Override
-    public void locked(Node node, List<String> ids) {
+    public void locked(Object context, List<String> ids) {
         // TODO Auto-generated method stub
     }
 
     @Override
-    public void stolen(Node node, List<String> ids) {
+    public void stolen(Object context, List<String> ids) {
         // TODO Auto-generated method stub
     }
-
 }
similarity index 98%
rename from ovsdb/src/main/java/org/opendaylight/ovsdb/plugin/InventoryService.java
rename to plugin/src/main/java/org/opendaylight/ovsdb/plugin/InventoryService.java
index a1bac127bc6ef6cf3ff19530f56d85584dbe0348..28ae17b68b4f4b4c3659f471e1dc45ed3cad5a4a 100644 (file)
@@ -33,12 +33,12 @@ import org.opendaylight.controller.sal.inventory.IPluginOutInventoryService;
 import org.opendaylight.controller.sal.utils.HexEncode;
 import org.opendaylight.controller.sal.utils.ServiceHelper;
 import org.opendaylight.ovsdb.lib.database.DatabaseSchema;
-import org.opendaylight.ovsdb.lib.message.TableUpdate;
-import org.opendaylight.ovsdb.lib.message.TableUpdate.Row;
-import org.opendaylight.ovsdb.lib.message.TableUpdates;
+import org.opendaylight.ovsdb.lib.message.temp.TableUpdate;
+import org.opendaylight.ovsdb.lib.message.temp.TableUpdate.Row;
+import org.opendaylight.ovsdb.lib.message.temp.TableUpdates;
 import org.opendaylight.ovsdb.lib.notation.OvsDBSet;
 import org.opendaylight.ovsdb.lib.table.Bridge;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
+import org.opendaylight.ovsdb.lib.table.Table;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
similarity index 93%
rename from ovsdb/src/main/java/org/opendaylight/ovsdb/plugin/InventoryServiceInternal.java
rename to plugin/src/main/java/org/opendaylight/ovsdb/plugin/InventoryServiceInternal.java
index 032427560e2cefcf439dc89a33f39c91dd999444..c06ac5fad4c049d1356e872d9be5673fb34bdfa7 100644 (file)
@@ -17,8 +17,8 @@ import org.opendaylight.controller.sal.core.Property;
 import org.opendaylight.controller.sal.core.UpdateType;
 import org.opendaylight.controller.sal.inventory.IPluginInInventoryService;
 import org.opendaylight.ovsdb.lib.database.DatabaseSchema;
-import org.opendaylight.ovsdb.lib.message.TableUpdates;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
+import org.opendaylight.ovsdb.lib.message.temp.TableUpdates;
+import org.opendaylight.ovsdb.lib.table.Table;
 
 public interface InventoryServiceInternal extends IPluginInInventoryService {
     public ConcurrentMap<String, ConcurrentMap<String, Table<?>>> getCache(Node n);
similarity index 97%
rename from ovsdb/src/main/java/org/opendaylight/ovsdb/plugin/NodeDB.java
rename to plugin/src/main/java/org/opendaylight/ovsdb/plugin/NodeDB.java
index 912d0ee0d39d6ca67400c889a8237262e214f48b..b97a6e369dd6492fe6e7c1b864e6b7b7384f54f2 100644 (file)
@@ -16,7 +16,7 @@ import com.google.common.collect.Maps;
 
 import org.apache.commons.collections.MapUtils;
 import org.opendaylight.ovsdb.lib.database.DatabaseSchema;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
+import org.opendaylight.ovsdb.lib.table.Table;
 
 public class NodeDB {
     private DatabaseSchema schema;
similarity index 95%
rename from ovsdb/src/main/java/org/opendaylight/ovsdb/plugin/OVSDBConfigService.java
rename to plugin/src/main/java/org/opendaylight/ovsdb/plugin/OVSDBConfigService.java
index 5deeaeaaf9a4023fd9fba0ae95a7b31c19affd50..ff34783f056d10fe5efa61722da05a6b898aceab 100644 (file)
@@ -14,7 +14,7 @@ import java.util.concurrent.ConcurrentMap;
 
 import org.opendaylight.controller.sal.core.Node;
 import org.opendaylight.controller.sal.utils.Status;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
+import org.opendaylight.ovsdb.lib.table.Table;
 
 public interface OVSDBConfigService {
     public StatusWithUuid insertRow (Node node, String tableName, String parentUUID, Table<?> row);
similarity index 93%
rename from ovsdb/src/main/java/org/opendaylight/ovsdb/plugin/OVSDBInventoryListener.java
rename to plugin/src/main/java/org/opendaylight/ovsdb/plugin/OVSDBInventoryListener.java
index e0bdc1e4c135399d3a0cc3927d988a8e3e9edcb5..87c6ead0466f236c025ce7dce22511bacd07a9f0 100644 (file)
@@ -10,7 +10,7 @@
 package org.opendaylight.ovsdb.plugin;
 
 import org.opendaylight.controller.sal.core.Node;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
+import org.opendaylight.ovsdb.lib.table.Table;
 
 public interface OVSDBInventoryListener {
     public void nodeAdded(Node node);
similarity index 75%
rename from ovsdb/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestBase.java
rename to plugin/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestBase.java
index 3bdbefbcc300cba31d031f2af516c0aaeafdd29c..e9644dbcd81683422c10408f2e1559be3dd31bca 100644 (file)
 package org.opendaylight.ovsdb.plugin;
 
 import java.io.IOException;
-import java.io.InputStream;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Properties;
 
+import junit.framework.Assert;
+
 import org.opendaylight.controller.sal.connection.ConnectionConstants;
 import org.opendaylight.controller.sal.core.Node;
 import org.opendaylight.controller.sal.core.NodeConnector;
@@ -26,19 +27,12 @@ public abstract class OvsdbTestBase {
     protected final static String TAGGED_PORT_NAME = "eth1";
     protected final static String TUNNEL_PORT_NAME = "vxlan0";
     protected final static String FAKE_IP = "192.168.254.254";
+    private final static String SERVER_IPADDRESS = "ovsdbserver.ipaddress";
+    private final static String SERVER_PORT = "ovsdbserver.port";
+    private final static String DEFAULT_SERVER_PORT = "6640";
 
     public Properties loadProperties() throws IOException {
-        InputStream is = this
-                .getClass()
-                .getClassLoader()
-                .getResourceAsStream(
-                        "org/opendaylight/ovsdb/lib/message/integration-test.properties");
-        if (is == null) {
-            throw new IOException("Unable to load integration-test.properties");
-        }
-        Properties props = new Properties();
-        props.load(is);
-
+        Properties props = new Properties(System.getProperties());
         return props;
     }
 
@@ -55,9 +49,19 @@ public abstract class OvsdbTestBase {
     }
 
     public TestObjects getTestConnection() throws IOException {
+        Properties props = loadProperties();
+        String address = props.getProperty(SERVER_IPADDRESS);
+        String port = props.getProperty(SERVER_PORT, DEFAULT_SERVER_PORT);
+
+        if (address == null) {
+            Assert.fail("Usage : mvn -Pintegrationtest -Dovsdbserver.ipaddress=x.x.x.x -Dovsdbserver.port=yyyy verify");
+        }
+
         Node.NodeIDType.registerIDType("OVS", String.class);
         NodeConnector.NodeConnectorIDType.registerIDType("OVS", String.class,
                 "OVS");
+        InventoryService inventoryService = new InventoryService();
+        inventoryService.init();
 
         ConnectionService connectionService = new ConnectionService();
         connectionService.init();
@@ -65,11 +69,9 @@ public abstract class OvsdbTestBase {
         inventory.init();
         connectionService.setInventoryServiceInternal(inventory);
         Map<ConnectionConstants, String> params = new HashMap<ConnectionConstants, String>();
-        Properties props = loadProperties();
-        params.put(ConnectionConstants.ADDRESS,
-                props.getProperty("ovsdbserver.ipaddress"));
-        params.put(ConnectionConstants.PORT,
-                props.getProperty("ovsdbserver.port", "6640"));
+
+        params.put(ConnectionConstants.ADDRESS, address);
+        params.put(ConnectionConstants.PORT, port);
 
         Node node = connectionService.connect(identifier, params);
         if (node == null) {
similarity index 75%
rename from ovsdb/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestDeletePortIT.java
rename to plugin/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestDeletePortIT.java
index c52d60751fe9176259e287d6fdf418aee1ba600a..3fd246d3134e535f4a05d10d2c868499163ee569 100644 (file)
@@ -9,10 +9,6 @@
  */
 package org.opendaylight.ovsdb.plugin;
 
-import java.io.IOException;
-import java.util.Properties;
-
-import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.controller.sal.core.Node;
 import org.slf4j.Logger;
@@ -22,20 +18,19 @@ public class OvsdbTestDeletePortIT extends OvsdbTestBase {
     private static final Logger logger = LoggerFactory
             .getLogger(OvsdbTestAddPortIT.class);
 
-    private Properties props;
-
-    @Before
-    public void loadProps() throws IOException {
-        props = loadProperties();
-    }
-
     @Test
     public void deletePort() throws Throwable{
         TestObjects testObjects = getTestConnection();
         ConnectionService connectionService = testObjects.connectionService;
         Node node = testObjects.node;
 
-
+        /**
+         * Deletes an existing port from an existing bridge
+         * Ex. ovs-vsctl del-port ovsbr0 tap0
+         * @param node Node serving this configuration service
+         * @param bridgeDomainIdentifier String representation of a Bridge Domain
+         * @param portIdentifier String representation of a user defined Port Name
+         */
         ConfigurationService configurationService = new ConfigurationService();
         configurationService.setConnectionServiceInternal(connectionService);
         configurationService.deletePort(node, BRIDGE_NAME, PORT_NAME);
diff --git a/pom.xml b/pom.xml
index fc66dd20d47cf1d1f15dcdeb1135342174b24312..09dc5dd86be6414efc196dd48a9bf98d2d57e368 100755 (executable)
--- a/pom.xml
+++ b/pom.xml
@@ -4,20 +4,22 @@
 
   <parent>
     <groupId>org.opendaylight.ovsdb</groupId>
-    <artifactId>commons.ovsdb</artifactId>
-    <version>1.0.1-SNAPSHOT</version>
+    <artifactId>ovsdb_commons</artifactId>
+    <version>1.1.0-SNAPSHOT</version>
     <relativePath>commons/parent</relativePath>
   </parent>
   <groupId>org.opendaylight.ovsdb</groupId>
-  <artifactId>ovsdb.project</artifactId>
-  <version>0.5.1-SNAPSHOT</version>
+  <artifactId>ovsdb_project</artifactId>
+  <version>1.0.0-SNAPSHOT</version>
   <packaging>pom</packaging>
   <prerequisites>
     <maven>3.0</maven>
   </prerequisites>
   <modules>
-    <module>ovsdb</module>
-    <module>northbound/ovsdb</module>
+    <module>library</module>
+    <module>schemas/Open_vSwitch</module>
+    <module>plugin</module>
+    <module>northbound</module>
     <module>neutron</module>
     <module>commons/parent</module>
     <module>distribution/opendaylight</module>
diff --git a/schemas/Open_vSwitch/pom.xml b/schemas/Open_vSwitch/pom.xml
new file mode 100755 (executable)
index 0000000..95174f1
--- /dev/null
@@ -0,0 +1,180 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.opendaylight.ovsdb</groupId>
+    <artifactId>ovsdb_commons</artifactId>
+    <version>1.1.0-SNAPSHOT</version>
+    <relativePath>../../commons/parent</relativePath>
+  </parent>
+  <artifactId>ovsdb_schema.Open_vSwitch</artifactId>
+  <version>1.0.0-SNAPSHOT</version>
+  <packaging>bundle</packaging>
+
+  <properties>
+    <skip.integrationtest>true</skip.integrationtest>
+  </properties>
+  <dependencies>
+    <dependency>
+      <groupId>ch.qos.logback</groupId>
+      <artifactId>logback-classic</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>ch.qos.logback</groupId>
+      <artifactId>logback-core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>com.fasterxml.jackson.core</groupId>
+      <artifactId>jackson-annotations</artifactId>
+      <version>${jackson.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>com.fasterxml.jackson.core</groupId>
+      <artifactId>jackson-core</artifactId>
+      <version>${jackson.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>com.fasterxml.jackson.core</groupId>
+      <artifactId>jackson-databind</artifactId>
+      <version>${jackson.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>com.google.code.gson</groupId>
+      <artifactId>gson</artifactId>
+      <version>2.1</version>
+      <scope>compile</scope>
+    </dependency>
+    <dependency>
+      <groupId>com.google.guava</groupId>
+      <artifactId>guava</artifactId>
+      <version>${guava.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>commons-codec</groupId>
+      <artifactId>commons-codec</artifactId>
+      <version>1.4</version>
+      <optional>true</optional>
+    </dependency>
+    <dependency>
+      <groupId>commons-collections</groupId>
+      <artifactId>commons-collections</artifactId>
+      <version>1.0</version>
+    </dependency>
+    <dependency>
+      <groupId>commons-lang</groupId>
+      <artifactId>commons-lang</artifactId>
+      <version>2.3</version>
+    </dependency>
+    <dependency>
+      <groupId>equinoxSDK381</groupId>
+      <artifactId>org.eclipse.osgi</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>io.netty</groupId>
+      <artifactId>netty-all</artifactId>
+      <version>4.0.10.Final</version>
+    </dependency>
+    <dependency>
+      <groupId>javax.portlet</groupId>
+      <artifactId>portlet-api</artifactId>
+      <version>2.0</version>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.httpcomponents</groupId>
+      <artifactId>httpcore-nio</artifactId>
+      <version>4.2.1</version>
+      <optional>true</optional>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.ovsdb</groupId>
+      <artifactId>ovsdb_library</artifactId>
+      <version>1.0.0-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <testResources>
+      <testResource>
+        <filtering>true</filtering>
+        <directory>src/test/resources</directory>
+      </testResource>
+    </testResources>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <version>2.3.6</version>
+        <extensions>true</extensions>
+        <configuration>
+          <instructions>
+            <Import-Package>org.opendaylight.ovsdb.lib,
+                org.opendaylight.ovsdb.lib.table,
+                org.opendaylight.ovsdb.lib.jsonrpc,
+                org.opendaylight.ovsdb.lib.notation,
+                org.opendaylight.ovsdb.lib.database,
+                org.opendaylight.ovsdb.lib.operations,
+                org.opendaylight.ovsdb.lib.message,
+                org.opendaylight.ovsdb.lib.schema,
+                org.opendaylight.ovsdb.lib.schema.typed,
+                org.apache.commons.lang3.builder,
+                org.apache.commons.lang3.tuple,
+                org.apache.felix.dm,
+                org.slf4j,
+                org.eclipse.osgi.framework.console,
+                org.osgi.framework,
+                javax.net.ssl,
+                *</Import-Package>
+            <Embed-Transitive>true</Embed-Transitive>
+            <Export-Package>org.opendaylight.ovsdb.schema.openvswitch</Export-Package>
+          </instructions>
+          <manifestLocation>${project.basedir}/META-INF</manifestLocation>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-failsafe-plugin</artifactId>
+        <configuration>
+          <skipITs>${skip.integrationtest}</skipITs>
+          <includes>
+            <include>**/*IT*</include>
+          </includes>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <version>2.16</version>
+        <configuration>
+          <excludes>
+            <!--  Exclude integration tests -->
+            <exclude>**/*IT*</exclude>
+          </excludes>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+  <scm>
+    <connection>scm:git:ssh://git.opendaylight.org:29418/ovsdb.git</connection>
+    <developerConnection>scm:git:ssh://git.opendaylight.org:29418/ovsdb.git</developerConnection>
+    <tag>HEAD</tag>
+    <url>https://wiki.opendaylight.org/view/OVSDB_Integration:Main</url>
+  </scm>
+
+  <profiles>
+    <profile>
+      <id>integrationtest</id>
+      <activation></activation>
+      <properties>
+        <skip.integrationtest>false</skip.integrationtest>
+      </properties>
+    </profile>
+  </profiles>
+</project>
diff --git a/schemas/Open_vSwitch/src/main/java/org/opendaylight/ovsdb/schema/openvswitch/Bridge.java b/schemas/Open_vSwitch/src/main/java/org/opendaylight/ovsdb/schema/openvswitch/Bridge.java
new file mode 100644 (file)
index 0000000..c822aab
--- /dev/null
@@ -0,0 +1,134 @@
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal, Dave Tucker
+ */
+
+package org.opendaylight.ovsdb.schema.openvswitch;
+import java.util.Map;
+import java.util.Set;
+
+import org.opendaylight.ovsdb.lib.notation.Column;
+import org.opendaylight.ovsdb.lib.notation.UUID;
+import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
+import org.opendaylight.ovsdb.lib.schema.typed.MethodType;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedBaseTable;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedColumn;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedTable;
+
+/**
+ * This class is a typed interface to the Bridge Table
+ */
+@TypedTable(name="Bridge", database="Open_vSwitch")
+public interface Bridge extends TypedBaseTable {
+
+    @TypedColumn(name="name", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, String> getNameColumn();
+
+    @TypedColumn(name="name", method=MethodType.GETDATA, fromVersion="1.0.0")
+    public String getName();
+
+    @TypedColumn(name="name", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setName(String name);
+
+    @TypedColumn(name="datapath_type", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, String> getDatapathTypeColumn();
+
+    @TypedColumn(name="datapath_type", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setDatapathType(String datapathType);
+
+    @TypedColumn(name="datapath_id", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Set<String>> getDatapathIdColumn();
+
+    @TypedColumn(name="datapath_id", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setDatapathId(Set<String> datapathId);
+
+    @TypedColumn(name="stp_enable", method=MethodType.GETCOLUMN, fromVersion="6.2.0")
+    public Column<GenericTableSchema, Boolean> getStpEnableColumn();
+
+    @TypedColumn(name="stp_enable", method=MethodType.SETDATA, fromVersion="6.2.0")
+    public void setStpEnable(Boolean stp_enable);
+
+    @TypedColumn(name="ports", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Set<UUID>> getPortsColumn();
+
+    @TypedColumn(name="ports", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setPorts(Set<UUID> ports);
+
+    @TypedColumn(name="mirrors", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Set<UUID>> getMirrorsColumn();
+
+    @TypedColumn(name="mirrors", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setMirrors(Set<UUID> mirrors);
+
+    @TypedColumn(name="netflow", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Set<UUID>> getNetflowColumn();
+
+    @TypedColumn(name="netflow", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setNetflow(Set<UUID> netflow);
+
+    @TypedColumn(name="sflow", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Set<UUID>> getSflowColumn();
+
+    @TypedColumn(name="sflow", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setSflow(Set<UUID> sflow);
+
+    @TypedColumn(name="ipfix", method=MethodType.GETCOLUMN, fromVersion="7.1.0")
+    public Column<GenericTableSchema, Set<UUID>> getIpfixColumn();
+
+    @TypedColumn(name="ipfix", method=MethodType.SETDATA, fromVersion="7.1.0")
+    public void setIpfix(Set<UUID> ipfix);
+
+    @TypedColumn(name="controller", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Set<UUID>> getControllerColumn();
+
+    @TypedColumn(name="controller", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setController(Set<UUID> controller);
+
+    @TypedColumn(name="protocols", method=MethodType.GETCOLUMN, fromVersion="6.11.1")
+    public Column<GenericTableSchema, Set<String>> getProtocolsColumn();
+
+    @TypedColumn(name="protocols", method=MethodType.SETDATA, fromVersion="6.11.1")
+    public void setProtocols(Set<String> protocols);
+
+    @TypedColumn(name="fail_mode", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Set<String>> getFailModeColumn();
+
+    @TypedColumn(name="fail_mode", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setFailMode(Set<String> failMode);
+
+    @TypedColumn(name="status", method=MethodType.GETCOLUMN, fromVersion="6.2.0")
+    public Column<GenericTableSchema, Map<String, String>> getStatusColumn();
+
+    @TypedColumn(name="status", method=MethodType.SETDATA, fromVersion="6.2.0")
+    public void setStatus(Map<String, String> status);
+
+    @TypedColumn(name="other_config", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Map<String, String>> getOtherConfigColumn();
+
+    @TypedColumn(name="other_config", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setOtherConfig(Map<String, String> otherConfig);
+
+    @TypedColumn(name="external_ids", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Map<String, String>> getExternalIdsColumn();
+
+    @TypedColumn(name="external_ids", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setExternalIds(Map<String, String> externalIds);
+
+    @TypedColumn(name="flood_vlans", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Set<Integer>> getFloodVlansColumn();
+
+    @TypedColumn(name="flood_vlans", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setFloodVlans(Set<Integer> vlans);
+
+    @TypedColumn(name="flow_tables", method=MethodType.GETCOLUMN, fromVersion="6.5.0")
+    public Column<GenericTableSchema, Map<Integer, UUID>> getFlowTablesColumn();
+
+    @TypedColumn(name="flow_tables", method=MethodType.SETDATA, fromVersion="6.5.0")
+    public void setFlowTables(Map<Integer, UUID> flowTables);
+
+}
diff --git a/schemas/Open_vSwitch/src/main/java/org/opendaylight/ovsdb/schema/openvswitch/Capability.java b/schemas/Open_vSwitch/src/main/java/org/opendaylight/ovsdb/schema/openvswitch/Capability.java
new file mode 100644 (file)
index 0000000..14eb565
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2013 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal
+ */
+package org.opendaylight.ovsdb.schema.openvswitch;
+
+import java.util.Map;
+
+import org.opendaylight.ovsdb.lib.notation.Column;
+import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
+import org.opendaylight.ovsdb.lib.schema.typed.MethodType;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedBaseTable;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedColumn;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedTable;
+
+/*
+ * Reusing the existing Table definitions and many of columns are not defined here
+ * TODO : Fill up the missing Columns and include Supported DB Version
+ */
+@TypedTable(name="Capability", database="Open_vSwitch")
+public interface Capability extends TypedBaseTable {
+    @TypedColumn(name="details", method=MethodType.GETCOLUMN)
+    public Column<GenericTableSchema, Map<String, String>> getDetailsColumn();
+
+    @TypedColumn(name="details", method=MethodType.SETDATA)
+    public void setDetails(Map<String, String> details);
+}
diff --git a/schemas/Open_vSwitch/src/main/java/org/opendaylight/ovsdb/schema/openvswitch/Controller.java b/schemas/Open_vSwitch/src/main/java/org/opendaylight/ovsdb/schema/openvswitch/Controller.java
new file mode 100644 (file)
index 0000000..48d3eb4
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2013 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal
+ */
+package org.opendaylight.ovsdb.schema.openvswitch;
+
+import org.opendaylight.ovsdb.lib.notation.Column;
+import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
+import org.opendaylight.ovsdb.lib.schema.typed.MethodType;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedBaseTable;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedColumn;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedTable;
+
+/*
+ * Reusing the existing Table definitions and many of columns are not defined here
+ * TODO : Fill up the missing Columns and include Supported DB Version
+ */
+
+@TypedTable(name="Controller", database="Open_vSwitch")
+public interface Controller extends TypedBaseTable {
+
+    @TypedColumn(name="target", method=MethodType.GETCOLUMN)
+    public Column<GenericTableSchema, String> getTargetColumn();
+
+    @TypedColumn(name="target", method=MethodType.SETDATA)
+    public void setTarget(String target);
+
+    @TypedColumn(name="controller_burst_limit", method=MethodType.GETCOLUMN)
+    public Column<GenericTableSchema, Integer> getBurstLimitColumn();
+
+    @TypedColumn(name="controller_burst_limit", method=MethodType.SETDATA)
+    public void setBurstLimit(Integer burstLimit);
+
+    @TypedColumn(name="controller_rate_limit", method=MethodType.GETCOLUMN)
+    public Column<GenericTableSchema, Integer> getRateLimitColumn();
+
+    @TypedColumn(name="controller_rate_limit", method=MethodType.SETDATA)
+    public void setRateLimit(Integer burstLimit);
+}
\ No newline at end of file
diff --git a/schemas/Open_vSwitch/src/main/java/org/opendaylight/ovsdb/schema/openvswitch/FlowSampleCollectorSet.java b/schemas/Open_vSwitch/src/main/java/org/opendaylight/ovsdb/schema/openvswitch/FlowSampleCollectorSet.java
new file mode 100644 (file)
index 0000000..b7f0cbc
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal
+ */
+
+package org.opendaylight.ovsdb.schema.openvswitch;
+
+import java.util.Map;
+
+import org.opendaylight.ovsdb.lib.notation.Column;
+import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
+import org.opendaylight.ovsdb.lib.schema.typed.MethodType;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedBaseTable;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedColumn;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedTable;
+
+/*
+ * Reusing the existing Table definitions and many of columns are not defined here
+ * TODO : Fill up the missing Columns and include Supported DB Version
+ */
+@TypedTable(name="Flow_Sample_Collector_Set", database="Open_vSwitch")
+public interface FlowSampleCollectorSet extends TypedBaseTable {
+    @TypedColumn(name="id", method=MethodType.GETCOLUMN)
+    public Column<GenericTableSchema, Integer> getIdColumn();
+    @TypedColumn(name="id", method=MethodType.SETDATA)
+    public void setId(Integer id);
+
+    @TypedColumn(name="bridge", method=MethodType.GETCOLUMN)
+    public Column<GenericTableSchema, Bridge> getBridgeColumn();
+    @TypedColumn(name="bridge", method=MethodType.SETDATA)
+    public void setBridge(Bridge bridge);
+
+    @TypedColumn(name="ipfix", method=MethodType.GETCOLUMN)
+    public Column<GenericTableSchema, IPFIX> getIpfixColumn();
+    @TypedColumn(name="ipfix", method=MethodType.SETDATA)
+    public void setIpfix(IPFIX ipfix);
+
+    @TypedColumn(name="external_ids", method=MethodType.GETCOLUMN)
+    public Column<GenericTableSchema, Map<String, String>> getExternalIdsColumn();
+    @TypedColumn(name="external_ids", method=MethodType.SETDATA)
+    public void setExternalIds(Map<String, String> externalIds);
+}
diff --git a/schemas/Open_vSwitch/src/main/java/org/opendaylight/ovsdb/schema/openvswitch/FlowTable.java b/schemas/Open_vSwitch/src/main/java/org/opendaylight/ovsdb/schema/openvswitch/FlowTable.java
new file mode 100644 (file)
index 0000000..90830f7
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal
+ */
+
+package org.opendaylight.ovsdb.schema.openvswitch;
+
+import java.util.Map;
+import java.util.Set;
+
+import org.opendaylight.ovsdb.lib.notation.Column;
+import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
+import org.opendaylight.ovsdb.lib.schema.typed.MethodType;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedBaseTable;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedColumn;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedTable;
+
+/**
+ * This class is a typed interface to the Flow_Table Table
+ */
+@TypedTable(name="Flow_Table", database="Open_vSwitch", fromVersion="6.5.0")
+public interface FlowTable extends TypedBaseTable {
+
+    @TypedColumn(name="flow_limit", method=MethodType.GETCOLUMN, fromVersion="6.5.0")
+    public Column<GenericTableSchema, Integer> getFlowLimitColumn() ;
+
+    @TypedColumn(name="flow_limit", method=MethodType.SETDATA, fromVersion="6.5.0")
+    public void setFlowLimit(Integer flowLimit) ;
+
+    @TypedColumn(name="overflow_policy", method=MethodType.GETCOLUMN, fromVersion="6.5.0")
+    public Column<GenericTableSchema, Set<String>> getOverflowPolicyColumn() ;
+
+    @TypedColumn(name="overflow_policy", method=MethodType.SETDATA, fromVersion="6.5.0")
+    public void setOverflowPolicy(Set<String> overflowPolicy) ;
+
+    @TypedColumn(name="groups", method=MethodType.GETCOLUMN, fromVersion="6.5.0")
+    public Column<GenericTableSchema, Set<String>> getGroupsColumn() ;
+
+    @TypedColumn(name="groups", method=MethodType.SETDATA, fromVersion="6.5.0")
+    public void setGroups(Set<String> groups) ;
+
+    @TypedColumn(name="name", method=MethodType.GETCOLUMN, fromVersion="6.5.0")
+    public Column<GenericTableSchema, Set<String>> getNameColumn();
+
+    @TypedColumn(name="name", method=MethodType.SETDATA, fromVersion="6.5.0")
+    public void setName(Set<String> name);
+
+    @TypedColumn(name="prefixes", method=MethodType.GETCOLUMN, fromVersion="7.4.0")
+    public Column<GenericTableSchema, Set<String>> getPrefixesColumn();
+
+    @TypedColumn(name="prefixes", method=MethodType.SETDATA, fromVersion="7.4.0")
+    public void setPrefixes(Set<String> prefixes);
+
+    @TypedColumn(name="external_ids", method=MethodType.GETCOLUMN, fromVersion="7.5.0")
+    public Column<GenericTableSchema, Map<String, String>> getExternalIdsColumn();
+
+    @TypedColumn(name="external_ids", method=MethodType.SETDATA, fromVersion="7.5.0")
+    public void setExternalIds(Map<String, String> externalIds);
+
+}
\ No newline at end of file
diff --git a/schemas/Open_vSwitch/src/main/java/org/opendaylight/ovsdb/schema/openvswitch/IPFIX.java b/schemas/Open_vSwitch/src/main/java/org/opendaylight/ovsdb/schema/openvswitch/IPFIX.java
new file mode 100644 (file)
index 0000000..c77cbe8
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal
+ */
+
+package org.opendaylight.ovsdb.schema.openvswitch;
+
+import java.util.Map;
+import java.util.Set;
+
+import org.opendaylight.ovsdb.lib.notation.Column;
+import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
+import org.opendaylight.ovsdb.lib.schema.typed.MethodType;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedBaseTable;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedColumn;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedTable;
+
+/**
+ * This class is a typed interface to the IPFIX Table
+ */
+@TypedTable(name="IPFIX", database="Open_vSwitch", fromVersion="7.1.0")
+public interface IPFIX extends TypedBaseTable {
+
+    @TypedColumn(name="targets", method=MethodType.GETCOLUMN, fromVersion="7.1.0")
+    public Column<GenericTableSchema, Set<String>> getTargetsColumn();
+    @TypedColumn(name="targets", method=MethodType.SETDATA, fromVersion="7.1.0")
+    public void setTargets(Set<String> targets);
+
+    @TypedColumn(name="sampling", method=MethodType.GETCOLUMN, fromVersion="7.1.0")
+    public Column<GenericTableSchema, Set<Integer>> getSamplingColumn();
+    @TypedColumn(name="sampling", method=MethodType.SETDATA, fromVersion="7.1.0")
+    public void setSampling(Set<Integer> sampling);
+
+    @TypedColumn(name="obs_domain_id", method=MethodType.GETCOLUMN, fromVersion="7.1.0")
+    public Column<GenericTableSchema, Set<Integer>> getObsDomainIdColumn();
+    @TypedColumn(name="obs_domain_id", method=MethodType.SETDATA, fromVersion="7.1.0")
+    public void setObsDomainId(Set<Integer> obs_domain_id);
+
+    @TypedColumn(name="obs_point_id", method=MethodType.GETCOLUMN, fromVersion="7.1.0")
+    public Column<GenericTableSchema, Set<Integer>> getObsPointIdColumn();
+    @TypedColumn(name="obs_point_id", method=MethodType.SETDATA, fromVersion="7.1.0")
+    public void setObsPointId(Set<Integer> obsPointId);
+
+    @TypedColumn(name="cache_active_timeout", method=MethodType.GETCOLUMN, fromVersion="7.3.0")
+    public Column<GenericTableSchema, Set<Integer>> getCacheActiveTimeoutColumn();
+    @TypedColumn(name="cache_active_timeout", method=MethodType.SETDATA, fromVersion="7.3.0")
+    public void setCacheActiveTimeout(Set<Integer> cacheActiveTimeout);
+
+    @TypedColumn(name="cache_max_flows", method=MethodType.GETCOLUMN, fromVersion="7.3.0")
+    public Column<GenericTableSchema, Set<Integer>> getCacheMaxFlowsColumn();
+    @TypedColumn(name="cache_max_flows", method=MethodType.SETDATA, fromVersion="7.3.0")
+    public void setCacheMaxFlows(Set<Integer> cacheMaxFlows);
+
+    @TypedColumn(name="external_ids", method=MethodType.GETCOLUMN, fromVersion="7.1.0")
+    public Column<GenericTableSchema, Map<String, String>> getExternalIdsColumn();
+    @TypedColumn(name="external_ids", method=MethodType.SETDATA, fromVersion="7.1.0")
+    public void setExternalIds(Map<String, String> externalIds);
+}
\ No newline at end of file
diff --git a/schemas/Open_vSwitch/src/main/java/org/opendaylight/ovsdb/schema/openvswitch/Interface.java b/schemas/Open_vSwitch/src/main/java/org/opendaylight/ovsdb/schema/openvswitch/Interface.java
new file mode 100644 (file)
index 0000000..e44c819
--- /dev/null
@@ -0,0 +1,196 @@
+/*
+ * Copyright (C) 2013 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal, Dave Tucker
+ */
+package org.opendaylight.ovsdb.schema.openvswitch;
+
+import java.math.BigInteger;
+import java.util.Map;
+import java.util.Set;
+
+import org.opendaylight.ovsdb.lib.notation.Column;
+import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
+import org.opendaylight.ovsdb.lib.schema.typed.MethodType;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedBaseTable;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedColumn;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedTable;
+
+/**
+ * This class is a typed interface to the Bridge Table
+ */
+@TypedTable(name="Interface", database="Open_vSwitch")
+public interface Interface extends TypedBaseTable {
+
+    @TypedColumn(name="name", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, String> getNameColumn();
+    @TypedColumn(name="name", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setName(String name);
+    @TypedColumn(name="name", method=MethodType.GETDATA, fromVersion="1.0.0")
+    public String getName();
+
+    @TypedColumn(name="type", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, String> getTypeColumn();
+    @TypedColumn(name="type", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setType(String type);
+
+    @TypedColumn(name="options", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Map<String, String>> getOptionsColumn();
+    @TypedColumn(name="options", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setOptions(Map<String, String> options);
+
+    @TypedColumn(name="ingress_policing_rate", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Set<Integer>> getIngressPolicingRateColumn();
+    @TypedColumn(name="ingress_policing_rate", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setIngressPolicingRate(Set<Integer> ingressPolicingRate);
+
+    @TypedColumn(name="ingress_policing_burst", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Set<Integer>> getIngressPolicingBurstColumn();
+    @TypedColumn(name="ingress_policing_burst", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setIngressPolicingBurst(Set<Integer> ingressPolicingBurst);
+
+    @TypedColumn(name="mac_in_use", method=MethodType.GETCOLUMN, fromVersion="7.1.0")
+    public Column<GenericTableSchema,Set<String>> getMacInUseColumn();
+    @TypedColumn(name="mac_in_use", method=MethodType.SETDATA, fromVersion="7.1.0")
+    public void setMacInUse(Set<String> macInUse);
+
+    @TypedColumn(name="mac", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Set<String>> getMacColumn();
+    @TypedColumn(name="mac", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setMac(Set<String> mac);
+
+    @TypedColumn(name="ifindex", method=MethodType.GETCOLUMN, fromVersion="7.2.1")
+    public Column<GenericTableSchema, BigInteger> getIfIndexColumn();
+    @TypedColumn(name="ifindex", method=MethodType.SETDATA, fromVersion="7.2.1")
+    public void setIfIndex(BigInteger ifIndex);
+
+    @TypedColumn(name="external_ids", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Map<String, String>> getExternalIdsColumn();
+    @TypedColumn(name="external_ids", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setExternalIds(Map<String, String> externalIds);
+
+    @TypedColumn(name="ofport", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Set<Integer>> getOpenFlowPortColumn();
+    @TypedColumn(name="ofport", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setOpenFlowPort(Set<Integer> openFlowPort);
+
+    @TypedColumn(name="ofport_request", method=MethodType.GETCOLUMN, fromVersion="6.2.0")
+    public Column<GenericTableSchema, Set<Integer>> getOpenFlowPortRequestColumn();
+    @TypedColumn(name="ofport_request", method=MethodType.SETDATA, fromVersion="6.2.0")
+    public void setOpenFlowPortRequest(String openFlowPortRequest);
+
+    @TypedColumn(name="bfd", method=MethodType.GETCOLUMN, fromVersion="7.2.0")
+    public Column<GenericTableSchema, Map<String, String>> getBfdColumn();
+    @TypedColumn(name="bfd", method=MethodType.SETDATA, fromVersion="7.2.0")
+    public void setBfd(Map<String, String> bfd);
+
+    @TypedColumn(name="bfd_status", method=MethodType.GETCOLUMN, fromVersion="7.2.0")
+    public Column<GenericTableSchema, Map<String, String>> getBfdStatusColumn();
+    @TypedColumn(name="bfd_status", method=MethodType.SETDATA, fromVersion="7.2.0")
+    public void setBfdStatus(Map<String, String> bfdStatus);
+
+    @TypedColumn(name="monitor", method=MethodType.GETCOLUMN, fromVersion="1.0.0", untilVersion="3.5.0")
+    public Column<GenericTableSchema, String> getMonitorColumn();
+    @TypedColumn(name="monitor", method=MethodType.SETDATA, fromVersion="1.0.0", untilVersion="3.5.0")
+    public void setMonitor(String monitor);
+
+    @TypedColumn(name="cfm_mpid", method=MethodType.GETCOLUMN, fromVersion="4.0.0")
+    public Column<GenericTableSchema, Set<Integer>> getCfmMpidColumn();
+    @TypedColumn(name="cfm_mpid", method=MethodType.SETDATA)
+    public void setCfmMpid(Set<Integer> cfmMpid);
+
+    @TypedColumn(name="cfm_remote_mpid", method=MethodType.GETCOLUMN, fromVersion="4.0.0", untilVersion="5.2.0")
+    public Column<GenericTableSchema, Set<Integer>> getCfmRemoteMpidColumn();
+    @TypedColumn(name="cfm_remote_mpid", method=MethodType.SETDATA, fromVersion="4.0.0", untilVersion="5.2.0")
+    public void setCfmRemoteMpid(Set<Integer> cfmRemoteMpid);
+
+    @TypedColumn(name="cfm_remote_mpids", method=MethodType.GETCOLUMN, fromVersion="6.0.0")
+    public Column<GenericTableSchema, Set<Integer>> getCfmRemoteMpidsColumn();
+    @TypedColumn(name="cfm_remote_mpids", method=MethodType.SETDATA, fromVersion="6.0.0")
+    public void setCfmRemoteMpids(Set<Integer> cfmRemoteMpids);
+
+    @TypedColumn(name="cfm_flap_count", method=MethodType.GETCOLUMN, fromVersion="7.3.0")
+    public Column<GenericTableSchema, Set<Integer>> getCfmFlapCountColumn();
+    @TypedColumn(name="cfm_flap_count", method=MethodType.SETDATA, fromVersion="7.3.0")
+    public void setCfmFlapCount(Set<Integer> cfmFlapCount);
+
+    @TypedColumn(name="cfm_fault", method=MethodType.GETCOLUMN, fromVersion="4.0.0")
+    public Column<GenericTableSchema, Set<Boolean>> getCfmFaultColumn();
+    @TypedColumn(name="cfm_fault", method=MethodType.SETDATA, fromVersion="4.0.0")
+    public void setCfmFault(Set<Boolean> cfmFault);
+
+    @TypedColumn(name="cfm_fault_status", method=MethodType.GETCOLUMN, fromVersion="6.6.0")
+    public Column<GenericTableSchema, Set<String>> getCfmFaultStatusColumn();
+    @TypedColumn(name="cfm_fault_status", method=MethodType.SETDATA, fromVersion="6.6.0")
+    public void setCfmFaultStatus(Set<String> cfmFaultStatus);
+
+    @TypedColumn(name="cfm_remote_opstate", method=MethodType.GETCOLUMN, fromVersion="6.10.0")
+    public Column<GenericTableSchema, Set<String>> getCfmRemoteOpStateColumn();
+    @TypedColumn(name="cfm_remote_opstate", method=MethodType.SETDATA, fromVersion="6.10.0")
+    public void setCfmRemoteOpState(Set<String> cfmRemoteOpState);
+
+    @TypedColumn(name="cfm_health", method=MethodType.GETCOLUMN, fromVersion="6.9.0")
+    public Column<GenericTableSchema, Set<Integer>> getCfmHealthColumn();
+    @TypedColumn(name="cfmHealth", method=MethodType.SETDATA, fromVersion="6.9.0")
+    public void setCfmHealth(Set<Integer> cfmHealth);
+
+    @TypedColumn(name="lacp_current", method=MethodType.GETCOLUMN, fromVersion="3.3.0")
+    public Column<GenericTableSchema, Set<Boolean>> getLacpCurrentColumn();
+    @TypedColumn(name="lacp_current", method=MethodType.SETDATA, fromVersion="3.3.0")
+    public void setLacpCurrent(Set<Boolean> lacpCurrent);
+
+    @TypedColumn(name="other_config", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Map<String, String>> getOtherConfigColumn();
+    @TypedColumn(name="other_config", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setOtherConfig(Map<String, String> otherConfig);
+
+    @TypedColumn(name="statistics", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Map<String, Integer>> getStatisticsColumn();
+    @TypedColumn(name="statistics", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setStatistics(Map<String, Integer> statistics);
+
+    @TypedColumn(name="status", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Map<String, String>> getStatusColumn();
+    @TypedColumn(name="status", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setStatus(Map<String, String> status);
+
+    @TypedColumn(name="admin_state", method=MethodType.GETCOLUMN, fromVersion="1.0.6")
+    public Column<GenericTableSchema, Set<String>> getAdminStateColumn();
+    @TypedColumn(name="admin_state", method=MethodType.SETDATA, fromVersion="1.0.6")
+    public void setAdminState(Set<String> adminState);
+
+    @TypedColumn(name="link_state", method=MethodType.GETCOLUMN, fromVersion="1.0.6")
+    public Column<GenericTableSchema, Map<String, String>> getLinkStateColumn();
+    @TypedColumn(name="link_state", method=MethodType.SETDATA, fromVersion="1.0.6")
+    public void setLinkState(Map<String, String> linkState);
+
+    @TypedColumn(name="link_resets", method=MethodType.GETCOLUMN, fromVersion="6.2.0")
+    public Column<GenericTableSchema, Set<String>> getLinkResetsColumn();
+    @TypedColumn(name="link_resets", method=MethodType.SETDATA, fromVersion="6.2.0")
+    public void setLinkResets(Set<String> linkResets);
+
+    @TypedColumn(name="link_speed", method=MethodType.GETCOLUMN, fromVersion="1.0.6")
+    public Column<GenericTableSchema, Set<Integer>> getLinkSpeedColumn();
+    @TypedColumn(name="link_speed", method=MethodType.SETDATA, fromVersion="1.0.6")
+    public void setLinkSpeed(Set<Integer>linkSpeed);
+
+    @TypedColumn(name="duplex", method=MethodType.GETCOLUMN, fromVersion="1.0.6")
+    public Column<GenericTableSchema, Set<String>> getDuplexColumn();
+    @TypedColumn(name="duplex", method=MethodType.SETDATA, fromVersion="1.0.6")
+    public void setDuplex(Set<Integer> duplex);
+
+    @TypedColumn(name="mtu", method=MethodType.GETCOLUMN, fromVersion="1.0.6")
+    public Column<GenericTableSchema, Set<Integer>> getMtuColumn();
+    @TypedColumn(name="mtu", method=MethodType.SETDATA, fromVersion="1.0.6")
+    public void setMtu(Set<Integer> mtu);
+
+    @TypedColumn(name="error", method=MethodType.GETCOLUMN, fromVersion="7.7.0")
+    public Column<GenericTableSchema, Set<String>> getErrorColumn();
+    @TypedColumn(name="error", method=MethodType.SETDATA, fromVersion="7.7.0")
+    public void setError(Set<String> error);
+
+}
diff --git a/schemas/Open_vSwitch/src/main/java/org/opendaylight/ovsdb/schema/openvswitch/Manager.java b/schemas/Open_vSwitch/src/main/java/org/opendaylight/ovsdb/schema/openvswitch/Manager.java
new file mode 100644 (file)
index 0000000..66e564b
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2013 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal
+ */
+package org.opendaylight.ovsdb.schema.openvswitch;
+
+import org.opendaylight.ovsdb.lib.notation.Column;
+import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
+import org.opendaylight.ovsdb.lib.schema.typed.MethodType;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedBaseTable;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedColumn;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedTable;
+
+/*
+ * Reusing the existing Table definitions and many of columns are not defined here
+ * TODO : Fill up the missing Columns and include Supported DB Version
+ */
+@TypedTable(name="Manager", database="Open_vSwitch")
+public interface Manager extends TypedBaseTable {
+    @TypedColumn(name="target", method=MethodType.GETCOLUMN)
+    public Column<GenericTableSchema, String> getTargetColumn() ;
+    @TypedColumn(name="target", method=MethodType.SETDATA)
+    public void setTarget(String target) ;
+}
diff --git a/schemas/Open_vSwitch/src/main/java/org/opendaylight/ovsdb/schema/openvswitch/Mirror.java b/schemas/Open_vSwitch/src/main/java/org/opendaylight/ovsdb/schema/openvswitch/Mirror.java
new file mode 100644 (file)
index 0000000..f9d1bd9
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2013 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal
+ */
+package org.opendaylight.ovsdb.schema.openvswitch;
+
+import java.util.Map;
+import java.util.Set;
+
+import org.opendaylight.ovsdb.lib.notation.Column;
+import org.opendaylight.ovsdb.lib.notation.UUID;
+import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
+import org.opendaylight.ovsdb.lib.schema.typed.MethodType;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedBaseTable;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedColumn;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedTable;
+
+
+/*
+ * Reusing the existing Table definitions and many of columns are not defined here
+ * TODO : Fill up the missing Columns and include Supported DB Version
+ */
+@TypedTable(name="Mirror", database="Open_vSwitch")
+public interface Mirror extends TypedBaseTable {
+
+    @TypedColumn(name="name", method=MethodType.GETCOLUMN)
+    public Column<GenericTableSchema, String> getNameColumn();
+    @TypedColumn(name="name", method=MethodType.SETDATA)
+    public void setName(String name);
+
+    @TypedColumn(name="select_src_port", method=MethodType.GETCOLUMN)
+    public Column<GenericTableSchema, Set<UUID>> getSelectSrcPortColumn();
+    @TypedColumn(name="select_src_port", method=MethodType.SETDATA)
+    public void setSelectSrcPort(Set<UUID> selectSrcPort);
+
+    @TypedColumn(name="select_dst_port", method=MethodType.GETCOLUMN)
+    public Column<GenericTableSchema, Set<UUID>> getSelectDstPortColumn();
+    @TypedColumn(name="select_dst_port", method=MethodType.SETDATA)
+    public void setSelectDstPort(Set<UUID> selectDstPrt);
+
+    @TypedColumn(name="select_vlan", method=MethodType.GETCOLUMN)
+    public Column<GenericTableSchema, Set<Integer>> getSelectVlanColumn();
+    @TypedColumn(name="select_vlan", method=MethodType.SETDATA)
+    public void setSelectVlan(Set<Integer> selectVlan);
+
+    @TypedColumn(name="output_port", method=MethodType.GETCOLUMN)
+    public Column<GenericTableSchema, Set<UUID>> getOutputPortColumn();
+    @TypedColumn(name="output_port", method=MethodType.SETDATA)
+    public void setOutputPort(Set<UUID> outputPort);
+
+    @TypedColumn(name="output_vlan", method=MethodType.GETCOLUMN)
+    public Column<GenericTableSchema, Set<Integer>> getOutputVlanColumn();
+    @TypedColumn(name="output_vlan", method=MethodType.SETDATA)
+    public void setOutputVlan(Set<Integer> outputVlan);
+
+    @TypedColumn(name="statistics", method=MethodType.GETCOLUMN)
+    public Column<GenericTableSchema, Map<String, Integer>> getStatisticsColumn();
+    @TypedColumn(name="statistics", method=MethodType.SETDATA)
+    public void setStatistics(Map<String, Integer> statistics);
+
+    @TypedColumn(name="external_ids", method=MethodType.GETCOLUMN)
+    public Column<GenericTableSchema, Map<String, String>> getExternalIdsColumn();
+    @TypedColumn(name="external_ids", method=MethodType.SETDATA)
+    public void setExternalIds(Map<String, String> externalIds);
+}
diff --git a/schemas/Open_vSwitch/src/main/java/org/opendaylight/ovsdb/schema/openvswitch/NetFlow.java b/schemas/Open_vSwitch/src/main/java/org/opendaylight/ovsdb/schema/openvswitch/NetFlow.java
new file mode 100644 (file)
index 0000000..b07ac71
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2013 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal
+ */
+package org.opendaylight.ovsdb.schema.openvswitch;
+
+import java.math.BigInteger;
+import java.util.Map;
+import java.util.Set;
+
+import org.opendaylight.ovsdb.lib.notation.Column;
+import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
+import org.opendaylight.ovsdb.lib.schema.typed.MethodType;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedBaseTable;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedColumn;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedTable;
+
+/**
+ * This class is a typed interface to the NetFlow Table
+ */
+@TypedTable(name="NetFlow", database="Open_vSwitch", fromVersion="1.0.0")
+public interface NetFlow extends TypedBaseTable {
+
+    @TypedColumn(name="targets", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Set<String>> getTargetsColumn();
+
+    @TypedColumn(name="targets", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setTargets(Set<String> targets);
+
+    @TypedColumn(name="active_timeout", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Set<Integer>> getActiveTimeoutColumn();
+
+    @TypedColumn(name="active_timeout", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setActiveTimeout(Integer activeTimeout);
+
+    @TypedColumn(name="engine_type", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Set<BigInteger>> getEngineTypeColumn();
+
+    @TypedColumn(name="engine_type", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setEngineType(Set<BigInteger> engineType);
+
+    @TypedColumn(name="external_ids", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Map<String, String>> getExternalIdsColumn();
+
+    @TypedColumn(name="external_ids", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setExternalIds(Map<String, String> externalIds);
+
+    @TypedColumn(name="active_timeout", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Set<Integer>> getActivityTimeoutColumn();
+
+    @TypedColumn(name="active_timeout", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setActivityTimeout(Set<Integer> activityTimeout);
+
+    @TypedColumn(name="add_id_to_interface", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Set<Boolean>> getAddIdToInterfaceColumn();
+
+    @TypedColumn(name="add_id_to_interface", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setAddIdToInterface(Boolean addIdToInterface);
+
+    @TypedColumn(name="engine_id", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Set<BigInteger>> getEngineIdColumn();
+
+    @TypedColumn(name="engine_id", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setEngineId(Set<BigInteger> engineId);
+
+}
diff --git a/schemas/Open_vSwitch/src/main/java/org/opendaylight/ovsdb/schema/openvswitch/OpenVSwitch.java b/schemas/Open_vSwitch/src/main/java/org/opendaylight/ovsdb/schema/openvswitch/OpenVSwitch.java
new file mode 100644 (file)
index 0000000..35132e9
--- /dev/null
@@ -0,0 +1,100 @@
+/*
+ * Copyright (C) 2013 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal, Dave Tucker
+ */
+package org.opendaylight.ovsdb.schema.openvswitch;
+
+import java.util.Map;
+import java.util.Set;
+
+import org.opendaylight.ovsdb.lib.notation.Column;
+import org.opendaylight.ovsdb.lib.notation.UUID;
+import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
+import org.opendaylight.ovsdb.lib.schema.typed.MethodType;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedBaseTable;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedColumn;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedTable;
+
+
+/**
+ * This class is a typed interface to the Open_vSwitch table
+ */
+@TypedTable(name="Open_vSwitch", database="Open_vSwitch")
+public interface OpenVSwitch extends TypedBaseTable {
+
+    @TypedColumn(name="bridges", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Set<UUID>> getBridgesColumn();
+    @TypedColumn(name="bridges", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setBridges(Set<UUID> bridges);
+
+    @TypedColumn(name="managers", method=MethodType.GETCOLUMN, fromVersion="1.0.0", untilVersion="2.0.0")
+    public Column<GenericTableSchema, Set<UUID>> getManagersColumn();
+    @TypedColumn(name="managers", method=MethodType.SETDATA, fromVersion="1.0.0", untilVersion="2.0.0")
+    public void setManagers(Set<UUID> managers);
+
+    @TypedColumn(name="manager_options", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Set<UUID>> getManagerOptionsColumn();
+    @TypedColumn(name="manager_options", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setManagerOptions(Set<UUID> managerOptions);
+
+    @TypedColumn(name="ssl", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Set<UUID>> getSslColumn();
+    @TypedColumn(name="ssl", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setSsl(Set<UUID> ssl);
+
+    @TypedColumn(name="other_config", method=MethodType.GETCOLUMN, fromVersion="5.1.0")
+    public Column<GenericTableSchema, Map<String, String>> getOtherConfigColumn() ;
+    @TypedColumn(name="other_config", method=MethodType.SETDATA, fromVersion="5.1.0")
+    public void setOtherConfig(Map<String, String> otherConfig);
+
+    @TypedColumn(name="external_ids", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Map<String, String>> getExternalIdsColumn() ;
+    @TypedColumn(name="external_ids", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setExternalIds(Map<String, String> externalIds);
+
+    @TypedColumn(name="next_cfg", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Integer> getNextConfigColumn();
+    @TypedColumn(name="next_cfg", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setNextConfig(Integer nextConfig);
+
+    @TypedColumn(name="cur_cfg", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Integer> getCurrentConfigColumn();
+    @TypedColumn(name="cur_cfg", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setCurrentConfig(Integer currentConfig);
+
+    @TypedColumn(name="capabilities", method=MethodType.GETCOLUMN, fromVersion="1.0.0", untilVersion="6.7.0")
+    public Column<GenericTableSchema, Map<String, UUID>> getCapabilitiesColumn();
+    @TypedColumn(name="capabilities", method=MethodType.SETDATA, fromVersion="1.0.0", untilVersion="6.7.0")
+    public void setCapabilities(Map<String, UUID> capabilities);
+
+    @TypedColumn(name="statistics", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Map<String, Integer>> getStatisticsColumn();
+    @TypedColumn(name="statistics", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setStatistics(Map<String, Integer> statistics);
+
+    @TypedColumn(name="ovs_version", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Set<String>> getOvsVersionColumn();
+    @TypedColumn(name="ovs_version", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setOvsVersion(Set<String> ovsVersion);
+
+    @TypedColumn(name="db_version", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Set<String>> getDbVersionColumn();
+    @TypedColumn(name="db_version", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setDbVersion(Set<String> dbVersion);
+
+    @TypedColumn(name="system_type", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Set<String>> getSystemTypeColumn();
+    @TypedColumn(name="system_type", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setSystemType(Set<String> systemType);
+
+    @TypedColumn(name="system_version", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Set<String>> getSystemVersionColumn();
+    @TypedColumn(name="system_version", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setSystemVersion(Set<String> systemVersion);
+
+}
diff --git a/schemas/Open_vSwitch/src/main/java/org/opendaylight/ovsdb/schema/openvswitch/Port.java b/schemas/Open_vSwitch/src/main/java/org/opendaylight/ovsdb/schema/openvswitch/Port.java
new file mode 100644 (file)
index 0000000..dd57e3c
--- /dev/null
@@ -0,0 +1,121 @@
+/*
+ * Copyright (C) 2013 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal, Dave Tucker
+ */
+package org.opendaylight.ovsdb.schema.openvswitch;
+
+import java.math.BigInteger;
+import java.util.Map;
+import java.util.Set;
+
+import org.opendaylight.ovsdb.lib.notation.Column;
+import org.opendaylight.ovsdb.lib.notation.UUID;
+import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
+import org.opendaylight.ovsdb.lib.schema.typed.MethodType;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedBaseTable;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedColumn;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedTable;
+
+/**
+ * This class is a typed interface to the Port Table
+ */
+@TypedTable(name="Port", database="Open_vSwitch")
+public interface Port extends TypedBaseTable {
+
+    @TypedColumn(name="name", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, String> getNameColumn();
+    @TypedColumn(name="name", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setName(String name);
+    @TypedColumn(name="name", method=MethodType.GETDATA, fromVersion="1.0.0")
+    public String getName();
+
+    @TypedColumn(name="interfaces", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Set<UUID>> getInterfacesColumn();
+    @TypedColumn(name="interfaces", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setInterfaces(Set<UUID> interfaces);
+
+    @TypedColumn(name="trunks", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Set<BigInteger>> getTrunksColumn();
+    @TypedColumn(name="trunks", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setTrunks(Set<BigInteger> trunks);
+
+    @TypedColumn(name="tag", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Set<BigInteger>> getTagColumn();
+    @TypedColumn(name="tag", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setTag(Set<BigInteger> tag);
+
+    @TypedColumn(name="vlan_mode", method=MethodType.GETCOLUMN, fromVersion="6.1.0")
+    public Column<GenericTableSchema, Set<String>> getVlanModeColumn();
+    @TypedColumn(name="vlan_mode", method=MethodType.SETDATA, fromVersion="6.1.0")
+    public void setVlanMode(Set<String> vlanMode);
+
+    @TypedColumn(name="qos", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Set<UUID>> getQosColumn();
+    @TypedColumn(name="qos", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setQos(Set<UUID> qos);
+
+    @TypedColumn(name="mac", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Set<String>> getMacColumn();
+    @TypedColumn(name="mac", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setMac(Set<String> mac);
+
+    @TypedColumn(name="bond_type", method=MethodType.GETCOLUMN, fromVersion="1.0.2", untilVersion="1.0.3")
+    public Column<GenericTableSchema, Set<String>> getBondTypeColumn();
+    @TypedColumn(name="bond_type", method=MethodType.SETDATA)
+    public void setBondType(Set<String> bond_type);
+
+    @TypedColumn(name="bond_mode", method=MethodType.GETCOLUMN, fromVersion="1.0.4")
+    public Column<GenericTableSchema, Set<String>> getBondModeColumn();
+    @TypedColumn(name="bond_mode", method=MethodType.SETDATA, fromVersion="1.0.4")
+    public void setBondMode(Set<String> bond_mode);
+
+    @TypedColumn(name="lacp", method=MethodType.GETCOLUMN, fromVersion="1.3.0")
+    public Column<GenericTableSchema, Set<String>> getLacpColumn();
+    @TypedColumn(name="lacp", method=MethodType.SETDATA, fromVersion="1.3.0")
+    public void setLacp(Set<String> lacp);
+
+    @TypedColumn(name="bond_updelay", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Set<BigInteger>> getBondUpDelayColumn();
+    @TypedColumn(name="bond_updelay", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setBondUpDelay(Set<BigInteger> bondUpDelay);
+
+    @TypedColumn(name="bond_downdelay", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Set<BigInteger>> getBondDownDelayColumn();
+    @TypedColumn(name="bond_downdelay", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setBondDownDelay(Set<BigInteger> bondDownDelay);
+
+    @TypedColumn(name="bond_fake_iface", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Set<Boolean>> getBondFakeInterfaceColumn();
+    @TypedColumn(name="bond_fake_iface", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setBondFakeInterface(Set<Boolean> bondFakeInterface);
+
+    @TypedColumn(name="fake_bridge", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Set<Boolean>> getFakeBridgeColumn();
+    @TypedColumn(name="fake_bridge", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setFakeBridge(Set<Boolean> fakeBridge);
+
+    @TypedColumn(name="status", method=MethodType.GETCOLUMN, fromVersion="6.2.0")
+    public Column<GenericTableSchema, Map<String, String>> getStatusColumn();
+    @TypedColumn(name="status", method=MethodType.SETDATA, fromVersion="6.2.0")
+    public void setStatus(Map<String, String> status);
+
+    @TypedColumn(name="statistics", method=MethodType.GETCOLUMN, fromVersion="6.3.0")
+    public Column<GenericTableSchema, Map<String, BigInteger>> getStatisticsColumn();
+    @TypedColumn(name="statistics", method=MethodType.SETDATA)
+    public void setStatistics(Map<String, BigInteger> statistics);
+
+    @TypedColumn(name="other_config", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Map<String, String>> getOtherConfigColumn();
+    @TypedColumn(name="other_config", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setOtherConfig(Map<String, String> otherConfig);
+
+    @TypedColumn(name="external_ids", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Map<String, String>> getExternalIdsColumn();
+    @TypedColumn(name="external_ids", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setExternalIds(Map<String, String> externalIds);
+}
diff --git a/schemas/Open_vSwitch/src/main/java/org/opendaylight/ovsdb/schema/openvswitch/Qos.java b/schemas/Open_vSwitch/src/main/java/org/opendaylight/ovsdb/schema/openvswitch/Qos.java
new file mode 100644 (file)
index 0000000..7cc9a6a
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2013 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal
+ */
+package org.opendaylight.ovsdb.schema.openvswitch;
+
+
+import java.util.Map;
+
+import org.opendaylight.ovsdb.lib.notation.Column;
+import org.opendaylight.ovsdb.lib.notation.UUID;
+import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
+import org.opendaylight.ovsdb.lib.schema.typed.MethodType;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedBaseTable;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedColumn;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedTable;
+
+
+/*
+ * Reusing the existing Table definitions and many of columns are not defined here
+ * TODO : Fill up the missing Columns and include Supported DB Version
+ */
+
+@TypedTable(name="Qos", database="Open_vSwitch")
+public interface Qos extends TypedBaseTable {
+    @TypedColumn(name="queues", method=MethodType.GETCOLUMN)
+    public Column<GenericTableSchema, Map<Integer, UUID>> getQueuesColumn() ;
+    @TypedColumn(name="queues", method=MethodType.SETDATA)
+    public void setQueues(Map<Integer, UUID> queues) ;
+
+    @TypedColumn(name="type", method=MethodType.GETCOLUMN)
+    public Column<GenericTableSchema, String> getTypeColumn() ;
+    @TypedColumn(name="type", method=MethodType.SETDATA)
+    public void setType(String type) ;
+
+    @TypedColumn(name="other_config", method=MethodType.GETCOLUMN)
+    public Column<GenericTableSchema, Map<String, String>> getOtherConfigColumn() ;
+    @TypedColumn(name="other_config", method=MethodType.SETDATA)
+    public void setOtherConfig(Map<String, String> otherConfig) ;
+
+    @TypedColumn(name="externalIds", method=MethodType.GETCOLUMN)
+    public Column<GenericTableSchema, Map<String, String>> getExternalIdsColumn() ;
+    @TypedColumn(name="externalIds", method=MethodType.SETDATA)
+    public void setExternalIds(Map<String, String> externalIds) ;
+}
diff --git a/schemas/Open_vSwitch/src/main/java/org/opendaylight/ovsdb/schema/openvswitch/Queue.java b/schemas/Open_vSwitch/src/main/java/org/opendaylight/ovsdb/schema/openvswitch/Queue.java
new file mode 100644 (file)
index 0000000..41b074c
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2013 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal
+ */
+package org.opendaylight.ovsdb.schema.openvswitch;
+
+
+import java.util.Map;
+import java.util.Set;
+
+import org.opendaylight.ovsdb.lib.notation.Column;
+import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
+import org.opendaylight.ovsdb.lib.schema.typed.MethodType;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedBaseTable;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedColumn;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedTable;
+
+
+/*
+ * Reusing the existing Table definitions and many of columns are not defined here
+ * TODO : Fill up the missing Columns and include Supported DB Version
+ */
+
+@TypedTable(name="Queue", database="Open_vSwitch")
+public interface Queue extends TypedBaseTable {
+    @TypedColumn(name="dscp", method=MethodType.GETCOLUMN)
+    public Column<GenericTableSchema, Set<Integer>> getDscpColumn() ;
+    @TypedColumn(name="dscp", method=MethodType.SETDATA)
+    public void setDscp(Set<Integer> dscp) ;
+
+    @TypedColumn(name="other_config", method=MethodType.GETCOLUMN)
+    public Column<GenericTableSchema, Map<String, String>> getOtherConfigColumn() ;
+    @TypedColumn(name="other_config", method=MethodType.SETDATA)
+    public void setOtherConfig(Map<String, String> otherConfig) ;
+
+    @TypedColumn(name="external_ids", method=MethodType.GETCOLUMN)
+    public Column<GenericTableSchema, Map<String, String>> getExternalIdsColumn() ;
+    @TypedColumn(name="external_ids", method=MethodType.SETDATA)
+    public void setExternalIds(Map<String, String> externalIds) ;
+}
\ No newline at end of file
diff --git a/schemas/Open_vSwitch/src/main/java/org/opendaylight/ovsdb/schema/openvswitch/SFlow.java b/schemas/Open_vSwitch/src/main/java/org/opendaylight/ovsdb/schema/openvswitch/SFlow.java
new file mode 100644 (file)
index 0000000..13edbba
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2013 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal
+ */
+package org.opendaylight.ovsdb.schema.openvswitch;
+
+import java.util.Map;
+import java.util.Set;
+
+import org.opendaylight.ovsdb.lib.notation.Column;
+import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
+import org.opendaylight.ovsdb.lib.schema.typed.MethodType;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedBaseTable;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedColumn;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedTable;
+
+/**
+ * This class is a typed interface to the SFlow Table
+ */
+@TypedTable(name="sFlow", database="Open_vSwitch", fromVersion="1.0.0")
+public interface SFlow extends TypedBaseTable {
+    @TypedColumn(name="targets", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Set<String>> getTargetsColumn() ;
+    @TypedColumn(name="targets", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setTargets(Set<String> targets) ;
+
+    @TypedColumn(name="agent", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Set<String>> getAgentColumn() ;
+    @TypedColumn(name="agent", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setAgent(Set<String> agent) ;
+
+    @TypedColumn(name="external_ids", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Map<String, String>> getExternalIdsColumn() ;
+    @TypedColumn(name="external_ids", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setExternalIds(Map<String, String> externalIds) ;
+
+    @TypedColumn(name="header", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Set<Integer>> getHeaderColumn() ;
+    @TypedColumn(name="header", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setHeader(Set<Integer> header) ;
+
+    @TypedColumn(name="polling", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Set<Integer>> getPollingColumn() ;
+    @TypedColumn(name="polling", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setPolling(Set<Integer> polling) ;
+
+    @TypedColumn(name="sampling", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Set<Integer>> getSamplingColumn() ;
+    @TypedColumn(name="sampling", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setSampling(Set<Integer> sampling) ;
+}
\ No newline at end of file
diff --git a/schemas/Open_vSwitch/src/main/java/org/opendaylight/ovsdb/schema/openvswitch/SSL.java b/schemas/Open_vSwitch/src/main/java/org/opendaylight/ovsdb/schema/openvswitch/SSL.java
new file mode 100644 (file)
index 0000000..a5f65fe
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2013 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal
+ */
+package org.opendaylight.ovsdb.schema.openvswitch;
+
+import java.util.Map;
+
+import org.opendaylight.ovsdb.lib.notation.Column;
+import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
+import org.opendaylight.ovsdb.lib.schema.typed.MethodType;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedBaseTable;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedColumn;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedTable;
+/*
+ * Reusing the existing Table definitions and many of columns are not defined here
+ * TODO : Fill up the missing Columns and include Supported DB Version
+ */
+@TypedTable(name="SSL", database="Open_vSwitch")
+public interface SSL extends TypedBaseTable {
+    @TypedColumn(name="ca_cert", method=MethodType.GETCOLUMN)
+    public Column<GenericTableSchema, String> getCaCertColumn() ;
+    @TypedColumn(name="ca_cert", method=MethodType.SETDATA)
+    public void setCaCert(String caCert) ;
+
+    @TypedColumn(name="external_ids", method=MethodType.GETCOLUMN)
+    public Column<GenericTableSchema, Map<String, String>> getExternalIdsColumn() ;
+    @TypedColumn(name="external_ids", method=MethodType.SETDATA)
+    public void setExternalIds(Map<String, String> externalIds) ;
+
+    @TypedColumn(name="bootstrap_ca_cert", method=MethodType.GETCOLUMN)
+    public Column<GenericTableSchema, Boolean> getBootstrapCaCertColumn() ;
+    @TypedColumn(name="bootstrap_ca_cert", method=MethodType.SETDATA)
+    public void setBootstrapCaCert(Boolean bootstrapCaCert) ;
+
+    @TypedColumn(name="certificate", method=MethodType.GETCOLUMN)
+    public Column<GenericTableSchema, String> getCertificateColumn() ;
+    @TypedColumn(name="certificate", method=MethodType.SETDATA)
+    public void setCertificate(String certificate) ;
+
+    @TypedColumn(name="private_key", method=MethodType.GETCOLUMN)
+    public Column<GenericTableSchema, String> getPrivateKeyColumn() ;
+    @TypedColumn(name="private_key", method=MethodType.SETDATA)
+    public void setPrivateKey(String private_key) ;
+}
diff --git a/schemas/Open_vSwitch/src/test/java/org/opendaylight/ovsdb/schema/openvswitch/OvsdbTestBase.java b/schemas/Open_vSwitch/src/test/java/org/opendaylight/ovsdb/schema/openvswitch/OvsdbTestBase.java
new file mode 100644 (file)
index 0000000..5d87096
--- /dev/null
@@ -0,0 +1,120 @@
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal
+ */
+
+package org.opendaylight.ovsdb.schema.openvswitch;
+import java.io.IOException;
+import java.net.InetAddress;
+import java.util.Properties;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+
+import junit.framework.Assert;
+
+import org.opendaylight.ovsdb.lib.OvsdbClient;
+import org.opendaylight.ovsdb.lib.OvsdbConnection;
+import org.opendaylight.ovsdb.lib.OvsdbConnectionListener;
+import org.opendaylight.ovsdb.lib.impl.OvsdbConnectionService;
+import org.opendaylight.ovsdb.lib.message.OvsdbRPC;
+
+public abstract class OvsdbTestBase implements OvsdbRPC.Callback{
+    private final static String SERVER_IPADDRESS = "ovsdbserver.ipaddress";
+    private final static String SERVER_PORT = "ovsdbserver.port";
+    private final static String CONNECTION_TYPE = "ovsdbserver.connection";
+    private final static String CONNECTION_TYPE_ACTIVE = "active";
+    private final static String CONNECTION_TYPE_PASSIVE = "passive";
+
+    private final static String DEFAULT_SERVER_PORT = "6640";
+
+    /**
+     * Represents the Open Vswitch Schema
+     */
+    public final static String OPEN_VSWITCH_SCHEMA = "Open_vSwitch";
+
+    public Properties loadProperties() {
+        Properties props = new Properties(System.getProperties());
+        return props;
+    }
+
+    public OvsdbClient getTestConnection() throws IOException, InterruptedException, ExecutionException, TimeoutException {
+        Properties props = loadProperties();
+        String addressStr = props.getProperty(SERVER_IPADDRESS);
+        String portStr = props.getProperty(SERVER_PORT, DEFAULT_SERVER_PORT);
+        String connectionType = props.getProperty(CONNECTION_TYPE, "active");
+
+        // If the connection type is active, controller connects to the ovsdb-server
+        if (connectionType.equalsIgnoreCase(CONNECTION_TYPE_ACTIVE)) {
+            if (addressStr == null) {
+                Assert.fail(usage());
+            }
+
+            InetAddress address;
+            try {
+                address = InetAddress.getByName(addressStr);
+            } catch (Exception e) {
+                System.out.println("Unable to resolve " + addressStr);
+                e.printStackTrace();
+                return null;
+            }
+
+            Integer port;
+            try {
+                port = Integer.parseInt(portStr);
+            } catch (NumberFormatException e) {
+                System.out.println("Invalid port number : " + portStr);
+                e.printStackTrace();
+                return null;
+            }
+
+            OvsdbConnection connection = OvsdbConnectionService.getService();
+            return connection.connect(address, port);
+        } else if (connectionType.equalsIgnoreCase(CONNECTION_TYPE_PASSIVE)) {
+            ExecutorService executor = Executors.newFixedThreadPool(1);
+            Future<OvsdbClient> passiveConnection = executor.submit(new PassiveListener());
+            return passiveConnection.get(60, TimeUnit.SECONDS);
+        }
+        Assert.fail("Connection parameter ("+CONNECTION_TYPE+") must be either active or passive");
+        return null;
+    }
+
+    private String usage() {
+        return "Integration Test needs a valid connection configuration as follows :\n" +
+               "active connection : mvn -Pintegrationtest -Dovsdbserver.ipaddress=x.x.x.x -Dovsdbserver.port=yyyy verify\n"+
+               "passive connection : mvn -Pintegrationtest -Dovsdbserver.connection=passive verify\n";
+    }
+
+    public class PassiveListener implements Callable<OvsdbClient>, OvsdbConnectionListener {
+        OvsdbClient client = null;
+        @Override
+        public OvsdbClient call() throws Exception {
+            OvsdbConnection connection = OvsdbConnectionService.getService();
+            connection.registerForPassiveConnection(this);
+            while (client == null) {
+                Thread.sleep(500);
+            }
+            return client;
+        }
+
+        @Override
+        public void connected(OvsdbClient client) {
+            this.client = client;
+        }
+
+        @Override
+        public void disconnected(OvsdbClient client) {
+            Assert.assertEquals(this.client.getConnectionInfo(), client.getConnectionInfo());
+            this.client = null;
+        }
+    }
+}
diff --git a/schemas/Open_vSwitch/src/test/java/org/opendaylight/ovsdb/schema/openvswitch/TypedVSwitchdSchemaIT.java b/schemas/Open_vSwitch/src/test/java/org/opendaylight/ovsdb/schema/openvswitch/TypedVSwitchdSchemaIT.java
new file mode 100644 (file)
index 0000000..1694a7f
--- /dev/null
@@ -0,0 +1,468 @@
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal
+ */
+package org.opendaylight.ovsdb.schema.openvswitch;
+
+import static org.junit.Assert.assertNull;
+import static org.opendaylight.ovsdb.lib.operations.Operations.op;
+
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.math.BigInteger;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeoutException;
+
+import junit.framework.Assert;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.ovsdb.lib.MonitorCallBack;
+import org.opendaylight.ovsdb.lib.MonitorHandle;
+import org.opendaylight.ovsdb.lib.OvsdbClient;
+import org.opendaylight.ovsdb.lib.message.MonitorRequest;
+import org.opendaylight.ovsdb.lib.message.MonitorRequestBuilder;
+import org.opendaylight.ovsdb.lib.message.MonitorSelect;
+import org.opendaylight.ovsdb.lib.message.TableUpdate;
+import org.opendaylight.ovsdb.lib.message.TableUpdates;
+import org.opendaylight.ovsdb.lib.message.UpdateNotification;
+import org.opendaylight.ovsdb.lib.notation.Mutator;
+import org.opendaylight.ovsdb.lib.notation.Row;
+import org.opendaylight.ovsdb.lib.notation.UUID;
+import org.opendaylight.ovsdb.lib.operations.OperationResult;
+import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
+import org.opendaylight.ovsdb.lib.schema.DatabaseSchema;
+import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedBaseTable;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
+import com.google.common.util.concurrent.ListenableFuture;
+
+public class TypedVSwitchdSchemaIT extends OvsdbTestBase {
+
+    Logger logger = LoggerFactory.getLogger(TypedVSwitchdSchemaIT.class);
+    OvsdbClient ovs;
+    DatabaseSchema dbSchema = null;
+    static String testBridgeName = "br_test";
+    static UUID testBridgeUuid = null;
+
+    @Test
+    public void testTypedBridgeOperations() throws IOException, InterruptedException, ExecutionException, NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+        this.monitorTables();
+        this.createTypedBridge();
+        this.createTypedController();
+        this.testCreateTypedPortandInterface();
+        this.testCreateTypedIpFix();
+        this.testCreateTypedNetFlow();
+        this.testCreateTypedSflow();
+    }
+
+    private void createTypedBridge() throws IOException, InterruptedException, ExecutionException, NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+        Bridge bridge = ovs.createTypedRowWrapper(Bridge.class);
+        bridge.setName(testBridgeName);
+        bridge.setStatus(ImmutableMap.of("key","value"));
+        bridge.setFloodVlans(Sets.newHashSet(34));
+
+        OpenVSwitch openVSwitch = ovs.createTypedRowWrapper(OpenVSwitch.class);
+        openVSwitch.setBridges(Sets.newHashSet(new UUID(testBridgeName)));
+
+        int insertOperationIndex = 0;
+
+        TransactionBuilder transactionBuilder = ovs.transactBuilder()
+                .add(op.insert(bridge.getSchema())
+                        .withId(testBridgeName)
+                        .value(bridge.getNameColumn()))
+                .add(op.update(bridge.getSchema())
+                        .set(bridge.getStatusColumn())
+                        .set(bridge.getFloodVlansColumn())
+                        .where(bridge.getNameColumn().getSchema().opEqual(bridge.getName()))
+                        .and(bridge.getNameColumn().getSchema().opEqual(bridge.getName())).build())
+                .add(op.mutate(openVSwitch.getSchema())
+                        .addMutation(openVSwitch.getBridgesColumn().getSchema(), Mutator.INSERT,
+                                     openVSwitch.getBridgesColumn().getData()));
+
+        ListenableFuture<List<OperationResult>> results = transactionBuilder.execute();
+        List<OperationResult> operationResults = results.get();
+        Assert.assertFalse(operationResults.isEmpty());
+        // Check if Results matches the number of operations in transaction
+        Assert.assertEquals(transactionBuilder.getOperations().size(), operationResults.size());
+        System.out.println("Insert & Update operation results = " + operationResults);
+        for (OperationResult result : operationResults) {
+            Assert.assertNull(result.getError());
+        }
+        testBridgeUuid = operationResults.get(insertOperationIndex).getUuid();
+
+        Row bridgeRow = tableCache.get(bridge.getSchema().getName()).get(testBridgeUuid);
+        Bridge monitoredBridge = ovs.getTypedRowWrapper(Bridge.class, bridgeRow);
+        Assert.assertEquals(monitoredBridge.getNameColumn().getData(), bridge.getNameColumn().getData());
+        Assert.assertNotNull(monitoredBridge.getUuid());
+        Assert.assertNotNull(monitoredBridge.getVersion());
+        Assert.assertNotNull(this.getOpenVSwitchTableUuid());
+    }
+
+    private void createTypedController() throws IOException, InterruptedException, ExecutionException, NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+        Controller controller1 = ovs.createTypedRowWrapper(Controller.class);
+        controller1.setTarget("tcp:1.1.1.1:6640");
+        Controller controller2 = ovs.createTypedRowWrapper(Controller.class);
+        controller2.setTarget("tcp:2.2.2.2:6640");
+
+        Bridge bridge = ovs.getTypedRowWrapper(Bridge.class, null);
+
+        String transactionUuidStr = "controller";
+        TransactionBuilder transactionBuilder = ovs.transactBuilder()
+                .add(op.insert(controller1.getSchema())
+                        .withId(transactionUuidStr)
+                        .value(controller1.getTargetColumn()))
+                .add(op.mutate(bridge.getSchema())
+                        .addMutation(bridge.getControllerColumn().getSchema(), Mutator.INSERT,
+                                     Sets.newHashSet(new UUID(transactionUuidStr)))
+                        .where(bridge.getNameColumn().getSchema().opEqual(testBridgeName))
+                        .build());
+
+        ListenableFuture<List<OperationResult>> results = transactionBuilder.execute();
+        List<OperationResult> operationResults = results.get();
+        Assert.assertFalse(operationResults.isEmpty());
+        // Check if Results matches the number of operations in transaction
+        Assert.assertEquals(transactionBuilder.getOperations().size(), operationResults.size());
+        System.out.println("Insert & Mutate operation results for controller1 = " + operationResults);
+        // Check for any errors
+        for (OperationResult result : operationResults) {
+            Assert.assertNull(result.getError());
+        }
+
+        Row bridgeRow = tableCache.get(bridge.getSchema().getName()).get(testBridgeUuid);
+        Bridge monitoredBridge = ovs.getTypedRowWrapper(Bridge.class, bridgeRow);
+        Assert.assertEquals(1, monitoredBridge.getControllerColumn().getData().size());
+
+        transactionBuilder = ovs.transactBuilder()
+                .add(op.insert(controller2.getSchema())
+                        .withId(transactionUuidStr)
+                        .value(controller2.getTargetColumn()))
+                .add(op.mutate(bridge.getSchema())
+                        .addMutation(bridge.getControllerColumn().getSchema(), Mutator.INSERT,
+                                Sets.newHashSet(new UUID(transactionUuidStr)))
+                        .where(bridge.getNameColumn().getSchema().opEqual(testBridgeName))
+                        .build());
+
+        results = transactionBuilder.execute();
+        operationResults = results.get();
+        Assert.assertFalse(operationResults.isEmpty());
+        // Check if Results matches the number of operations in transaction
+        Assert.assertEquals(transactionBuilder.getOperations().size(), operationResults.size());
+        System.out.println("Insert & Mutate operation results for controller2 = " + operationResults);
+        // Check for any errors
+        for (OperationResult result : operationResults) {
+            Assert.assertNull(result.getError());
+        }
+
+        bridgeRow = tableCache.get(bridge.getSchema().getName()).get(testBridgeUuid);
+        monitoredBridge = ovs.getTypedRowWrapper(Bridge.class, bridgeRow);
+        Assert.assertEquals(2, monitoredBridge.getControllerColumn().getData().size());
+    }
+
+    private void testCreateTypedPortandInterface() throws InterruptedException, ExecutionException{
+        String portUuidStr = "testPort";
+        String intfUuidStr = "testIntf";
+        Port port = ovs.createTypedRowWrapper(Port.class);
+        port.setName("testPort");
+        port.setTag(ImmutableSet.of(BigInteger.ONE));
+        port.setMac(ImmutableSet.of("00:00:00:00:00:01"));
+        port.setInterfaces(ImmutableSet.of(new UUID(intfUuidStr)));
+
+        Interface intf = ovs.createTypedRowWrapper(Interface.class);
+        intf.setName(port.getNameColumn().getData());
+        intf.setExternalIds(ImmutableMap.of("vm-id", "12345abcedf78910"));
+
+        Bridge bridge = ovs.getTypedRowWrapper(Bridge.class, null);
+        TransactionBuilder transactionBuilder = ovs.transactBuilder()
+                .add(op.insert(port.getSchema())
+                        .withId(portUuidStr)
+                        .value(port.getNameColumn())
+                        .value(port.getMacColumn()))
+                .add(op.insert(intf.getSchema())
+                        .withId(intfUuidStr)
+                        .value(intf.getNameColumn()))
+                .add(op.update(port.getSchema())
+                        .set(port.getTagColumn())
+                        .set(port.getMacColumn())
+                        .set(port.getInterfacesColumn())
+                        .where(port.getNameColumn().getSchema().opEqual(port.getName()))
+                        .build())
+                .add(op.update(intf.getSchema())
+                        .set(intf.getExternalIdsColumn())
+                        .where(intf.getNameColumn().getSchema().opEqual(intf.getName()))
+                        .build())
+                .add(op.mutate(bridge.getSchema())
+                        .addMutation(bridge.getPortsColumn().getSchema(), Mutator.INSERT, Sets.newHashSet(new UUID(portUuidStr)))
+                        .where(bridge.getNameColumn().getSchema().opEqual(testBridgeName))
+                        .build());
+        ListenableFuture<List<OperationResult>> results = transactionBuilder.execute();
+        List<OperationResult> operationResults = results.get();
+        Assert.assertFalse(operationResults.isEmpty());
+        // Check if Results matches the number of operations in transaction
+        Assert.assertEquals(transactionBuilder.getOperations().size(), operationResults.size());
+        System.out.println("Insert & Mutate operation results for Port and Interface = " + operationResults);
+    }
+
+    private void testCreateTypedIpFix() throws InterruptedException, ExecutionException, IllegalArgumentException{
+        String ipfixUuidStr = "testIpfix";
+        String ipfixTarget = "172.16.20.1:4739";
+        Integer obsDomainId = 112;
+        Integer obsPointId = 358;
+        Integer cacheMax = 132;
+        Integer cacheTimeout = 134;
+        Integer sampling = 558;
+        IPFIX ipfix = ovs.createTypedRowWrapper(IPFIX.class);
+        ipfix.setTargets(ImmutableSet.of(ipfixTarget));
+        ipfix.setObsDomainId(ImmutableSet.of(obsDomainId));
+        ipfix.setObsPointId(ImmutableSet.of(obsPointId));
+        ipfix.setCacheMaxFlows(ImmutableSet.of(cacheMax));
+        ipfix.setCacheActiveTimeout(ImmutableSet.of(cacheTimeout));
+        ipfix.setSampling(ImmutableSet.of(sampling));
+        ipfix.setExternalIds(ImmutableMap.of("<3", "ovs"));
+        Bridge bridge = ovs.getTypedRowWrapper(Bridge.class, null);
+        TransactionBuilder transactionBuilder = ovs.transactBuilder()
+                .add(op.insert(ipfix.getSchema())
+                        .withId(ipfixUuidStr)
+                        .value(ipfix.getTargetsColumn())
+                        .value(ipfix.getObsDomainIdColumn())
+                        .value(ipfix.getObsPointIdColumn())
+                        .value(ipfix.getCacheMaxFlowsColumn())
+                        .value(ipfix.getCacheActiveTimeoutColumn())
+                        .value(ipfix.getSamplingColumn())
+                        .value(ipfix.getExternalIdsColumn()))
+                .add(op.mutate(bridge.getSchema())
+                        .addMutation(bridge.getIpfixColumn().getSchema(), Mutator.INSERT,
+                                Sets.newHashSet(new UUID(ipfixUuidStr)))
+                        .where(bridge.getNameColumn().getSchema().opEqual(testBridgeName))
+                        .build());
+        ListenableFuture<List<OperationResult>> results = transactionBuilder.execute();
+        List<OperationResult> operationResults = results.get();
+        Assert.assertFalse(operationResults.isEmpty());
+        // Check if Results matches the number of operations in transaction
+        Assert.assertEquals(transactionBuilder.getOperations().size(), operationResults.size());
+        for (OperationResult result : operationResults) Assert.assertNull(result.getError());
+        logger.info("Insert & Mutate operation results for IPFIX = {} ", operationResults);
+    }
+
+    private void testCreateTypedSflow() throws InterruptedException, ExecutionException, IllegalArgumentException{
+        String sFlowUuidStr = "testSFlow";
+        String sFlowTarget = "172.16.20.200:6343";
+        Integer header = 128;
+        Integer obsPointId = 358;
+        Integer polling = 10;
+        String agent = "172.16.20.210";
+        Integer sampling = 64;
+        SFlow sFlow = ovs.createTypedRowWrapper(SFlow.class);
+        sFlow.setTargets(ImmutableSet.of(sFlowTarget));
+        sFlow.setHeader(ImmutableSet.of(header));
+        sFlow.setPolling(ImmutableSet.of(obsPointId));
+        sFlow.setPolling(ImmutableSet.of(polling));
+        sFlow.setAgent(ImmutableSet.of(agent));
+        sFlow.setSampling(ImmutableSet.of(sampling));
+        sFlow.setExternalIds(ImmutableMap.of("kit", "tah"));
+        Bridge bridge = ovs.getTypedRowWrapper(Bridge.class, null);
+        TransactionBuilder transactionBuilder = ovs.transactBuilder()
+                .add(op.insert(sFlow.getSchema())
+                        .withId(sFlowUuidStr)
+                        .value(sFlow.getTargetsColumn())
+                        .value(sFlow.getHeaderColumn())
+                        .value(sFlow.getPollingColumn())
+                        .value(sFlow.getAgentColumn())
+                        .value(sFlow.getSamplingColumn())
+                        .value(sFlow.getExternalIdsColumn()))
+                .add(op.mutate(bridge.getSchema())
+                        .addMutation(bridge.getSflowColumn().getSchema(), Mutator.INSERT,
+                                Sets.newHashSet(new UUID(sFlowUuidStr)))
+                        .where(bridge.getNameColumn().getSchema().opEqual(testBridgeName))
+                        .build());
+        ListenableFuture<List<OperationResult>> results = transactionBuilder.execute();
+        List<OperationResult> operationResults = results.get();
+        for (OperationResult result : operationResults) {
+            assertNull(result.getError());
+        }
+        Assert.assertFalse(operationResults.isEmpty());
+        // Check if Results matches the number of operations in transaction
+        Assert.assertEquals(transactionBuilder.getOperations().size(), operationResults.size());
+        logger.info("Insert & Mutate operation results for SFlow = {} ", operationResults);
+    }
+
+    private void testCreateTypedNetFlow() throws InterruptedException, ExecutionException, IllegalArgumentException{
+        String netFlowUuidStr = "testNetFlow";
+        String netFlowTargets = "172.16.20.200:6343";
+        BigInteger engineType = BigInteger.valueOf(128);
+        BigInteger engineID = BigInteger.valueOf(32);
+        Integer activityTimeout = 1;
+        NetFlow netFlow = ovs.createTypedRowWrapper(NetFlow.class);
+        netFlow.setTargets(ImmutableSet.of(netFlowTargets));
+        netFlow.setEngineType(ImmutableSet.of(engineType));
+        netFlow.setEngineId(ImmutableSet.of(engineID));
+        netFlow.setActivityTimeout(ImmutableSet.of(activityTimeout));
+        netFlow.setExternalIds(ImmutableMap.of("big", "baby"));
+        Bridge bridge = ovs.getTypedRowWrapper(Bridge.class, null);
+        TransactionBuilder transactionBuilder = ovs.transactBuilder()
+                .add(op.insert(netFlow.getSchema())
+                        .withId(netFlowUuidStr)
+                        .value(netFlow.getTargetsColumn())
+                        .value(netFlow.getEngineTypeColumn())
+                        .value(netFlow.getEngineIdColumn())
+                        .value(netFlow.getActiveTimeoutColumn())
+                        .value(netFlow.getExternalIdsColumn()))
+                .add(op.mutate(bridge.getSchema())
+                        .addMutation(bridge.getNetflowColumn().getSchema(), Mutator.INSERT,
+                                Sets.newHashSet(new UUID(netFlowUuidStr)))
+                        .where(bridge.getNameColumn().getSchema().opEqual(testBridgeName))
+                        .build());
+        ListenableFuture<List<OperationResult>> results = transactionBuilder.execute();
+        List<OperationResult> operationResults = results.get();
+        for (OperationResult result : operationResults) Assert.assertNull(result.getError());
+        Assert.assertFalse(operationResults.isEmpty());
+        // Check if Results matches the number of operations in transaction
+        Assert.assertEquals(transactionBuilder.getOperations().size(), operationResults.size());
+        logger.info("Insert & Mutate operation results for NetFlow = {} ", operationResults);
+    }
+
+    public void testGetDBs() throws ExecutionException, InterruptedException {
+        ListenableFuture<List<String>> databases = ovs.getDatabases();
+        List<String> dbNames = databases.get();
+        Assert.assertNotNull(dbNames);
+        boolean hasOpenVswitchSchema = false;
+        for(String dbName : dbNames) {
+           if (dbName.equals(OPEN_VSWITCH_SCHEMA)) {
+                hasOpenVswitchSchema = true;
+                break;
+           }
+        }
+        Assert.assertTrue(OPEN_VSWITCH_SCHEMA+" schema is not supported by the switch", hasOpenVswitchSchema);
+    }
+
+    private UUID getOpenVSwitchTableUuid() {
+        OpenVSwitch openVSwitch = ovs.getTypedRowWrapper(OpenVSwitch.class, null);
+        Map<UUID, Row> ovsTable = tableCache.get(openVSwitch.getSchema().getName());
+        if (ovsTable != null) {
+            if (ovsTable.keySet().size() >= 1) {
+                return (UUID)ovsTable.keySet().toArray()[0];
+            }
+        }
+        return null;
+    }
+
+    public void monitorTables() throws ExecutionException, InterruptedException, IOException {
+        Assert.assertNotNull(dbSchema);
+
+        List<MonitorRequest<GenericTableSchema>> monitorRequests = Lists.newArrayList();
+        monitorRequests.add(this.getAllColumnsMonitorRequest(Bridge.class));
+        monitorRequests.add(this.getAllColumnsMonitorRequest(OpenVSwitch.class));
+
+        MonitorHandle monitor = ovs.monitor(dbSchema, monitorRequests, new UpdateMonitor());
+        Assert.assertNotNull(monitor);
+    }
+
+    /**
+     * As per RFC 7047, section 4.1.5, if a Monitor request is sent without any columns, the update response will not include
+     * the _uuid column.
+     * ----------------------------------------------------------------------------------------------------------------------------------
+     * Each <monitor-request> specifies one or more columns and the manner in which the columns (or the entire table) are to be monitored.
+     * The "columns" member specifies the columns whose values are monitored. It MUST NOT contain duplicates.
+     * If "columns" is omitted, all columns in the table, except for "_uuid", are monitored.
+     * ----------------------------------------------------------------------------------------------------------------------------------
+     * In order to overcome this limitation, this method
+     *
+     * @return MonitorRequest that includes all the Bridge Columns including _uuid
+     */
+    public <T extends TypedBaseTable> MonitorRequest<GenericTableSchema> getAllColumnsMonitorRequest (Class <T> klazz) {
+        TypedBaseTable table = ovs.createTypedRowWrapper(klazz);
+        GenericTableSchema bridgeSchema = table.getSchema();
+        Set<String> columns = bridgeSchema.getColumns();
+        MonitorRequestBuilder<GenericTableSchema> bridgeBuilder = MonitorRequestBuilder.builder(table.getSchema());
+        for (String column : columns) {
+            bridgeBuilder.addColumn(column);
+        }
+        return bridgeBuilder.with(new MonitorSelect(true, true, true, true)).build();
+    }
+
+    static Map<String, Map<UUID, Row>> tableCache = new HashMap<String, Map<UUID, Row>>();
+    private static class UpdateMonitor implements MonitorCallBack {
+        @Override
+        public void update(TableUpdates result) {
+            for (String tableName : result.getUpdates().keySet()) {
+                Map<UUID, Row> tUpdate = tableCache.get(tableName);
+                TableUpdate update = result.getUpdates().get(tableName);
+                if (update.getNew() != null) {
+                    if (tUpdate == null) {
+                        tUpdate = new HashMap<UUID, Row>();
+                        tableCache.put(tableName, tUpdate);
+                    }
+                    tUpdate.put(update.getUuid(), update.getNew());
+                } else {
+                    tUpdate.remove(update.getUuid());
+                }
+            }
+        }
+
+        @Override
+        public void exception(Throwable t) {
+            System.out.println("Exception t = " + t);
+        }
+    }
+
+    @Before
+    public  void setUp() throws IOException, ExecutionException, InterruptedException, TimeoutException {
+        if (ovs != null) {
+            return;
+        }
+        ovs = getTestConnection();
+        testGetDBs();
+        dbSchema = ovs.getSchema(OPEN_VSWITCH_SCHEMA, true).get();
+    }
+
+    @After
+    public void tearDown() throws InterruptedException, ExecutionException {
+        Bridge bridge = ovs.getTypedRowWrapper(Bridge.class, null);
+        OpenVSwitch openVSwitch = ovs.getTypedRowWrapper(OpenVSwitch.class, null);
+
+        ListenableFuture<List<OperationResult>> results = ovs.transactBuilder()
+                .add(op.delete(bridge.getSchema())
+                        .where(bridge.getNameColumn().getSchema().opEqual(testBridgeName))
+                        .build())
+                .add(op.mutate(openVSwitch.getSchema())
+                        .addMutation(openVSwitch.getBridgesColumn().getSchema(), Mutator.DELETE, Sets.newHashSet(testBridgeUuid)))
+                .add(op.commit(true))
+                .execute();
+
+        List<OperationResult> operationResults = results.get();
+        System.out.println("Delete operation results = " + operationResults);
+        tableCache = new HashMap<String, Map<UUID, Row>>();
+    }
+
+    @Override
+    public void update(Object node, UpdateNotification upadateNotification) {
+        // TODO Auto-generated method stub
+
+    }
+    @Override
+    public void locked(Object node, List<String> ids) {
+        // TODO Auto-generated method stub
+
+    }
+    @Override
+    public void stolen(Object node, List<String> ids) {
+        // TODO Auto-generated method stub
+
+    }
+}
diff --git a/schemas/Open_vSwitch/src/test/resources/logback.xml b/schemas/Open_vSwitch/src/test/resources/logback.xml
new file mode 100644 (file)
index 0000000..70118ce
--- /dev/null
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<configuration>
+
+    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+        <!-- encoders are assigned the type
+             ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
+        <encoder>
+            <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{5} - %msg%n</pattern>
+        </encoder>
+    </appender>
+
+    <logger name="org.opendaylight.ovsdb.lib.jsonrpc.JsonRpcEndpoint" level="TRACE" additivity="false">
+        <appender-ref ref="STDOUT" />
+    </logger>
+
+    <!--<logger name="com.lordofthejars.foo" level="INFO" additivity="false">-->
+        <!--<appender-ref ref="STDOUT" />-->
+    <!--</logger>-->
+
+    <root level="INFO">
+        <appender-ref ref="STDOUT" />
+    </root>
+
+</configuration>
\ No newline at end of file
diff --git a/schemas/hardware_vtep/pom.xml b/schemas/hardware_vtep/pom.xml
new file mode 100755 (executable)
index 0000000..78f93c3
--- /dev/null
@@ -0,0 +1,180 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.opendaylight.ovsdb</groupId>
+    <artifactId>ovsdb_commons</artifactId>
+    <version>1.1.0-SNAPSHOT</version>
+    <relativePath>../../commons/parent</relativePath>
+  </parent>
+  <artifactId>ovsdb_schema.hardware_vtep</artifactId>
+  <version>1.0.0-SNAPSHOT</version>
+  <packaging>bundle</packaging>
+
+  <properties>
+    <skip.integrationtest>true</skip.integrationtest>
+  </properties>
+  <dependencies>
+    <dependency>
+      <groupId>ch.qos.logback</groupId>
+      <artifactId>logback-classic</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>ch.qos.logback</groupId>
+      <artifactId>logback-core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>com.fasterxml.jackson.core</groupId>
+      <artifactId>jackson-annotations</artifactId>
+      <version>${jackson.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>com.fasterxml.jackson.core</groupId>
+      <artifactId>jackson-core</artifactId>
+      <version>${jackson.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>com.fasterxml.jackson.core</groupId>
+      <artifactId>jackson-databind</artifactId>
+      <version>${jackson.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>com.google.code.gson</groupId>
+      <artifactId>gson</artifactId>
+      <version>2.1</version>
+      <scope>compile</scope>
+    </dependency>
+    <dependency>
+      <groupId>com.google.guava</groupId>
+      <artifactId>guava</artifactId>
+      <version>${guava.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>commons-codec</groupId>
+      <artifactId>commons-codec</artifactId>
+      <version>1.4</version>
+      <optional>true</optional>
+    </dependency>
+    <dependency>
+      <groupId>commons-collections</groupId>
+      <artifactId>commons-collections</artifactId>
+      <version>1.0</version>
+    </dependency>
+    <dependency>
+      <groupId>commons-lang</groupId>
+      <artifactId>commons-lang</artifactId>
+      <version>2.3</version>
+    </dependency>
+    <dependency>
+      <groupId>equinoxSDK381</groupId>
+      <artifactId>org.eclipse.osgi</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>io.netty</groupId>
+      <artifactId>netty-all</artifactId>
+      <version>4.0.10.Final</version>
+    </dependency>
+    <dependency>
+      <groupId>javax.portlet</groupId>
+      <artifactId>portlet-api</artifactId>
+      <version>2.0</version>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.httpcomponents</groupId>
+      <artifactId>httpcore-nio</artifactId>
+      <version>4.2.1</version>
+      <optional>true</optional>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.ovsdb</groupId>
+      <artifactId>ovsdb_library</artifactId>
+      <version>1.0.0-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <testResources>
+      <testResource>
+        <filtering>true</filtering>
+        <directory>src/test/resources</directory>
+      </testResource>
+    </testResources>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <version>2.3.6</version>
+        <extensions>true</extensions>
+        <configuration>
+          <instructions>
+            <Import-Package>org.opendaylight.ovsdb.lib,
+                org.opendaylight.ovsdb.lib.table,
+                org.opendaylight.ovsdb.lib.jsonrpc,
+                org.opendaylight.ovsdb.lib.notation,
+                org.opendaylight.ovsdb.lib.database,
+                org.opendaylight.ovsdb.lib.operations,
+                org.opendaylight.ovsdb.lib.message,
+                org.opendaylight.ovsdb.lib.schema,
+                org.opendaylight.ovsdb.lib.schema.typed,
+                org.apache.commons.lang3.builder,
+                org.apache.commons.lang3.tuple,
+                org.apache.felix.dm,
+                org.slf4j,
+                org.eclipse.osgi.framework.console,
+                org.osgi.framework,
+                javax.net.ssl,
+                *</Import-Package>
+            <Embed-Transitive>true</Embed-Transitive>
+            <Export-Package>org.opendaylight.ovsdb.schema.hardwarevtep</Export-Package>
+          </instructions>
+          <manifestLocation>${project.basedir}/META-INF</manifestLocation>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-failsafe-plugin</artifactId>
+        <configuration>
+          <skipITs>${skip.integrationtest}</skipITs>
+          <includes>
+            <include>**/*IT*</include>
+          </includes>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <version>2.16</version>
+        <configuration>
+          <excludes>
+            <!--  Exclude integration tests -->
+            <exclude>**/*IT*</exclude>
+          </excludes>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+  <scm>
+    <connection>scm:git:ssh://git.opendaylight.org:29418/ovsdb.git</connection>
+    <developerConnection>scm:git:ssh://git.opendaylight.org:29418/ovsdb.git</developerConnection>
+    <tag>HEAD</tag>
+    <url>https://wiki.opendaylight.org/view/OVSDB_Integration:Main</url>
+  </scm>
+
+  <profiles>
+    <profile>
+      <id>integrationtest</id>
+      <activation></activation>
+      <properties>
+        <skip.integrationtest>false</skip.integrationtest>
+      </properties>
+    </profile>
+  </profiles>
+</project>
diff --git a/schemas/hardware_vtep/src/main/java/org/opendaylight/ovsdb/schema/hardwarevtep/ArpSourcesLocal.java b/schemas/hardware_vtep/src/main/java/org/opendaylight/ovsdb/schema/hardwarevtep/ArpSourcesLocal.java
new file mode 100644 (file)
index 0000000..232c704
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal
+ */
+package org.opendaylight.ovsdb.schema.hardwarevtep;
+
+import org.opendaylight.ovsdb.lib.notation.Column;
+import org.opendaylight.ovsdb.lib.notation.UUID;
+import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
+import org.opendaylight.ovsdb.lib.schema.typed.MethodType;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedBaseTable;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedColumn;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedTable;
+
+@TypedTable(name="Arp_Sources_Local", database="hardware_vtep", fromVersion="1.2.0")
+public interface ArpSourcesLocal extends TypedBaseTable {
+    @TypedColumn(name="src_mac", method=MethodType.GETCOLUMN, fromVersion="1.2.0")
+    public Column<GenericTableSchema, String> getSrcMacColumn();
+
+    @TypedColumn(name="src_mac", method=MethodType.GETDATA, fromVersion="1.2.0")
+    public String getSrcMac();
+
+    @TypedColumn(name="src_mac", method=MethodType.SETDATA, fromVersion="1.2.0")
+    public void setSrcMac(String srcMac);
+
+    @TypedColumn(name="locator", method=MethodType.GETCOLUMN, fromVersion="1.2.0")
+    public Column<GenericTableSchema, UUID> getLocatorColumn();
+
+    @TypedColumn(name="locator", method=MethodType.SETDATA, fromVersion="1.2.0")
+    public void setLocator(UUID locator);
+}
diff --git a/schemas/hardware_vtep/src/main/java/org/opendaylight/ovsdb/schema/hardwarevtep/ArpSourcesRemote.java b/schemas/hardware_vtep/src/main/java/org/opendaylight/ovsdb/schema/hardwarevtep/ArpSourcesRemote.java
new file mode 100644 (file)
index 0000000..f6d45d3
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal
+ */
+package org.opendaylight.ovsdb.schema.hardwarevtep;
+
+import org.opendaylight.ovsdb.lib.notation.Column;
+import org.opendaylight.ovsdb.lib.notation.UUID;
+import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
+import org.opendaylight.ovsdb.lib.schema.typed.MethodType;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedBaseTable;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedColumn;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedTable;
+
+@TypedTable(name="Arp_Sources_Remote", database="hardware_vtep", fromVersion="1.2.0")
+public interface ArpSourcesRemote extends TypedBaseTable {
+    @TypedColumn(name="src_mac", method=MethodType.GETCOLUMN, fromVersion="1.2.0")
+    public Column<GenericTableSchema, String> getSrcMacColumn();
+
+    @TypedColumn(name="src_mac", method=MethodType.GETDATA, fromVersion="1.2.0")
+    public String getSrcMac();
+
+    @TypedColumn(name="src_mac", method=MethodType.SETDATA, fromVersion="1.2.0")
+    public void setSrcMac(String srcMac);
+
+    @TypedColumn(name="locator", method=MethodType.GETCOLUMN, fromVersion="1.2.0")
+    public Column<GenericTableSchema, UUID> getLocatorColumn();
+
+    @TypedColumn(name="locator", method=MethodType.SETDATA, fromVersion="1.2.0")
+    public void setLocator(UUID locator);
+}
diff --git a/schemas/hardware_vtep/src/main/java/org/opendaylight/ovsdb/schema/hardwarevtep/Global.java b/schemas/hardware_vtep/src/main/java/org/opendaylight/ovsdb/schema/hardwarevtep/Global.java
new file mode 100644 (file)
index 0000000..31c0f2f
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal
+ */
+
+package org.opendaylight.ovsdb.schema.hardwarevtep;
+
+import java.util.Set;
+
+import org.opendaylight.ovsdb.lib.notation.Column;
+import org.opendaylight.ovsdb.lib.notation.UUID;
+import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
+import org.opendaylight.ovsdb.lib.schema.typed.MethodType;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedBaseTable;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedColumn;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedTable;
+
+@TypedTable(name="Global", database="hardware_vtep", fromVersion="1.0.0")
+public interface Global extends TypedBaseTable {
+
+    @TypedColumn(name="managers", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Set<UUID>> getManagersColumn();
+
+    @TypedColumn(name="managers", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setManagers(Set<UUID> managers);
+
+    @TypedColumn(name="switches", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Set<UUID>> getSwitchesColumn();
+
+    @TypedColumn(name="switches", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setSwitches(Set<UUID> switches);
+}
diff --git a/schemas/hardware_vtep/src/main/java/org/opendaylight/ovsdb/schema/hardwarevtep/LogicalBindingStats.java b/schemas/hardware_vtep/src/main/java/org/opendaylight/ovsdb/schema/hardwarevtep/LogicalBindingStats.java
new file mode 100644 (file)
index 0000000..180408e
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal
+ */
+package org.opendaylight.ovsdb.schema.hardwarevtep;
+
+import org.opendaylight.ovsdb.lib.notation.Column;
+import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
+import org.opendaylight.ovsdb.lib.schema.typed.MethodType;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedBaseTable;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedColumn;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedTable;
+
+@TypedTable(name="Logical_Binding_Stats", database="hardware_vtep", fromVersion="1.0.0")
+public interface LogicalBindingStats extends TypedBaseTable {
+
+    @TypedColumn(name="bytes_from_local", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Integer> getBytesFromLocalColumn();
+
+    @TypedColumn(name="bytes_from_local", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setBytesFromLocal(Integer bytesFromLocal);
+
+    @TypedColumn(name="packets_from_local", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Integer> getPacketsFromLocalColumn();
+
+    @TypedColumn(name="packets_from_local", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setPacketsFromLocal(Integer packetsFromLocal);
+
+    @TypedColumn(name="bytes_to_local", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Integer> getBytesToLocalColumn();
+
+    @TypedColumn(name="bytes_to_local", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setBytesToLocal(Integer bytesToLocal);
+
+    @TypedColumn(name="packets_to_local", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Integer> getPacketsToLocalColumn();
+
+    @TypedColumn(name="packets_to_local", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setPacketsToLocal(Integer packetsToLocal);
+}
diff --git a/schemas/hardware_vtep/src/main/java/org/opendaylight/ovsdb/schema/hardwarevtep/LogicalRouter.java b/schemas/hardware_vtep/src/main/java/org/opendaylight/ovsdb/schema/hardwarevtep/LogicalRouter.java
new file mode 100644 (file)
index 0000000..0e7eabf
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal
+ */
+package org.opendaylight.ovsdb.schema.hardwarevtep;
+
+import java.util.Map;
+
+import org.opendaylight.ovsdb.lib.notation.Column;
+import org.opendaylight.ovsdb.lib.notation.UUID;
+import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
+import org.opendaylight.ovsdb.lib.schema.typed.MethodType;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedBaseTable;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedColumn;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedTable;
+
+@TypedTable(name="Logical_Router", database="hardware_vtep", fromVersion="1.0.0")
+public interface LogicalRouter extends TypedBaseTable {
+    @TypedColumn(name="name", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, String> getNameColumn();
+
+    @TypedColumn(name="name", method=MethodType.GETDATA, fromVersion="1.0.0")
+    public String getName();
+
+    @TypedColumn(name="name", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setName(String name);
+
+
+    @TypedColumn(name="description", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, String> getDescriptionColumn();
+
+    @TypedColumn(name="description", method=MethodType.GETDATA, fromVersion="1.0.0")
+    public String getDescription();
+
+    @TypedColumn(name="description", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setDescription(String description);
+
+
+    @TypedColumn(name="switch_binding", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Map<String, UUID>> getSwitchBindingColumn();
+
+    @TypedColumn(name="switch_binding", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setSwitchBinding(Map<String, UUID> switchBinding);
+
+
+    @TypedColumn(name="static_routes", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Map<String, String>> setStaticRoutesColumn();
+
+    @TypedColumn(name="static_routes", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setStaticRoutes(Map<String, String> staticRoutes);
+}
\ No newline at end of file
diff --git a/schemas/hardware_vtep/src/main/java/org/opendaylight/ovsdb/schema/hardwarevtep/LogicalSwitch.java b/schemas/hardware_vtep/src/main/java/org/opendaylight/ovsdb/schema/hardwarevtep/LogicalSwitch.java
new file mode 100644 (file)
index 0000000..8a2ca61
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal
+ */
+package org.opendaylight.ovsdb.schema.hardwarevtep;
+
+import java.util.Set;
+
+import org.opendaylight.ovsdb.lib.notation.Column;
+import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
+import org.opendaylight.ovsdb.lib.schema.typed.MethodType;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedBaseTable;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedColumn;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedTable;
+
+@TypedTable(name="Logical_Switch", database="hardware_vtep", fromVersion="1.0.0")
+public interface LogicalSwitch extends TypedBaseTable {
+    @TypedColumn(name="name", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, String> getNameColumn();
+
+    @TypedColumn(name="name", method=MethodType.GETDATA, fromVersion="1.0.0")
+    public String getName();
+
+    @TypedColumn(name="name", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setName(String name);
+
+
+    @TypedColumn(name="description", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, String> getDescriptionColumn();
+
+    @TypedColumn(name="description", method=MethodType.GETDATA, fromVersion="1.0.0")
+    public String getDescription();
+
+    @TypedColumn(name="description", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setDescription(String description);
+
+
+    @TypedColumn(name="tunnel_key", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Set<Integer>> getTunnelKeyColumn();
+
+    @TypedColumn(name="tunnel_key", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setTunnelKey(Set<Integer> tunnelKey);
+}
\ No newline at end of file
diff --git a/schemas/hardware_vtep/src/main/java/org/opendaylight/ovsdb/schema/hardwarevtep/Manager.java b/schemas/hardware_vtep/src/main/java/org/opendaylight/ovsdb/schema/hardwarevtep/Manager.java
new file mode 100644 (file)
index 0000000..b5a0852
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal
+ */
+
+package org.opendaylight.ovsdb.schema.hardwarevtep;
+
+import java.util.Map;
+import java.util.Set;
+
+import org.opendaylight.ovsdb.lib.notation.Column;
+import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
+import org.opendaylight.ovsdb.lib.schema.typed.MethodType;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedBaseTable;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedColumn;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedTable;
+
+@TypedTable(name="Manager", database="hardware_vtep", fromVersion="1.0.0")
+public interface Manager extends TypedBaseTable {
+
+    @TypedColumn(name="target", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, String> getTargetColumn();
+
+    @TypedColumn(name="target", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setTarget(String target);
+
+    @TypedColumn(name="max_backoff", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Set<Integer>> getMaxBackoffColumn();
+
+    @TypedColumn(name="max_backoff", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setMaxBackoff(Set<Integer> maxBackoff);
+
+    @TypedColumn(name="inactivity_probe", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Set<Integer>> getInactivityProbeColumn();
+
+    @TypedColumn(name="inactivity_probe", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setInactivityProbe(Set<Integer> inactivityProbe);
+
+    @TypedColumn(name="other_config", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Map<String, String>> getOtherConfigColumn();
+
+    @TypedColumn(name="other_config", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setOtherConfig(Map<String, String> otherConfig);
+
+    @TypedColumn(name="is_connected", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Boolean> getIsConnectedColumn();
+
+    @TypedColumn(name="is_connected", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setIsConnectedColumn(Boolean isConnected);
+
+    @TypedColumn(name="status", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Map<String, String>> getStatusColumn();
+
+    @TypedColumn(name="status", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setStatus(Map<String, String> status);
+}
\ No newline at end of file
diff --git a/schemas/hardware_vtep/src/main/java/org/opendaylight/ovsdb/schema/hardwarevtep/McastMacsLocal.java b/schemas/hardware_vtep/src/main/java/org/opendaylight/ovsdb/schema/hardwarevtep/McastMacsLocal.java
new file mode 100644 (file)
index 0000000..bc4f842
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal
+ */
+package org.opendaylight.ovsdb.schema.hardwarevtep;
+
+import org.opendaylight.ovsdb.lib.notation.Column;
+import org.opendaylight.ovsdb.lib.notation.UUID;
+import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
+import org.opendaylight.ovsdb.lib.schema.typed.MethodType;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedBaseTable;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedColumn;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedTable;
+
+@TypedTable(name="Mcast_Macs_Local", database="hardware_vtep", fromVersion="1.0.0")
+public interface McastMacsLocal extends TypedBaseTable {
+    @TypedColumn(name="MAC", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, String> getMacColumn();
+
+    @TypedColumn(name="MAC", method=MethodType.GETDATA, fromVersion="1.0.0")
+    public String getMac();
+
+    @TypedColumn(name="MAC", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setMac(String mac);
+
+
+    @TypedColumn(name="logical_switch", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, UUID> getLogicalSwitchColumn();
+
+    @TypedColumn(name="logical_switch", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setLogicalSwitch(UUID logicalSwitch);
+
+    @TypedColumn(name="locator_set", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, UUID> getLocatorSetColumn();
+
+    @TypedColumn(name="locator_set", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setLocatorSet(UUID locatorSet);
+
+
+    @TypedColumn(name="ipaddr", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, String> getIpAddrColumn();
+
+    @TypedColumn(name="ipaddr", method=MethodType.GETDATA, fromVersion="1.0.0")
+    public String getIpAddr();
+
+    @TypedColumn(name="ipaddr", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setIpAddress(String ipAddr);
+}
diff --git a/schemas/hardware_vtep/src/main/java/org/opendaylight/ovsdb/schema/hardwarevtep/McastMacsRemote.java b/schemas/hardware_vtep/src/main/java/org/opendaylight/ovsdb/schema/hardwarevtep/McastMacsRemote.java
new file mode 100644 (file)
index 0000000..dedec6b
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal
+ */
+package org.opendaylight.ovsdb.schema.hardwarevtep;
+
+import org.opendaylight.ovsdb.lib.notation.Column;
+import org.opendaylight.ovsdb.lib.notation.UUID;
+import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
+import org.opendaylight.ovsdb.lib.schema.typed.MethodType;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedBaseTable;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedColumn;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedTable;
+
+@TypedTable(name="Mcast_Macs_Remote", database="hardware_vtep", fromVersion="1.0.0")
+public interface McastMacsRemote extends TypedBaseTable {
+    @TypedColumn(name="MAC", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, String> getMacColumn();
+
+    @TypedColumn(name="MAC", method=MethodType.GETDATA, fromVersion="1.0.0")
+    public String getMac();
+
+    @TypedColumn(name="MAC", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setMac(String mac);
+
+
+    @TypedColumn(name="logical_switch", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, UUID> getLogicalSwitchColumn();
+
+    @TypedColumn(name="logical_switch", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setLogicalSwitch(UUID logicalSwitch);
+
+    @TypedColumn(name="locator_set", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, UUID> getLocatorSetColumn();
+
+    @TypedColumn(name="locator_set", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setLocatorSet(UUID locatorSet);
+
+
+    @TypedColumn(name="ipaddr", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, String> getIpAddrColumn();
+
+    @TypedColumn(name="ipaddr", method=MethodType.GETDATA, fromVersion="1.0.0")
+    public String getIpAddr();
+
+    @TypedColumn(name="ipaddr", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setIpAddress(String ipAddr);
+}
diff --git a/schemas/hardware_vtep/src/main/java/org/opendaylight/ovsdb/schema/hardwarevtep/PhysicalLocator.java b/schemas/hardware_vtep/src/main/java/org/opendaylight/ovsdb/schema/hardwarevtep/PhysicalLocator.java
new file mode 100644 (file)
index 0000000..20ee906
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal
+ */
+package org.opendaylight.ovsdb.schema.hardwarevtep;
+
+import java.util.Map;
+
+import org.opendaylight.ovsdb.lib.notation.Column;
+import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
+import org.opendaylight.ovsdb.lib.schema.typed.MethodType;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedBaseTable;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedColumn;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedTable;
+
+@TypedTable(name="Physical_Locator", database="hardware_vtep", fromVersion="1.0.0")
+public interface PhysicalLocator extends TypedBaseTable {
+    @TypedColumn(name="encapsulation_type", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, String> getEncapsulationTypeColumn();
+
+    @TypedColumn(name="encapsulation_type", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setEncapsulationType(String encapsulationType);
+
+    @TypedColumn(name="dst_ip", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, String> getDstIpColumn();
+
+    @TypedColumn(name="dst_ip", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setDstIp(String dstIp);
+
+    @TypedColumn(name="bfd", method=MethodType.GETCOLUMN, fromVersion="1.0.0", untilVersion="1.2.0")
+    public Column<GenericTableSchema, Map<String, String>> getBfdColumn();
+
+    @TypedColumn(name="bfd", method=MethodType.SETDATA, fromVersion="1.0.0", untilVersion="1.2.0")
+    public void setBfd(Map<String, String> bfd);
+
+    @TypedColumn(name="bfd_status", method=MethodType.GETCOLUMN, fromVersion="1.0.0", untilVersion="1.2.0")
+    public Column<GenericTableSchema, Map<String, String>> getBfdStatusColumn();
+
+    @TypedColumn(name="bfd_status", method=MethodType.SETDATA, fromVersion="1.0.0", untilVersion="1.2.0")
+    public void setBfdStatus(Map<String, String> bfdStatus);
+}
\ No newline at end of file
diff --git a/schemas/hardware_vtep/src/main/java/org/opendaylight/ovsdb/schema/hardwarevtep/PhysicalLocatorSet.java b/schemas/hardware_vtep/src/main/java/org/opendaylight/ovsdb/schema/hardwarevtep/PhysicalLocatorSet.java
new file mode 100644 (file)
index 0000000..4335cda
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal
+ */
+package org.opendaylight.ovsdb.schema.hardwarevtep;
+
+import java.util.Set;
+
+import org.opendaylight.ovsdb.lib.notation.Column;
+import org.opendaylight.ovsdb.lib.notation.UUID;
+import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
+import org.opendaylight.ovsdb.lib.schema.typed.MethodType;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedBaseTable;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedColumn;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedTable;
+
+@TypedTable(name="Physical_Locator_Set", database="hardware_vtep", fromVersion="1.0.0")
+public interface PhysicalLocatorSet extends TypedBaseTable {
+    @TypedColumn(name="locators", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Set<UUID>> getLocatorsColumn();
+
+    @TypedColumn(name="locators", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setLocators(Set<UUID> locators);
+}
\ No newline at end of file
diff --git a/schemas/hardware_vtep/src/main/java/org/opendaylight/ovsdb/schema/hardwarevtep/PhysicalPort.java b/schemas/hardware_vtep/src/main/java/org/opendaylight/ovsdb/schema/hardwarevtep/PhysicalPort.java
new file mode 100644 (file)
index 0000000..4d74af3
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal
+ */
+package org.opendaylight.ovsdb.schema.hardwarevtep;
+
+import java.util.Map;
+import java.util.Set;
+
+import org.opendaylight.ovsdb.lib.notation.Column;
+import org.opendaylight.ovsdb.lib.notation.UUID;
+import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
+import org.opendaylight.ovsdb.lib.schema.typed.MethodType;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedBaseTable;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedColumn;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedTable;
+
+@TypedTable(name="Physical_Port", database="hardware_vtep", fromVersion="1.0.0")
+public interface PhysicalPort extends TypedBaseTable {
+    @TypedColumn(name="name", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, String> getNameColumn();
+
+    @TypedColumn(name="name", method=MethodType.GETDATA, fromVersion="1.0.0")
+    public String getName();
+
+    @TypedColumn(name="name", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setName(String name);
+
+
+    @TypedColumn(name="description", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, String> getDescriptionColumn();
+
+    @TypedColumn(name="description", method=MethodType.GETDATA, fromVersion="1.0.0")
+    public String getDescription();
+
+    @TypedColumn(name="description", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setDescription(String description);
+
+
+    @TypedColumn(name="vlan_bindings", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Map<Integer, UUID>> getVlanBindingsColumn();
+
+    @TypedColumn(name="vlan_bindings", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setVlanBindings(Map<Integer, UUID> vlanBindings);
+
+
+    @TypedColumn(name="vlan_stats", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Map<Integer, UUID>> getVlanStatsColumn();
+
+    @TypedColumn(name="vlan_stats", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setVlanStats(Map<Integer, UUID> vlanStats);
+
+
+    @TypedColumn(name="port_fault_status", method=MethodType.GETCOLUMN, fromVersion="1.1.0")
+    public Column<GenericTableSchema, Set<String>> getPortFaultStatusColumn();
+
+    @TypedColumn(name="port_fault_status", method=MethodType.SETDATA, fromVersion="1.1.0")
+    public void setPortFaultStatus(Set<String> portFaultStatus);
+}
diff --git a/schemas/hardware_vtep/src/main/java/org/opendaylight/ovsdb/schema/hardwarevtep/PhysicalSwitch.java b/schemas/hardware_vtep/src/main/java/org/opendaylight/ovsdb/schema/hardwarevtep/PhysicalSwitch.java
new file mode 100644 (file)
index 0000000..61c3afa
--- /dev/null
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal
+ */
+package org.opendaylight.ovsdb.schema.hardwarevtep;
+
+import java.util.Set;
+
+import org.opendaylight.ovsdb.lib.notation.Column;
+import org.opendaylight.ovsdb.lib.notation.UUID;
+import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
+import org.opendaylight.ovsdb.lib.schema.typed.MethodType;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedBaseTable;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedColumn;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedTable;
+
+@TypedTable(name="Physical_Switch", database="hardware_vtep", fromVersion="1.0.0")
+public interface PhysicalSwitch extends TypedBaseTable {
+    @TypedColumn(name="name", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, String> getNameColumn();
+
+    @TypedColumn(name="name", method=MethodType.GETDATA, fromVersion="1.0.0")
+    public String getName();
+
+    @TypedColumn(name="name", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setName(String name);
+
+
+    @TypedColumn(name="description", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, String> getDescriptionColumn();
+
+    @TypedColumn(name="description", method=MethodType.GETDATA, fromVersion="1.0.0")
+    public String getDescription();
+
+    @TypedColumn(name="description", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setDescription(String description);
+
+
+    @TypedColumn(name="ports", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Set<UUID>> getPortsColumn();
+
+    @TypedColumn(name="ports", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setPorts(Set<UUID> ports);
+
+
+    @TypedColumn(name="management_ips", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Set<String>> getManagementIpsColumn();
+
+    @TypedColumn(name="management_ips", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setManagementIps(Set<String> managementIps);
+
+
+    @TypedColumn(name="tunnel_ips", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, Set<String>> getTunnelIpsColumn();
+
+    @TypedColumn(name="tunnel_ips", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setTunnelIps(Set<String> tunnelIps);
+
+
+    @TypedColumn(name="tunnels", method=MethodType.GETCOLUMN, fromVersion="1.3.0")
+    public Column<GenericTableSchema, Set<UUID>> getTunnels();
+
+    @TypedColumn(name="tunnels", method=MethodType.SETDATA, fromVersion="1.3.0")
+    public void setTunnels(Set<UUID> tunnels);
+
+    @TypedColumn(name="switch_fault_status", method=MethodType.GETCOLUMN, fromVersion="1.1.0")
+    public Column<GenericTableSchema, Set<String>> getSwitchFaultStatusColumn();
+
+    @TypedColumn(name="switch_fault_status", method=MethodType.SETDATA, fromVersion="1.1.0")
+    public void setSwitchFaultStatus(Set<String> switchFaultStatus);
+}
diff --git a/schemas/hardware_vtep/src/main/java/org/opendaylight/ovsdb/schema/hardwarevtep/Tunnel.java b/schemas/hardware_vtep/src/main/java/org/opendaylight/ovsdb/schema/hardwarevtep/Tunnel.java
new file mode 100644 (file)
index 0000000..0e6ea7a
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal
+ */
+package org.opendaylight.ovsdb.schema.hardwarevtep;
+
+import java.util.Map;
+
+import org.opendaylight.ovsdb.lib.notation.Column;
+import org.opendaylight.ovsdb.lib.notation.UUID;
+import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
+import org.opendaylight.ovsdb.lib.schema.typed.MethodType;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedBaseTable;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedColumn;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedTable;
+
+@TypedTable(name="Tunnel", database="hardware_vtep", fromVersion="1.3.0")
+public interface Tunnel extends TypedBaseTable {
+    @TypedColumn(name="local", method=MethodType.GETCOLUMN, fromVersion="1.3.0")
+    public Column<GenericTableSchema, UUID> getLocalColumn();
+
+    @TypedColumn(name="local", method=MethodType.SETDATA, fromVersion="1.3.0")
+    public void setLocal(UUID local);
+
+    @TypedColumn(name="remote", method=MethodType.GETCOLUMN, fromVersion="1.3.0")
+    public Column<GenericTableSchema, UUID> getRemoteColumn();
+
+    @TypedColumn(name="remote", method=MethodType.SETDATA, fromVersion="1.3.0")
+    public void setRemote(UUID remote);
+
+    @TypedColumn(name="bfd_config_local", method=MethodType.GETCOLUMN, fromVersion="1.3.0")
+    public Column<GenericTableSchema, Map<String, String>> getBfdConfigLocalColumn();
+
+    @TypedColumn(name="bfd_config_local", method=MethodType.SETDATA, fromVersion="1.3.0")
+    public void setBfdConfigLocal(Map<String, String> bfdConfigLocal);
+
+    @TypedColumn(name="bfd_config_remote", method=MethodType.GETCOLUMN, fromVersion="1.3.0")
+    public Column<GenericTableSchema, Map<String, String>> getBfdConfigRemoteColumn();
+
+    @TypedColumn(name="bfd_config_remote", method=MethodType.SETDATA, fromVersion="1.3.0")
+    public void setBfdConfigRemote(Map<String, String> bfdConfigRemote);
+
+    @TypedColumn(name="bfd_params", method=MethodType.GETCOLUMN, fromVersion="1.3.0")
+    public Column<GenericTableSchema, Map<String, String>> getBfdParamsColumn();
+
+    @TypedColumn(name="bfd_params", method=MethodType.SETDATA, fromVersion="1.3.0")
+    public void setBfdParams(Map<String, String> bfdParams);
+
+    @TypedColumn(name="bfd_status", method=MethodType.GETCOLUMN, fromVersion="1.3.0")
+    public Column<GenericTableSchema, Map<String, String>> getBfdStatusColumn();
+
+    @TypedColumn(name="bfd_status", method=MethodType.SETDATA, fromVersion="1.3.0")
+    public void setBfdStatus(Map<String, String> bfdStatus);
+}
diff --git a/schemas/hardware_vtep/src/main/java/org/opendaylight/ovsdb/schema/hardwarevtep/UcastMacsLocal.java b/schemas/hardware_vtep/src/main/java/org/opendaylight/ovsdb/schema/hardwarevtep/UcastMacsLocal.java
new file mode 100644 (file)
index 0000000..db1a2b9
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal
+ */
+package org.opendaylight.ovsdb.schema.hardwarevtep;
+
+import org.opendaylight.ovsdb.lib.notation.Column;
+import org.opendaylight.ovsdb.lib.notation.UUID;
+import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
+import org.opendaylight.ovsdb.lib.schema.typed.MethodType;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedBaseTable;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedColumn;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedTable;
+
+@TypedTable(name="Ucast_Macs_Local", database="hardware_vtep", fromVersion="1.0.0")
+public interface UcastMacsLocal extends TypedBaseTable {
+    @TypedColumn(name="MAC", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, String> getMacColumn();
+
+    @TypedColumn(name="MAC", method=MethodType.GETDATA, fromVersion="1.0.0")
+    public String getMac();
+
+    @TypedColumn(name="MAC", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setMac(String mac);
+
+
+    @TypedColumn(name="logical_switch", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, UUID> getLogicalSwitchColumn();
+
+    @TypedColumn(name="logical_switch", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setLogicalSwitch(UUID logicalSwitch);
+
+    @TypedColumn(name="locator", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, UUID> getLocatorColumn();
+
+    @TypedColumn(name="locator", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setLocator(UUID locator);
+
+
+    @TypedColumn(name="ipaddr", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, String> getIpAddrColumn();
+
+    @TypedColumn(name="ipaddr", method=MethodType.GETDATA, fromVersion="1.0.0")
+    public String getIpAddr();
+
+    @TypedColumn(name="ipaddr", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setIpAddress(String ipAddr);
+}
diff --git a/schemas/hardware_vtep/src/main/java/org/opendaylight/ovsdb/schema/hardwarevtep/UcastMacsRemote.java b/schemas/hardware_vtep/src/main/java/org/opendaylight/ovsdb/schema/hardwarevtep/UcastMacsRemote.java
new file mode 100644 (file)
index 0000000..b79c895
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal
+ */
+package org.opendaylight.ovsdb.schema.hardwarevtep;
+
+import org.opendaylight.ovsdb.lib.notation.Column;
+import org.opendaylight.ovsdb.lib.notation.UUID;
+import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
+import org.opendaylight.ovsdb.lib.schema.typed.MethodType;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedBaseTable;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedColumn;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedTable;
+
+@TypedTable(name="Ucast_Macs_Remote", database="hardware_vtep", fromVersion="1.0.0")
+public interface UcastMacsRemote extends TypedBaseTable {
+    @TypedColumn(name="MAC", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, String> getMacColumn();
+
+    @TypedColumn(name="MAC", method=MethodType.GETDATA, fromVersion="1.0.0")
+    public String getMac();
+
+    @TypedColumn(name="MAC", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setMac(String mac);
+
+
+    @TypedColumn(name="logical_switch", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, UUID> getLogicalSwitchColumn();
+
+    @TypedColumn(name="logical_switch", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setLogicalSwitch(UUID logicalSwitch);
+
+    @TypedColumn(name="locator", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, UUID> getLocatorColumn();
+
+    @TypedColumn(name="locator", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setLocator(UUID locator);
+
+
+    @TypedColumn(name="ipaddr", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+    public Column<GenericTableSchema, String> getIpAddrColumn();
+
+    @TypedColumn(name="ipaddr", method=MethodType.GETDATA, fromVersion="1.0.0")
+    public String getIpAddr();
+
+    @TypedColumn(name="ipaddr", method=MethodType.SETDATA, fromVersion="1.0.0")
+    public void setIpAddress(String ipAddr);
+}
diff --git a/schemas/hardware_vtep/src/test/java/org/opendaylight/ovsdb/schema/hardwarevtep/OvsdbTestBase.java b/schemas/hardware_vtep/src/test/java/org/opendaylight/ovsdb/schema/hardwarevtep/OvsdbTestBase.java
new file mode 100644 (file)
index 0000000..07960a8
--- /dev/null
@@ -0,0 +1,121 @@
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal
+ */
+
+package org.opendaylight.ovsdb.schema.hardwarevtep;
+
+import java.io.IOException;
+import java.net.InetAddress;
+import java.util.Properties;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+
+import junit.framework.Assert;
+
+import org.opendaylight.ovsdb.lib.OvsdbClient;
+import org.opendaylight.ovsdb.lib.OvsdbConnection;
+import org.opendaylight.ovsdb.lib.OvsdbConnectionListener;
+import org.opendaylight.ovsdb.lib.impl.OvsdbConnectionService;
+import org.opendaylight.ovsdb.lib.message.OvsdbRPC;
+
+public abstract class OvsdbTestBase implements OvsdbRPC.Callback{
+    private final static String SERVER_IPADDRESS = "ovsdbserver.ipaddress";
+    private final static String SERVER_PORT = "ovsdbserver.port";
+    private final static String DEFAULT_SERVER_PORT = "6640";
+    private final static String CONNECTION_TYPE = "ovsdbserver.connection";
+    private final static String CONNECTION_TYPE_ACTIVE = "active";
+    private final static String CONNECTION_TYPE_PASSIVE = "passive";
+
+    /**
+     * Represents the Hardware VTEP Schema
+     */
+    public final static String HARDWARE_VTEP_SCHEMA = "hardware_vtep";
+
+    public Properties loadProperties() {
+        Properties props = new Properties(System.getProperties());
+        return props;
+    }
+
+
+    public OvsdbClient getTestConnection() throws IOException, InterruptedException, ExecutionException, TimeoutException {
+        Properties props = loadProperties();
+        String addressStr = props.getProperty(SERVER_IPADDRESS);
+        String portStr = props.getProperty(SERVER_PORT, DEFAULT_SERVER_PORT);
+        String connectionType = props.getProperty(CONNECTION_TYPE, "active");
+
+        // If the connection type is active, controller connects to the ovsdb-server
+        if (connectionType.equalsIgnoreCase(CONNECTION_TYPE_ACTIVE)) {
+            if (addressStr == null) {
+                Assert.fail(usage());
+            }
+
+            InetAddress address;
+            try {
+                address = InetAddress.getByName(addressStr);
+            } catch (Exception e) {
+                System.out.println("Unable to resolve " + addressStr);
+                e.printStackTrace();
+                return null;
+            }
+
+            Integer port;
+            try {
+                port = Integer.parseInt(portStr);
+            } catch (NumberFormatException e) {
+                System.out.println("Invalid port number : " + portStr);
+                e.printStackTrace();
+                return null;
+            }
+
+            OvsdbConnection connection = OvsdbConnectionService.getService();
+            return connection.connect(address, port);
+        } else if (connectionType.equalsIgnoreCase(CONNECTION_TYPE_PASSIVE)) {
+            ExecutorService executor = Executors.newFixedThreadPool(1);
+            Future<OvsdbClient> passiveConnection = executor.submit(new PassiveListener());
+            return passiveConnection.get(60, TimeUnit.SECONDS);
+        }
+        Assert.fail("Connection parameter ("+CONNECTION_TYPE+") must be either active or passive");
+        return null;
+    }
+
+    private String usage() {
+        return "Integration Test needs a valid connection configuration as follows :\n" +
+               "active connection : mvn -Pintegrationtest -Dovsdbserver.ipaddress=x.x.x.x -Dovsdbserver.port=yyyy verify\n"+
+               "passive connection : mvn -Pintegrationtest -Dovsdbserver.connection=passive verify\n";
+    }
+
+    public class PassiveListener implements Callable<OvsdbClient>, OvsdbConnectionListener {
+        OvsdbClient client = null;
+        @Override
+        public OvsdbClient call() throws Exception {
+            OvsdbConnection connection = OvsdbConnectionService.getService();
+            connection.registerForPassiveConnection(this);
+            while (client == null) {
+                Thread.sleep(500);
+            }
+            return client;
+        }
+
+        @Override
+        public void connected(OvsdbClient client) {
+            this.client = client;
+        }
+
+        @Override
+        public void disconnected(OvsdbClient client) {
+            Assert.assertEquals(this.client.getConnectionInfo(), client.getConnectionInfo());
+            this.client = null;
+        }
+    }
+}
diff --git a/schemas/hardware_vtep/src/test/java/org/opendaylight/ovsdb/schema/hardwarevtep/TypedHardwareVTepSchemaIT.java b/schemas/hardware_vtep/src/test/java/org/opendaylight/ovsdb/schema/hardwarevtep/TypedHardwareVTepSchemaIT.java
new file mode 100644 (file)
index 0000000..50ec2d5
--- /dev/null
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal
+ */
+package org.opendaylight.ovsdb.schema.hardwarevtep;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeoutException;
+
+import junit.framework.Assert;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.ovsdb.lib.OvsdbClient;
+import org.opendaylight.ovsdb.lib.message.UpdateNotification;
+import org.opendaylight.ovsdb.lib.schema.DatabaseSchema;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.util.concurrent.ListenableFuture;
+
+public class TypedHardwareVTepSchemaIT extends OvsdbTestBase {
+
+    Logger logger = LoggerFactory.getLogger(TypedHardwareVTepSchemaIT.class);
+    OvsdbClient ovs;
+    DatabaseSchema dbSchema = null;
+
+    @Test
+    public void testGetDBs() throws ExecutionException, InterruptedException {
+        ListenableFuture<List<String>> databases = ovs.getDatabases();
+        List<String> dbNames = databases.get();
+        Assert.assertNotNull(dbNames);
+        boolean hasHardwareVTepSchema = false;
+        for(String dbName : dbNames) {
+           if (dbName.equals(HARDWARE_VTEP_SCHEMA)) {
+                hasHardwareVTepSchema = true;
+                break;
+           }
+        }
+        Assert.assertTrue(HARDWARE_VTEP_SCHEMA+" schema is not supported by the switch", hasHardwareVTepSchema);
+    }
+
+    @Before
+    public  void setUp() throws IOException, ExecutionException, InterruptedException, TimeoutException {
+        if (ovs != null) {
+            return;
+        }
+        ovs = getTestConnection();
+        testGetDBs();
+        dbSchema = ovs.getSchema(HARDWARE_VTEP_SCHEMA, true).get();
+    }
+
+    @After
+    public void tearDown() throws InterruptedException, ExecutionException {
+    }
+
+    @Override
+    public void update(Object node, UpdateNotification upadateNotification) {
+        // TODO Auto-generated method stub
+
+    }
+    @Override
+    public void locked(Object node, List<String> ids) {
+        // TODO Auto-generated method stub
+
+    }
+    @Override
+    public void stolen(Object node, List<String> ids) {
+        // TODO Auto-generated method stub
+
+    }
+}
diff --git a/schemas/hardware_vtep/src/test/resources/logback.xml b/schemas/hardware_vtep/src/test/resources/logback.xml
new file mode 100644 (file)
index 0000000..70118ce
--- /dev/null
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<configuration>
+
+    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+        <!-- encoders are assigned the type
+             ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
+        <encoder>
+            <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{5} - %msg%n</pattern>
+        </encoder>
+    </appender>
+
+    <logger name="org.opendaylight.ovsdb.lib.jsonrpc.JsonRpcEndpoint" level="TRACE" additivity="false">
+        <appender-ref ref="STDOUT" />
+    </logger>
+
+    <!--<logger name="com.lordofthejars.foo" level="INFO" additivity="false">-->
+        <!--<appender-ref ref="STDOUT" />-->
+    <!--</logger>-->
+
+    <root level="INFO">
+        <appender-ref ref="STDOUT" />
+    </root>
+
+</configuration>
\ No newline at end of file