Merge "Fix test coverage not being reported in Sonar"
authorTony Tkacik <ttkacik@cisco.com>
Thu, 7 Aug 2014 06:09:50 +0000 (06:09 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Thu, 7 Aug 2014 06:09:50 +0000 (06:09 +0000)
126 files changed:
features/config-netty/pom.xml
features/config-persister/pom.xml
features/netconf/pom.xml
features/protocol-framework/pom.xml
opendaylight/commons/opendaylight/pom.xml
opendaylight/config/config-netty-config/src/main/resources/initial/00-netty.xml
opendaylight/distribution/opendaylight-karaf/pom.xml
opendaylight/distribution/opendaylight/pom.xml
opendaylight/md-sal/compatibility/flow-management-compatibility/pom.xml [deleted file]
opendaylight/md-sal/compatibility/flow-management-compatibility/src/main/java/org/opendaylight/controller/md/frm/compatibility/ConfigurationReader.java [deleted file]
opendaylight/md-sal/compatibility/flow-management-compatibility/src/main/java/org/opendaylight/controller/md/frm/compatibility/FRMRuntimeDataProvider.java [deleted file]
opendaylight/md-sal/compatibility/flow-management-compatibility/src/main/java/org/opendaylight/controller/md/frm/compatibility/FlowCommitTransaction.java [deleted file]
opendaylight/md-sal/compatibility/flow-management-compatibility/src/main/java/org/opendaylight/controller/md/frm/compatibility/FlowConfigMapping.java [deleted file]
opendaylight/md-sal/compatibility/flow-management-compatibility/src/main/java/org/opendaylight/controller/md/frm/compatibility/FlowManagementReader.java [deleted file]
opendaylight/md-sal/compatibility/flow-management-compatibility/src/main/java/org/opendaylight/controller/md/frm/compatibility/SampleConsumer.java [deleted file]
opendaylight/md-sal/compatibility/inventory-topology-compatibility/pom.xml [deleted file]
opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/inventory/InventoryReader.java [deleted file]
opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/switchmanager/CompatibleSwitchManager.java [deleted file]
opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/switchmanager/ConfigurableSwitchManager.java [deleted file]
opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topology/TopologyMapping.java [deleted file]
opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topology/TopologyReader.java [deleted file]
opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topologymanager/AdSalTopologyMapping.java [deleted file]
opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topologymanager/CompatibleTopologyManager.java [deleted file]
opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topologymanager/ConfigurableLinkManager.java [deleted file]
opendaylight/md-sal/compatibility/pom.xml
opendaylight/md-sal/forwardingrules-manager/pom.xml
opendaylight/md-sal/pom.xml
opendaylight/md-sal/sal-binding-dom-it/pom.xml
opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/DOMCodecBug01Test.java [deleted file]
opendaylight/md-sal/sal-binding-it/pom.xml
opendaylight/md-sal/sal-clustering-commons/README-FIRST [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/README-FIRST with 100% similarity]
opendaylight/md-sal/sal-clustering-commons/pom.xml [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/pom.xml with 98% similarity]
opendaylight/md-sal/sal-clustering-commons/run.sh [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/run.sh with 93% similarity]
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/NodeToNormalizedNodeBuilder.java [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/NodeToNormalizedNodeBuilder.java with 100% similarity]
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/NodeValueCodec.java [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/NodeValueCodec.java with 100% similarity]
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/NormalizedNodeToNodeCodec.java [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/NormalizedNodeToNodeCodec.java with 100% similarity]
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/NormalizedNodeToProtocolBufferNode.java [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/NormalizedNodeToProtocolBufferNode.java with 100% similarity]
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/AugmentationIdentifierGenerator.java [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/AugmentationIdentifierGenerator.java with 100% similarity]
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/NodeIdentifierFactory.java [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/NodeIdentifierFactory.java with 100% similarity]
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/NodeIdentifierGenerator.java [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/NodeIdentifierGenerator.java with 100% similarity]
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/NodeIdentifierWithPredicatesGenerator.java [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/NodeIdentifierWithPredicatesGenerator.java with 100% similarity]
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/NodeIdentifierWithValueGenerator.java [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/NodeIdentifierWithValueGenerator.java with 100% similarity]
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/NormalizedNodeGetter.java [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/NormalizedNodeGetter.java with 100% similarity]
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/NormalizedNodeNavigator.java [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/NormalizedNodeNavigator.java with 100% similarity]
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/NormalizedNodePrinter.java [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/NormalizedNodePrinter.java with 100% similarity]
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/NormalizedNodeVisitor.java [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/NormalizedNodeVisitor.java with 100% similarity]
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/PathUtils.java [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/PathUtils.java with 100% similarity]
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/QNameFactory.java [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/QNameFactory.java with 100% similarity]
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/util/EncoderDecoderUtil.java [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/util/EncoderDecoderUtil.java with 100% similarity]
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/util/InstanceIdentifierUtils.java [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/util/InstanceIdentifierUtils.java with 100% similarity]
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/mdsal/CompositeModificationPayload.java [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/mdsal/CompositeModificationPayload.java with 90% similarity]
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/protobuff/messages/cohort3pc/ThreePhaseCommitCohortMessages.java [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/protobuff/messages/cohort3pc/ThreePhaseCommitCohortMessages.java with 99% similarity]
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/protobuff/messages/common/NormalizedNodeMessages.java [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/protobuff/messages/common/NormalizedNodeMessages.java with 99% similarity]
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/protobuff/messages/common/SimpleNormalizedNodeMessage.java [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/protobuff/messages/common/SimpleNormalizedNodeMessage.java with 98% similarity]
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/protobuff/messages/datachange/notification/DataChangeListenerMessages.java [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/protobuff/messages/datachange/notification/DataChangeListenerMessages.java with 99% similarity]
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/protobuff/messages/persistent/PersistentMessages.java [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/protobuff/messages/persistent/PersistentMessages.java with 99% similarity]
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/protobuff/messages/registration/ListenerRegistrationMessages.java [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/protobuff/messages/registration/ListenerRegistrationMessages.java with 99% similarity]
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/protobuff/messages/shard/ShardManagerMessages.java [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/protobuff/messages/shard/ShardManagerMessages.java with 99% similarity]
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/protobuff/messages/transaction/ShardTransactionChainMessages.java [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/protobuff/messages/transaction/ShardTransactionChainMessages.java with 99% similarity]
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/protobuff/messages/transaction/ShardTransactionMessages.java [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/protobuff/messages/transaction/ShardTransactionMessages.java with 98% similarity]
opendaylight/md-sal/sal-clustering-commons/src/main/resources/Cohort.proto [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/resources/Cohort.proto with 100% similarity]
opendaylight/md-sal/sal-clustering-commons/src/main/resources/Common.proto [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/resources/Common.proto with 100% similarity]
opendaylight/md-sal/sal-clustering-commons/src/main/resources/CompositeModificationPayload.proto [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/resources/CompositeModificationPayload.proto with 100% similarity]
opendaylight/md-sal/sal-clustering-commons/src/main/resources/DataChangeListener.proto [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/resources/DataChangeListener.proto with 100% similarity]
opendaylight/md-sal/sal-clustering-commons/src/main/resources/ListenerRegistration.proto [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/resources/ListenerRegistration.proto with 100% similarity]
opendaylight/md-sal/sal-clustering-commons/src/main/resources/Persistent.proto [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/resources/Persistent.proto with 100% similarity]
opendaylight/md-sal/sal-clustering-commons/src/main/resources/ShardManager.proto [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/resources/ShardManager.proto with 100% similarity]
opendaylight/md-sal/sal-clustering-commons/src/main/resources/ShardTransaction.proto [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/resources/ShardTransaction.proto with 96% similarity]
opendaylight/md-sal/sal-clustering-commons/src/main/resources/ShardTransactionChain.proto [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/resources/ShardTransactionChain.proto with 100% similarity]
opendaylight/md-sal/sal-clustering-commons/src/main/resources/SimpleNormalizedNode.proto [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/resources/SimpleNormalizedNode.proto with 100% similarity]
opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/node/NormalizedNodeToNodeCodecTest.java [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/java/org/opendaylight/controller/cluster/datastore/node/NormalizedNodeToNodeCodecTest.java with 100% similarity]
opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/node/utils/NodeIdentifierFactoryTest.java [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/java/org/opendaylight/controller/cluster/datastore/node/utils/NodeIdentifierFactoryTest.java with 100% similarity]
opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/util/InstanceIdentifierUtilsTest.java [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/java/org/opendaylight/controller/cluster/datastore/util/InstanceIdentifierUtilsTest.java with 100% similarity]
opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/util/NormalizedNodeXmlConverterTest.java [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/java/org/opendaylight/controller/cluster/datastore/util/NormalizedNodeXmlConverterTest.java with 100% similarity]
opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/util/TestModel.java [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/java/org/opendaylight/controller/cluster/datastore/util/TestModel.java with 100% similarity]
opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/protobuff/messages/AbstractMessagesTest.java [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/java/org/opendaylight/controller/protobuff/messages/AbstractMessagesTest.java with 100% similarity]
opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/protobuff/messages/cohort3pc/ThreePhaseCommitCohortMessagesTest.java [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/java/org/opendaylight/controller/protobuff/messages/cohort3pc/ThreePhaseCommitCohortMessagesTest.java with 100% similarity]
opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/protobuff/messages/common/NormalizedNodeMessagesTest.java [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/java/org/opendaylight/controller/protobuff/messages/common/NormalizedNodeMessagesTest.java with 100% similarity]
opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/protobuff/messages/datachange/notification/DataChangeListenerMessagesTest.java [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/java/org/opendaylight/controller/protobuff/messages/datachange/notification/DataChangeListenerMessagesTest.java with 100% similarity]
opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/protobuff/messages/persistent/PersistentMessagesTest.java [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/java/org/opendaylight/controller/protobuff/messages/persistent/PersistentMessagesTest.java with 100% similarity]
opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/protobuff/messages/registration/ListenerRegistrationMessagesTest.java [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/java/org/opendaylight/controller/protobuff/messages/registration/ListenerRegistrationMessagesTest.java with 100% similarity]
opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/protobuff/messages/shard/ShardManagerMessagesTest.java [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/java/org/opendaylight/controller/protobuff/messages/shard/ShardManagerMessagesTest.java with 100% similarity]
opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/protobuff/messages/transaction/ShardTransactionChainMessagesTest.java [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/java/org/opendaylight/controller/protobuff/messages/transaction/ShardTransactionChainMessagesTest.java with 100% similarity]
opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/protobuff/messages/transaction/ShardTransactionMessagesTest.java [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/java/org/opendaylight/controller/protobuff/messages/transaction/ShardTransactionMessagesTest.java with 100% similarity]
opendaylight/md-sal/sal-clustering-commons/src/test/resources/application.conf [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/resources/application.conf with 100% similarity]
opendaylight/md-sal/sal-clustering-commons/src/test/resources/augment_choice.xml [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/resources/augment_choice.xml with 100% similarity]
opendaylight/md-sal/sal-clustering-commons/src/test/resources/augment_choice.yang [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/resources/augment_choice.yang with 100% similarity]
opendaylight/md-sal/sal-clustering-commons/src/test/resources/odl-datastore-augmentation.yang [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/resources/odl-datastore-augmentation.yang with 100% similarity]
opendaylight/md-sal/sal-clustering-commons/src/test/resources/odl-datastore-test-notification.yang [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/resources/odl-datastore-test-notification.yang with 100% similarity]
opendaylight/md-sal/sal-clustering-commons/src/test/resources/odl-datastore-test.yang [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/resources/odl-datastore-test.yang with 100% similarity]
opendaylight/md-sal/sal-clustering-commons/src/test/resources/simple_xml_with_attributes.xml [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/resources/simple_xml_with_attributes.xml with 100% similarity]
opendaylight/md-sal/sal-clustering-commons/src/test/resources/test.yang [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/resources/test.yang with 100% similarity]
opendaylight/md-sal/sal-clustering-commons/src/test/resources/version-compatibility-serialized-data/DataChangeListenerMessagesData [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/resources/version-compatibility-serialized-data/DataChangeListenerMessagesData with 100% similarity]
opendaylight/md-sal/sal-clustering-commons/src/test/resources/version-compatibility-serialized-data/ListenerRegistrationMessagesData [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/resources/version-compatibility-serialized-data/ListenerRegistrationMessagesData with 100% similarity]
opendaylight/md-sal/sal-clustering-commons/src/test/resources/version-compatibility-serialized-data/NormalizedNodeMessagesTestData [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/resources/version-compatibility-serialized-data/NormalizedNodeMessagesTestData with 100% similarity]
opendaylight/md-sal/sal-clustering-commons/src/test/resources/version-compatibility-serialized-data/PersistentMessagesTestData [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/resources/version-compatibility-serialized-data/PersistentMessagesTestData with 100% similarity]
opendaylight/md-sal/sal-clustering-commons/src/test/resources/version-compatibility-serialized-data/ShardManagerMessagesTestData [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/resources/version-compatibility-serialized-data/ShardManagerMessagesTestData with 100% similarity]
opendaylight/md-sal/sal-clustering-commons/src/test/resources/version-compatibility-serialized-data/ShardTransactionChainMessagesTestData [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/resources/version-compatibility-serialized-data/ShardTransactionChainMessagesTestData with 100% similarity]
opendaylight/md-sal/sal-clustering-commons/src/test/resources/version-compatibility-serialized-data/ShardTransactionMessagesTestData [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/resources/version-compatibility-serialized-data/ShardTransactionMessagesTestData with 100% similarity]
opendaylight/md-sal/sal-clustering-commons/src/test/resources/version-compatibility-serialized-data/ThreePhaseCommitCohortMessagesTestData [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/resources/version-compatibility-serialized-data/ThreePhaseCommitCohortMessagesTestData with 100% similarity]
opendaylight/md-sal/sal-clustering-commons/src/test/resources/version-compatibility-serialized-data/readme.txt [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/resources/version-compatibility-serialized-data/readme.txt with 100% similarity]
opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/TransactionCommitDeadlockException.java [new file with mode: 0644]
opendaylight/md-sal/sal-distributed-datastore/pom.xml
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/Shard.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardReadTransaction.java [new file with mode: 0644]
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardReadWriteTransaction.java [new file with mode: 0644]
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardTransaction.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardTransactionChain.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardWriteTransaction.java [new file with mode: 0644]
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/TransactionProxy.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CreateTransaction.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/BasicIntegrationTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTransactionChainTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTransactionTest.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/dom/impl/DomInmemoryDataBrokerModule.java
opendaylight/md-sal/sal-dom-broker/src/test/java/org/opendaylight/controller/md/sal/dom/broker/impl/DOMBrokerTest.java
opendaylight/md-sal/sal-dom-broker/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/TestModel.java
opendaylight/md-sal/sal-dom-broker/src/test/resources/odl-datastore-test.yang
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/RestconfImpl.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestGetOperationTest.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/TestUtils.java
opendaylight/md-sal/topology-lldp-discovery/pom.xml
opendaylight/netconf/config-persister-impl/src/main/java/org/opendaylight/controller/netconf/persist/impl/ConfigPusher.java
opendaylight/netconf/netconf-cli/pom.xml
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/impl/NormalizedNodeWriter.java

index 98b97d1d95feabcfba4b8b4ca5b9bc15aafe8a5d..16fd975130592a1975332b6b390dbce2f9f1d614 100644 (file)
@@ -19,7 +19,6 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>config-persister-features</artifactId>
-      <version>${config.version}</version>
       <classifier>features</classifier>
       <type>xml</type>
       <scope>runtime</scope>
index 969d0c8841b61caa947aa63166ff4ddba01c4a57..ec1520ed9818eb573942cde1ac6561110d2cb44f 100644 (file)
@@ -27,7 +27,6 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>netconf-features</artifactId>
-      <version>${netconf.version}</version>
       <classifier>features</classifier>
       <type>xml</type>
       <scope>runtime</scope>
@@ -35,7 +34,6 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>config-features</artifactId>
-      <version>${config.version}</version>
       <classifier>features</classifier>
       <type>xml</type>
       <scope>runtime</scope>
index 90c088eaba2aab2911bdc65fbbba281af094ecb4..856557c1e8245ef24ada6cdb63e9ad4c775b696e 100644 (file)
@@ -19,7 +19,6 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>config-features</artifactId>
-      <version>${config.version}</version>
       <classifier>features</classifier>
       <type>xml</type>
       <scope>runtime</scope>
@@ -27,7 +26,6 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>features-odl-protocol-framework</artifactId>
-      <version>${protocol-framework.version}</version>
       <classifier>features</classifier>
       <type>xml</type>
       <scope>runtime</scope>
index 045ac2dffec10871437ab784f53d7c97cbfe98cd..ba5dd18fc21615f3e52ddcbbe6f91c2323cc33d5 100644 (file)
@@ -19,7 +19,6 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>config-features</artifactId>
-      <version>${config.version}</version>
       <classifier>features</classifier>
       <type>xml</type>
       <scope>runtime</scope>
index 454958738306454ec59a9cbde881ee24d4e59223..6b17011099254e3a96bd0ead702f29698919865c 100644 (file)
         <artifactId>filter-valve</artifactId>
         <version>${filtervalve.version}</version>
       </dependency>
-      <dependency>
-        <groupId>org.opendaylight.controller</groupId>
-        <artifactId>flow-management-compatibility</artifactId>
-        <version>${mdsal.version}</version>
-      </dependency>
       <dependency>
         <groupId>org.opendaylight.controller</groupId>
         <artifactId>flowprogrammer.northbound</artifactId>
         <artifactId>sal-distributed-datastore</artifactId>
         <version>${mdsal.version}</version>
       </dependency>
+        <dependency>
+            <groupId>org.opendaylight.controller</groupId>
+            <artifactId>sal-clustering-commons</artifactId>
+            <version>${mdsal.version}</version>
+        </dependency>
 
       <dependency>
         <groupId>org.opendaylight.controller</groupId>
         <artifactId>model-flow-base</artifactId>
         <version>${mdsal.version}</version>
       </dependency>
-      <dependency>
-        <groupId>org.opendaylight.controller.model</groupId>
-        <artifactId>model-flow-management</artifactId>
-        <version>${mdsal.version}</version>
-      </dependency>
       <dependency>
         <groupId>org.opendaylight.controller.model</groupId>
         <artifactId>model-flow-service</artifactId>
         <version>${yangtools.version}</version>
         <scope>test</scope>
       </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>config-features</artifactId>
+        <version>${config.version}</version>
+        <classifier>features</classifier>
+        <type>xml</type>
+        <scope>runtime</scope>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>features-odl-protocol-framework</artifactId>
+        <version>${protocol-framework.version}</version>
+        <classifier>features</classifier>
+        <type>xml</type>
+        <scope>runtime</scope>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>netconf-features</artifactId>
+        <version>${netconf.version}</version>
+        <classifier>features</classifier>
+        <type>xml</type>
+        <scope>runtime</scope>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>config-persister-features</artifactId>
+        <version>${config.version}</version>
+        <classifier>features</classifier>
+        <type>xml</type>
+        <scope>runtime</scope>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>config-netty-features</artifactId>
+        <version>${config.version}</version>
+        <classifier>features</classifier>
+        <type>xml</type>
+        <scope>runtime</scope>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>features-adsal</artifactId>
+        <version>${sal.version}</version>
+        <classifier>features</classifier>
+        <type>xml</type>
+        <scope>runtime</scope>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>mdsal-features</artifactId>
+        <version>${mdsal.version}</version>
+        <classifier>features</classifier>
+        <type>xml</type>
+        <scope>runtime</scope>
+      </dependency>
     </dependencies>
   </dependencyManagement>
 
index 686d3631108d250f5dc56b825200e387536dd9c5..2bf5b36d7a770c43bc5a51fa2e7eb7c057624041 100644 (file)
@@ -15,7 +15,7 @@
         <capability>urn:opendaylight:params:xml:ns:yang:controller:netty:timer?module=netty-timer&amp;revision=2013-11-19</capability>
     </required-capabilities>
     <configuration>
-    
+
         <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
             <modules xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
                 <module>
@@ -35,7 +35,7 @@
                     <name>singleton</name>
                 </module>
             </modules>
-            
+
             <services xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
                 <service>
                     <type xmlns:netty="urn:opendaylight:params:xml:ns:yang:controller:netty">netty:netty-threadgroup</type>
index 977fab1334ae48791f9901aedbc1420eabb1e2e7..5effbb09fc81536ed2cf176427c37f25d16e9ddf 100644 (file)
@@ -64,7 +64,6 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>config-netty-features</artifactId>
-      <version>${config.version}</version>
       <classifier>features</classifier>
       <type>xml</type>
       <scope>runtime</scope>
@@ -74,7 +73,6 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>features-adsal</artifactId>
-      <version>${sal.version}</version>
       <classifier>features</classifier>
       <type>xml</type>
       <scope>runtime</scope>
@@ -92,7 +90,6 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>mdsal-features</artifactId>
-      <version>${mdsal.version}</version>
       <classifier>features</classifier>
       <type>xml</type>
       <scope>runtime</scope>
index f8796e0ae4468093bde4cb91a88174335bc3a434..b02835e845cf1f5f16464bf41c10161532565a42 100644 (file)
               <groupId>org.opendaylight.controller</groupId>
               <artifactId>sal-distributed-datastore</artifactId>
           </dependency>
-
       </dependencies>
     </profile>
     <profile>
diff --git a/opendaylight/md-sal/compatibility/flow-management-compatibility/pom.xml b/opendaylight/md-sal/compatibility/flow-management-compatibility/pom.xml
deleted file mode 100644 (file)
index 7770c15..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-<?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.controller</groupId>
-    <artifactId>compatibility-parent</artifactId>
-    <version>1.1-SNAPSHOT</version>
-  </parent>
-  <artifactId>flow-management-compatibility</artifactId>
-  <packaging>bundle</packaging>
-
-  <dependencies>
-    <dependency>
-      <groupId>com.google.guava</groupId>
-      <artifactId>guava</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.opendaylight.controller</groupId>
-      <artifactId>forwardingrulesmanager</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.opendaylight.controller</groupId>
-      <artifactId>sal-binding-api</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.opendaylight.controller</groupId>
-      <artifactId>sal-common-util</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.opendaylight.controller</groupId>
-      <artifactId>sal-compatibility</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.opendaylight.controller.model</groupId>
-      <artifactId>model-flow-management</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-api</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.mockito</groupId>
-      <artifactId>mockito-all</artifactId>
-      <scope>test</scope>
-    </dependency>
-
-  </dependencies>
-
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.felix</groupId>
-        <artifactId>maven-bundle-plugin</artifactId>
-        <extensions>true</extensions>
-        <configuration>
-          <instructions>
-            <Bundle-Name>Forwarding Rules Manager Adapter for MD-SAL</Bundle-Name>
-          </instructions>
-        </configuration>
-      </plugin>
-    </plugins>
-  </build>
-  <scm>
-    <connection>scm:git:ssh://git.opendaylight.org:29418/controller.git</connection>
-    <developerConnection>scm:git:ssh://git.opendaylight.org:29418/controller.git</developerConnection>
-    <tag>HEAD</tag>
-    <url>https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL</url>
-  </scm>
-</project>
diff --git a/opendaylight/md-sal/compatibility/flow-management-compatibility/src/main/java/org/opendaylight/controller/md/frm/compatibility/ConfigurationReader.java b/opendaylight/md-sal/compatibility/flow-management-compatibility/src/main/java/org/opendaylight/controller/md/frm/compatibility/ConfigurationReader.java
deleted file mode 100644 (file)
index 411af28..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/**
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * 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
- */
-package org.opendaylight.controller.md.frm.compatibility;
-
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.opendaylight.controller.forwardingrulesmanager.FlowConfig;
-import org.opendaylight.controller.forwardingrulesmanager.IForwardingRulesManager;
-import org.opendaylight.controller.sal.compatibility.NodeMapping;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.config.rev130819.Flows;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.config.rev130819.FlowsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.config.rev130819.flows.Flow;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.config.rev130819.flows.FlowKey;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class ConfigurationReader implements FlowManagementReader {
-
-    private final static Logger LOG = LoggerFactory.getLogger(ConfigurationReader.class);
-
-    private IForwardingRulesManager manager;
-
-    @Override
-    public Flows readAllFlows() {
-        List<FlowConfig> staticFlows = this.manager.getStaticFlows();
-        List<Flow> flowMap = new ArrayList<Flow>(staticFlows.size());
-
-        for (FlowConfig conf : staticFlows) {
-            flowMap.add(FlowConfigMapping.toConfigurationFlow(conf));
-        }
-        final FlowsBuilder flowsBuilder = new FlowsBuilder();
-        return (flowsBuilder.setFlow(flowMap)).build();
-    }
-
-    @Override
-    public Flow readFlow(final FlowKey key) {
-        try {
-            final FlowConfig flowConf =
-                    this.manager.getStaticFlow(String.valueOf(key.getId()), NodeMapping.toADNode(key.getNode()));
-            return FlowConfigMapping.toConfigurationFlow(flowConf);
-        } catch (Exception e) {
-            String errMsg = MessageFormat.format("readFlow by key {} fail", key);
-            LOG.error(errMsg, e);
-            throw new RuntimeException(errMsg, e);
-        }
-    }
-
-    public IForwardingRulesManager getManager() {
-        return this.manager;
-    }
-
-    public void setManager(final IForwardingRulesManager manager) {
-        this.manager = manager;
-    }
-}
diff --git a/opendaylight/md-sal/compatibility/flow-management-compatibility/src/main/java/org/opendaylight/controller/md/frm/compatibility/FRMRuntimeDataProvider.java b/opendaylight/md-sal/compatibility/flow-management-compatibility/src/main/java/org/opendaylight/controller/md/frm/compatibility/FRMRuntimeDataProvider.java
deleted file mode 100644 (file)
index 0653eeb..0000000
+++ /dev/null
@@ -1,119 +0,0 @@
-/**
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * 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
- */
-package org.opendaylight.controller.md.frm.compatibility;
-
-import org.opendaylight.controller.forwardingrulesmanager.FlowConfig;
-import org.opendaylight.controller.forwardingrulesmanager.IForwardingRulesManager;
-import org.opendaylight.controller.md.sal.common.api.data.DataChangeListener;
-import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler;
-import org.opendaylight.controller.md.sal.common.api.data.DataModification;
-import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
-import org.opendaylight.controller.sal.binding.api.data.RuntimeDataProvider;
-import org.opendaylight.controller.sal.common.util.Arguments;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.config.rev130819.Flows;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.config.rev130819.flows.FlowKey;
-import org.opendaylight.yangtools.concepts.Registration;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.Identifier;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.IdentifiableItem;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.PathArgument;
-import org.opendaylight.yangtools.yang.common.RpcResult;
-import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Preconditions;
-
-public class FRMRuntimeDataProvider implements RuntimeDataProvider, DataCommitHandler<InstanceIdentifier<? extends DataObject>,DataObject> {
-
-    private final static InstanceIdentifier<Flows> FLOWS_PATH = InstanceIdentifier.<Flows> builder(Flows.class).toInstance();
-
-    private final FlowManagementReader configuration = new ConfigurationReader();
-    private DataChangeListener<InstanceIdentifier<? extends DataObject>, DataObject> changeListener;
-    private DataProviderService dataService;
-    private IForwardingRulesManager manager;
-
-    public Registration init() {
-        return this.dataService.registerCommitHandler(FRMRuntimeDataProvider.FLOWS_PATH, this);
-    }
-
-    @Override
-    public DataObject readConfigurationData(final InstanceIdentifier<? extends DataObject> path) {
-        return this.readFrom(this.configuration, path);
-    }
-
-    @Override
-    public DataObject readOperationalData(final InstanceIdentifier<? extends DataObject> path) {
-        return this.readFrom(this.configuration, path);
-    }
-
-    public DataObject readFrom(final FlowManagementReader store, final InstanceIdentifier<? extends DataObject> path) {
-        if (Objects.equal(FRMRuntimeDataProvider.FLOWS_PATH, path)) {
-            return store.readAllFlows();
-        }
-        if (FRMRuntimeDataProvider.FLOWS_PATH.contains(path)) {
-            return store.readFlow(this.toFlowKey(path));
-        }
-        return null;
-    }
-
-    @Override
-    public FlowCommitTransaction requestCommit(final DataModification<InstanceIdentifier<? extends DataObject>, DataObject> modification) {
-        return new FlowCommitTransaction(this, modification);
-    }
-
-    public FlowKey toFlowKey(final InstanceIdentifier<? extends DataObject> identifier) {
-        Preconditions.<InstanceIdentifier<? extends DataObject>> checkNotNull(identifier);
-
-        Iterable<PathArgument> path = identifier.getPathArguments();
-        PathArgument get = path.iterator().next();
-        final Identifier itemKey = Arguments.<IdentifiableItem> checkInstanceOf(get, IdentifiableItem.class).getKey();
-        return Arguments.<FlowKey> checkInstanceOf(itemKey, FlowKey.class);
-    }
-
-    public RpcResult<Void> finish(final FlowCommitTransaction transaction) {
-        Iterable<FlowConfig> toRemove = transaction.getToRemove();
-        for (final FlowConfig flow : toRemove) {
-            this.manager.removeStaticFlow(flow.getName(), flow.getNode());
-        }
-        Iterable<FlowConfig> toUpdate = transaction.getToUpdate();
-        for (final FlowConfig flow : toUpdate) {
-            this.manager.removeStaticFlow(flow.getName(), flow.getNode());
-            this.manager.addStaticFlow(flow);
-        }
-        return RpcResultBuilder.<Void> success().build();
-    }
-
-    public RpcResult<Void> rollback(final FlowCommitTransaction transaction) {
-        return null;
-    }
-
-    public DataProviderService getDataService() {
-        return this.dataService;
-    }
-
-    public void setDataService(final DataProviderService dataService) {
-        this.dataService = dataService;
-    }
-
-    public DataChangeListener<InstanceIdentifier<? extends DataObject>, DataObject> getChangeListener() {
-        return this.changeListener;
-    }
-
-    public void setChangeListener(final DataChangeListener<InstanceIdentifier<? extends DataObject>, DataObject> changeListener) {
-        this.changeListener = changeListener;
-    }
-
-    public IForwardingRulesManager getManager() {
-        return this.manager;
-    }
-
-    public void setManager(final IForwardingRulesManager manager) {
-        this.manager = manager;
-    }
-}
diff --git a/opendaylight/md-sal/compatibility/flow-management-compatibility/src/main/java/org/opendaylight/controller/md/frm/compatibility/FlowCommitTransaction.java b/opendaylight/md-sal/compatibility/flow-management-compatibility/src/main/java/org/opendaylight/controller/md/frm/compatibility/FlowCommitTransaction.java
deleted file mode 100644 (file)
index bf0050d..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-/**
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * 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
- */
-package org.opendaylight.controller.md.frm.compatibility;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map.Entry;
-import java.util.Set;
-
-import org.opendaylight.controller.forwardingrulesmanager.FlowConfig;
-import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler.DataCommitTransaction;
-import org.opendaylight.controller.md.sal.common.api.data.DataModification;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.config.rev130819.flows.Flow;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.common.RpcResult;
-
-public class FlowCommitTransaction implements DataCommitTransaction<InstanceIdentifier<? extends DataObject>, DataObject> {
-
-    private final DataModification<InstanceIdentifier<? extends DataObject>, DataObject> modification;
-    private final HashSet<FlowConfig> toAdd = new HashSet<FlowConfig>();
-    private final FRMRuntimeDataProvider flowManager;
-    private Iterable<FlowConfig> toUpdate;
-    private Iterable<FlowConfig> toRemove;
-
-    public FlowCommitTransaction(
-            final FRMRuntimeDataProvider flowManager,
-            final DataModification<InstanceIdentifier<? extends DataObject>, DataObject> modification) {
-        this.flowManager = flowManager;
-        this.modification = modification;
-        this.processModification();
-    }
-
-    @Override
-    public RpcResult<Void> finish() throws IllegalStateException {
-        return this.flowManager.finish(this);
-    }
-
-    @Override
-    public RpcResult<Void> rollback() throws IllegalStateException {
-        return this.flowManager.rollback(this);
-    }
-
-    public void processModification() {
-        final Set<Entry<InstanceIdentifier<? extends DataObject>, DataObject>> updated =
-                this.modification.getUpdatedConfigurationData().entrySet();
-        final List<FlowConfig> forUpdate = new ArrayList<FlowConfig>(updated.size());
-
-        if (updated != null && !(updated.isEmpty())) {
-            for (Entry<InstanceIdentifier<? extends DataObject>, DataObject> entry : updated) {
-                if (FlowConfigMapping.isFlowPath(entry.getKey())) {
-                    forUpdate.add(FlowConfigMapping.toFlowConfig((Flow) entry.getValue()));
-                }
-            }
-        }
-        this.toUpdate = Collections.unmodifiableCollection(forUpdate);
-
-        final Set<InstanceIdentifier<? extends DataObject>> removedConfigurationData =
-                this.modification.getRemovedConfigurationData();
-        final List<FlowConfig> forRemove = new ArrayList<FlowConfig>(removedConfigurationData.size());
-
-        if (removedConfigurationData != null && !(removedConfigurationData.isEmpty())) {
-            for (InstanceIdentifier<? extends DataObject> data : removedConfigurationData) {
-                if (FlowConfigMapping.isFlowPath(data)) {
-                    forRemove.add(FlowConfigMapping.toFlowConfig(data));
-                }
-            }
-        }
-        this.toRemove = Collections.unmodifiableCollection(forRemove);
-    }
-
-    @Override
-    public DataModification<InstanceIdentifier<? extends DataObject>, DataObject> getModification() {
-        return this.modification;
-    }
-
-    public FRMRuntimeDataProvider getFlowManager() {
-        return this.flowManager;
-    }
-
-    public HashSet<FlowConfig> getToAdd() {
-        return this.toAdd;
-    }
-
-    public Iterable<FlowConfig> getToUpdate() {
-        return this.toUpdate;
-    }
-
-    public Iterable<FlowConfig> getToRemove() {
-        return this.toRemove;
-    }
-}
diff --git a/opendaylight/md-sal/compatibility/flow-management-compatibility/src/main/java/org/opendaylight/controller/md/frm/compatibility/FlowConfigMapping.java b/opendaylight/md-sal/compatibility/flow-management-compatibility/src/main/java/org/opendaylight/controller/md/frm/compatibility/FlowConfigMapping.java
deleted file mode 100644 (file)
index 58c60ec..0000000
+++ /dev/null
@@ -1,109 +0,0 @@
-/**
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * 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
- */
-package org.opendaylight.controller.md.frm.compatibility;
-
-import java.text.MessageFormat;
-import java.util.Iterator;
-
-import org.opendaylight.controller.forwardingrulesmanager.FlowConfig;
-import org.opendaylight.controller.sal.compatibility.MDFlowMapping;
-import org.opendaylight.controller.sal.compatibility.NodeMapping;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.config.rev130819.flows.Flow;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.config.rev130819.flows.FlowBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.config.rev130819.flows.FlowKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowAdded;
-import org.opendaylight.yangtools.yang.binding.Identifiable;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.IdentifiableItem;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.PathArgument;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class FlowConfigMapping {
-
-    private final static Logger LOG = LoggerFactory.getLogger(FlowConfigMapping.class);
-
-    /* nodes/node/flow  -> 0 / 1 / 2  */
-    private static final int FLOW_KEY_IDENTIFIER_DEEP = 2;
-
-    public static Flow toConfigurationFlow(final FlowConfig sourceCfg) {
-        final FlowAdded source = MDFlowMapping.flowAdded(sourceCfg.getFlow());
-        final FlowBuilder flowBuilder = new FlowBuilder();
-        flowBuilder.setInstructions(source.getInstructions());
-        flowBuilder.setCookie(source.getCookie());
-        flowBuilder.setHardTimeout(source.getHardTimeout());
-        flowBuilder.setIdleTimeout(source.getIdleTimeout());
-        flowBuilder.setMatch(source.getMatch());
-        flowBuilder.setNode(source.getNode());
-
-        FlowKey flowKey =
-                new FlowKey(Long.valueOf(sourceCfg.getName()), flowBuilder.getNode());
-        flowBuilder.setKey(flowKey);
-        return flowBuilder.build();
-    }
-
-    public static FlowConfig toFlowConfig(final Flow sourceCfg) {
-        try {
-            final FlowConfig flowConfig = new FlowConfig();
-            flowConfig.setName(String.valueOf(sourceCfg.getId()));
-            flowConfig.setNode(NodeMapping.toADNode(sourceCfg.getNode()));
-            return flowConfig;
-        } catch (Exception e) {
-            String errMsg = MessageFormat.format("Convert from Flow {} to FlowConfig fail", sourceCfg);
-            LOG.error(errMsg, e);
-            throw new RuntimeException(errMsg, e);
-        }
-    }
-
-    public static FlowConfig toFlowConfig(final InstanceIdentifier<? extends Object> identifier) {
-        try {
-            PathArgument pathArg = FlowConfigMapping.getSecondPathArgumentFromPath(identifier);
-            if (pathArg != null) {
-                final FlowConfig flowConfig = new FlowConfig();
-                FlowKey key = ((IdentifiableItem<Flow, FlowKey>) pathArg).getKey();
-                flowConfig.setName(String.valueOf(key.getId()));
-                flowConfig.setNode(NodeMapping.toADNode(key.getNode()));
-                return flowConfig;
-            }
-            return null;
-        } catch (Exception e) {
-            String errMsg = MessageFormat.format("Convert from InstanceIdentifier {} to FlowConfig fail", identifier);
-            LOG.error(errMsg, e);
-            throw new RuntimeException(errMsg, e);
-        }
-    }
-
-    public static boolean isFlowPath(final InstanceIdentifier<? extends Object> path) {
-        PathArgument pathArg = FlowConfigMapping.getSecondPathArgumentFromPath(path);
-        if (pathArg == null) {
-            return false;
-        }
-        if (pathArg instanceof IdentifiableItem<?,?>) {
-            final Identifiable<?> key = ((IdentifiableItem<?, ? extends Identifiable<?>>) pathArg).getKey();
-            if ((key instanceof FlowKey)) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    private static PathArgument getSecondPathArgumentFromPath(final InstanceIdentifier<? extends Object> path) {
-        if (path != null && path.getPathArguments() != null) {
-            Iterator<PathArgument> iterator = path.getPathArguments().iterator();
-            int deep = 0;
-            while (iterator.hasNext()) {
-                PathArgument pathArg = iterator.next();
-                if (deep == FlowConfigMapping.FLOW_KEY_IDENTIFIER_DEEP) {
-                    return pathArg;
-                }
-                deep++;
-            }
-        }
-        return null;
-    }
-}
diff --git a/opendaylight/md-sal/compatibility/flow-management-compatibility/src/main/java/org/opendaylight/controller/md/frm/compatibility/FlowManagementReader.java b/opendaylight/md-sal/compatibility/flow-management-compatibility/src/main/java/org/opendaylight/controller/md/frm/compatibility/FlowManagementReader.java
deleted file mode 100644 (file)
index cb61c8a..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-/**
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * 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
- */
-package org.opendaylight.controller.md.frm.compatibility;
-
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.config.rev130819.Flows;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.config.rev130819.flows.Flow;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.config.rev130819.flows.FlowKey;
-
-public interface FlowManagementReader {
-
-    Flows readAllFlows();
-
-    Flow readFlow(FlowKey key);
-
-}
diff --git a/opendaylight/md-sal/compatibility/flow-management-compatibility/src/main/java/org/opendaylight/controller/md/frm/compatibility/SampleConsumer.java b/opendaylight/md-sal/compatibility/flow-management-compatibility/src/main/java/org/opendaylight/controller/md/frm/compatibility/SampleConsumer.java
deleted file mode 100644 (file)
index a91cef6..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * 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
- */
-package org.opendaylight.controller.md.frm.compatibility;
-
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ConsumerContext;
-import org.opendaylight.controller.sal.binding.api.data.DataBrokerService;
-import org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.config.rev130819.Flows;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.config.rev130819.flows.Flow;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.config.rev130819.flows.FlowBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.config.rev130819.flows.FlowKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public class SampleConsumer {
-
-    ConsumerContext context;
-
-    void addFlowExample() {
-
-        DataBrokerService dataService = context.getSALService(DataBrokerService.class);
-
-        DataModificationTransaction transaction = dataService.beginTransaction();
-        Flow flow = createSampleFlow("foo", null);
-        InstanceIdentifier<Flow> path = InstanceIdentifier.builder(Flows.class).child(Flow.class, flow.getKey())
-                .toInstance();
-        transaction.putConfigurationData(path, flow);
-
-        transaction.commit();
-
-        dataService.readConfigurationData(path);
-    }
-
-    Flow createSampleFlow(String name, NodeRef node) {
-        FlowBuilder ret = new FlowBuilder();
-        FlowKey key = new FlowKey(Long.parseLong(name), node);
-        ret.setKey(key);
-        return ret.build();
-    }
-}
diff --git a/opendaylight/md-sal/compatibility/inventory-topology-compatibility/pom.xml b/opendaylight/md-sal/compatibility/inventory-topology-compatibility/pom.xml
deleted file mode 100644 (file)
index 62dc2ff..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-<?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.controller</groupId>
-    <artifactId>compatibility-parent</artifactId>
-    <version>1.1-SNAPSHOT</version>
-  </parent>
-  <artifactId>inventory-topology-compatibility</artifactId>
-  <packaging>bundle</packaging>
-
-  <dependencies>
-    <dependency>
-      <groupId>com.google.guava</groupId>
-      <artifactId>guava</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.opendaylight.controller</groupId>
-      <artifactId>forwardingrulesmanager</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.opendaylight.controller</groupId>
-      <artifactId>sal-binding-api</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.opendaylight.controller</groupId>
-      <artifactId>sal-binding-util</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.opendaylight.controller</groupId>
-      <artifactId>sal-common-util</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.opendaylight.controller</groupId>
-      <artifactId>sal-compatibility</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.opendaylight.controller</groupId>
-      <artifactId>switchmanager</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.opendaylight.controller</groupId>
-      <artifactId>topologymanager</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.opendaylight.controller.model</groupId>
-      <artifactId>model-flow-management</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.opendaylight.controller.model</groupId>
-      <artifactId>model-topology</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-api</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.mockito</groupId>
-      <artifactId>mockito-all</artifactId>
-      <scope>test</scope>
-    </dependency>
-  </dependencies>
-
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.felix</groupId>
-        <artifactId>maven-bundle-plugin</artifactId>
-        <extensions>true</extensions>
-        <configuration>
-          <instructions>
-            <Bundle-Name>Forwarding Rules Manager Adapter
-                            for MD-SAL</Bundle-Name>
-          </instructions>
-        </configuration>
-      </plugin>
-    </plugins>
-  </build>
-  <scm>
-    <connection>scm:git:ssh://git.opendaylight.org:29418/controller.git</connection>
-    <developerConnection>scm:git:ssh://git.opendaylight.org:29418/controller.git</developerConnection>
-    <tag>HEAD</tag>
-    <url>https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL</url>
-  </scm>
-</project>
diff --git a/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/inventory/InventoryReader.java b/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/inventory/InventoryReader.java
deleted file mode 100644 (file)
index b37b501..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-/**
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * 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
- */
-package org.opendaylight.controller.md.compatibility.inventory;
-
-import java.util.ArrayList;
-import java.util.Set;
-
-import org.opendaylight.controller.sal.binding.api.data.RuntimeDataProvider;
-import org.opendaylight.controller.sal.compatibility.InventoryMapping;
-import org.opendaylight.controller.switchmanager.ISwitchManager;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodesBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeBuilder;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class InventoryReader implements RuntimeDataProvider {
-    private static final Logger LOG = LoggerFactory.getLogger(InventoryReader.class);
-    private ISwitchManager switchManager;
-
-    public ISwitchManager getSwitchManager() {
-        return switchManager;
-    }
-
-    public void setSwitchManager(final ISwitchManager switchManager) {
-        this.switchManager = switchManager;
-    }
-
-    @Override
-    public DataObject readConfigurationData(final InstanceIdentifier<? extends DataObject> path) {
-        // Topology and Inventory are operational only
-        return null;
-    }
-
-    @SuppressWarnings("unchecked")
-    @Override
-    public DataObject readOperationalData(final InstanceIdentifier<? extends DataObject> path) {
-        final Class<? extends DataObject> type = path.getTargetType();
-        if (Nodes.class.equals(type)) {
-            return readNodes(((InstanceIdentifier<Nodes>) path));
-        }
-        if (Node.class.equals(type)) {
-            return readNode(((InstanceIdentifier<Node>) path));
-        }
-        if (NodeConnector.class.equals(type)) {
-            return readNodeConnector(((InstanceIdentifier<NodeConnector>) path));
-        }
-
-        LOG.debug("Unsupported type {}", type);
-        return null;
-    }
-
-    private NodeConnector readNodeConnector(final InstanceIdentifier<NodeConnector> identifier) {
-        return constructNodeConnector(InventoryMapping.toAdNodeConnector(identifier));
-    }
-
-    private Node readNode(final InstanceIdentifier<Node> identifier) {
-        return constructNode(InventoryMapping.toAdNode(identifier));
-    }
-
-    private Node constructNode(final org.opendaylight.controller.sal.core.Node node) {
-        final Set<org.opendaylight.controller.sal.core.NodeConnector> connectors = getSwitchManager().getNodeConnectors(node);
-        final ArrayList<NodeConnector> tpList = new ArrayList<NodeConnector>(connectors.size());
-        for (final org.opendaylight.controller.sal.core.NodeConnector connector : connectors) {
-            tpList.add(constructNodeConnector(connector));
-        }
-
-        return new NodeBuilder()
-        .setKey(InventoryMapping.toNodeKey(node))
-        .setNodeConnector(tpList)
-        .build();
-    }
-
-    private Nodes readNodes(final InstanceIdentifier<Nodes> identifier) {
-        final Set<org.opendaylight.controller.sal.core.Node> nodes = getSwitchManager().getNodes();
-        final ArrayList<Node> nodeList = new ArrayList<Node>(nodes.size());
-        for (final org.opendaylight.controller.sal.core.Node node : nodes) {
-            nodeList.add(constructNode(node));
-        }
-
-        return new NodesBuilder().setNode(nodeList).build();
-    }
-
-    private static NodeConnector constructNodeConnector(final org.opendaylight.controller.sal.core.NodeConnector connector) {
-        return new NodeConnectorBuilder().setKey(InventoryMapping.toNodeConnectorKey(connector)).build();
-    }
-}
diff --git a/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/switchmanager/CompatibleSwitchManager.java b/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/switchmanager/CompatibleSwitchManager.java
deleted file mode 100644 (file)
index 82c5b7b..0000000
+++ /dev/null
@@ -1,347 +0,0 @@
-/**
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * 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
- */
-package org.opendaylight.controller.md.compatibility.switchmanager;
-
-import java.net.InetAddress;
-import java.net.NetworkInterface;
-import java.net.SocketException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.opendaylight.controller.sal.binding.api.data.DataBrokerService;
-import org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction;
-import org.opendaylight.controller.sal.compatibility.NodeMapping;
-import org.opendaylight.controller.sal.core.Bandwidth;
-import org.opendaylight.controller.sal.core.ConstructionException;
-import org.opendaylight.controller.sal.core.Description;
-import org.opendaylight.controller.sal.core.ForwardingMode;
-import org.opendaylight.controller.sal.core.MacAddress;
-import org.opendaylight.controller.sal.core.NodeConnector;
-import org.opendaylight.controller.sal.core.Property;
-import org.opendaylight.controller.sal.core.Tier;
-import org.opendaylight.controller.sal.utils.Status;
-import org.opendaylight.controller.switchmanager.ISwitchManager;
-import org.opendaylight.controller.switchmanager.Subnet;
-import org.opendaylight.controller.switchmanager.Switch;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRef;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class CompatibleSwitchManager extends ConfigurableSwitchManager implements ISwitchManager {
-    private static final  Logger LOG = LoggerFactory.getLogger(CompatibleSwitchManager.class);
-
-    private DataBrokerService _dataService;
-
-    public DataBrokerService getDataService() {
-        return this._dataService;
-    }
-
-    public void setDataService(final DataBrokerService dataService) {
-        this._dataService = dataService;
-    }
-
-    @Override
-    public Status addNodeConnectorProp(final NodeConnector nodeConnector, final Property prop) {
-        final DataModificationTransaction it = getDataService().beginTransaction();
-        final NodeConnectorRef path = NodeMapping.toNodeConnectorRef(nodeConnector);
-        return null;
-    }
-
-    @Override
-    public Property createProperty(final String propName, final String propValue) {
-        try {
-            if (propName.equalsIgnoreCase(Description.propertyName)) {
-                return new Description(propValue);
-            } else if (propName.equalsIgnoreCase(Tier.TierPropName)) {
-                return new Tier(Integer.parseInt(propValue));
-            } else if (propName.equalsIgnoreCase(Bandwidth.BandwidthPropName)) {
-                return new Bandwidth(Long.parseLong(propValue));
-            } else if (propName.equalsIgnoreCase(ForwardingMode.name)) {
-                return new ForwardingMode(Integer.parseInt(propValue));
-            } else if (propName.equalsIgnoreCase(MacAddress.name)) {
-                return new MacAddress(propValue);
-            } else {
-                LOG.debug("Not able to create {} property", propName);
-            }
-        } catch (Exception e) {
-            LOG.debug("createProperty caught exception {}", e.getMessage());
-        }
-
-        return null;
-    }
-
-    @Override
-    public boolean doesNodeConnectorExist(final NodeConnector nc) {
-        return (getDataService().readOperationalData(NodeMapping.toNodeConnectorRef(nc).getValue()) != null);
-    }
-
-    @Override
-    public byte[] getControllerMAC() {
-        final Enumeration<NetworkInterface> nis;
-        try {
-            nis = NetworkInterface.getNetworkInterfaces();
-        } catch (SocketException e) {
-            LOG.error("Failed to acquire list of interfaces, cannot determine controller MAC", e);
-            return null;
-        }
-
-        while (nis.hasMoreElements()) {
-            final NetworkInterface ni = nis.nextElement();
-            try {
-                return ni.getHardwareAddress();
-            } catch (SocketException e) {
-                LOG.error("Failed to acquire controller MAC from interface {}", ni, e);
-            }
-        }
-
-        // This happens when running controller on windows VM, for example
-        // Try parsing the OS command output
-        LOG.warn("Failed to acquire controller MAC: No physical interface found");
-        return null;
-    }
-
-    @Override
-    public Map<String,Property> getControllerProperties() {
-        return Collections.<String, Property>emptyMap();
-    }
-
-    @Override
-    public Property getControllerProperty(final String propertyName) {
-        return null;
-    }
-
-    @Override
-    public List<Switch> getNetworkDevices() {
-        final InstanceIdentifier<Nodes> path = InstanceIdentifier.builder(Nodes.class).toInstance();
-        final Nodes data = ((Nodes) getDataService().readOperationalData(path));
-        final ArrayList<Switch> ret = new ArrayList<>();
-        for (final Node node : data.getNode()) {
-            try {
-                ret.add(toSwitch(node));
-            } catch (ConstructionException e) {
-                throw new IllegalStateException(String.format("Failed to create switch {}", node), e);
-            }
-        }
-        return ret;
-    }
-
-    @Override
-    public NodeConnector getNodeConnector(final org.opendaylight.controller.sal.core.Node node, final String nodeConnectorName) {
-        final NodeConnectorKey key = new NodeConnectorKey(new NodeConnectorId(nodeConnectorName));
-        try {
-            return new NodeConnector(NodeMapping.MD_SAL_TYPE, key, node);
-        } catch (ConstructionException e) {
-            throw new IllegalStateException(String.format("Failed to create node connector for {} {}", node, nodeConnectorName), e);
-        }
-    }
-
-    @Override
-    public Property getNodeConnectorProp(final NodeConnector nodeConnector, final String propName) {
-        return getNodeConnectorProps(nodeConnector).get(propName);
-    }
-
-    @Override
-    public Map<String,Property> getNodeConnectorProps(final NodeConnector nodeConnector) {
-        final NodeConnectorRef ref = NodeMapping.toNodeConnectorRef(nodeConnector);
-        return toAdProperties(readNodeConnector(ref.getValue()));
-    }
-
-    @Override
-    public Set<NodeConnector> getNodeConnectors(final org.opendaylight.controller.sal.core.Node node) {
-        final Node data = this.readNode(NodeMapping.toNodeRef(node).getValue());
-        final HashSet<NodeConnector> ret = new HashSet<>();
-        for (final org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector nc : data.getNodeConnector()) {
-            try {
-                ret.add(new NodeConnector(NodeMapping.MD_SAL_TYPE, nc.getKey(), node));
-            } catch (ConstructionException e) {
-                throw new IllegalStateException(String.format("Failed to create node {} connector", node, nc.getKey()), e);
-            }
-        }
-        return ret;
-    }
-
-    @Override
-    public String getNodeDescription(final org.opendaylight.controller.sal.core.Node node) {
-        return ((Description) getNodeProps(node).get(Description.propertyName)).getValue();
-    }
-
-    @Override
-    public byte[] getNodeMAC(final org.opendaylight.controller.sal.core.Node node) {
-        return ((MacAddress) getNodeProps(node).get(MacAddress.name)).getMacAddress();
-    }
-
-    @Override
-    public Property getNodeProp(final org.opendaylight.controller.sal.core.Node node, final String propName) {
-        return getNodeProps(node).get(propName);
-    }
-
-    @Override
-    public Map<String,Property> getNodeProps(final org.opendaylight.controller.sal.core.Node node) {
-        final NodeRef ref = NodeMapping.toNodeRef(node);
-        return toAdProperties(((Node) getDataService().readOperationalData(ref.getValue())));
-    }
-
-    @Override
-    public Set<org.opendaylight.controller.sal.core.Node> getNodes() {
-        final InstanceIdentifier<Nodes> path = InstanceIdentifier.builder(Nodes.class).toInstance();
-        final Nodes data = ((Nodes) getDataService().readOperationalData(path));
-        final HashSet<org.opendaylight.controller.sal.core.Node> ret = new HashSet<>();
-        for (final Node node : data.getNode()) {
-            try {
-                ret.add(new org.opendaylight.controller.sal.core.Node(NodeMapping.MD_SAL_TYPE, node.getKey()));
-            } catch (ConstructionException e) {
-                throw new IllegalStateException(String.format("Failed to create node for {}", node), e);
-            }
-        }
-        return ret;
-    }
-
-    private static Switch toSwitch(final Node node) throws ConstructionException {
-        return new Switch(new org.opendaylight.controller.sal.core.Node(NodeMapping.MD_SAL_TYPE, node.getKey()));
-    }
-
-    @Override
-    public Set<NodeConnector> getPhysicalNodeConnectors(final org.opendaylight.controller.sal.core.Node node) {
-        final NodeRef ref = NodeMapping.toNodeRef(node);
-        final Node data = readNode(ref.getValue());
-        final HashSet<NodeConnector> ret = new HashSet<>();
-        for (final org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector nc : data.getNodeConnector()) {
-            final FlowCapableNodeConnector flowConnector = nc.getAugmentation(FlowCapableNodeConnector.class);
-            try {
-                ret.add(new NodeConnector(NodeMapping.MD_SAL_TYPE, nc.getKey(), node));
-            } catch (ConstructionException e) {
-                throw new IllegalStateException(String.format("Failed to create connector for {} on node {}", nc.getKey(), node), e);
-            }
-        }
-        return ret;
-    }
-
-    private static Map<String,Property> toAdProperties(final org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector connector) {
-        return Collections.emptyMap();
-    }
-
-    private static Map<String,Property> toAdProperties(final Node connector) {
-        return Collections.emptyMap();
-    }
-
-    private Node readNode(final InstanceIdentifier<? extends Object> ref) {
-        return (Node) getDataService().readOperationalData((ref));
-    }
-
-    private org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector readNodeConnector(final InstanceIdentifier<? extends Object> ref) {
-        return ((org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector) getDataService().readOperationalData(ref));
-    }
-
-    @Override
-    public List<NodeConnector> getSpanPorts(final org.opendaylight.controller.sal.core.Node node) {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub");
-    }
-
-    @Override
-    public Subnet getSubnetByNetworkAddress(final InetAddress networkAddress) {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub");
-    }
-
-    @Override
-    public Set<NodeConnector> getUpNodeConnectors(final org.opendaylight.controller.sal.core.Node node) {
-        final Node data = readNode(NodeMapping.toNodeRef(node).getValue());
-        final HashSet<NodeConnector> ret = new HashSet<>();
-        for (final org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector nc : data.getNodeConnector()) {
-            final FlowCapableNodeConnector flowConn = nc.<FlowCapableNodeConnector>getAugmentation(FlowCapableNodeConnector.class);
-            if (flowConn != null && flowConn.getState() != null && !flowConn.getState().isLinkDown()) {
-                try {
-                    ret.add(new NodeConnector(NodeMapping.MD_SAL_TYPE, nc.getKey(), node));
-                } catch (ConstructionException e) {
-                    throw new IllegalStateException(String.format("Failed to create node connector for node {} connector {}", node, nc), e);
-                }
-            }
-        }
-        return ret;
-    }
-
-    @Override
-    public Boolean isNodeConnectorEnabled(final NodeConnector nodeConnector) {
-        final NodeConnectorRef ref = NodeMapping.toNodeConnectorRef(nodeConnector);
-        final org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector data = readNodeConnector(ref.getValue());
-        return true;
-    }
-
-    @Override
-    public boolean isSpecial(final NodeConnector p) {
-        final NodeConnectorRef ref = NodeMapping.toNodeConnectorRef(p);
-        final org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector data = readNodeConnector(ref.getValue());
-        return true;
-    }
-
-    @Override
-    public Status removeControllerProperty(final String propertyName) {
-        return null;
-    }
-
-    @Override
-    public Status removeNodeAllProps(final org.opendaylight.controller.sal.core.Node node) {
-        return null;
-    }
-
-    @Override
-    public Status removeNodeConnectorAllProps(final NodeConnector nodeConnector) {
-        return null;
-    }
-
-    @Override
-    public Status removeNodeConnectorProp(final NodeConnector nc, final String propName) {
-        return null;
-    }
-
-    @Override
-    public Status removeNodeProp(final org.opendaylight.controller.sal.core.Node node, final String propName) {
-        return null;
-    }
-
-    @Override
-    public Status removePortsFromSubnet(final String name, final List<String> nodeConnectors) {
-        return null;
-    }
-
-    @Override
-    public Status removeSubnet(final String name) {
-        return null;
-    }
-
-    @Override
-    public Status setControllerProperty(final Property property) {
-        return null;
-    }
-
-    @Override
-    public void setNodeProp(final org.opendaylight.controller.sal.core.Node node, final Property prop) {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub");
-    }
-
-    @Override
-    public Status addPortsToSubnet(final String name, final List<String> nodeConnectors) {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub");
-    }
-
-    @Override
-    public Set<Switch> getConfiguredNotConnectedSwitches() {
-        return null;
-    }
-}
diff --git a/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/switchmanager/ConfigurableSwitchManager.java b/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/switchmanager/ConfigurableSwitchManager.java
deleted file mode 100644 (file)
index 63f682a..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-/**
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * 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
- */
-package org.opendaylight.controller.md.compatibility.switchmanager;
-
-import java.util.List;
-
-import org.opendaylight.controller.sal.utils.Status;
-import org.opendaylight.controller.switchmanager.ISwitchManager;
-import org.opendaylight.controller.switchmanager.SpanConfig;
-import org.opendaylight.controller.switchmanager.SubnetConfig;
-import org.opendaylight.controller.switchmanager.SwitchConfig;
-
-/**
- * These methods should be backed by config subsystem.
- */
-public abstract class ConfigurableSwitchManager implements ISwitchManager {
-    @Override
-    public Status saveSwitchConfig() {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub");
-    }
-
-    @Override
-    public Status removeSpanConfig(final SpanConfig cfgObject) {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub");
-    }
-
-    @Override
-    public Status addSubnet(final SubnetConfig configObject) {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub");
-    }
-
-    @Override
-    public final Status addSpanConfig(final SpanConfig configObject) {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub");
-    }
-
-    @Override
-    public final List<SpanConfig> getSpanConfigList() {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub");
-    }
-
-    @Override
-    public final void updateSwitchConfig(final SwitchConfig cfgObject) {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub");
-    }
-
-    @Override
-    public final Status updateNodeConfig(final SwitchConfig switchConfig) {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub");
-    }
-
-    @Override
-    public final SubnetConfig getSubnetConfig(final String subnet) {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub");
-    }
-
-    @Override
-    public final Status removeNodeConfig(final String nodeId) {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub");
-    }
-
-    @Override
-    public final Status removeSubnet(final SubnetConfig configObject) {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub");
-    }
-
-    @Override
-    public final List<SubnetConfig> getSubnetsConfigList() {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub");
-    }
-
-    @Override
-    public final SwitchConfig getSwitchConfig(final String nodeId) {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub");
-    }
-
-    @Override
-    public Status modifySubnet(final SubnetConfig configObject) {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub");
-    }
-}
diff --git a/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topology/TopologyMapping.java b/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topology/TopologyMapping.java
deleted file mode 100644 (file)
index 8e50bd8..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-/**
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * 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
- */
-package org.opendaylight.controller.md.compatibility.topology;
-
-import java.util.Iterator;
-
-import org.opendaylight.controller.sal.compatibility.InventoryMapping;
-import org.opendaylight.controller.sal.core.ConstructionException;
-import org.opendaylight.controller.sal.core.Edge;
-import org.opendaylight.controller.sal.core.NodeConnector;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.LinkId;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TpId;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Link;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.LinkKey;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointKey;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
-
-import com.google.common.base.Splitter;
-
-public class TopologyMapping {
-    private static final String HEAD_TAIL_STRING = "::::";
-    private static final Splitter HEAD_TAIL_SPLITTER = Splitter.on(HEAD_TAIL_STRING);
-
-    public TopologyMapping(final TopologyKey path, final InstanceIdentifier<Topology> key) {
-        // No-op for now. Multi-instance will require fixing InventoryMapping first.
-    }
-
-    public Edge toAdTopologyEdge(final InstanceIdentifier<Link> identifier) throws ConstructionException {
-        @SuppressWarnings("unchecked")
-        final LinkKey linkKey = ((KeyedInstanceIdentifier<Link, LinkKey>)identifier).getKey();
-
-        final Iterator<String> it = HEAD_TAIL_SPLITTER.split(linkKey.getLinkId().getValue()).iterator();
-        final NodeConnector tail = InventoryMapping.nodeConnectorFromId(it.next());
-        final NodeConnector head = InventoryMapping.nodeConnectorFromId(it.next());
-        return new Edge(tail, head);
-    }
-
-    public NodeConnector toAdTopologyNodeConnector(final InstanceIdentifier<TerminationPoint> identifier) {
-        @SuppressWarnings("unchecked")
-        final TerminationPointKey tpKey = ((KeyedInstanceIdentifier<TerminationPoint, TerminationPointKey>)identifier).getKey();
-
-        return InventoryMapping.nodeConnectorFromId(tpKey.getTpId().getValue());
-    }
-
-    public org.opendaylight.controller.sal.core.Node toAdTopologyNode(final InstanceIdentifier<Node> identifier) {
-        @SuppressWarnings("unchecked")
-        final NodeKey nodeKey = ((KeyedInstanceIdentifier<Node, NodeKey>)identifier).getKey();
-
-        return InventoryMapping.nodeFromNodeId(nodeKey.getNodeId().getValue());
-    }
-
-    public NodeKey toTopologyNodeKey(final org.opendaylight.controller.sal.core.Node node) {
-        return new NodeKey(new NodeId(InventoryMapping.toNodeId(node)));
-    }
-
-    public TerminationPointKey toTopologyTerminationPointKey(final NodeConnector nc) {
-        return new TerminationPointKey(new TpId(InventoryMapping.toNodeConnectorId(nc)));
-    }
-
-    public LinkKey toTopologyLinkKey(final Edge edge) {
-        final TerminationPointKey sourceTp = toTopologyTerminationPointKey(edge.getTailNodeConnector());
-        final TerminationPointKey destTp = toTopologyTerminationPointKey(edge.getHeadNodeConnector());
-
-        final StringBuilder sb = new StringBuilder();
-        sb.append(sourceTp.getTpId().toString());
-        sb.append(HEAD_TAIL_STRING);
-        sb.append(destTp.getTpId().toString());
-        return new LinkKey(new LinkId(sb.toString()));
-    }
-}
diff --git a/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topology/TopologyReader.java b/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topology/TopologyReader.java
deleted file mode 100644 (file)
index a4ac6f9..0000000
+++ /dev/null
@@ -1,199 +0,0 @@
-/**
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * 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
- */
-package org.opendaylight.controller.md.compatibility.topology;
-
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.Set;
-
-import org.opendaylight.controller.sal.binding.api.data.RuntimeDataProvider;
-import org.opendaylight.controller.sal.core.ConstructionException;
-import org.opendaylight.controller.sal.core.Edge;
-import org.opendaylight.controller.sal.core.NodeConnector;
-import org.opendaylight.controller.sal.core.Property;
-import org.opendaylight.controller.switchmanager.ISwitchManager;
-import org.opendaylight.controller.topologymanager.ITopologyManager;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.link.attributes.DestinationBuilder;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.link.attributes.SourceBuilder;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyBuilder;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Link;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.LinkBuilder;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeBuilder;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointBuilder;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class TopologyReader implements RuntimeDataProvider {
-    private static final Logger LOG = LoggerFactory.getLogger(TopologyReader.class);
-    private final InstanceIdentifier<Topology> topologyPath;
-    private final TopologyKey topologyKey;
-    private final TopologyMapping mapping;
-    private ITopologyManager topologyManager;
-    private ISwitchManager switchManager;
-
-    public ISwitchManager getSwitchManager() {
-        return this.switchManager;
-    }
-
-    public void setSwitchManager(final ISwitchManager switchManager) {
-        this.switchManager = switchManager;
-    }
-
-    public ITopologyManager getTopologyManager() {
-        return this.topologyManager;
-    }
-
-    public void setTopologyManager(final ITopologyManager topologyManager) {
-        this.topologyManager = topologyManager;
-    }
-
-    public TopologyKey getTopologyKey() {
-        return this.topologyKey;
-    }
-
-    public TopologyMapping getMapping() {
-        return this.mapping;
-    }
-
-    public TopologyReader() {
-        this.topologyKey = new TopologyKey(new TopologyId("compatibility:ad-sal"));
-        this.topologyPath = InstanceIdentifier.builder(NetworkTopology.class)
-                .child(Topology.class, topologyKey)
-                .toInstance();
-        this.mapping = new TopologyMapping(topologyKey, topologyPath);
-    }
-
-    @Override
-    public DataObject readConfigurationData(final InstanceIdentifier<? extends DataObject> path) {
-        // Topology and Inventory are operational only
-        return null;
-    }
-
-    @SuppressWarnings("unchecked")
-    @Override
-    public DataObject readOperationalData(final InstanceIdentifier<? extends DataObject> path) {
-        if (!topologyPath.contains(path)) {
-            return null;
-        }
-
-        final Class<? extends DataObject> type = path.getTargetType();
-        if (Link.class.equals(type)) {
-            return readLink((InstanceIdentifier<Link>) path);
-        }
-        if (Node.class.equals(type)) {
-            return readNode((InstanceIdentifier<Node>) path);
-        }
-        if (TerminationPoint.class.equals(type)) {
-            return readTerminationPoint((InstanceIdentifier<TerminationPoint>) path);
-
-        }
-        if (Topology.class.equals(type)) {
-            return readTopology((InstanceIdentifier<Topology>) path);
-        }
-
-        LOG.debug("Unsupported type {}", type);
-        return null;
-    }
-
-    private Link readLink(final InstanceIdentifier<Link> identifier) {
-        final Edge edge;
-        try {
-            edge = this.mapping.toAdTopologyEdge(identifier);
-        } catch (ConstructionException e) {
-            throw new IllegalStateException(String.format("Failed to construct edge for link %s", identifier), e);
-        }
-
-        final Map<Edge,Set<Property>> edges;
-        if (topologyManager != null) {
-            edges = topologyManager.getEdges();
-        } else {
-            edges = null;
-        }
-
-        final Set<Property> properties;
-        if (edges != null) {
-            properties = edges.get(edge);
-        } else {
-            properties = null;
-        }
-
-        return constructLink(edge);
-    }
-
-    private TerminationPoint readTerminationPoint(final InstanceIdentifier<TerminationPoint> identifier) {
-        return constructTerminationPoint(mapping.toAdTopologyNodeConnector(identifier));
-    }
-
-    private Node readNode(final InstanceIdentifier<Node> identifier) {
-        return constructNode(mapping.toAdTopologyNode(identifier));
-    }
-
-    private Topology readTopology(final InstanceIdentifier<Topology> identifier) {
-        final Set<org.opendaylight.controller.sal.core.Node> nodes = getSwitchManager().getNodes();
-        final ArrayList<Node> nodeList = new ArrayList<Node>(nodes.size());
-        for (final org.opendaylight.controller.sal.core.Node node : nodes) {
-            nodeList.add(constructNode(node));
-        }
-
-        final Map<Edge,Set<Property>> edges = getTopologyManager().getEdges();
-        final ArrayList<Link> linkList = new ArrayList<Link>(edges.size());
-        for (final Edge edge : edges.keySet()) {
-            linkList.add(constructLink(edge));
-        }
-
-        return new TopologyBuilder()
-        .setKey(topologyKey)
-        .setNode(nodeList)
-        .setLink(linkList)
-        .build();
-    }
-
-    private Link constructLink(final Edge edge) {
-        final NodeConnector sourceNc = edge.getTailNodeConnector();
-        final NodeConnector destNc = edge.getHeadNodeConnector();
-
-        final LinkBuilder it = new LinkBuilder().setKey(mapping.toTopologyLinkKey(edge));
-
-        it.setSource(new SourceBuilder()
-        .setSourceNode(mapping.toTopologyNodeKey(sourceNc.getNode()).getNodeId())
-        .setSourceTp(mapping.toTopologyTerminationPointKey(sourceNc).getTpId())
-        .build());
-
-        it.setDestination(new DestinationBuilder()
-        .setDestNode(mapping.toTopologyNodeKey(destNc.getNode()).getNodeId())
-        .setDestTp(mapping.toTopologyTerminationPointKey(destNc).getTpId())
-        .build());
-
-        return it.build();
-    }
-
-    private Node constructNode(final org.opendaylight.controller.sal.core.Node node) {
-        final Set<NodeConnector> connectors = getSwitchManager().getNodeConnectors(node);
-        final ArrayList<TerminationPoint> tpList = new ArrayList<TerminationPoint>(connectors.size());
-        for (final NodeConnector connector : connectors) {
-            tpList.add(constructTerminationPoint(connector));
-        }
-
-        return new NodeBuilder()
-        .setKey(mapping.toTopologyNodeKey(node))
-        .setTerminationPoint(tpList)
-        .build();
-    }
-
-    private TerminationPoint constructTerminationPoint(final NodeConnector connector) {
-        return new TerminationPointBuilder().setKey(mapping.toTopologyTerminationPointKey(connector)).build();
-    }
-}
diff --git a/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topologymanager/AdSalTopologyMapping.java b/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topologymanager/AdSalTopologyMapping.java
deleted file mode 100644 (file)
index a7a7a9a..0000000
+++ /dev/null
@@ -1,109 +0,0 @@
-/**
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * 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
- */
-package org.opendaylight.controller.md.compatibility.topologymanager;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import org.opendaylight.controller.sal.compatibility.NodeMapping;
-import org.opendaylight.controller.sal.core.ConstructionException;
-import org.opendaylight.controller.sal.core.Edge;
-import org.opendaylight.controller.sal.core.NodeConnector;
-import org.opendaylight.controller.sal.core.Property;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.link.attributes.Destination;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.link.attributes.Source;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Link;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointKey;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public class AdSalTopologyMapping {
-    private final InstanceIdentifier<Topology> topologyPath;
-
-    public AdSalTopologyMapping(final TopologyKey topology) {
-        this.topologyPath = InstanceIdentifier.builder(NetworkTopology.class)
-                .child(Topology.class, topology).toInstance();
-    }
-
-    public InstanceIdentifier<Topology> getTopologyPath() {
-        return topologyPath;
-    }
-
-    public InstanceIdentifier<TerminationPoint> toTerminationPoint(final NodeConnector connector) {
-        return getTopologyPath().builder()
-                .child(Node.class)
-                .child(TerminationPoint.class, toTerminationPointKey(connector))
-                .toInstance();
-    }
-
-    public Map<Edge,Set<Property>> toEdgePropertiesMap(final Iterable<Link> links) {
-        final HashMap<Edge,Set<Property>> ret = new HashMap<>();
-        for (final Link link : links) {
-            try {
-                ret.put(toEdge(link), toProperties(link));
-            } catch (ConstructionException e) {
-                throw new IllegalStateException(String.format("Failed to create edge properties for {}", link), e);
-            }
-        }
-        return ret;
-    }
-
-    public static Set<Edge> toEdges(final Iterable<Link> links) throws ConstructionException {
-        final HashSet<Edge> ret = new HashSet<Edge>();
-        for (final Link link : links) {
-            ret.add(toEdge(link));
-        }
-        return ret;
-    }
-
-    public static Edge toEdge(final Link link) throws ConstructionException {
-        final NodeConnector tail = toNodeConnector(link.getSource());
-        final NodeConnector head = toNodeConnector(link.getDestination());
-        return new Edge(tail, head);
-    }
-
-    public static org.opendaylight.controller.sal.core.Node toAdNode(final Node node) throws ConstructionException {
-        return toAdNode(node.getNodeId());
-    }
-
-    public static org.opendaylight.controller.sal.core.Node toAdNode(final NodeId node) throws ConstructionException {
-        final NodeKey key = new NodeKey(
-                new org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId(node));
-        return new org.opendaylight.controller.sal.core.Node(NodeMapping.MD_SAL_TYPE, key);
-    }
-
-    public static NodeConnector toNodeConnector(final Source ref) throws ConstructionException {
-        final org.opendaylight.controller.sal.core.Node adNode = toAdNode(ref.getSourceNode());
-        final NodeConnectorKey key = new NodeConnectorKey(new NodeConnectorId(ref.getSourceTp()));
-        return new NodeConnector(NodeMapping.MD_SAL_TYPE, key, adNode);
-    }
-
-    public static NodeConnector toNodeConnector(final Destination ref) throws ConstructionException {
-        final org.opendaylight.controller.sal.core.Node adNode = toAdNode(ref.getDestNode());
-        final NodeConnectorKey key = new NodeConnectorKey(new NodeConnectorId(ref.getDestTp()));
-        return new NodeConnector(NodeMapping.MD_SAL_TYPE, key, adNode);
-    }
-
-    public TerminationPointKey toTerminationPointKey(final NodeConnector connector) {
-        return null;
-    }
-
-    public Set<Property> toProperties(final Link link) {
-        return null;
-    }
-}
diff --git a/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topologymanager/CompatibleTopologyManager.java b/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topologymanager/CompatibleTopologyManager.java
deleted file mode 100644 (file)
index 11320a1..0000000
+++ /dev/null
@@ -1,149 +0,0 @@
-/**
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * 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
- */
-package org.opendaylight.controller.md.compatibility.topologymanager;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.opendaylight.controller.md.sal.binding.util.TypeSafeDataReader;
-import org.opendaylight.controller.sal.core.ConstructionException;
-import org.opendaylight.controller.sal.core.Edge;
-import org.opendaylight.controller.sal.core.Host;
-import org.opendaylight.controller.sal.core.NodeConnector;
-import org.opendaylight.controller.sal.core.Property;
-import org.opendaylight.controller.sal.core.UpdateType;
-import org.opendaylight.controller.sal.utils.Status;
-import org.opendaylight.controller.topologymanager.ITopologyManager;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TpId;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Link;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-import com.google.common.base.Predicate;
-import com.google.common.collect.FluentIterable;
-
-@SuppressWarnings("all")
-public class CompatibleTopologyManager extends ConfigurableLinkManager implements ITopologyManager {
-    private AdSalTopologyMapping topologyMapping;
-    private TypeSafeDataReader dataReader;
-
-    public TypeSafeDataReader getDataReader() {
-        return dataReader;
-    }
-
-    public void setDataReader(final TypeSafeDataReader dataReader) {
-        this.dataReader = dataReader;
-    }
-
-    public AdSalTopologyMapping getTopologyMapping() {
-        return topologyMapping;
-    }
-
-    public void setTopologyMapping(final AdSalTopologyMapping topologyMapping) {
-        this.topologyMapping = topologyMapping;
-    }
-
-    @Override
-    public Map<Edge,Set<Property>> getEdges() {
-        final Topology topology = getDataReader().readOperationalData(topologyMapping.getTopologyPath());
-        return this.topologyMapping.toEdgePropertiesMap(topology.getLink());
-    }
-
-    @Override
-    public Map<org.opendaylight.controller.sal.core.Node, Set<Edge>> getNodeEdges() {
-        final Topology topology = getDataReader().readOperationalData(topologyMapping.getTopologyPath());
-        final HashMap<org.opendaylight.controller.sal.core.Node, Set<Edge>> ret = new HashMap<>();
-        for (final Node node : topology.getNode()) {
-            try {
-                ret.put(topologyMapping.toAdNode(node), topologyMapping.toEdges(
-                        FluentIterable.from(topology.getLink()).filter(new Predicate<Link>() {
-                            @Override
-                            public boolean apply(final Link input) {
-                                final NodeId nodeId = node.getNodeId();
-                                if (nodeId.equals(input.getSource().getSourceNode())) {
-                                    return true;
-                                }
-                                if (nodeId.equals(input.getDestination().getDestNode())) {
-                                    return true;
-                                }
-
-                                return false;
-                            }
-                        })));
-            } catch (ConstructionException e) {
-                throw new IllegalStateException(String.format("Failed to construct node for {}", node), e);
-            }
-        }
-        return ret;
-    }
-
-    /**
-     * Returns true if point is connected to link
-     */
-    private boolean isInternal(final TerminationPoint point) {
-        final Topology topology = getDataReader().readConfigurationData(topologyMapping.getTopologyPath());
-        final TpId tpId = point.getKey().getTpId();
-        return FluentIterable.from(topology.getLink()).anyMatch(new Predicate<Link>() {
-            @Override
-            public boolean apply(final Link input) {
-                if (tpId.equals(input.getSource().getSourceTp())) {
-                    return true;
-                }
-                if (tpId.equals(input.getDestination().getDestTp())) {
-                    return true;
-                }
-                return false;
-            }
-        });
-    }
-
-    @Override
-    public Set<NodeConnector> getNodeConnectorWithHost() {
-        return null;
-    }
-
-    @Override
-    public Host getHostAttachedToNodeConnector(final NodeConnector p) {
-        final InstanceIdentifier<TerminationPoint> tpPath = topologyMapping.toTerminationPoint(p);
-        throw new UnsupportedOperationException("TODO: auto-generated method stub");
-    }
-
-    @Override
-    public List<Host> getHostsAttachedToNodeConnector(final NodeConnector p) {
-        final Topology topology = getDataReader().readOperationalData(topologyMapping.getTopologyPath());
-        throw new UnsupportedOperationException("Hosts not mapped yet");
-    }
-
-    @Override
-    public Map<org.opendaylight.controller.sal.core.Node, Set<NodeConnector>> getNodesWithNodeConnectorHost() {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub");
-    }
-
-    @Override
-    public boolean isInternal(final NodeConnector p) {
-        final TerminationPoint connector = getDataReader()
-                .readConfigurationData(topologyMapping.toTerminationPoint(p));
-        return this.isInternal(connector);
-    }
-
-    @Override
-    public void updateHostLink(final NodeConnector p, final Host h, final UpdateType t, final Set<Property> props) {
-        // Update app defined topology
-    }
-
-    @Override
-    public Status saveConfig() {
-        // FIXME: commit configuration
-        return null;
-    }
-}
diff --git a/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topologymanager/ConfigurableLinkManager.java b/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topologymanager/ConfigurableLinkManager.java
deleted file mode 100644 (file)
index 2d85f76..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * 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
- */
-package org.opendaylight.controller.md.compatibility.topologymanager;
-
-import java.util.concurrent.ConcurrentMap;
-
-import org.opendaylight.controller.sal.utils.Status;
-import org.opendaylight.controller.topologymanager.ITopologyManager;
-import org.opendaylight.controller.topologymanager.TopologyUserLinkConfig;
-
-public abstract class ConfigurableLinkManager implements ITopologyManager {
-    @Override
-    public final Status addUserLink(final TopologyUserLinkConfig link) {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub");
-    }
-
-    @Override
-    public final Status deleteUserLink(final String linkName) {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub");
-    }
-
-    @Override
-    public final ConcurrentMap<String,TopologyUserLinkConfig> getUserLinks() {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub");
-    }
-}
index 688e6ac09b25b29d8160ad05b10ef078430e1d37..b9e9d19b48dce4eed7f5e42cc335588306ad1692 100644 (file)
@@ -12,8 +12,6 @@
 
   <modules>
     <module>sal-compatibility</module>
-    <module>inventory-topology-compatibility</module>
-    <module>flow-management-compatibility</module>
   </modules>
 
   <dependencies>
index ed5e19219353e3265a5b7f55ef58dccd5f6b7ad7..5a9b19021945b947e7601fbdaa82dd74676fbdc8 100644 (file)
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal-binding-api</artifactId>
     </dependency>
-    <dependency>
-      <groupId>org.opendaylight.controller.model</groupId>
-      <artifactId>model-flow-management</artifactId>
-    </dependency>
     <dependency>
       <groupId>org.opendaylight.controller.model</groupId>
       <artifactId>model-flow-service</artifactId>
index 02fbde8f1826648b12278311fb3defe1e72c1347..fd828dc05a92cfd2070825a1edc4fb4dddab8af5 100644 (file)
@@ -66,8 +66,8 @@
     <!--InMemory DOM DataStore-->
     <module>sal-inmemory-datastore</module>
 
-    <!--sal-protocolbuffer-encoding-->
-    <module>sal-protocolbuffer-encoding</module>
+    <!--sal-protocolbuffer-encoding is now part of sal-clutering-commons-->
+    <module>sal-clustering-commons</module>
 
     <!-- sal-distributed-datastore -->
     <module>sal-distributed-datastore</module>
index 42d5cfff65e755e29ef2f9198fb6478eabf783d6..7a66c411962285efe2de6514b862f10670b9e296 100644 (file)
       <type>test-jar</type>
       <scope>test</scope>
     </dependency>
-    <dependency>
-      <groupId>org.opendaylight.controller.model</groupId>
-      <artifactId>model-flow-management</artifactId>
-      <scope>test</scope>
-    </dependency>
     <dependency>
       <groupId>org.opendaylight.controller.model</groupId>
       <artifactId>model-flow-service</artifactId>
diff --git a/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/DOMCodecBug01Test.java b/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/DOMCodecBug01Test.java
deleted file mode 100644 (file)
index 34a71ac..0000000
+++ /dev/null
@@ -1,232 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * 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
- */
-package org.opendaylight.controller.sal.binding.test.bugfix;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-import org.junit.Ignore;
-import org.junit.Test;
-import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
-import org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction;
-import org.opendaylight.controller.sal.binding.test.AbstractDataServiceTest;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopMplsActionCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.mpls.action._case.PopMplsActionBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.config.rev130819.Flows;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.config.rev130819.flows.Flow;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.config.rev130819.flows.FlowBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.config.rev130819.flows.FlowKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.InstructionsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.apply.actions._case.ApplyActionsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.VlanMatchBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatchBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.vlan.match.fields.VlanIdBuilder;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.common.RpcResult;
-import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-
-import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.ListenableFuture;
-import com.google.common.util.concurrent.ListeningExecutorService;
-import com.google.common.util.concurrent.MoreExecutors;
-
-@SuppressWarnings("deprecation")
-public class DOMCodecBug01Test extends AbstractDataServiceTest {
-
-    private static final long FLOW_ID = 1234;
-    private static final String NODE_ID = "node:1";
-
-    private static final NodeKey NODE_KEY = new NodeKey(new NodeId(NODE_ID));
-
-    private static final InstanceIdentifier<Node> NODE_INSTANCE_ID_BA = InstanceIdentifier.builder(Nodes.class) //
-            .child(Node.class, NODE_KEY).toInstance();
-
-    private static final NodeRef NODE_REF = new NodeRef(NODE_INSTANCE_ID_BA);
-
-    private static final FlowKey FLOW_KEY = new FlowKey(FLOW_ID, NODE_REF);
-
-    private static final InstanceIdentifier<? extends DataObject> FLOW_INSTANCE_ID_BA = //
-    InstanceIdentifier.builder(Flows.class) //
-            .child(Flow.class, FLOW_KEY) //
-            .toInstance();
-
-
-
-    /**
-     *
-     * Testcase for https://bugs.opendaylight.org/show_bug.cgi?id=
-     *
-     * Cannot compile CoDec for
-     * org.opendaylight.yang.gen.v1.urn.opendaylight.flow
-     * .config.rev130819.flows.Flow
-     *
-     * When invoking following code in the consumer, user got an
-     * IllegalStateException during creation of mapping between Java DTOs and
-     * data-dom.
-     *
-     * Exception was compilation error which was caused by incorect generation
-     * of code.
-     *
-     * Reported by Depthi V V
-     *
-     * @deprecated This test tests indirect generation, which should be tested
-     *    different way. the test creates conflicting transactions
-     *    and assumes correct commit - to test codec generation
-     *
-     */
-    @Test
-    @Ignore
-    @Deprecated
-    public void testIndirectGeneration() throws Exception {
-
-        ExecutorService basePool = Executors.newFixedThreadPool(2);
-        ListeningExecutorService listenablePool = MoreExecutors.listeningDecorator(basePool);
-
-        createFlow();
-
-        Object lock = new Object();
-        CreateFlowTask task1 = new CreateFlowTask(lock);
-        CreateFlowTask task2 = new CreateFlowTask(lock);
-        CreateFlowTask task3 = new CreateFlowTask(lock);
-
-        ListenableFuture<Void> task1Future = listenablePool.submit(task1);
-        ListenableFuture<Void> task2Future = listenablePool.submit(task2);
-        ListenableFuture<Void> task3Future = listenablePool.submit(task3);
-
-
-        @SuppressWarnings("unchecked")
-        ListenableFuture<List<Void>> compositeFuture = Futures.allAsList(task1Future,task2Future,task3Future);
-
-        Thread.sleep(500);
-        //lock.notifyAll();
-        compositeFuture.get();
-
-        verifyDataAreStoredProperly();
-
-        DataModificationTransaction modification2 = baDataService.beginTransaction();
-        modification2.removeConfigurationData(FLOW_INSTANCE_ID_BA);
-
-        DataObject originalData = modification2.getOriginalConfigurationData().get(FLOW_INSTANCE_ID_BA);
-        assertNotNull(originalData);
-        RpcResult<TransactionStatus> ret2 = modification2.commit().get();
-
-        assertNotNull(ret2);
-        assertEquals(TransactionStatus.COMMITED, ret2.getResult());
-
-        // Data are not in the store.
-        assertNull(baDataService.readConfigurationData(FLOW_INSTANCE_ID_BA));
-
-    }
-
-    private void createFlow() throws Exception {
-
-        DataModificationTransaction modification = baDataService.beginTransaction();
-
-        FlowBuilder flow = new FlowBuilder();
-        MatchBuilder match = new MatchBuilder();
-        VlanMatchBuilder vlanBuilder = new VlanMatchBuilder();
-        VlanIdBuilder vlanIdBuilder = new VlanIdBuilder();
-        VlanId vlanId = new VlanId(10);
-        vlanBuilder.setVlanId(vlanIdBuilder.setVlanId(vlanId).build());
-        match.setVlanMatch(vlanBuilder.build());
-
-        flow.setKey(FLOW_KEY);
-        flow.setMatch(match.build());
-        flow.setNode(NODE_REF);
-        InstructionsBuilder instructions = new InstructionsBuilder();
-        InstructionBuilder instruction = new InstructionBuilder();
-
-        instruction.setOrder(10);
-        ApplyActionsBuilder applyActions = new ApplyActionsBuilder();
-        List<Action> actionList = new ArrayList<>();
-        PopMplsActionBuilder popMplsAction = new PopMplsActionBuilder();
-        popMplsAction.setEthernetType(34);
-        actionList.add(new ActionBuilder().setAction(new PopMplsActionCaseBuilder().setPopMplsAction(popMplsAction.build()).build()).setOrder(10).build());
-
-        applyActions.setAction(actionList );
-
-        instruction.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(applyActions.build()).build());
-
-
-        List<Instruction> instructionList = Collections.<Instruction>singletonList(instruction.build());
-        instructions.setInstruction(instructionList );
-
-        flow.setInstructions(instructions.build());
-        modification.putConfigurationData(FLOW_INSTANCE_ID_BA, flow.build());
-        RpcResult<TransactionStatus> ret = modification.commit().get();
-        assertNotNull(ret);
-        assertEquals(TransactionStatus.COMMITED, ret.getResult());
-    }
-
-    private void createFlow2() throws Exception {
-        DataModificationTransaction modification = baDataService.beginTransaction();
-        long id = 123;
-        FlowKey key = new FlowKey(id, new NodeRef(NODE_INSTANCE_ID_BA));
-        InstanceIdentifier<?> path1;
-        FlowBuilder flow = new FlowBuilder();
-        flow.setKey(key);
-        MatchBuilder match = new MatchBuilder();
-        match.setLayer4Match(new TcpMatchBuilder().build());
-        flow.setMatch(match.build());
-
-        path1 = InstanceIdentifier.builder(Flows.class).child(Flow.class, key).toInstance();
-       // DataObject cls = (DataObject) modification.readConfigurationData(path1);
-        modification.putConfigurationData(path1, flow.build());
-        modification.commit();
-
-    }
-
-    private class CreateFlowTask implements Callable<Void> {
-
-        public CreateFlowTask(final Object startSync) {
-        }
-
-        @Override
-        public Void call() {
-            try {
-                //startSyncObj          ect.wait();
-                //Thread.sleep(500);
-                createFlow();
-                createFlow2();
-            } catch (Exception e) {
-                throw new RuntimeException(e);
-            }
-            return null;
-        }
-    }
-
-    private void verifyDataAreStoredProperly() {
-        CompositeNode biFlows = biDataService.readConfigurationData(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.of(Flows.QNAME));
-        assertNotNull(biFlows);
-        CompositeNode biFlow = biFlows.getFirstCompositeByName(Flow.QNAME);
-        assertNotNull(biFlow);
-    }
-
-
-}
index 8e47d87a74f6d78f86098e90a6e7fd6dfe9aa71c..1912462cf0aa5d081ec56166d16b6256e69f7be8 100644 (file)
       <groupId>org.slf4j</groupId>
       <artifactId>log4j-over-slf4j</artifactId>
     </dependency>
-    <dependency>
-      <groupId>org.opendaylight.controller.model</groupId>
-      <artifactId>model-flow-management</artifactId>
-      <scope>provided</scope>
-    </dependency>
     <dependency>
       <groupId>org.opendaylight.controller.model</groupId>
       <artifactId>model-flow-service</artifactId>
similarity index 98%
rename from opendaylight/md-sal/sal-protocolbuffer-encoding/pom.xml
rename to opendaylight/md-sal/sal-clustering-commons/pom.xml
index 28e629a92c92fa7b165a390e12e2fd89a15e2ba5..6db4d3a094f43cb80c461418cfd56d54639dd5a2 100644 (file)
@@ -8,7 +8,7 @@
     <version>1.1-SNAPSHOT</version>
   </parent>
 
-  <artifactId>sal-protocolbuffer-encoding</artifactId>
+  <artifactId>sal-clustering-commons</artifactId>
 
   <packaging>bundle</packaging>
 
similarity index 93%
rename from opendaylight/md-sal/sal-protocolbuffer-encoding/run.sh
rename to opendaylight/md-sal/sal-clustering-commons/run.sh
index f0907db6648e974298bb399f0956e719cd6e1552..d3d0324fa029e193dd4b36fcec6d34818db07e17 100755 (executable)
@@ -30,7 +30,7 @@
 #   org.opendaylight.controller.protobuff.messages to properly exclude from sonar.
 ########################################################################################################
 
-protoc --proto_path=src/main/resources --java_out=src/main/java src/main/resources/*.proto
+protoc --proto_path=src/main/resources --proto_path=../sal-akka-raft/src/main/resources --java_out=src/main/java src/main/resources/*.proto
 
 echo "Done generating Java source files."
 
@@ -1,13 +1,3 @@
-/*
- *
- *  Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- *  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
- *
- */
-
 // Generated by the protocol buffer compiler.  DO NOT EDIT!
 // source: CompositeModificationPayload.proto
 
@@ -1,13 +1,3 @@
-/*
- *
- *  Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- *  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
- *
- */
-
 // Generated by the protocol buffer compiler.  DO NOT EDIT!
 // source: Cohort.proto
 
@@ -1,13 +1,3 @@
-/*
- *
- *  Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- *  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
- *
- */
-
 // Generated by the protocol buffer compiler.  DO NOT EDIT!
 // source: Common.proto
 
@@ -1,13 +1,3 @@
-/*
- *
- *  Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- *  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
- *
- */
-
 // Generated by the protocol buffer compiler.  DO NOT EDIT!
 // source: SimpleNormalizedNode.proto
 
@@ -1,13 +1,3 @@
-/*
- *
- *  Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- *  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
- *
- */
-
 // Generated by the protocol buffer compiler.  DO NOT EDIT!
 // source: DataChangeListener.proto
 
@@ -1,13 +1,3 @@
-/*
- *
- *  Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- *  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
- *
- */
-
 // Generated by the protocol buffer compiler.  DO NOT EDIT!
 // source: Persistent.proto
 
@@ -1,13 +1,3 @@
-/*
- *
- *  Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- *  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
- *
- */
-
 // Generated by the protocol buffer compiler.  DO NOT EDIT!
 // source: ListenerRegistration.proto
 
@@ -1,13 +1,3 @@
-/*
- *
- *  Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- *  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
- *
- */
-
 // Generated by the protocol buffer compiler.  DO NOT EDIT!
 // source: ShardManager.proto
 
@@ -1,13 +1,3 @@
-/*
- *
- *  Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- *  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
- *
- */
-
 // Generated by the protocol buffer compiler.  DO NOT EDIT!
 // source: ShardTransactionChain.proto
 
@@ -1,13 +1,3 @@
-/*
- *
- *  Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- *  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
- *
- */
-
 // Generated by the protocol buffer compiler.  DO NOT EDIT!
 // source: ShardTransaction.proto
 
@@ -653,6 +643,16 @@ public final class ShardTransactionMessages {
      */
     com.google.protobuf.ByteString
         getTransactionIdBytes();
+
+    // required int32 transactionType = 2;
+    /**
+     * <code>required int32 transactionType = 2;</code>
+     */
+    boolean hasTransactionType();
+    /**
+     * <code>required int32 transactionType = 2;</code>
+     */
+    int getTransactionType();
   }
   /**
    * Protobuf type {@code org.opendaylight.controller.mdsal.CreateTransaction}
@@ -710,6 +710,11 @@ public final class ShardTransactionMessages {
               transactionId_ = input.readBytes();
               break;
             }
+            case 16: {
+              bitField0_ |= 0x00000002;
+              transactionType_ = input.readInt32();
+              break;
+            }
           }
         }
       } catch (com.google.protobuf.InvalidProtocolBufferException e) {
@@ -793,8 +798,25 @@ public final class ShardTransactionMessages {
       }
     }
 
+    // required int32 transactionType = 2;
+    public static final int TRANSACTIONTYPE_FIELD_NUMBER = 2;
+    private int transactionType_;
+    /**
+     * <code>required int32 transactionType = 2;</code>
+     */
+    public boolean hasTransactionType() {
+      return ((bitField0_ & 0x00000002) == 0x00000002);
+    }
+    /**
+     * <code>required int32 transactionType = 2;</code>
+     */
+    public int getTransactionType() {
+      return transactionType_;
+    }
+
     private void initFields() {
       transactionId_ = "";
+      transactionType_ = 0;
     }
     private byte memoizedIsInitialized = -1;
     public final boolean isInitialized() {
@@ -805,6 +827,10 @@ public final class ShardTransactionMessages {
         memoizedIsInitialized = 0;
         return false;
       }
+      if (!hasTransactionType()) {
+        memoizedIsInitialized = 0;
+        return false;
+      }
       memoizedIsInitialized = 1;
       return true;
     }
@@ -815,6 +841,9 @@ public final class ShardTransactionMessages {
       if (((bitField0_ & 0x00000001) == 0x00000001)) {
         output.writeBytes(1, getTransactionIdBytes());
       }
+      if (((bitField0_ & 0x00000002) == 0x00000002)) {
+        output.writeInt32(2, transactionType_);
+      }
       getUnknownFields().writeTo(output);
     }
 
@@ -828,6 +857,10 @@ public final class ShardTransactionMessages {
         size += com.google.protobuf.CodedOutputStream
           .computeBytesSize(1, getTransactionIdBytes());
       }
+      if (((bitField0_ & 0x00000002) == 0x00000002)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeInt32Size(2, transactionType_);
+      }
       size += getUnknownFields().getSerializedSize();
       memoizedSerializedSize = size;
       return size;
@@ -946,6 +979,8 @@ public final class ShardTransactionMessages {
         super.clear();
         transactionId_ = "";
         bitField0_ = (bitField0_ & ~0x00000001);
+        transactionType_ = 0;
+        bitField0_ = (bitField0_ & ~0x00000002);
         return this;
       }
 
@@ -978,6 +1013,10 @@ public final class ShardTransactionMessages {
           to_bitField0_ |= 0x00000001;
         }
         result.transactionId_ = transactionId_;
+        if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
+          to_bitField0_ |= 0x00000002;
+        }
+        result.transactionType_ = transactionType_;
         result.bitField0_ = to_bitField0_;
         onBuilt();
         return result;
@@ -999,6 +1038,9 @@ public final class ShardTransactionMessages {
           transactionId_ = other.transactionId_;
           onChanged();
         }
+        if (other.hasTransactionType()) {
+          setTransactionType(other.getTransactionType());
+        }
         this.mergeUnknownFields(other.getUnknownFields());
         return this;
       }
@@ -1008,6 +1050,10 @@ public final class ShardTransactionMessages {
 
           return false;
         }
+        if (!hasTransactionType()) {
+
+          return false;
+        }
         return true;
       }
 
@@ -1104,6 +1150,39 @@ public final class ShardTransactionMessages {
         return this;
       }
 
+      // required int32 transactionType = 2;
+      private int transactionType_ ;
+      /**
+       * <code>required int32 transactionType = 2;</code>
+       */
+      public boolean hasTransactionType() {
+        return ((bitField0_ & 0x00000002) == 0x00000002);
+      }
+      /**
+       * <code>required int32 transactionType = 2;</code>
+       */
+      public int getTransactionType() {
+        return transactionType_;
+      }
+      /**
+       * <code>required int32 transactionType = 2;</code>
+       */
+      public Builder setTransactionType(int value) {
+        bitField0_ |= 0x00000002;
+        transactionType_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>required int32 transactionType = 2;</code>
+       */
+      public Builder clearTransactionType() {
+        bitField0_ = (bitField0_ & ~0x00000002);
+        transactionType_ = 0;
+        onChanged();
+        return this;
+      }
+
       // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.CreateTransaction)
     }
 
@@ -6581,32 +6660,33 @@ public final class ShardTransactionMessages {
     java.lang.String[] descriptorData = {
       "\n\026ShardTransaction.proto\022!org.opendaylig" +
       "ht.controller.mdsal\032\014Common.proto\"\022\n\020Clo" +
-      "seTransaction\"\027\n\025CloseTransactionReply\"*" +
+      "seTransaction\"\027\n\025CloseTransactionReply\"C" +
       "\n\021CreateTransaction\022\025\n\rtransactionId\030\001 \002" +
-      "(\t\"M\n\026CreateTransactionReply\022\034\n\024transact" +
-      "ionActorPath\030\001 \002(\t\022\025\n\rtransactionId\030\002 \002(" +
-      "\t\"\022\n\020ReadyTransaction\"*\n\025ReadyTransactio" +
-      "nReply\022\021\n\tactorPath\030\001 \002(\t\"l\n\nDeleteData\022" +
-      "^\n\037instanceIdentifierPathArguments\030\001 \002(\013" +
-      "25.org.opendaylight.controller.mdsal.Ins",
-      "tanceIdentifier\"\021\n\017DeleteDataReply\"j\n\010Re" +
-      "adData\022^\n\037instanceIdentifierPathArgument" +
-      "s\030\001 \002(\01325.org.opendaylight.controller.md" +
-      "sal.InstanceIdentifier\"P\n\rReadDataReply\022" +
-      "?\n\016normalizedNode\030\001 \001(\0132\'.org.opendaylig" +
-      "ht.controller.mdsal.Node\"\254\001\n\tWriteData\022^" +
-      "\n\037instanceIdentifierPathArguments\030\001 \002(\0132" +
-      "5.org.opendaylight.controller.mdsal.Inst" +
-      "anceIdentifier\022?\n\016normalizedNode\030\002 \002(\0132\'" +
-      ".org.opendaylight.controller.mdsal.Node\"",
-      "\020\n\016WriteDataReply\"\254\001\n\tMergeData\022^\n\037insta" +
+      "(\t\022\027\n\017transactionType\030\002 \002(\005\"M\n\026CreateTra" +
+      "nsactionReply\022\034\n\024transactionActorPath\030\001 " +
+      "\002(\t\022\025\n\rtransactionId\030\002 \002(\t\"\022\n\020ReadyTrans" +
+      "action\"*\n\025ReadyTransactionReply\022\021\n\tactor" +
+      "Path\030\001 \002(\t\"l\n\nDeleteData\022^\n\037instanceIden" +
+      "tifierPathArguments\030\001 \002(\01325.org.opendayl",
+      "ight.controller.mdsal.InstanceIdentifier" +
+      "\"\021\n\017DeleteDataReply\"j\n\010ReadData\022^\n\037insta" +
       "nceIdentifierPathArguments\030\001 \002(\01325.org.o" +
       "pendaylight.controller.mdsal.InstanceIde" +
-      "ntifier\022?\n\016normalizedNode\030\002 \002(\0132\'.org.op" +
-      "endaylight.controller.mdsal.Node\"\020\n\016Merg" +
-      "eDataReplyBV\n:org.opendaylight.controlle" +
-      "r.protobuff.messages.transactionB\030ShardT" +
-      "ransactionMessages"
+      "ntifier\"P\n\rReadDataReply\022?\n\016normalizedNo" +
+      "de\030\001 \001(\0132\'.org.opendaylight.controller.m" +
+      "dsal.Node\"\254\001\n\tWriteData\022^\n\037instanceIdent" +
+      "ifierPathArguments\030\001 \002(\01325.org.opendayli" +
+      "ght.controller.mdsal.InstanceIdentifier\022" +
+      "?\n\016normalizedNode\030\002 \002(\0132\'.org.opendaylig",
+      "ht.controller.mdsal.Node\"\020\n\016WriteDataRep" +
+      "ly\"\254\001\n\tMergeData\022^\n\037instanceIdentifierPa" +
+      "thArguments\030\001 \002(\01325.org.opendaylight.con" +
+      "troller.mdsal.InstanceIdentifier\022?\n\016norm" +
+      "alizedNode\030\002 \002(\0132\'.org.opendaylight.cont" +
+      "roller.mdsal.Node\"\020\n\016MergeDataReplyBV\n:o" +
+      "rg.opendaylight.controller.protobuff.mes" +
+      "sages.transactionB\030ShardTransactionMessa" +
+      "ges"
     };
     com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
       new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
@@ -6630,7 +6710,7 @@ public final class ShardTransactionMessages {
           internal_static_org_opendaylight_controller_mdsal_CreateTransaction_fieldAccessorTable = new
             com.google.protobuf.GeneratedMessage.FieldAccessorTable(
               internal_static_org_opendaylight_controller_mdsal_CreateTransaction_descriptor,
-              new java.lang.String[] { "TransactionId", });
+              new java.lang.String[] { "TransactionId", "TransactionType", });
           internal_static_org_opendaylight_controller_mdsal_CreateTransactionReply_descriptor =
             getDescriptor().getMessageTypes().get(3);
           internal_static_org_opendaylight_controller_mdsal_CreateTransactionReply_fieldAccessorTable = new
similarity index 96%
rename from opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/resources/ShardTransaction.proto
rename to opendaylight/md-sal/sal-clustering-commons/src/main/resources/ShardTransaction.proto
index 9684b7d72f57679ad069f31320bf00f0e989380c..4177bd7a052c244385e75df38dcf0fa31523b67c 100644 (file)
@@ -14,6 +14,7 @@ message CloseTransactionReply{
 
 message CreateTransaction{
   required string transactionId = 1;
+  required int32  transactionType =2;
 }
 
 message CreateTransactionReply{
diff --git a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/TransactionCommitDeadlockException.java b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/TransactionCommitDeadlockException.java
new file mode 100644 (file)
index 0000000..60313bf
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2014 Brocade Communications Systems, Inc. and others.  All rights reserved.
+ *
+ * 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
+ */
+
+package org.opendaylight.controller.md.sal.common.api.data;
+
+import org.opendaylight.yangtools.yang.common.RpcError;
+import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
+import org.opendaylight.yangtools.yang.common.RpcError.ErrorType;
+
+import com.google.common.base.Function;
+
+/**
+ * A type of TransactionCommitFailedException that indicates a situation that would result in a
+ * threading deadlock. This can occur if a caller that submits a write transaction tries to perform
+ * a blocking call via one of the <code>get</code> methods on the returned ListenableFuture. Callers
+ * should process the commit result asynchronously (via Futures#addCallback) to ensure deadlock
+ * won't occur.
+ *
+ * @author Thomas Pantelis
+ */
+public class TransactionCommitDeadlockException extends TransactionCommitFailedException {
+
+    private static final long serialVersionUID = 1L;
+
+    private static final String DEADLOCK_MESSAGE =
+            "An attempt to block on a ListenableFuture via a get method from a write " +
+            "transaction submit was detected that would result in deadlock. The commit " +
+            "result must be obtained asynchronously, e.g. via Futures#addCallback, to avoid deadlock.";
+
+    public static Function<Void, Exception> DEADLOCK_EXECUTOR_FUNCTION = new Function<Void, Exception>() {
+        @Override
+        public Exception apply(Void notUsed) {
+            return new TransactionCommitDeadlockException( DEADLOCK_MESSAGE,
+                    RpcResultBuilder.newError(ErrorType.APPLICATION, "lock-denied", DEADLOCK_MESSAGE));
+        }
+    };
+
+    public TransactionCommitDeadlockException(String message, final RpcError... errors) {
+        super(message, errors);
+    }
+}
index 94c895dab385a92e3f547099ac83010cb7e517ec..848d425bf9d8a712d42a873b564a1657b9d95953 100644 (file)
 
     <dependency>
         <groupId>org.opendaylight.controller</groupId>
-        <artifactId>sal-protocolbuffer-encoding</artifactId>
+        <artifactId>sal-clustering-commons</artifactId>
         <version>1.1-SNAPSHOT</version>
     </dependency>
 
             <Private-Package></Private-Package>
             <Import-Package>!*snappy;!org.jboss.*;*</Import-Package>
             <Embed-Dependency>
-                sal-protocolbuffer-encoding;
+                sal-clustering-commons;
                 sal-akka-raft;
                 !sal*;
                 !*config-api*;
index 23e27c9f5ff909b2c9b887aa5f7687b92d7cda10..9cda3f1aa168ee43c40f715753a49ecdbace8369 100644 (file)
@@ -15,11 +15,9 @@ import akka.event.Logging;
 import akka.event.LoggingAdapter;
 import akka.japi.Creator;
 import akka.serialization.Serialization;
-
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.ListeningExecutorService;
 import com.google.common.util.concurrent.MoreExecutors;
-
 import org.opendaylight.controller.cluster.datastore.jmx.mbeans.shard.ShardMBeanFactory;
 import org.opendaylight.controller.cluster.datastore.jmx.mbeans.shard.ShardStats;
 import org.opendaylight.controller.cluster.datastore.messages.CommitTransactionReply;
@@ -143,13 +141,29 @@ public class Shard extends RaftActor {
         }
     }
 
+   private ActorRef createTypedTransactionActor(CreateTransaction createTransaction,String transactionId){
+      if(createTransaction.getTransactionType()== TransactionProxy.TransactionType.READ_ONLY.ordinal()){
+        return getContext().actorOf(
+            ShardTransaction.props( store.newReadOnlyTransaction(), getSelf(), schemaContext), transactionId);
+
+      }else if (createTransaction.getTransactionType()== TransactionProxy.TransactionType.READ_WRITE.ordinal()){
+        return getContext().actorOf(
+            ShardTransaction.props( store.newReadWriteTransaction(), getSelf(), schemaContext), transactionId);
+
+
+      }else if (createTransaction.getTransactionType()== TransactionProxy.TransactionType.WRITE_ONLY.ordinal()){
+        return getContext().actorOf(
+            ShardTransaction.props( store.newWriteOnlyTransaction(), getSelf(), schemaContext), transactionId);
+      }else{
+        throw new IllegalArgumentException ("CreateTransaction message has unidentified transaction type="+createTransaction.getTransactionType()) ;
+      }
+   }
+
     private void createTransaction(CreateTransaction createTransaction) {
-        DOMStoreReadWriteTransaction transaction =
-            store.newReadWriteTransaction();
+
         String transactionId = "shard-" + createTransaction.getTransactionId();
         LOG.info("Creating transaction : {} " , transactionId);
-        ActorRef transactionActor = getContext().actorOf(
-            ShardTransaction.props(transaction, getSelf(), schemaContext), transactionId);
+        ActorRef transactionActor = createTypedTransactionActor(createTransaction,transactionId);
 
         getSender()
             .tell(new CreateTransactionReply(Serialization.serializedActorPath(transactionActor), createTransaction.getTransactionId()).toSerializable(),
diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardReadTransaction.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardReadTransaction.java
new file mode 100644 (file)
index 0000000..f78935b
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ *
+ *  Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ *  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
+ *
+ */
+
+package org.opendaylight.controller.cluster.datastore;
+
+import akka.actor.ActorRef;
+import akka.actor.PoisonPill;
+import akka.event.Logging;
+import akka.event.LoggingAdapter;
+import org.opendaylight.controller.cluster.datastore.messages.CloseTransaction;
+import org.opendaylight.controller.cluster.datastore.messages.CloseTransactionReply;
+import org.opendaylight.controller.cluster.datastore.messages.ReadData;
+import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadTransaction;
+import org.opendaylight.controller.sal.core.spi.data.DOMStoreTransactionChain;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+
+/**
+ * @author: syedbahm
+ * Date: 8/6/14
+ */
+public class ShardReadTransaction extends ShardTransaction {
+  private final DOMStoreReadTransaction transaction;
+  private final LoggingAdapter log =
+      Logging.getLogger(getContext().system(), this);
+
+  public ShardReadTransaction(DOMStoreReadTransaction transaction, ActorRef shardActor, SchemaContext schemaContext) {
+    super(shardActor, schemaContext);
+    this.transaction = transaction;
+
+  }
+
+  public ShardReadTransaction(DOMStoreTransactionChain transactionChain, DOMStoreReadTransaction transaction, ActorRef shardActor, SchemaContext schemaContext) {
+    super(transactionChain, shardActor, schemaContext);
+    this.transaction = transaction;
+  }
+
+  @Override
+  public void handleReceive(Object message) throws Exception {
+    if (ReadData.SERIALIZABLE_CLASS.equals(message.getClass())) {
+      readData(transaction,ReadData.fromSerializable(message));
+    } else {
+      super.handleReceive(message);
+    }
+  }
+  protected void closeTransaction(CloseTransaction message) {
+    transaction.close();
+    getSender().tell(new CloseTransactionReply().toSerializable(), getSelf());
+    getSelf().tell(PoisonPill.getInstance(), getSelf());
+  }
+
+}
diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardReadWriteTransaction.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardReadWriteTransaction.java
new file mode 100644 (file)
index 0000000..6733bcf
--- /dev/null
@@ -0,0 +1,68 @@
+/*
+ *
+ *  Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ *  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
+ *
+ */
+
+package org.opendaylight.controller.cluster.datastore;
+
+import akka.actor.ActorRef;
+import akka.actor.PoisonPill;
+import akka.event.Logging;
+import akka.event.LoggingAdapter;
+import org.opendaylight.controller.cluster.datastore.messages.CloseTransaction;
+import org.opendaylight.controller.cluster.datastore.messages.CloseTransactionReply;
+import org.opendaylight.controller.cluster.datastore.messages.DeleteData;
+import org.opendaylight.controller.cluster.datastore.messages.MergeData;
+import org.opendaylight.controller.cluster.datastore.messages.ReadData;
+import org.opendaylight.controller.cluster.datastore.messages.ReadyTransaction;
+import org.opendaylight.controller.cluster.datastore.messages.WriteData;
+import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransaction;
+import org.opendaylight.controller.sal.core.spi.data.DOMStoreTransactionChain;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+
+/**
+ * @author: syedbahm
+ * Date: 8/6/14
+ */
+public class ShardReadWriteTransaction extends ShardTransaction {
+  private final DOMStoreReadWriteTransaction transaction;
+  private final LoggingAdapter log =
+      Logging.getLogger(getContext().system(), this);
+  public ShardReadWriteTransaction(DOMStoreTransactionChain transactionChain, DOMStoreReadWriteTransaction transaction, ActorRef shardActor, SchemaContext schemaContext) {
+    super(transactionChain,  shardActor, schemaContext);
+    this.transaction = transaction;
+  }
+
+  public ShardReadWriteTransaction(DOMStoreReadWriteTransaction transaction, ActorRef shardActor, SchemaContext schemaContext) {
+    super( shardActor, schemaContext);
+    this.transaction = transaction;
+  }
+
+  @Override
+  public void handleReceive(Object message) throws Exception {
+    if (ReadData.SERIALIZABLE_CLASS.equals(message.getClass())) {
+      readData(transaction,ReadData.fromSerializable(message));
+    }else if (WriteData.SERIALIZABLE_CLASS.equals(message.getClass())) {
+      writeData(transaction, WriteData.fromSerializable(message, schemaContext));
+    } else if (MergeData.SERIALIZABLE_CLASS.equals(message.getClass())) {
+      mergeData(transaction, MergeData.fromSerializable(message, schemaContext));
+    } else if (DeleteData.SERIALIZABLE_CLASS.equals(message.getClass())) {
+      deleteData(transaction,DeleteData.fromSerizalizable(message));
+    } else if (ReadyTransaction.SERIALIZABLE_CLASS.equals(message.getClass())) {
+      readyTransaction(transaction,new ReadyTransaction());
+    }else {
+      super.handleReceive(message);
+    }
+  }
+
+  protected void closeTransaction(CloseTransaction message) {
+    transaction.close();
+    getSender().tell(new CloseTransactionReply().toSerializable(), getSelf());
+    getSelf().tell(PoisonPill.getInstance(), getSelf());
+  }
+}
index 737f57bf5d7314536f5fc20b1cbc45167f1b6e97..3a916bda2c6e163d75c4d39a0c4d80b94b823fb2 100644 (file)
@@ -9,7 +9,6 @@
 package org.opendaylight.controller.cluster.datastore;
 
 import akka.actor.ActorRef;
-import akka.actor.PoisonPill;
 import akka.actor.Props;
 import akka.event.Logging;
 import akka.event.LoggingAdapter;
@@ -17,7 +16,6 @@ import akka.japi.Creator;
 import com.google.common.base.Optional;
 import com.google.common.util.concurrent.ListenableFuture;
 import org.opendaylight.controller.cluster.datastore.messages.CloseTransaction;
-import org.opendaylight.controller.cluster.datastore.messages.CloseTransactionReply;
 import org.opendaylight.controller.cluster.datastore.messages.DeleteData;
 import org.opendaylight.controller.cluster.datastore.messages.DeleteDataReply;
 import org.opendaylight.controller.cluster.datastore.messages.MergeData;
@@ -34,9 +32,11 @@ import org.opendaylight.controller.cluster.datastore.modification.ImmutableCompo
 import org.opendaylight.controller.cluster.datastore.modification.MergeModification;
 import org.opendaylight.controller.cluster.datastore.modification.MutableCompositeModification;
 import org.opendaylight.controller.cluster.datastore.modification.WriteModification;
+import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadTransaction;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransaction;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreThreePhaseCommitCohort;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreTransactionChain;
+import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
@@ -65,170 +65,200 @@ import java.util.concurrent.ExecutionException;
  * <li> {@link org.opendaylight.controller.cluster.datastore.messages.CloseTransaction}
  * </p>
  */
-public class ShardTransaction extends AbstractUntypedActor {
-
-    private final ActorRef shardActor;
-    private final SchemaContext schemaContext;
-
-    // FIXME : see below
-    // If transactionChain is not null then this transaction is part of a
-    // transactionChain. Not really clear as to what that buys us
-    private final DOMStoreTransactionChain transactionChain;
-
-    private final DOMStoreReadWriteTransaction transaction;
-
-    private final MutableCompositeModification modification =
-        new MutableCompositeModification();
-
-    private final LoggingAdapter log =
-        Logging.getLogger(getContext().system(), this);
-
-    public ShardTransaction(DOMStoreReadWriteTransaction transaction,
-        ActorRef shardActor, SchemaContext schemaContext) {
-        this(null, transaction, shardActor, schemaContext);
-    }
-
-    public ShardTransaction(DOMStoreTransactionChain transactionChain, DOMStoreReadWriteTransaction transaction,
-        ActorRef shardActor, SchemaContext schemaContext) {
-        this.transactionChain = transactionChain;
-        this.transaction = transaction;
-        this.shardActor = shardActor;
-        this.schemaContext = schemaContext;
-    }
-
-
-
-    public static Props props(final DOMStoreReadWriteTransaction transaction,
-        final ActorRef shardActor, final SchemaContext schemaContext) {
-        return Props.create(new Creator<ShardTransaction>() {
-
-            @Override
-            public ShardTransaction create() throws Exception {
-                return new ShardTransaction(transaction, shardActor, schemaContext);
-            }
-        });
-    }
-
-    public static Props props(final DOMStoreTransactionChain transactionChain, final DOMStoreReadWriteTransaction transaction,
-        final ActorRef shardActor, final SchemaContext schemaContext) {
-        return Props.create(new Creator<ShardTransaction>() {
-
-            @Override
-            public ShardTransaction create() throws Exception {
-                return new ShardTransaction(transactionChain, transaction, shardActor, schemaContext);
-            }
-        });
+public abstract class ShardTransaction extends AbstractUntypedActor {
+
+  private final ActorRef shardActor;
+  protected final SchemaContext schemaContext;
+
+  // FIXME : see below
+  // If transactionChain is not null then this transaction is part of a
+  // transactionChain. Not really clear as to what that buys us
+  private final DOMStoreTransactionChain transactionChain;
+
+
+  private final MutableCompositeModification modification =
+      new MutableCompositeModification();
+
+  private final LoggingAdapter log =
+      Logging.getLogger(getContext().system(), this);
+
+  protected ShardTransaction(
+                          ActorRef shardActor, SchemaContext schemaContext) {
+    this(null,  shardActor, schemaContext);
+  }
+
+  protected ShardTransaction(DOMStoreTransactionChain transactionChain,
+                          ActorRef shardActor, SchemaContext schemaContext) {
+    this.transactionChain = transactionChain;
+    //this.transaction = transaction;
+    this.shardActor = shardActor;
+    this.schemaContext = schemaContext;
+  }
+
+
+
+  public static Props props(final DOMStoreReadTransaction transaction,
+                            final ActorRef shardActor, final SchemaContext schemaContext) {
+    return Props.create(new Creator<ShardTransaction>() {
+
+      @Override
+      public ShardTransaction create() throws Exception {
+        return new ShardReadTransaction(transaction, shardActor, schemaContext);
+      }
+    });
+  }
+
+  public static Props props(final DOMStoreTransactionChain transactionChain, final DOMStoreReadTransaction transaction,
+                            final ActorRef shardActor, final SchemaContext schemaContext) {
+    return Props.create(new Creator<ShardTransaction>() {
+
+      @Override
+      public ShardTransaction create() throws Exception {
+        return new ShardReadTransaction(transactionChain, transaction, shardActor, schemaContext);
+      }
+    });
+  }
+
+  public static Props props(final DOMStoreReadWriteTransaction transaction,
+                            final ActorRef shardActor, final SchemaContext schemaContext) {
+    return Props.create(new Creator<ShardTransaction>() {
+
+      @Override
+      public ShardTransaction create() throws Exception {
+        return new ShardReadWriteTransaction(transaction, shardActor, schemaContext);
+      }
+    });
+  }
+
+  public static Props props(final DOMStoreTransactionChain transactionChain, final DOMStoreReadWriteTransaction transaction,
+                            final ActorRef shardActor, final SchemaContext schemaContext) {
+    return Props.create(new Creator<ShardTransaction>() {
+
+      @Override
+      public ShardTransaction create() throws Exception {
+        return new ShardReadWriteTransaction(transactionChain, transaction, shardActor, schemaContext);
+      }
+    });
+  }
+
+
+  public static Props props(final DOMStoreWriteTransaction transaction,
+                            final ActorRef shardActor, final SchemaContext schemaContext) {
+    return Props.create(new Creator<ShardTransaction>() {
+
+      @Override
+      public ShardTransaction create() throws Exception {
+        return new ShardWriteTransaction(transaction, shardActor, schemaContext);
+      }
+    });
+  }
+
+  public static Props props(final DOMStoreTransactionChain transactionChain, final DOMStoreWriteTransaction transaction,
+                            final ActorRef shardActor, final SchemaContext schemaContext) {
+    return Props.create(new Creator<ShardTransaction>() {
+
+      @Override
+      public ShardTransaction create() throws Exception {
+        return new ShardWriteTransaction(transactionChain, transaction, shardActor, schemaContext);
+      }
+    });
+  }
+
+
+  @Override
+  public void handleReceive(Object message) throws Exception {
+     if (message.getClass().equals(CloseTransaction.SERIALIZABLE_CLASS)) {
+      closeTransaction(new CloseTransaction());
+    } else if (message instanceof GetCompositedModification) {
+      // This is here for testing only
+      getSender().tell(new GetCompositeModificationReply(
+          new ImmutableCompositeModification(modification)), getSelf());
+    }else{
+      throw new Exception ("ShardTransaction:handleRecieve received an unknown message"+message);
     }
-
-
-    @Override
-    public void handleReceive(Object message) throws Exception {
-        if (ReadData.SERIALIZABLE_CLASS.equals(message.getClass())) {
-            readData(ReadData.fromSerializable(message));
-        } else if (WriteData.SERIALIZABLE_CLASS.equals(message.getClass())) {
-            writeData(WriteData.fromSerializable(message, schemaContext));
-        } else if (MergeData.SERIALIZABLE_CLASS.equals(message.getClass())) {
-            mergeData(MergeData.fromSerializable(message, schemaContext));
-        } else if (DeleteData.SERIALIZABLE_CLASS.equals(message.getClass())) {
-            deleteData(DeleteData.fromSerizalizable(message));
-        } else if (ReadyTransaction.SERIALIZABLE_CLASS.equals(message.getClass())) {
-            readyTransaction(new ReadyTransaction());
-        } else if (message.getClass().equals(CloseTransaction.SERIALIZABLE_CLASS)) {
-            closeTransaction(new CloseTransaction());
-        } else if (message instanceof GetCompositedModification) {
-            // This is here for testing only
-            getSender().tell(new GetCompositeModificationReply(
-                new ImmutableCompositeModification(modification)), getSelf());
-        }else{
-          throw new Exception ("Shard:handleRecieve received an unknown message"+message);
+  }
+
+  abstract protected  void closeTransaction(CloseTransaction message);
+
+  protected void readData(DOMStoreReadTransaction transaction,ReadData message) {
+    final ActorRef sender = getSender();
+    final ActorRef self = getSelf();
+    final YangInstanceIdentifier path = message.getPath();
+    final ListenableFuture<Optional<NormalizedNode<?, ?>>> future =
+        transaction.read(path);
+
+    future.addListener(new Runnable() {
+      @Override
+      public void run() {
+        try {
+          Optional<NormalizedNode<?, ?>> optional = future.get();
+          if (optional.isPresent()) {
+            sender.tell(new ReadDataReply(schemaContext,optional.get()).toSerializable(), self);
+          } else {
+            sender.tell(new ReadDataReply(schemaContext,null).toSerializable(), self);
+          }
+        } catch (InterruptedException | ExecutionException e) {
+          log.error(e,
+              "An exception happened when reading data from path : "
+                  + path.toString());
         }
-    }
 
-    private void readData(ReadData message) {
-        final ActorRef sender = getSender();
-        final ActorRef self = getSelf();
-        final YangInstanceIdentifier path = message.getPath();
-        final ListenableFuture<Optional<NormalizedNode<?, ?>>> future =
-            transaction.read(path);
-
-        future.addListener(new Runnable() {
-            @Override
-            public void run() {
-                try {
-                    Optional<NormalizedNode<?, ?>> optional = future.get();
-                    if (optional.isPresent()) {
-                        sender.tell(new ReadDataReply(schemaContext,optional.get()).toSerializable(), self);
-                    } else {
-                        sender.tell(new ReadDataReply(schemaContext,null).toSerializable(), self);
-                    }
-                } catch (InterruptedException | ExecutionException e) {
-                    log.error(e,
-                        "An exception happened when reading data from path : "
-                            + path.toString());
-                }
-
-            }
-        }, getContext().dispatcher());
-    }
+      }
+    }, getContext().dispatcher());
+  }
 
 
-    private void writeData(WriteData message) {
-        modification.addModification(
-            new WriteModification(message.getPath(), message.getData(),schemaContext));
-        LOG.debug("writeData at path : " + message.getPath().toString());
-        transaction.write(message.getPath(), message.getData());
-        getSender().tell(new WriteDataReply().toSerializable(), getSelf());
-    }
+  protected void writeData(DOMStoreWriteTransaction transaction, WriteData message) {
+    modification.addModification(
+        new WriteModification(message.getPath(), message.getData(),schemaContext));
+    LOG.debug("writeData at path : " + message.getPath().toString());
+    transaction.write(message.getPath(), message.getData());
+    getSender().tell(new WriteDataReply().toSerializable(), getSelf());
+  }
 
-    private void mergeData(MergeData message) {
-        modification.addModification(
-            new MergeModification(message.getPath(), message.getData(), schemaContext));
-        LOG.debug("mergeData at path : " + message.getPath().toString());
-        transaction.merge(message.getPath(), message.getData());
-        getSender().tell(new MergeDataReply().toSerializable(), getSelf());
-    }
+  protected void mergeData(DOMStoreWriteTransaction transaction, MergeData message) {
+    modification.addModification(
+        new MergeModification(message.getPath(), message.getData(), schemaContext));
+    LOG.debug("mergeData at path : " + message.getPath().toString());
+    transaction.merge(message.getPath(), message.getData());
+    getSender().tell(new MergeDataReply().toSerializable(), getSelf());
+  }
 
-    private void deleteData(DeleteData message) {
-        modification.addModification(new DeleteModification(message.getPath()));
-        transaction.delete(message.getPath());
-        getSender().tell(new DeleteDataReply().toSerializable(), getSelf());
-    }
+  protected void deleteData(DOMStoreWriteTransaction transaction, DeleteData message) {
+    modification.addModification(new DeleteModification(message.getPath()));
+    transaction.delete(message.getPath());
+    getSender().tell(new DeleteDataReply().toSerializable(), getSelf());
+  }
 
-    private void readyTransaction(ReadyTransaction message) {
-        DOMStoreThreePhaseCommitCohort cohort = transaction.ready();
-        ActorRef cohortActor = getContext().actorOf(
-            ThreePhaseCommitCohort.props(cohort, shardActor, modification), "cohort");
-        getSender()
-            .tell(new ReadyTransactionReply(cohortActor.path()).toSerializable(), getSelf());
+  protected void readyTransaction(DOMStoreWriteTransaction transaction, ReadyTransaction message) {
+    DOMStoreThreePhaseCommitCohort cohort =  transaction.ready();
+    ActorRef cohortActor = getContext().actorOf(
+        ThreePhaseCommitCohort.props(cohort, shardActor, modification), "cohort");
+    getSender()
+        .tell(new ReadyTransactionReply(cohortActor.path()).toSerializable(), getSelf());
 
-    }
-
-    private void closeTransaction(CloseTransaction message) {
-        transaction.close();
-        getSender().tell(new CloseTransactionReply().toSerializable(), getSelf());
-        getSelf().tell(PoisonPill.getInstance(), getSelf());
-    }
+  }
 
 
-    // These classes are in here for test purposes only
+  // These classes are in here for test purposes only
 
 
-    static class GetCompositedModification {
+  static class GetCompositedModification {
 
-    }
+  }
 
 
-    static class GetCompositeModificationReply {
-        private final CompositeModification modification;
+  static class GetCompositeModificationReply {
+    private final CompositeModification modification;
 
 
-        GetCompositeModificationReply(CompositeModification modification) {
-            this.modification = modification;
-        }
+    GetCompositeModificationReply(CompositeModification modification) {
+      this.modification = modification;
+    }
 
 
-        public CompositeModification getModification() {
-            return modification;
-        }
+    public CompositeModification getModification() {
+      return modification;
     }
+  }
 }
index 50042411b17eeb0b0428963535008e8a777ca915..ce63f1107daafe31855c67c4eec4d676e94f384a 100644 (file)
@@ -15,7 +15,6 @@ import org.opendaylight.controller.cluster.datastore.messages.CloseTransactionCh
 import org.opendaylight.controller.cluster.datastore.messages.CloseTransactionChainReply;
 import org.opendaylight.controller.cluster.datastore.messages.CreateTransaction;
 import org.opendaylight.controller.cluster.datastore.messages.CreateTransactionReply;
-import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransaction;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreTransactionChain;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 
@@ -45,11 +44,27 @@ public class ShardTransactionChain extends AbstractUntypedActor {
         }
     }
 
+  private ActorRef createTypedTransactionActor(CreateTransaction createTransaction,String transactionId){
+    if(createTransaction.getTransactionType()== TransactionProxy.TransactionType.READ_ONLY.ordinal()){
+      return getContext().actorOf(
+          ShardTransaction.props( chain.newReadOnlyTransaction(), getSelf(), schemaContext), transactionId);
+
+    }else if (createTransaction.getTransactionType()== TransactionProxy.TransactionType.READ_WRITE.ordinal()){
+      return getContext().actorOf(
+          ShardTransaction.props( chain.newReadWriteTransaction(), getSelf(), schemaContext), transactionId);
+
+
+    }else if (createTransaction.getTransactionType()== TransactionProxy.TransactionType.WRITE_ONLY.ordinal()){
+      return getContext().actorOf(
+          ShardTransaction.props( chain.newWriteOnlyTransaction(), getSelf(), schemaContext), transactionId);
+    }else{
+      throw new IllegalArgumentException ("CreateTransaction message has unidentified transaction type="+createTransaction.getTransactionType()) ;
+    }
+  }
+
     private void createTransaction(CreateTransaction createTransaction) {
-        DOMStoreReadWriteTransaction transaction =
-            chain.newReadWriteTransaction();
-        ActorRef transactionActor = getContext().actorOf(ShardTransaction
-            .props(chain, transaction, getContext().parent(), schemaContext), "shard-" + createTransaction.getTransactionId());
+
+        ActorRef transactionActor = createTypedTransactionActor(createTransaction, "shard-" + createTransaction.getTransactionId());
         getSender()
             .tell(new CreateTransactionReply(transactionActor.path().toString(),createTransaction.getTransactionId()).toSerializable(),
                 getSelf());
diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardWriteTransaction.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardWriteTransaction.java
new file mode 100644 (file)
index 0000000..2a5429b
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+ *
+ *  Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ *  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
+ *
+ */
+
+package org.opendaylight.controller.cluster.datastore;
+
+import akka.actor.ActorRef;
+import akka.actor.PoisonPill;
+import akka.event.Logging;
+import akka.event.LoggingAdapter;
+import org.opendaylight.controller.cluster.datastore.messages.CloseTransaction;
+import org.opendaylight.controller.cluster.datastore.messages.CloseTransactionReply;
+import org.opendaylight.controller.cluster.datastore.messages.DeleteData;
+import org.opendaylight.controller.cluster.datastore.messages.MergeData;
+import org.opendaylight.controller.cluster.datastore.messages.ReadyTransaction;
+import org.opendaylight.controller.cluster.datastore.messages.WriteData;
+import org.opendaylight.controller.sal.core.spi.data.DOMStoreTransactionChain;
+import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+
+/**
+ * @author: syedbahm
+ * Date: 8/6/14
+ */
+public class ShardWriteTransaction extends ShardTransaction {
+  private final DOMStoreWriteTransaction transaction;
+  private final LoggingAdapter log =
+      Logging.getLogger(getContext().system(), this);
+  public ShardWriteTransaction(DOMStoreWriteTransaction transaction, ActorRef shardActor, SchemaContext schemaContext) {
+    super( shardActor, schemaContext);
+    this.transaction = transaction;
+
+  }
+
+  public ShardWriteTransaction(DOMStoreTransactionChain transactionChain, DOMStoreWriteTransaction transaction, ActorRef shardActor, SchemaContext schemaContext) {
+    super(transactionChain, shardActor, schemaContext);
+    this.transaction = transaction;
+  }
+
+  @Override
+  public void handleReceive(Object message) throws Exception {
+    if (WriteData.SERIALIZABLE_CLASS.equals(message.getClass())) {
+      writeData(transaction, WriteData.fromSerializable(message, schemaContext));
+    } else if (MergeData.SERIALIZABLE_CLASS.equals(message.getClass())) {
+      mergeData(transaction, MergeData.fromSerializable(message, schemaContext));
+    } else if (DeleteData.SERIALIZABLE_CLASS.equals(message.getClass())) {
+      deleteData(transaction,DeleteData.fromSerizalizable(message));
+    } else if (ReadyTransaction.SERIALIZABLE_CLASS.equals(message.getClass())) {
+      readyTransaction(transaction,new ReadyTransaction());
+    }else {
+      super.handleReceive(message);
+    }
+  }
+
+  protected void closeTransaction(CloseTransaction message) {
+    transaction.close();
+    getSender().tell(new CloseTransactionReply().toSerializable(), getSelf());
+    getSelf().tell(PoisonPill.getInstance(), getSelf());
+  }
+}
index 333a8f8617040ab3540ba6be39f6848085236df4..fa98905a66968b111372d4b893ef35bef6e32bd4 100644 (file)
@@ -180,7 +180,7 @@ public class TransactionProxy implements DOMStoreReadWriteTransaction {
 
         try {
             Object response = actorContext.executeShardOperation(shardName,
-                new CreateTransaction(identifier).toSerializable(),
+                new CreateTransaction(identifier,this.transactionType.ordinal() ).toSerializable(),
                 ActorContext.ASK_DURATION);
             if (response.getClass()
                 .equals(CreateTransactionReply.SERIALIZABLE_CLASS)) {
index 795131fdbf6400f0b53c98f91d167bf31f45d493..b27ad86be987097b9bb9c37713a50116bfa5116e 100644 (file)
@@ -15,23 +15,28 @@ import org.opendaylight.controller.protobuff.messages.transaction.ShardTransacti
 public class CreateTransaction implements SerializableMessage {
   public static Class SERIALIZABLE_CLASS = ShardTransactionMessages.CreateTransaction.class;
   private final String transactionId;
+  private final int transactionType;
 
-  public CreateTransaction(String transactionId){
+  public CreateTransaction(String transactionId, int transactionType){
 
     this.transactionId = transactionId;
+    this.transactionType = transactionType;
   }
 
   public String getTransactionId() {
     return transactionId;
   }
 
+  public int getTransactionType() { return transactionType;}
+
   @Override
   public Object toSerializable() {
-    return  ShardTransactionMessages.CreateTransaction.newBuilder().setTransactionId(transactionId).build();
+    return  ShardTransactionMessages.CreateTransaction.newBuilder().setTransactionId(transactionId).setTransactionType(transactionType).build();
   }
 
   public static CreateTransaction fromSerializable(Object message){
-    return new CreateTransaction(((ShardTransactionMessages.CreateTransaction)message).getTransactionId());
+    ShardTransactionMessages.CreateTransaction createTransaction = (ShardTransactionMessages.CreateTransaction)message;
+    return new CreateTransaction(createTransaction.getTransactionId(),createTransaction.getTransactionType() );
   }
 
 }
index 11ad559744a3923aebfbb07472771b98a4439ab0..df3c78ec970722e3a4b8b23d4200ffec2d890755 100644 (file)
@@ -90,7 +90,7 @@ public class BasicIntegrationTest extends AbstractActorTest {
                     System.out.println("Successfully created transaction chain");
 
                     // 2. Create a Transaction on the TransactionChain
-                    transactionChain.tell(new CreateTransaction("txn-1").toSerializable(), getRef());
+                    transactionChain.tell(new CreateTransaction("txn-1", TransactionProxy.TransactionType.WRITE_ONLY.ordinal() ).toSerializable(), getRef());
 
                     final ActorSelection transaction =
                         new ExpectMsg<ActorSelection>("CreateTransactionReply") {
index 38920d86ca36b8889276b6f9823381d0cc1a4239..ee112a40de9ed8c9869887e615629cc3076668de 100644 (file)
@@ -153,7 +153,7 @@ public class ShardTest extends AbstractActorTest {
                         new UpdateSchemaContext(TestModel.createTestContext()),
                         getRef());
 
-                    subject.tell(new CreateTransaction("txn-1").toSerializable(),
+                    subject.tell(new CreateTransaction("txn-1", TransactionProxy.TransactionType.READ_ONLY.ordinal() ).toSerializable(),
                         getRef());
 
                     final String out = new ExpectMsg<String>("match hint") {
index 6330ad8acca33ab6c05f3263aa45ca459f0c283d..57d0bd6aa9504517547d1eb9619365c5a5f115d9 100644 (file)
@@ -33,7 +33,7 @@ public class ShardTransactionChainTest extends AbstractActorTest {
      new Within(duration("1 seconds")) {
         protected void run() {
 
-          subject.tell(new CreateTransaction("txn-1").toSerializable(), getRef());
+          subject.tell(new CreateTransaction("txn-1", TransactionProxy.TransactionType.READ_ONLY.ordinal() ).toSerializable(), getRef());
 
           final String out = new ExpectMsg<String>("match hint") {
             // do not put code outside this method, will run afterwards
index 7884eeccdae7874f8d19c9090bf08d755cc991be..f15e3bff06c27f51501633ed8626d0bfdfa58ef2 100644 (file)
@@ -4,8 +4,10 @@ import akka.actor.ActorRef;
 import akka.actor.Props;
 import akka.actor.Terminated;
 import akka.testkit.JavaTestKit;
+import akka.testkit.TestActorRef;
 import com.google.common.util.concurrent.ListeningExecutorService;
 import com.google.common.util.concurrent.MoreExecutors;
+import org.junit.Assert;
 import org.junit.Test;
 import org.opendaylight.controller.cluster.datastore.messages.CloseTransaction;
 import org.opendaylight.controller.cluster.datastore.messages.CloseTransactionReply;
@@ -53,7 +55,7 @@ public class ShardTransactionTest extends AbstractActorTest {
         new JavaTestKit(getSystem()) {{
             final ActorRef shard = getSystem().actorOf(Shard.props("config", Collections.EMPTY_MAP));
             final Props props =
-                ShardTransaction.props(store.newReadWriteTransaction(), shard, testSchemaContext);
+                ShardTransaction.props(store.newReadOnlyTransaction(), shard, testSchemaContext);
             final ActorRef subject = getSystem().actorOf(props, "testReadData");
 
             new Within(duration("1 seconds")) {
@@ -93,7 +95,7 @@ public class ShardTransactionTest extends AbstractActorTest {
         new JavaTestKit(getSystem()) {{
             final ActorRef shard = getSystem().actorOf(Shard.props("config", Collections.EMPTY_MAP));
             final Props props =
-                ShardTransaction.props(store.newReadWriteTransaction(), shard, testSchemaContext);
+                ShardTransaction.props( store.newReadOnlyTransaction(), shard, testSchemaContext);
             final ActorRef subject = getSystem().actorOf(props, "testReadDataWhenDataNotFound");
 
             new Within(duration("1 seconds")) {
@@ -167,7 +169,7 @@ public class ShardTransactionTest extends AbstractActorTest {
         new JavaTestKit(getSystem()) {{
             final ActorRef shard = getSystem().actorOf(Shard.props("config", Collections.EMPTY_MAP));
             final Props props =
-                ShardTransaction.props(store.newReadWriteTransaction(), shard, TestModel.createTestContext());
+                ShardTransaction.props(store.newWriteOnlyTransaction(), shard, TestModel.createTestContext());
             final ActorRef subject =
                 getSystem().actorOf(props, "testWriteData");
 
@@ -244,7 +246,7 @@ public class ShardTransactionTest extends AbstractActorTest {
         new JavaTestKit(getSystem()) {{
             final ActorRef shard = getSystem().actorOf(Shard.props("config", Collections.EMPTY_MAP));
             final Props props =
-                ShardTransaction.props(store.newReadWriteTransaction(), shard, TestModel.createTestContext());
+                ShardTransaction.props( store.newWriteOnlyTransaction(), shard, TestModel.createTestContext());
             final ActorRef subject =
                 getSystem().actorOf(props, "testDeleteData");
 
@@ -281,7 +283,7 @@ public class ShardTransactionTest extends AbstractActorTest {
         new JavaTestKit(getSystem()) {{
             final ActorRef shard = getSystem().actorOf(Shard.props("config", Collections.EMPTY_MAP));
             final Props props =
-                ShardTransaction.props(store.newReadWriteTransaction(), shard, TestModel.createTestContext());
+                ShardTransaction.props( store.newReadWriteTransaction(), shard, TestModel.createTestContext());
             final ActorRef subject =
                 getSystem().actorOf(props, "testReadyTransaction");
 
@@ -361,4 +363,24 @@ public class ShardTransactionTest extends AbstractActorTest {
         }};
 
     }
+
+
+  @Test
+  public void testNegativePerformingWriteOperationOnReadTransaction() throws Exception {
+    try {
+
+        final ActorRef shard = getSystem().actorOf(Shard.props("config", Collections.EMPTY_MAP));
+        final Props props =
+            ShardTransaction.props(store.newReadOnlyTransaction(), shard, TestModel.createTestContext());
+         final TestActorRef subject = TestActorRef.apply(props,getSystem());
+
+        subject.receive(new DeleteData(TestModel.TEST_PATH).toSerializable(), ActorRef.noSender());
+        Assert.assertFalse(true);
+
+
+    } catch (Exception cs) {
+      assertEquals(cs.getClass().getSimpleName(), Exception.class.getSimpleName());
+      assertTrue(cs.getMessage().startsWith("ShardTransaction:handleRecieve received an unknown message"));
+    }
+  }
 }
index 667c0fc2826a100b2fc6ae77f4c0344a52d723f6..22dad6af23c1464b63f8a4aa25075551b64ef686 100644 (file)
@@ -10,9 +10,11 @@ package org.opendaylight.controller.config.yang.md.sal.dom.impl;
 import java.util.concurrent.Executors;
 
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitDeadlockException;
 import org.opendaylight.controller.md.sal.dom.broker.impl.DOMDataBrokerImpl;
 import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStore;
 import org.opendaylight.controller.sal.core.spi.data.DOMStore;
+import org.opendaylight.yangtools.util.concurrent.DeadlockDetectingListeningExecutorService;
 
 import com.google.common.collect.ImmutableMap;
 import com.google.common.util.concurrent.ListeningExecutorService;
@@ -64,7 +66,9 @@ public final class DomInmemoryDataBrokerModule extends
                 .<LogicalDatastoreType, DOMStore> builder().put(LogicalDatastoreType.OPERATIONAL, operStore)
                 .put(LogicalDatastoreType.CONFIGURATION, configStore).build();
 
-        DOMDataBrokerImpl newDataBroker = new DOMDataBrokerImpl(datastores, MoreExecutors.listeningDecorator(Executors.newSingleThreadExecutor()));
+        DOMDataBrokerImpl newDataBroker = new DOMDataBrokerImpl(datastores,
+                new DeadlockDetectingListeningExecutorService(Executors.newSingleThreadExecutor(),
+                                              TransactionCommitDeadlockException.DEADLOCK_EXECUTOR_FUNCTION));
 
         return newDataBroker;
     }
index b006ca94e5d1387bfd84e7a76eccba3700756905..0bb16a39b90f7eb513093b18faa20815061fad3c 100644 (file)
@@ -3,26 +3,40 @@ package org.opendaylight.controller.md.sal.dom.broker.impl;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertEquals;
 import static org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType.CONFIGURATION;
 import static org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType.OPERATIONAL;
 
+import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicReference;
 
+import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
+import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker.DataChangeScope;
+import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitDeadlockException;
+import org.opendaylight.controller.md.sal.dom.api.DOMDataChangeListener;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataReadTransaction;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataReadWriteTransaction;
+import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
 import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStore;
 import org.opendaylight.controller.md.sal.dom.store.impl.TestModel;
 import org.opendaylight.controller.sal.core.spi.data.DOMStore;
+import org.opendaylight.yangtools.util.concurrent.DeadlockDetectingListeningExecutorService;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 
 import com.google.common.base.Optional;
 import com.google.common.collect.ImmutableMap;
+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.ListeningExecutorService;
 import com.google.common.util.concurrent.MoreExecutors;
@@ -31,6 +45,7 @@ public class DOMBrokerTest {
 
     private SchemaContext schemaContext;
     private DOMDataBrokerImpl domBroker;
+    private ListeningExecutorService executor;
 
     @Before
     public void setupStore() {
@@ -46,11 +61,19 @@ public class DOMBrokerTest {
                 .put(OPERATIONAL, operStore) //
                 .build();
 
-        ListeningExecutorService executor = MoreExecutors.listeningDecorator(Executors.newSingleThreadExecutor());
+        executor = new DeadlockDetectingListeningExecutorService(Executors.newSingleThreadExecutor(),
+                                          TransactionCommitDeadlockException.DEADLOCK_EXECUTOR_FUNCTION);
         domBroker = new DOMDataBrokerImpl(stores, executor);
     }
 
-    @Test
+    @After
+    public void tearDown() {
+        if( executor != null ) {
+            executor.shutdownNow();
+        }
+    }
+
+    @Test(timeout=10000)
     public void testTransactionIsolation() throws InterruptedException, ExecutionException {
 
         assertNotNull(domBroker);
@@ -86,7 +109,7 @@ public class DOMBrokerTest {
         assertFalse(readTxContainer.get().isPresent());
     }
 
-    @Test
+    @Test(timeout=10000)
     public void testTransactionCommit() throws InterruptedException, ExecutionException {
 
         DOMDataReadWriteTransaction writeTx = domBroker.newReadWriteTransaction();
@@ -114,6 +137,173 @@ public class DOMBrokerTest {
         assertTrue(afterCommitRead.isPresent());
     }
 
+    /**
+     * Tests a simple DataChangeListener notification after a write.
+     */
+    @Test
+    public void testDataChangeListener() throws Throwable {
+
+        final NormalizedNode<?, ?> testNode = ImmutableNodes.containerNode( TestModel.TEST_QNAME );
+
+        TestDOMDataChangeListener dcListener = new TestDOMDataChangeListener();
+
+        domBroker.registerDataChangeListener( OPERATIONAL, TestModel.TEST_PATH,
+                                              dcListener, DataChangeScope.BASE );
+
+        final DOMDataWriteTransaction writeTx = domBroker.newWriteOnlyTransaction();
+        assertNotNull( writeTx );
+
+        writeTx.put( OPERATIONAL, TestModel.TEST_PATH, testNode );
+
+        AtomicReference<Throwable> caughtEx = submitTxAsync( writeTx );
+
+        dcListener.waitForChange();
+
+        if( caughtEx.get() != null ) {
+            throw caughtEx.get();
+        }
+
+        NormalizedNode<?, ?> actualNode = dcListener.change.getCreatedData().get( TestModel.TEST_PATH );
+        assertEquals( "Created node", testNode, actualNode );
+    }
+
+    /**
+     * Tests a DataChangeListener that does an async submit of a write Tx in its onDataChanged method.
+     * This should succeed without deadlock.
+     */
+    @Test
+    public void testDataChangeListenerDoingAsyncWriteTxSubmit() throws Throwable {
+
+        final AtomicReference<Throwable> caughtCommitEx = new AtomicReference<>();
+        final CountDownLatch commitCompletedLatch = new CountDownLatch( 1 );
+
+        TestDOMDataChangeListener dcListener = new TestDOMDataChangeListener() {
+            @Override
+            public void onDataChanged( AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change ) {
+
+                DOMDataWriteTransaction writeTx = domBroker.newWriteOnlyTransaction();
+                writeTx.put( OPERATIONAL, TestModel.TEST2_PATH,
+                             ImmutableNodes.containerNode( TestModel.TEST2_QNAME ) );
+                Futures.addCallback( writeTx.submit(), new FutureCallback<Void>() {
+                    @Override
+                    public void onSuccess( Void result ) {
+                        commitCompletedLatch.countDown();
+                    }
+
+                    @Override
+                    public void onFailure( Throwable t ) {
+                        caughtCommitEx.set( t );
+                        commitCompletedLatch.countDown();
+                    }
+                } );
+
+                super.onDataChanged( change );
+            }
+        };
+
+        domBroker.registerDataChangeListener( OPERATIONAL, TestModel.TEST_PATH,
+                                              dcListener, DataChangeScope.BASE );
+
+        final DOMDataWriteTransaction writeTx = domBroker.newWriteOnlyTransaction();
+        assertNotNull( writeTx );
+
+        writeTx.put( OPERATIONAL, TestModel.TEST_PATH, ImmutableNodes.containerNode( TestModel.TEST_QNAME ) );
+
+        AtomicReference<Throwable> caughtEx = submitTxAsync( writeTx );
+
+        dcListener.waitForChange();
+
+        if( caughtEx.get() != null ) {
+            throw caughtEx.get();
+        }
+
+        assertTrue( "Commit Future was not invoked", commitCompletedLatch.await( 5, TimeUnit.SECONDS ) );
+
+        if( caughtCommitEx.get() != null ) {
+            throw caughtCommitEx.get();
+        }
+    }
+
+    /**
+     * Tests a DataChangeListener that does a blocking submit of a write Tx in its onDataChanged method.
+     * This should throw an exception and not deadlock.
+     */
+    @Test(expected=TransactionCommitDeadlockException.class)
+    public void testDataChangeListenerDoingBlockingWriteTxSubmit() throws Throwable {
+
+        final AtomicReference<Throwable> caughtCommitEx = new AtomicReference<>();
+
+        TestDOMDataChangeListener dcListener = new TestDOMDataChangeListener() {
+            @Override
+            public void onDataChanged( AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change ) {
+                DOMDataWriteTransaction writeTx = domBroker.newWriteOnlyTransaction();
+                writeTx.put( OPERATIONAL, TestModel.TEST2_PATH,
+                             ImmutableNodes.containerNode( TestModel.TEST2_QNAME ) );
+                try {
+                    writeTx.submit().get();
+                } catch( ExecutionException e ) {
+                    caughtCommitEx.set( e.getCause() );
+                } catch( Exception e ) {
+                    caughtCommitEx.set( e );
+                }
+                finally {
+                    super.onDataChanged( change );
+                }
+            }
+        };
+
+        domBroker.registerDataChangeListener( OPERATIONAL, TestModel.TEST_PATH,
+                                              dcListener, DataChangeScope.BASE );
+
+        final DOMDataWriteTransaction writeTx = domBroker.newWriteOnlyTransaction();
+        assertNotNull( writeTx );
+
+        writeTx.put( OPERATIONAL, TestModel.TEST_PATH, ImmutableNodes.containerNode( TestModel.TEST_QNAME ) );
+
+        AtomicReference<Throwable> caughtEx = submitTxAsync( writeTx );
 
+        dcListener.waitForChange();
 
+        if( caughtEx.get() != null ) {
+            throw caughtEx.get();
+        }
+
+        if( caughtCommitEx.get() != null ) {
+            throw caughtCommitEx.get();
+        }
+    }
+
+    AtomicReference<Throwable> submitTxAsync( final DOMDataWriteTransaction writeTx ) {
+        final AtomicReference<Throwable> caughtEx = new AtomicReference<>();
+        new Thread() {
+            @Override
+            public void run() {
+
+                try {
+                    writeTx.submit();
+                } catch( Throwable e ) {
+                    caughtEx.set( e );
+                }
+            }
+
+        }.start();
+
+        return caughtEx;
+    }
+
+    static class TestDOMDataChangeListener implements DOMDataChangeListener {
+
+        volatile AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change;
+        private final CountDownLatch latch = new CountDownLatch( 1 );
+
+        @Override
+        public void onDataChanged( AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change ) {
+            this.change = change;
+            latch.countDown();
+        }
+
+        void waitForChange() throws InterruptedException {
+            assertTrue( "onDataChanged was not called", latch.await( 5, TimeUnit.SECONDS ) );
+        }
+    }
 }
index d5ba2a2b9a50212e0b75c4036f1afc5fc890b065..09835ec5e37dcd92db413be12cfe5d35967d0910 100644 (file)
@@ -21,6 +21,8 @@ public class TestModel {
 
     public static final QName TEST_QNAME = QName.create("urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test", "2014-03-13",
             "test");
+    public static final QName TEST2_QNAME = QName.create("urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test", "2014-03-13",
+            "test2");
     public static final QName OUTER_LIST_QNAME = QName.create(TEST_QNAME, "outer-list");
     public static final QName INNER_LIST_QNAME = QName.create(TEST_QNAME, "inner-list");
     public static final QName OUTER_CHOICE_QNAME = QName.create(TEST_QNAME, "outer-choice");
@@ -30,6 +32,7 @@ public class TestModel {
     private static final String DATASTORE_TEST_YANG = "/odl-datastore-test.yang";
 
     public static final YangInstanceIdentifier TEST_PATH = YangInstanceIdentifier.of(TEST_QNAME);
+    public static final YangInstanceIdentifier TEST2_PATH = YangInstanceIdentifier.of(TEST2_QNAME);
     public static final YangInstanceIdentifier OUTER_LIST_PATH = YangInstanceIdentifier.builder(TEST_PATH).node(OUTER_LIST_QNAME).build();
     public static final QName TWO_QNAME = QName.create(TEST_QNAME,"two");
     public static final QName THREE_QNAME = QName.create(TEST_QNAME,"three");
index 17541fecab02c62f35c7a64cd679ad3ca52849e6..5fbf470f090e44e9e3c080998baa1c1a3a948c46 100644 (file)
@@ -39,4 +39,7 @@ module odl-datastore-test {
             }
         }
     }
+
+    container test2 {
+    }
 }
\ No newline at end of file
index ce18f7c67d596cbe7d886f6b8a8737da8c1138fa..73ca02c505f47741ca4e38c071a780a0f32e1cdf 100644 (file)
@@ -62,12 +62,8 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.InstanceIdentifierBuilder;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
-import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
-import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
-import org.opendaylight.yangtools.yang.data.api.schema.MapNode;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.opendaylight.yangtools.yang.data.composite.node.schema.cnsn.parser.CnSnToNormalizedNodeParserFactory;
-import org.opendaylight.yangtools.yang.data.composite.node.schema.cnsn.serializer.CnSnFromNormalizedNodeSerializerFactory;
 import org.opendaylight.yangtools.yang.data.impl.ImmutableCompositeNode;
 import org.opendaylight.yangtools.yang.data.impl.NodeFactory;
 import org.opendaylight.yangtools.yang.model.api.AnyXmlSchemaNode;
@@ -1414,25 +1410,15 @@ public class RestconfImpl implements RestconfService {
     }
 
     private CompositeNode datastoreNormalizedNodeToCompositeNode(final NormalizedNode<?, ?> dataNode, final DataSchemaNode schema) {
-        Iterable<Node<?>> nodes = null;
+        Node<?> nodes = null;
         if (dataNode == null) {
             throw new RestconfDocumentedException(new RestconfError(ErrorType.APPLICATION, ErrorTag.DATA_MISSING,
                     "No data was found."));
         }
-        if (schema instanceof ContainerSchemaNode && dataNode instanceof ContainerNode) {
-            nodes = CnSnFromNormalizedNodeSerializerFactory.getInstance().getContainerNodeSerializer()
-                    .serialize((ContainerSchemaNode) schema, (ContainerNode) dataNode);
-        } else if (schema instanceof ListSchemaNode && dataNode instanceof MapNode) {
-            nodes = CnSnFromNormalizedNodeSerializerFactory.getInstance().getMapNodeSerializer()
-                    .serialize((ListSchemaNode) schema, (MapNode) dataNode);
-        } else if (schema instanceof ListSchemaNode && dataNode instanceof MapEntryNode) {
-            nodes = CnSnFromNormalizedNodeSerializerFactory.getInstance().getMapEntryNodeSerializer()
-                    .serialize((ListSchemaNode) schema, (MapEntryNode) dataNode);
-        }
+        nodes = DataNormalizer.toLegacy(dataNode);
         if (nodes != null) {
-            if (nodes.iterator().hasNext()) {
-                Node<?> nodeOldStruct = nodes.iterator().next();
-                return (CompositeNode) nodeOldStruct;
+            if (nodes instanceof CompositeNode) {
+                return (CompositeNode) nodes;
             } else {
                 LOG.error("The node " + dataNode.getNodeType() + " couldn't be transformed to compositenode.");
             }
index e9d94b118412f2c0acbb967d82035a215e01a111..539248a147cd4eea16dca9f4725cf26e9b185496 100644 (file)
@@ -64,15 +64,11 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
-import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
-import org.opendaylight.yangtools.yang.data.api.schema.MapNode;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.opendaylight.yangtools.yang.data.impl.ImmutableCompositeNode;
 import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
-import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.CollectionNodeBuilder;
 import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableLeafNodeBuilder;
 import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableMapEntryNodeBuilder;
-import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableMapNodeBuilder;
 import org.opendaylight.yangtools.yang.data.impl.util.CompositeNodeBuilder;
 import org.opendaylight.yangtools.yang.model.api.DataNodeContainer;
 import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
@@ -675,9 +671,7 @@ public class RestGetOperationTest extends JerseyTest {
     }
 
     private NormalizedNode prepareCnDataForSlashesBehindMountPointTest() throws ParseException {
-        CollectionNodeBuilder<MapEntryNode, MapNode> lst1 = ImmutableMapNodeBuilder.create();
-        lst1.withNodeIdentifier(TestUtils.getNodeIdentifier("lst1", "test:module", "2014-01-09"));
-        lst1.withChild(ImmutableMapEntryNodeBuilder
+        return ImmutableMapEntryNodeBuilder
                 .create()
                 .withNodeIdentifier(
                         TestUtils.getNodeIdentifierPredicate("lst1", "test:module", "2014-01-09", "lf11",
@@ -685,9 +679,8 @@ public class RestGetOperationTest extends JerseyTest {
                 .withChild(
                         ImmutableLeafNodeBuilder.create()
                                 .withNodeIdentifier(TestUtils.getNodeIdentifier("lf11", "test:module", "2014-01-09"))
-                                .withValue("GigabitEthernet0/0/0/0").build()).build());
+                                .withValue("GigabitEthernet0/0/0/0").build()).build();
 
-        return lst1.build();
     }
 
     /**
index 562cac0bcf523a74a62163116105a9fff7d47c8d..c2b153f02bd27b6729dbba2a89a201a306763a99 100644 (file)
@@ -62,15 +62,12 @@ import org.opendaylight.yangtools.yang.data.api.CompositeNode;
 import org.opendaylight.yangtools.yang.data.api.Node;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
-import org.opendaylight.yangtools.yang.data.api.schema.MapNode;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.opendaylight.yangtools.yang.data.composite.node.schema.cnsn.parser.CnSnToNormalizedNodeParserFactory;
 import org.opendaylight.yangtools.yang.data.impl.ImmutableCompositeNode;
-import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.CollectionNodeBuilder;
 import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.DataContainerNodeAttrBuilder;
 import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableLeafNodeBuilder;
 import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableMapEntryNodeBuilder;
-import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableMapNodeBuilder;
 import org.opendaylight.yangtools.yang.data.impl.util.CompositeNodeBuilder;
 import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
@@ -407,9 +404,7 @@ public final class TestUtils {
 
     static NormalizedNode prepareNormalizedNodeWithIetfInterfacesInterfacesData() throws ParseException {
         String ietfInterfacesDate = "2013-07-04";
-        CollectionNodeBuilder<MapEntryNode, MapNode> intface = ImmutableMapNodeBuilder.create();
         String namespace = "urn:ietf:params:xml:ns:yang:ietf-interfaces";
-        intface.withNodeIdentifier(getNodeIdentifier("interface", namespace, ietfInterfacesDate));
         DataContainerNodeAttrBuilder<YangInstanceIdentifier.NodeIdentifierWithPredicates, MapEntryNode> mapEntryNode = ImmutableMapEntryNodeBuilder.create();
 
         Map<String, Object> predicates = new HashMap<>();
@@ -431,8 +426,6 @@ public final class TestUtils {
                 .withNodeIdentifier(getNodeIdentifier("description", namespace, ietfInterfacesDate))
                 .withValue("some interface").build());
 
-        intface.withChild(mapEntryNode.build());
-
-        return intface.build();
+        return mapEntryNode.build();
     }
 }
index 2c8571ca64369c80748ee5d1b157a39017c1db86..e01a0d5dcba4956f790d2274462455911970742c 100644 (file)
       <groupId>org.opendaylight.controller.model</groupId>
       <artifactId>model-flow-base</artifactId>
     </dependency>
-    <dependency>
-      <groupId>org.opendaylight.controller.model</groupId>
-      <artifactId>model-flow-management</artifactId>
-    </dependency>
     <dependency>
       <groupId>org.opendaylight.controller.model</groupId>
       <artifactId>model-flow-service</artifactId>
index eddad8b4c7c1df593c45a5f829c3c56828339e18..fff8d611b7975b34dce89ce603f164603ea2b582 100644 (file)
@@ -65,9 +65,11 @@ public class ConfigPusher {
         LinkedHashMap<ConfigSnapshotHolder, EditAndCommitResponse> result = new LinkedHashMap<>();
         // start pushing snapshots:
         for (ConfigSnapshotHolder configSnapshotHolder : configs) {
-            EditAndCommitResponse editAndCommitResponseWithRetries = pushConfigWithConflictingVersionRetries(configSnapshotHolder);
-            logger.debug("Config snapshot pushed successfully: {}, result: {}", configSnapshotHolder, result);
-            result.put(configSnapshotHolder, editAndCommitResponseWithRetries);
+            if(configSnapshotHolder != null) {
+                EditAndCommitResponse editAndCommitResponseWithRetries = pushConfigWithConflictingVersionRetries(configSnapshotHolder);
+                logger.debug("Config snapshot pushed successfully: {}, result: {}", configSnapshotHolder, result);
+                result.put(configSnapshotHolder, editAndCommitResponseWithRetries);
+            }
         }
         logger.debug("All configuration snapshots have been pushed successfully.");
         return result;
index cd7a1aacf2dbfbf47dc0e6a00003abde2f09b3d7..55a87150008ab51f0a96cc163ed218e629e31201 100644 (file)
     <dependency>
       <groupId>org.opendaylight.yangtools</groupId>
       <artifactId>yang-data-impl</artifactId>
-      <!--        <version>0.6.2-SNAPSHOT</version>-->
     </dependency>
     <dependency>
       <groupId>org.opendaylight.yangtools</groupId>
-      <artifactId>yang-data-json</artifactId>
-      <version>0.6.2-SNAPSHOT</version>
+      <artifactId>yang-data-composite-node</artifactId>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.yangtools</groupId>
index c101db9ef8406342c502fe2e276e203791970662..ef29a76fff342c5c5e0fc87d89b1a56639aa04f6 100644 (file)
@@ -18,7 +18,7 @@ import org.opendaylight.yangtools.yang.data.api.Node;
 import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild;
 import org.opendaylight.yangtools.yang.data.impl.schema.transform.base.serializer.NodeSerializerDispatcher;
 import org.opendaylight.yangtools.yang.data.impl.schema.transform.dom.DomUtils;
-import org.opendaylight.yangtools.yang.data.json.schema.cnsn.parser.CnSnToNormalizedNodeParserFactory;
+import org.opendaylight.yangtools.yang.data.composite.node.schema.cnsn.parser.CnSnToNormalizedNodeParserFactory;
 import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
 import org.opendaylight.yangtools.yang.model.api.ChoiceNode;
 import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;